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

fileno.3p (2776B)


  1. '\" et
  2. .TH FILENO "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. fileno
  12. \(em map a stream pointer to a file descriptor
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <stdio.h>
  17. .P
  18. int fileno(FILE *\fIstream\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIfileno\fR()
  23. function shall return the integer file descriptor associated with
  24. the stream pointed to by
  25. .IR stream .
  26. .SH "RETURN VALUE"
  27. Upon successful completion,
  28. \fIfileno\fR()
  29. shall return the integer value of the file descriptor associated with
  30. .IR stream .
  31. Otherwise, the value \-1 shall be returned and
  32. .IR errno
  33. set to indicate the error.
  34. .SH ERRORS
  35. The
  36. \fIfileno\fR()
  37. function shall fail if:
  38. .TP
  39. .BR EBADF
  40. The stream is not associated with a file.
  41. .P
  42. The
  43. \fIfileno\fR()
  44. function may fail if:
  45. .TP
  46. .BR EBADF
  47. The file descriptor underlying
  48. .IR stream
  49. is not a valid file descriptor.
  50. .LP
  51. .IR "The following sections are informative."
  52. .SH EXAMPLES
  53. None.
  54. .SH "APPLICATION USAGE"
  55. None.
  56. .SH RATIONALE
  57. Without some specification of which file descriptors are associated
  58. with these streams, it is impossible for an application to set up the
  59. streams for another application it starts with
  60. \fIfork\fR()
  61. and
  62. .IR exec .
  63. In particular, it would not be possible to write a portable version of
  64. the
  65. .IR sh
  66. command interpreter (although there may be other constraints that would
  67. prevent that portability).
  68. .SH "FUTURE DIRECTIONS"
  69. None.
  70. .SH "SEE ALSO"
  71. .IR "Section 2.5.1" ", " "Interaction of File Descriptors and Standard I/O Streams",
  72. .IR "\fIdirfd\fR\^(\|)",
  73. .IR "\fIfdopen\fR\^(\|)",
  74. .IR "\fIfopen\fR\^(\|)",
  75. .IR "\fIstdin\fR\^"
  76. .P
  77. The Base Definitions volume of POSIX.1\(hy2017,
  78. .IR "\fB<stdio.h>\fP"
  79. .\"
  80. .SH COPYRIGHT
  81. Portions of this text are reprinted and reproduced in electronic form
  82. from IEEE Std 1003.1-2017, Standard for Information Technology
  83. -- Portable Operating System Interface (POSIX), The Open Group Base
  84. Specifications Issue 7, 2018 Edition,
  85. Copyright (C) 2018 by the Institute of
  86. Electrical and Electronics Engineers, Inc and The Open Group.
  87. In the event of any discrepancy between this version and the original IEEE and
  88. The Open Group Standard, the original IEEE and The Open Group Standard
  89. is the referee document. The original Standard can be obtained online at
  90. http://www.opengroup.org/unix/online.html .
  91. .PP
  92. Any typographical or formatting errors that appear
  93. in this page are most likely
  94. to have been introduced during the conversion of the source files to
  95. man page format. To report such errors, see
  96. https://www.kernel.org/doc/man-pages/reporting_bugs.html .