SIGISMEMBER(3POSIX)

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

okay so this is a page from the POSIX Programmer's Manual bestie, and before we get into it, real talk:

⚠️ The Linux implementation of this interface may differ (consult the corresponding Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux.

so like, it's giving "your mileage may vary, check ur local manpage" energy. noted. πŸ’…


✨ NAME ✨

sigismember β€” test for a signal in a signal set πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <signal.h>

int sigismember(const sigset_t *set, int signo);

🌸 DESCRIPTION 🌸

So the whole vibe of sigismember() is: it shall test whether the signal specified by signo is a member of the set pointed to by set. that's it. that's the function. is this signal in this little club or not. membership check. iconic. πŸ‘‘

BUT β€” and this is the part people skip and then their code explodes β€” applications should call either sigemptyset() or sigfillset() at least once for each object of type sigset_t prior to any other use of that object.

like, initialize ur set first, bestie. don't be weird about it.

And if you don't initialize it that way, but you still hand it over as an argument to any of these:

  • pthread_sigmask()
  • sigaction()
  • sigaddset()
  • sigdelset()
  • sigismember()
  • sigpending()
  • sigprocmask()
  • sigsuspend()
  • sigtimedwait()
  • sigwait()
  • sigwaitinfo()

…then the results are undefined. πŸ’€ undefined behaviour. not "maybe it works", not "works on my machine", just undefined. so don't. please. for me. πŸ™ˆ


πŸ’œ RETURN VALUE πŸ’œ

Upon successful completion, sigismember() shall return:

  • 1 β€” if the specified signal is a member of the specified set ✨
  • 0 β€” if it is not 🫢

Otherwise, it shall return -1 and set errno to indicate the error. 😭


🌈 ERRORS 🌈

The sigismember() function may fail if:

  • EINVAL β€” the signo argument is not a valid signal number, or is an unsupported signal number. 🚫

πŸŽ€ the following sections are informative β€” meaning: cute to know, not rules. slay. πŸŽ€

πŸ“ EXAMPLES πŸ“

None. (yes literally none, the page just says None. we love a low-effort queen.) πŸ’€


🧚 APPLICATION USAGE 🧚

None. ✨


⭐ RATIONALE ⭐

None. πŸ’œ


🌸 FUTURE DIRECTIONS 🌸

None. πŸ¦‹


πŸ‘‘ SEE ALSO πŸ‘‘

  • Section 2.4, Signal Concepts
  • pthread_sigmask()
  • sigaction()
  • sigaddset()
  • sigdelset()
  • sigfillset()
  • sigemptyset()
  • sigpending()
  • sigsuspend()

and from the Base Definitions volume of POSIX.1‐2017, <signal.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 πŸ’– IEEE/The Open Group, 2017, SIGISMEMBER(3POSIX) β€” mwah, go initialize ur sigsets, ily, bye πŸŽ€βœ¨