UMASK(2)
π UMASK(2) β the manual page, but make it make sense
okay bestie, gather round, because we're talking about umask(2) β the system call version, not the shell builtin, and yes they're different, stay with me π«Ά
β¨ NAME β¨
umask β set file creation mode mask
π LIBRARY π
Standard C Library (libc, -lc)
πΈ SYNOPSIS πΈ
#include <sys/stat.h>
mode_t
umask(mode_t numask);
π DESCRIPTION π
so the umask() routine sets your process's file mode creation mask to numask, and then β plot twist β it returns the previous value of the mask. like it's handing you the receipt for the old one. iconic behavior honestly.
here's the tea: the 9 low-order access permission bits of numask are used by system calls β including open(2), mkdir(2), and mkfifo(2) β to turn off corresponding bits requested in file mode. (see chmod(2), she's the one who explains all that.) this clearing is literally the whole point: it lets each user restrict the default access to their files. your files, your rules, periodt π₯
the default mask value is S_IWGRP|S_IWOTH (022, write access for the owner only). and because generational trauma is real, child processes inherit the mask of the calling process. it's giving family business π
π RETURN VALUES π
the previous value of the file mode mask gets returned by the call. that's it, that's the whole return. she's simple, she's reliable, we love her β¨
π ERRORS π
not a single one, bestie. the umask() system call is always successful. no errno drama, no failure arc, no nothing. she simply does not miss π
π SEE ALSO π
β STANDARDS β
the umask() system call is expected to conform to ISO/IEC 9945-1:1990 ("POSIX.1"). certified, stamped, official π
π¦ HISTORY π¦
the umask() function appeared in Version 7 AT&T UNIX. an absolute elder. a legend. we stan a vintage queen π
okay that's the whole page!! thank you for coming to my TED talk, go forth and mask responsibly ππ
this page came from the Debian crew, dated June 4, 1993, and it's the UMASK(2) page in the System Calls Manual β mwah, bye bestie!! πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1980, 1991, 1993 The Regents of the University of California. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms