TCGETSID(3POSIX)

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

okay bestie, welcome to the POSIX Programmer's Manual page for tcgetsid, straight out of the 3POSIX section. pull up a chair, grab a boba, we're doing terminal session stuff 🫢

🌸 PROLOG 🌸

real talk before we even start: this page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface may just not be implemented on Linux at all. not every vibe is universal, iykyk 😭


✨ NAME ✨

tcgetsid β€” get the process group ID for the session leader for the controlling terminal

like... it gets you the process group ID. for the session leader. for the controlling terminal. that's the whole job and she does it flawlessly πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

#include <termios.h>

pid_t tcgetsid(int fildes);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the tcgetsid() function shall obtain the process group ID of the session for which the terminal specified by fildes is the controlling terminal.

that's it. that's the function. she looks at the terminal you handed her and tells you which session's process group is running the show. main character energy, no cap πŸ‘‘


πŸ’œ RETURN VALUE πŸ’œ

when it works? tcgetsid() shall return the process group ID of the session associated with the terminal. iconic, love that for us ✨

when it doesn't? a value of -1 shall be returned and errno set to indicate the error. sad girl hours 😭


🌈 ERRORS 🌈

the tcgetsid() function shall fail if:

  • EBADF β€” the fildes argument is not a valid file descriptor. girl, that's not a real fd, what are you doing πŸ™ˆ
  • ENOTTY β€” the calling process does not have a controlling terminal, or the file is not the controlling terminal. so either you're terminal-less or you brought the wrong file to the party πŸ’€

the following sections are informative.


πŸ“ EXAMPLES πŸ“

None.

(not a single example, she's mysterious like that 🧚)


🌸 APPLICATION USAGE 🌸

None.


πŸ’… RATIONALE πŸ’…

None.


⭐ FUTURE DIRECTIONS ⭐

None.


πŸ”₯ SEE ALSO πŸ”₯

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

okay legal bestie moment, we gotta do this part properly, no skipping:

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 πŸŽ€ big mwah to IEEE/The Open Group, who shipped this in 2017 β€” so if you ever need to cite it, that's your source and your date, periodt πŸ’–