diff --git a/libs/ardour/butler.cc b/libs/ardour/butler.cc index b1e05bb344..0c16425022 100644 --- a/libs/ardour/butler.cc +++ b/libs/ardour/butler.cc @@ -24,6 +24,10 @@ #include #include +#ifdef HAVE_IOPRIO +#include +#endif + #ifndef PLATFORM_WINDOWS #include #endif @@ -177,6 +181,13 @@ Butler::thread_work () bool disk_work_outstanding = false; RouteList::iterator i; +#ifdef HAVE_IOPRIO + // ioprio_set (IOPRIO_WHO_PROCESS, 0 /*calling thread*/, IOPRIO_PRIO_VALUE (IOPRIO_CLASS_RT, 4)) + if (0 != syscall (SYS_ioprio_set, 1, 0, (1 << 13) | 4)) { + warning << _("Cannot set I/O Priority for disk read/write thread") << endmsg; + } +#endif + while (true) { DEBUG_TRACE (DEBUG::Butler, string_compose ("%1 butler main loop, disk work outstanding ? %2 @ %3\n", DEBUG_THREAD_SELF, disk_work_outstanding, g_get_monotonic_time ())); diff --git a/libs/ardour/wscript b/libs/ardour/wscript index 9f87f689cb..aa75d4a256 100644 --- a/libs/ardour/wscript +++ b/libs/ardour/wscript @@ -345,9 +345,19 @@ def configure(conf): conf.check(header_name='sys/vfs.h', define_name='HAVE_SYS_VFS_H',mandatory=False) conf.check(header_name='sys/statvfs.h', define_name='HAVE_SYS_STATVFS_H',mandatory=False) - conf.check(header_name='unistd.h', define_name='HAVE_UNISTD',mandatory=False) + have_sys_ioprio = conf.check_cc( + msg="Checking for 'ioprio_set' syscall support", + features = 'c', + mandatory = False, + execute = False, + fragment = "#include \nint main () { syscall(SYS_ioprio_set, 1, 0, 8192); return 0; }") + + if have_sys_ioprio: + conf.define('HAVE_IOPRIO', 1) + conf.env['HAVE_IOPRIO'] = True + conf.write_config_header('libardour-config.h', remove=False) # Boost headers diff --git a/wscript b/wscript index f46c3de520..a11924f964 100644 --- a/wscript +++ b/wscript @@ -1571,6 +1571,7 @@ const char* const ardour_config_info = "\\n\\ write_config_text('Futex Semaphore', conf.is_defined('USE_FUTEX_SEMAPHORE')) write_config_text('Freedesktop files', opts.freedesktop) write_config_text('G_ENABLE_DEBUG', opts.gdebug or conf.env['DEBUG']) + write_config_text('I/O Priorty Set', conf.is_defined('HAVE_IOPRIO')) write_config_text('Libjack linking', conf.env['libjack_link']) write_config_text('Libjack metadata', conf.is_defined ('HAVE_JACK_METADATA')) write_config_text('Lua Binding Doc', conf.is_defined('LUABINDINGDOC'))