1
0

rtkit.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*-*- Mode: C; c-basic-offset: 8 -*-*/
  2. #ifndef foortkithfoo
  3. #define foortkithfoo
  4. /***
  5. Copyright 2009 Lennart Poettering
  6. Copyright 2010 David Henningsson <[email protected]>
  7. Permission is hereby granted, free of charge, to any person
  8. obtaining a copy of this software and associated documentation files
  9. (the "Software"), to deal in the Software without restriction,
  10. including without limitation the rights to use, copy, modify, merge,
  11. publish, distribute, sublicense, and/or sell copies of the Software,
  12. and to permit persons to whom the Software is furnished to do so,
  13. subject to the following conditions:
  14. The above copyright notice and this permission notice shall be
  15. included in all copies or substantial portions of the Software.
  16. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  17. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  18. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  19. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  20. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  21. ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. SOFTWARE.
  24. ***/
  25. #include <sys/types.h>
  26. #include <dbus/dbus.h>
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /* This is the reference implementation for a client for
  31. * RealtimeKit. You don't have to use this, but if do, just copy these
  32. * sources into your repository */
  33. #define RTKIT_SERVICE_NAME "org.freedesktop.RealtimeKit1"
  34. #define RTKIT_OBJECT_PATH "/org/freedesktop/RealtimeKit1"
  35. /* This is mostly equivalent to sched_setparam(thread, SCHED_RR, {
  36. * .sched_priority = priority }). 'thread' needs to be a kernel thread
  37. * id as returned by gettid(), not a pthread_t! If 'thread' is 0 the
  38. * current thread is used. The returned value is a negative errno
  39. * style error code, or 0 on success. */
  40. int rtkit_make_realtime(DBusConnection *system_bus, pid_t thread, int priority);
  41. /* This is mostly equivalent to setpriority(PRIO_PROCESS, thread,
  42. * nice_level). 'thread' needs to be a kernel thread id as returned by
  43. * gettid(), not a pthread_t! If 'thread' is 0 the current thread is
  44. * used. The returned value is a negative errno style error code, or 0
  45. * on success.*/
  46. int rtkit_make_high_priority(DBusConnection *system_bus, pid_t thread, int nice_level);
  47. /* Return the maximum value of realtime priority available. Realtime requests
  48. * above this value will fail. A negative value is an errno style error code.
  49. */
  50. int rtkit_get_max_realtime_priority(DBusConnection *system_bus);
  51. /* Retreive the minimum value of nice level available. High prio requests
  52. * below this value will fail. The returned value is a negative errno
  53. * style error code, or 0 on success.*/
  54. int rtkit_get_min_nice_level(DBusConnection *system_bus, int* min_nice_level);
  55. /* Return the maximum value of RLIMIT_RTTIME to set before attempting a
  56. * realtime request. A negative value is an errno style error code.
  57. */
  58. long long rtkit_get_rttime_usec_max(DBusConnection *system_bus);
  59. #ifdef __cplusplus
  60. }
  61. #endif
  62. #endif