mkvmerge: set I/O priority class to 'idle' for lower/lowest --priorities on Linux

Implements #863.
This commit is contained in:
Moritz Bunkus 2013-03-31 14:29:34 +02:00
parent b5c5961125
commit a156d0d5be
2 changed files with 13 additions and 2 deletions

View File

@ -17,5 +17,5 @@ PKG_PROG_PKG_CONFIG
dnl Check for headers
AC_HEADER_STDC()
AC_CHECK_HEADERS([inttypes.h stdint.h sys/types.h])
AC_CHECK_FUNCS(vsscanf,,)
AC_CHECK_HEADERS([inttypes.h stdint.h sys/types.h sys/syscall.h])
AC_CHECK_FUNCS([vsscanf syscall],,)

View File

@ -17,6 +17,9 @@
#ifdef SYS_WINDOWS
# include <windows.h>
#endif
#if defined(HAVE_SYS_SYSCALL_H)
# include <sys/syscall.h>
#endif
#include <matroska/KaxVersion.h>
#include <matroska/FileKax.h>
@ -107,6 +110,14 @@ set_process_priority(int priority) {
// 'warn if return value is ignored'.
if (!nice(s_nice_levels[priority + 2])) {
}
# if defined(HAVE_SYSCALL) && defined(SYS_ioprio_set)
if (0 < s_nice_levels[priority + 2])
syscall(SYS_ioprio_set,
1, // IOPRIO_WHO_PROCESS
0, // current process/thread
3 << 13); // I/O class 'idle'
# endif
#endif
}