svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
tmpfile_s(3c)
Standard C Library Functions tmpfile(3C)
NAME
tmpfile, tmpfile_s - create a temporary file
SYNOPSIS
#include <stdio.h>
FILE *tmpfile(void);
#define __STDC_WANT_LIB_EXT1__ 1
#include <stdio.h>
errno_t tmpfile_s(FILE *restrict *restrict streamptr);
DESCRIPTION
The tmpfile() function creates a temporary file in /var/tmp and opens a
corresponding stream. If that directory is not accessible, /tmp is
used. The file will automatically be deleted when all references to the
file are closed. The file is opened as in fopen(3C) for update (wb+).
The largest value that can be represented correctly in an object of
type off_t will be established as the offset maximum in the open file
description.
The tmpfile_s() function is part of the C11 bounds checking interfaces
specified in the C11 standard, Annex K. It is similar to the tmpfile()
function with differing parameters and return types in order to provide
additional safety checks on the parameters passed. See runtime_con‐
straint_handler(3C) and INCITS/ISO/IEC 9899:2011.
A NULL streamptr value as an argument to tmpfile_s() generates a run‐
time-constraint violation (runtime_constraint_handler(3C)) and tmp‐
file_s() will fail to create a file.
RETURN VALUES
Upon successful completion, the tmpfile() function returns a pointer to
the stream of the file that is created. Otherwise, it returns a null
pointer and sets errno to indicate the error.
If the file is created, the tmpfile_s() function returns 0, otherwise,
a non-zero value is returned.
ERRORS
The tmpfile() function will fail if:
EINTR A signal was caught during the execution of tmpfile().
EMFILE There are OPEN_MAX file descriptors currently open in the
calling process.
ENFILE The maximum allowable number of files is currently open in
the system.
ENOSPC The directory or file system which would contain the new file
cannot be expanded.
The tmpfile() function will fail if:
EMFILE There are FOPEN_MAX streams currently open in the calling
process.
ENOMEM Insufficient storage space is available.
The tmpfile_s() function will fail if:
EINVAL NULL pointer passed.
USAGE
The stream refers to a file which is unlinked. If the process is killed
in the period between file creation and unlinking, a permanent file may
be left behind.
The tmpfile() function has a transitional interface for 64-bit file
offsets. For more information, see the lf64(7) man page.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Interface StabilityCommitted _ StandardSee stan‐
dards(7). _ MT-LevelSee below
The tmpfile() function can be used safely in multithreaded applica‐
tions. However, the file descriptors may be leaked if a function in the
fork() or exec() family is called in another thread before the fcntl(2)
function is called to set the FD_CLOEXEC flag. Applications can avoid
this leak by instead using the mkostemp(3C) function with the O_CLOEXEC
flag, and then using the fdopen(3C) function to associate a stream with
the resulting file descriptor.
The tmpfile_s() function cannot be used safely in a multithreaded
application due to the runtime constraint handler. For more informa‐
tion, see the runtime_constraint_handler(3C) man page.
SEE ALSO
fcntl(2), unlink(2), fdopen(3C), fopen(3C), fopen_s(3C), mkostemp(3C),
mkstemp(3C), mktemp(3C), tmpnam(3C), attributes(7), lf64(7), stan‐
dards(7), runtime_constraint_handler(3C)
Oracle Solaris 11.4 7 Aug 2019 tmpfile(3C)