logo

oasis-root

Compiled tree of Oasis Linux based on own branch at <https://hacktivis.me/git/oasis/> git clone https://anongit.hacktivis.me/git/oasis-root.git

tmpnam.3p (4135B)


  1. '\" et
  2. .TH TMPNAM "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
  3. .\"
  4. .SH PROLOG
  5. This manual page is part of the POSIX Programmer's Manual.
  6. The Linux implementation of this interface may differ (consult
  7. the corresponding Linux manual page for details of Linux behavior),
  8. or the interface may not be implemented on Linux.
  9. .\"
  10. .SH NAME
  11. tmpnam
  12. \(em create a name for a temporary file
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdio.h>
  17. .P
  18. char *tmpnam(char *\fIs\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The functionality described on this reference page is aligned with the
  22. ISO\ C standard. Any conflict between the requirements described here and the
  23. ISO\ C standard is unintentional. This volume of POSIX.1\(hy2017 defers to the ISO\ C standard.
  24. .P
  25. The
  26. \fItmpnam\fR()
  27. function shall generate a string that is a valid pathname that does not
  28. name an existing file. The function is potentially capable of generating
  29. {TMP_MAX}
  30. different strings, but any or all of them may already be in use by
  31. existing files and thus not be suitable return values.
  32. .P
  33. The
  34. \fItmpnam\fR()
  35. function generates a different string each time it is called from the
  36. same process, up to
  37. {TMP_MAX}
  38. times. If it is called more than
  39. {TMP_MAX}
  40. times, the behavior is implementation-defined.
  41. .P
  42. The implementation shall behave as if no function defined in this volume of POSIX.1\(hy2017,
  43. except
  44. \fItempnam\fR(),
  45. calls
  46. \fItmpnam\fR().
  47. .P
  48. The
  49. \fItmpnam\fR()
  50. function need not be thread-safe if called with a NULL parameter.
  51. .SH "RETURN VALUE"
  52. Upon successful completion,
  53. \fItmpnam\fR()
  54. shall return a pointer to a string. If no suitable string can be
  55. generated, the
  56. \fItmpnam\fR()
  57. function shall return a null pointer.
  58. .P
  59. If the argument
  60. .IR s
  61. is a null pointer,
  62. \fItmpnam\fR()
  63. shall leave its result in an internal static object and return a
  64. pointer to that object. Subsequent calls to
  65. \fItmpnam\fR()
  66. may modify the same object. If the argument
  67. .IR s
  68. is not a null pointer, it is presumed to point to an array of at least
  69. L_tmpnam
  70. .BR char s;
  71. \fItmpnam\fR()
  72. shall write its result in that array and shall return the argument
  73. as its value.
  74. .SH ERRORS
  75. No errors are defined.
  76. .LP
  77. .IR "The following sections are informative."
  78. .SH EXAMPLES
  79. .SS "Generating a Pathname"
  80. .P
  81. The following example generates a unique pathname and stores it in the
  82. array pointed to by
  83. .IR ptr .
  84. .sp
  85. .RS 4
  86. .nf
  87. #include <stdio.h>
  88. \&...
  89. char pathname[L_tmpnam+1];
  90. char *ptr;
  91. .P
  92. ptr = tmpnam(pathname);
  93. .fi
  94. .P
  95. .RE
  96. .SH "APPLICATION USAGE"
  97. This function only creates pathnames. It is the application's
  98. responsibility to create and remove the files.
  99. .P
  100. Between the time a pathname is created and the file is opened, it is
  101. possible for some other process to create a file with the same name.
  102. Applications may find
  103. \fItmpfile\fR()
  104. more useful.
  105. .P
  106. Applications should use the
  107. \fItmpfile\fR(),
  108. \fImkstemp\fR(),
  109. or
  110. \fImkdtemp\fR()
  111. functions instead of the obsolescent
  112. \fItmpnam\fR()
  113. function.
  114. .SH RATIONALE
  115. None.
  116. .SH "FUTURE DIRECTIONS"
  117. The
  118. \fItmpnam\fR()
  119. function may be removed in a future version.
  120. .SH "SEE ALSO"
  121. .IR "\fIfopen\fR\^(\|)",
  122. .IR "\fIopen\fR\^(\|)",
  123. .IR "\fImkdtemp\fR\^(\|)",
  124. .IR "\fItempnam\fR\^(\|)",
  125. .IR "\fItmpfile\fR\^(\|)",
  126. .IR "\fIunlink\fR\^(\|)"
  127. .P
  128. The Base Definitions volume of POSIX.1\(hy2017,
  129. .IR "\fB<stdio.h>\fP"
  130. .\"
  131. .SH COPYRIGHT
  132. Portions of this text are reprinted and reproduced in electronic form
  133. from IEEE Std 1003.1-2017, Standard for Information Technology
  134. -- Portable Operating System Interface (POSIX), The Open Group Base
  135. Specifications Issue 7, 2018 Edition,
  136. Copyright (C) 2018 by the Institute of
  137. Electrical and Electronics Engineers, Inc and The Open Group.
  138. In the event of any discrepancy between this version and the original IEEE and
  139. The Open Group Standard, the original IEEE and The Open Group Standard
  140. is the referee document. The original Standard can be obtained online at
  141. http://www.opengroup.org/unix/online.html .
  142. .PP
  143. Any typographical or formatting errors that appear
  144. in this page are most likely
  145. to have been introduced during the conversion of the source files to
  146. man page format. To report such errors, see
  147. https://www.kernel.org/doc/man-pages/reporting_bugs.html .