153a5a1b3Sopenharmony_ci/*-*- Mode: C; c-basic-offset: 8 -*-*/ 253a5a1b3Sopenharmony_ci 353a5a1b3Sopenharmony_ci#ifndef foortkithfoo 453a5a1b3Sopenharmony_ci#define foortkithfoo 553a5a1b3Sopenharmony_ci 653a5a1b3Sopenharmony_ci/*** 753a5a1b3Sopenharmony_ci Copyright 2009 Lennart Poettering 853a5a1b3Sopenharmony_ci Copyright 2010 David Henningsson <diwic@ubuntu.com> 953a5a1b3Sopenharmony_ci 1053a5a1b3Sopenharmony_ci Permission is hereby granted, free of charge, to any person 1153a5a1b3Sopenharmony_ci obtaining a copy of this software and associated documentation files 1253a5a1b3Sopenharmony_ci (the "Software"), to deal in the Software without restriction, 1353a5a1b3Sopenharmony_ci including without limitation the rights to use, copy, modify, merge, 1453a5a1b3Sopenharmony_ci publish, distribute, sublicense, and/or sell copies of the Software, 1553a5a1b3Sopenharmony_ci and to permit persons to whom the Software is furnished to do so, 1653a5a1b3Sopenharmony_ci subject to the following conditions: 1753a5a1b3Sopenharmony_ci 1853a5a1b3Sopenharmony_ci The above copyright notice and this permission notice shall be 1953a5a1b3Sopenharmony_ci included in all copies or substantial portions of the Software. 2053a5a1b3Sopenharmony_ci 2153a5a1b3Sopenharmony_ci THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 2253a5a1b3Sopenharmony_ci EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 2353a5a1b3Sopenharmony_ci MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 2453a5a1b3Sopenharmony_ci NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 2553a5a1b3Sopenharmony_ci BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 2653a5a1b3Sopenharmony_ci ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 2753a5a1b3Sopenharmony_ci CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 2853a5a1b3Sopenharmony_ci SOFTWARE. 2953a5a1b3Sopenharmony_ci***/ 3053a5a1b3Sopenharmony_ci 3153a5a1b3Sopenharmony_ci#include <sys/types.h> 3253a5a1b3Sopenharmony_ci#include <dbus/dbus.h> 3353a5a1b3Sopenharmony_ci 3453a5a1b3Sopenharmony_ci#ifdef __cplusplus 3553a5a1b3Sopenharmony_ciextern "C" { 3653a5a1b3Sopenharmony_ci#endif 3753a5a1b3Sopenharmony_ci 3853a5a1b3Sopenharmony_ci/* This is the reference implementation for a client for 3953a5a1b3Sopenharmony_ci * RealtimeKit. You don't have to use this, but if do, just copy these 4053a5a1b3Sopenharmony_ci * sources into your repository */ 4153a5a1b3Sopenharmony_ci 4253a5a1b3Sopenharmony_ci#define RTKIT_SERVICE_NAME "org.freedesktop.RealtimeKit1" 4353a5a1b3Sopenharmony_ci#define RTKIT_OBJECT_PATH "/org/freedesktop/RealtimeKit1" 4453a5a1b3Sopenharmony_ci 4553a5a1b3Sopenharmony_ci/* This is mostly equivalent to sched_setparam(thread, SCHED_RR, { 4653a5a1b3Sopenharmony_ci * .sched_priority = priority }). 'thread' needs to be a kernel thread 4753a5a1b3Sopenharmony_ci * id as returned by gettid(), not a pthread_t! If 'thread' is 0 the 4853a5a1b3Sopenharmony_ci * current thread is used. The returned value is a negative errno 4953a5a1b3Sopenharmony_ci * style error code, or 0 on success. */ 5053a5a1b3Sopenharmony_ciint rtkit_make_realtime(DBusConnection *system_bus, pid_t thread, int priority); 5153a5a1b3Sopenharmony_ci 5253a5a1b3Sopenharmony_ci/* This is mostly equivalent to setpriority(PRIO_PROCESS, thread, 5353a5a1b3Sopenharmony_ci * nice_level). 'thread' needs to be a kernel thread id as returned by 5453a5a1b3Sopenharmony_ci * gettid(), not a pthread_t! If 'thread' is 0 the current thread is 5553a5a1b3Sopenharmony_ci * used. The returned value is a negative errno style error code, or 0 5653a5a1b3Sopenharmony_ci * on success.*/ 5753a5a1b3Sopenharmony_ciint rtkit_make_high_priority(DBusConnection *system_bus, pid_t thread, int nice_level); 5853a5a1b3Sopenharmony_ci 5953a5a1b3Sopenharmony_ci/* Return the maximum value of realtime priority available. Realtime requests 6053a5a1b3Sopenharmony_ci * above this value will fail. A negative value is an errno style error code. 6153a5a1b3Sopenharmony_ci */ 6253a5a1b3Sopenharmony_ciint rtkit_get_max_realtime_priority(DBusConnection *system_bus); 6353a5a1b3Sopenharmony_ci 6453a5a1b3Sopenharmony_ci/* Retrieve the minimum value of nice level available. High prio requests 6553a5a1b3Sopenharmony_ci * below this value will fail. The returned value is a negative errno 6653a5a1b3Sopenharmony_ci * style error code, or 0 on success.*/ 6753a5a1b3Sopenharmony_ciint rtkit_get_min_nice_level(DBusConnection *system_bus, int* min_nice_level); 6853a5a1b3Sopenharmony_ci 6953a5a1b3Sopenharmony_ci/* Return the maximum value of RLIMIT_RTTIME to set before attempting a 7053a5a1b3Sopenharmony_ci * realtime request. A negative value is an errno style error code. 7153a5a1b3Sopenharmony_ci */ 7253a5a1b3Sopenharmony_cilong long rtkit_get_rttime_usec_max(DBusConnection *system_bus); 7353a5a1b3Sopenharmony_ci 7453a5a1b3Sopenharmony_ci 7553a5a1b3Sopenharmony_ci#ifdef __cplusplus 7653a5a1b3Sopenharmony_ci} 7753a5a1b3Sopenharmony_ci#endif 7853a5a1b3Sopenharmony_ci 7953a5a1b3Sopenharmony_ci#endif 80