SCHED_GETSCHEDULER(3P)

πŸ’… SCHED_GETSCHEDULER(3P) β€” POSIX Programmer's Manual πŸ’…

okay bestie, welcome to the POSIX Programmer's Manual ✨ this one's a 3P page, which means it's the POSIX-flavoured version of things. quick heads up before we dive in:

PROLOG: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so pls consult the corresponding Linux manual page for the deets on Linux behavior), or the interface may not even be implemented on Linux at all. πŸ™ˆ

πŸŽ€ NAME πŸŽ€

sched_getscheduler β€” get scheduling policy (REALTIME)

like. it gets the scheduler. the name ate, honestly. πŸ”₯


✨ SYNOPSIS ✨

#include <sched.h>

int sched_getscheduler(pid_t pid);

🌸 DESCRIPTION 🌸

so the whole vibe here is: sched_getscheduler() shall return the scheduling policy of the process specified by pid. that's it, that's the function. πŸ‘‘

now, plot twist β€” if the value of pid is negative, the behavior of the sched_getscheduler() function is unspecified. not me handing you a negative pid and getting chaos back 😭 don't do that.

the values that can be returned by sched_getscheduler() are defined in the <sched.h> header. go look, they're in there, iykyk.

if a process specified by pid exists, and if the calling process has permission, the scheduling policy shall be returned for the process whose process ID is equal to pid. permission check first, always. 🫢

and if pid is zero? the scheduling policy shall be returned for the calling process. it's giving main character energy β€” you're asking about yourself. πŸ’–


πŸ¦‹ RETURN VALUE πŸ¦‹

upon successful completion, the sched_getscheduler() function shall return the scheduling policy of the specified process. slay. ✨

if unsuccessful, the function shall return -1 and set errno to indicate the error. classic. that's the move. πŸ’€


🌈 ERRORS 🌈

the sched_getscheduler() function shall fail if:

  • EPERM β€” the requesting process does not have permission to determine the scheduling policy of the specified process. bestie you are not on the list. 🚫
  • ESRCH β€” no process can be found corresponding to that specified by pid. it's not there. ghosted fr fr. πŸ‘»

the following sections are informative β€” meaning they're not normative requirements, they're just vibes. 🧚


πŸ’œ EXAMPLES πŸ’œ

None.

literally none. the page said "no thoughts, head empty" πŸŽ€


⭐ APPLICATION USAGE ⭐

None.

again β€” nothing. we're keeping it minimal. πŸ’…


πŸ“ RATIONALE πŸ“

None.

the reasoning? nonexistent. iconic behavior honestly. πŸ™ˆ


🌸 FUTURE DIRECTIONS 🌸

None.

the future? unbothered. πŸ’–


πŸ‘‘ SEE ALSO πŸ‘‘

  • sched_getparam()
  • sched_setparam()
  • sched_setscheduler()
  • The Base Definitions volume of POSIX.1‐2017, <sched.h>

go read those next, bestie, they're the whole friend group 🫢


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 πŸŽ€ this one came to you from IEEE/The Open Group, 2017, SCHED_GETSCHEDULER(3P) β€” go forth and schedule responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from