mkstemp(3) Library Functions Manual mkstemp(3) mkstemp, mkostemp, mkstemps, mkostemps - (libc -lc) #include int mkstemp(char *template); int mkostemp(char *template, int flags); int mkstemps(char *template, int suffixlen); int mkostemps(char *template, int suffixlen, int flags); glibc ( feature_test_macros(7)): mkstemp(): _XOPEN_SOURCE >= 500 || /* glibc >= 2.12: */ _POSIX_C_SOURCE >= 200809L || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE mkostemp(): _GNU_SOURCE mkstemps(): /* glibc >= 2.19: */ _DEFAULT_SOURCE || /* glibc <= 2.19: */ _SVID_SOURCE || _BSD_SOURCE mkostemps(): _GNU_SOURCE mkstemp() template . template "XXXXXX" . template . 0600 . . O_EXCL open(2) . mkostemp() mkstemp() -- open(2)-- flags: O_APPEND O_CLOEXEC O_SYNC. mkostemp() O_RDWR O_CREAT O_EXCL flags open(2) flags mkostemp() . mkstemps() mkstemp() template suffixlen . template prefixXXXXXXsuffix XXXXXX mkstemp(). mkostemps() mkstemps() mkostemp() mkstemp(). . -1 errno . EEXIST . template . EINVAL mkstemp() mkostemp(): template XXXXXX template . mkstemps() mkostemps(): template (6 + suffixlen) 6 template XXXXXX. open(2). attributes(7). +------------+------------------------------------+--------------------+ || | | +------------+------------------------------------+--------------------+ |mkstemp()| | MT-Safe | |mkostemp()| | | |mkstemps()| | | |mkostemps() | | | +------------+------------------------------------+--------------------+ mkstemp() POSIX.1-2001. mkstemps() BSD. mkostemp() mkostemps() GNU. mkstemp() 4.3BSD POSIX.1-2001. mkstemps() glibc 2.11. BSD 64. mkostemp() glibc 2.7. mkostemps() glibc 2.11. glibc 2.06 0666 . 0600 . POSIX.1-2008 0600. POSIX mkstemp() ( umask(2)) mkstemp() ( mkostemp()). mkdtemp(3) mktemp(3) tempnam(3) tmpfile(3) tmpnam(3) 3 . . : . 6.18 8 2026 mkstemp(3)