SCHED_GETSCHEDULER(3POSIX)

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

okay bestie, welcome to the POSIX Programmer's Manual ✨ quick lil heads up before we dive in: this page lives in the POSIX manual, and the Linux version of this interface might act a little different from what's written here (so like, go check the matching Linux man page for the Linux tea β˜•), or honestly it might not even be implemented on Linux at all. no cap. πŸ™ˆ


🌸 PROLOG 🌸

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β€” consult the corresponding Linux manual page for details on Linux behavior β€” or the interface may not be implemented on Linux.


πŸ‘‘ NAME πŸ‘‘

sched_getscheduler β€” get scheduling policy (REALTIME)


✨ SYNOPSIS ✨

#include <sched.h>

int sched_getscheduler(pid_t pid);

πŸ¦‹ DESCRIPTION πŸ¦‹

So like, what does sched_getscheduler() actually do? It shall return the scheduling policy of the process specified by pid. that's it, that's the whole gig πŸ’…

⚠️ but wait β€” if the value of pid is negative, the behavior of sched_getscheduler() is unspecified. we don't do that here, bestie. undefined-ish territory, stay safe. 😭

The values that sched_getscheduler() can hand back to you are defined in the <sched.h> header. πŸŽ€

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? then the scheduling policy shall be returned for the calling process itself. main character energy, honestly. 🌟


🫢 RETURN VALUE 🫢

Slay, so if everything goes right: upon successful completion, sched_getscheduler() shall return the scheduling policy of the specified process. πŸŽ‰

If it's unsuccessful? the function shall return -1 and set errno to indicate the error. not the vibe, but at least it tells you why. πŸ’€


πŸ’œ 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. (you're not on the list, bestie πŸ™ˆ)
  • ESRCH β€” No process can be found corresponding to that specified by pid. (ghosted, literally πŸ‘»)

The following sections are informative. 🧚 (yes, all of them. informational only, no rules here.)


🌈 EXAMPLES 🌈

None.


πŸ“ APPLICATION USAGE πŸ“

None.


⭐ RATIONALE ⭐

None.


πŸ”₯ FUTURE DIRECTIONS πŸ”₯

None.


🌸 SEE ALSO 🌸

  • sched_getparam()
  • 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!! 🫢 this one came to you from IEEE/The Open Group, 2017, and the page name on the tin is SCHED_GETSCHEDULER(3POSIX). go get those scheduling policies, you icon. πŸ’…βœ¨