SCHED_GETPARAM(3POSIX)

πŸ’– SCHED_GETPARAM(3POSIX) πŸ’–

okay bestie so this one is from the POSIX Programmer's Manual (that's the manual name, keep it in your notes πŸ“) and we're about to learn how to peek at a process's scheduling parameters. no cap, it's shorter than you think.


🌸 PROLOG 🌸

This manual page is part of the POSIX Programmer's Manual. Heads up though β€” the Linux implementation of this interface may differ, so go check the corresponding Linux manual page for the deets on Linux behavior. or like… the interface might not even be implemented on Linux at all πŸ™ˆ. vibe check accordingly.


✨ NAME ✨

sched_getparam β€” get scheduling parameters (REALTIME)


πŸŽ€ SYNOPSIS πŸŽ€

#include <sched.h>

int sched_getparam(pid_t pid, struct sched_param *param);

πŸ¦‹ DESCRIPTION πŸ¦‹

So the sched_getparam() function shall return the scheduling parameters of a process specified by pid, and it drops them into the sched_param structure pointed to by param. it's giving "here's your info, queen" πŸ‘‘

If a process specified by pid exists, and the calling process has permission, then the scheduling parameters for the process whose process ID equals pid shall be returned. permission check first though, always.

If pid is zero, then the scheduling parameters for the calling process shall be returned. cute, self-love 🫢.

⚠️ But if pid is negative, the behavior of sched_getparam() is unspecified. like, we literally do not know what happens. don't do it. that's not a vibe. πŸ’€

🌈 RETURN VALUE 🌈

Upon successful completion, sched_getparam() shall return zero. slay, zero, the good number ✨

If the call is unsuccessful, the function shall return a value of -1 and set errno to indicate the error. classic. iconic even.


πŸ’… ERRORS πŸ’…

The sched_getparam() function shall fail if:

  • EPERM β€” The requesting process does not have permission to obtain the scheduling parameters of the specified process. like, no access babes, sorry 😭
  • ESRCH β€” No process can be found corresponding to that specified by pid. that process? doesn't exist. gone. never was. πŸ”

The following sections are informative.


πŸ“ EXAMPLES πŸ“

None.

(yes, literally none. we're on our own bestie.)


🧚 APPLICATION USAGE 🧚

None.


πŸ’œ RATIONALE πŸ’œ

None.


⭐ FUTURE DIRECTIONS ⭐

None.


πŸ”₯ SEE ALSO πŸ”₯

  • sched_getscheduler()
  • sched_setparam()
  • sched_setscheduler()

The Base Definitions volume of POSIX.1‐2017, <sched.h>


Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


and that's the whole page, bestie!! brought to you by IEEE/The Open Group, 2017 β€” the year this little SCHED_GETPARAM(3POSIX) baddie got stamped πŸ’… go forth and check your scheduling params responsibly βœ¨πŸŽ€