POSIX_SPAWNATTR_SETFLAGS(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

✨ POSIX_SPAWNATTR_GETFLAGS πŸ’…

okay bestie, so this is a <italic>Library Functions Manual</italic> moment β€” specifically the POSIX_SPAWNATTR_GETFLAGS(3) page β€” and it's literally the getter/setter duo for the spawn-flags attribute on a spawn attributes object. tiny API, big main character energy. let's get into it πŸŽ€


🌸 NAME 🌸

posix_spawnattr_getflags, posix_spawnattr_setflags β€” get and set the spawn-flags attribute of a spawn attributes object ✨


πŸ¦‹ LIBRARY πŸ¦‹

Standard C Library (libc, -lc) β€” she's literally built in, no extra linking drama πŸ’…


⭐ SYNOPSIS ⭐

#include <spawn.h>

int
posix_spawnattr_getflags(const posix_spawnattr_t *restrict attr,
    short *restrict flags);

int
posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags);

πŸ’– DESCRIPTION πŸ’–

so posix_spawnattr_getflags() obtains the value of the spawn-flags attribute from the attributes object that attr points at. it's the read side. the vibes-extraction function. 🫢

and posix_spawnattr_setflags() sets the spawn-flags attribute in an initialized attributes object referenced by attr. initialized is doing a lot of work in that sentence babe, don't skip it.

the spawn-flags attribute is the whole point of this page: it tells the system which process attributes are gonna be changed in the new process image when you invoke posix_spawn() or posix_spawnp(). and how do you build it? it's the bitwise-inclusive OR of zero or more of these flags (see posix_spawn()):

  • POSIX_SPAWN_RESETIDS
  • POSIX_SPAWN_SETPGROUP
  • POSIX_SPAWN_SETSIGDEF
  • POSIX_SPAWN_SETSIGMASK
  • POSIX_SPAWN_SETSCHEDPARAM
  • POSIX_SPAWN_SETSCHEDULER
  • POSIX_SPAWN_DISABLE_ASLR_NP

these flags live in <spawn.h> β€” that's where they're defined, periodt. πŸ“Œ

πŸ’€ heads up: the default value of this attribute is as if no flags were set. so if you never touch it, you get the empty-vibes version. not a bug, just the default.

🧚 RETURN VALUES 🧚

  • posix_spawnattr_getflags() β€” returns zero. that's it. that's the whole return value story. πŸŽ€
  • posix_spawnattr_setflags() β€” returns zero on success, and EINVAL on failure due to an invalid flag being specified. so if you pass her something cursed, she'll tell you. 😭

πŸ”₯ SEE ALSO πŸ”₯

go read the whole squad, they're all linked, iykyk πŸ’œ


πŸ‘‘ STANDARDS πŸ‘‘

posix_spawnattr_getflags() and posix_spawnattr_setflags() conform to IEEE Std 1003.1-2001 (β€œPOSIX.1”). certified. official. iconic. ⭐


🌈 HISTORY 🌈

posix_spawnattr_getflags() and posix_spawnattr_setflags() first appeared in FreeBSD 8.0. vintage but make it fresh πŸ¦‹


πŸ“ AUTHORS πŸ“

Ed Schouten <ed@FreeBSD.org> β€” thank you for your service, king πŸ‘‘


okay that's the whole page bestie, no notes, go forth and set those flags responsibly πŸ«ΆπŸ’…

sign-off: this one came from the Debian crew, dated March 4, 2024, and it's the POSIX_SPAWNATTR_GETFLAGS(3) page β€” mwah, love u, bye πŸ’–βœ¨

πŸ“¦ where this page comes from