#2817: setpriority and getpriority are missing to compile ocaml out of the box under Haiku ----------------------------+---------------------------- Reporter: oco | Owner: nobody Type: enhancement | Status: new Priority: normal | Milestone: Unscheduled Component: System/POSIX | Version: R1/Development Resolution: | Keywords: Blocked By: | Blocking: Has a Patch: 1 | Platform: All ----------------------------+---------------------------- Comment (by pulkomandy): What is called "team" in the BeAPI is what is called "process" in POSIX. The setpriority documentation (http://pubs.opengroup.org/onlinepubs/9699919799/functions/setpriority.html) says that the priority is set for the whole process. {{{ If the process is multi-threaded, the nice value shall affect all system scope threads in the process. }}} So, the "niceness" is process global. It needs to be stored somewhere, and getpriority can read it there and return it directly. This avoid the rounding errors of your current implementation. When setpriority is called, the "nice" value for the team should be updated, and the priority for each running thread adjusted to match. When a new thread is spawned, its priority should be adjusted according to the current nice value. You are right that team_info shouldn't be modified, however it is only the user-visible information for the team (ans since getpriority already allows getting the nice value, it doesn't need to be available in the team_info). In headers/private/kernel/thread_types.h is the definition of {{{struct Team}}} which is the place where the process nice value can be stored. Of course we need a way to get it on the kernel side, and for this getthreadpriority and setthreadpriority must probably use a new system call. -- Ticket URL: <https://dev.haiku-os.org/ticket/2817#comment:18> Haiku <https://dev.haiku-os.org> Haiku - the operating system.