Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/man/man3c/./tmpfile.3c
Real path: /usr/share/man/man3c/tmpfile.3c
Zurück
'\" te .\" Copyright (c) 1992, The X/Open Company Ltd. All rights reserved. .\" Copyright (c) 1989, AT&T. All rights reserved. .\" Portions Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. .\" Oracle gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at http://www.opengroup.org/bookstore/. .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions 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. This notice shall appear on any product containing this material. .TH tmpfile 3C "7 Aug 2019" "Oracle Solaris 11.4" "Standard C Library Functions" .SH NAME tmpfile, tmpfile_s \- create a temporary file .SH SYNOPSIS .LP .nf #include <stdio.h> FILE *tmpfile(void); .fi .LP .nf #define __STDC_WANT_LIB_EXT1__ 1 #include <stdio.h> errno_t tmpfile_s(FILE *restrict *restrict \fIstreamptr\fR); .fi .SH DESCRIPTION .sp .LP The \fBtmpfile()\fR function creates a temporary file in \fB/var/tmp\fR and opens a corresponding stream. If that directory is not accessible, \fB/tmp\fR is used. The file will automatically be deleted when all references to the file are closed. The file is opened as in \fBfopen\fR(3C) for update (\fBwb+\fR). .sp .LP The largest value that can be represented correctly in an object of type \fBoff_t\fR will be established as the offset maximum in the open file description. .sp .LP The \fBtmpfile_s()\fR function is part of the C11 bounds checking interfaces specified in the C11 standard, Annex K. It is similar to the \fBtmpfile()\fR function with differing parameters and return types in order to provide additional safety checks on the parameters passed. See \fBruntime_constraint_handler\fR(3C) and INCITS/ISO/IEC 9899:2011. .sp .LP A \fBNULL\fR \fBstreamptr\fR value as an argument to \fBtmpfile_s()\fR generates a runtime-constraint violation (\fBruntime_constraint_handler\fR(3C)) and \fBtmpfile_s()\fR will fail to create a file. .SH RETURN VALUES .sp .LP Upon successful completion, the \fBtmpfile()\fR function returns a pointer to the stream of the file that is created. Otherwise, it returns a null pointer and sets \fBerrno\fR to indicate the error. .sp .LP If the file is created, the \fBtmpfile_s()\fR function returns \fB0\fR, otherwise, a non-zero value is returned. .SH ERRORS .sp .LP The \fBtmpfile()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINTR\fR\fR .ad .RS 10n .rt A signal was caught during the execution of \fBtmpfile()\fR. .RE .sp .ne 2 .mk .na \fB\fBEMFILE\fR\fR .ad .RS 10n .rt There are \fBOPEN_MAX\fR file descriptors currently open in the calling process. .RE .sp .ne 2 .mk .na \fB\fBENFILE\fR\fR .ad .RS 10n .rt The maximum allowable number of files is currently open in the system. .RE .sp .ne 2 .mk .na \fB\fBENOSPC\fR\fR .ad .RS 10n .rt The directory or file system which would contain the new file cannot be expanded. .RE .sp .LP The \fBtmpfile()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEMFILE\fR\fR .ad .RS 10n .rt There are \fBFOPEN_MAX\fR streams currently open in the calling process. .RE .sp .ne 2 .mk .na \fB\fBENOMEM\fR\fR .ad .RS 10n .rt Insufficient storage space is available. .RE .sp .LP The \fBtmpfile_s()\fR function will fail if: .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt \fBNULL\fR pointer passed. .RE .SH USAGE .sp .LP 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. .sp .LP The \fBtmpfile()\fR function has a transitional interface for 64-bit file offsets. For more information, see the \fBlf64\fR(7) man page. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(7) for descriptions of the following attributes: .sp .TS tab( ) box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Committed _ Standard See \fBstandards\fR(7). _ MT-Level See below .TE .sp .sp .LP The \fBtmpfile()\fR function can be used safely in multithreaded applications. However, the file descriptors may be leaked if a function in the \fBfork()\fR or \fBexec()\fR family is called in another thread before the \fBfcntl\fR(2) function is called to set the \fBFD_CLOEXEC\fR flag. Applications can avoid this leak by instead using the \fBmkostemp\fR(3C) function with the \fBO_CLOEXEC\fR flag, and then using the \fBfdopen\fR(3C) function to associate a stream with the resulting file descriptor. .sp .LP The \fBtmpfile_s()\fR function cannot be used safely in a multithreaded application due to the runtime constraint handler. For more information, see the \fBruntime_constraint_handler\fR(3C) man page. .SH SEE ALSO .sp .LP \fBfcntl\fR(2), \fBunlink\fR(2), \fBfdopen\fR(3C), \fBfopen\fR(3C), \fBfopen_s\fR(3C), \fBmkostemp\fR(3C), \fBmkstemp\fR(3C), \fBmktemp\fR(3C), \fBtmpnam\fR(3C), \fBattributes\fR(7), \fBlf64\fR(7), \fBstandards\fR(7), \fBruntime_constraint_handler\fR(3C)