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

sem_close.3p (3152B)


  1. '\" et
  2. .TH SEM_CLOSE "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. sem_close
  12. \(em close a named semaphore
  13. .SH SYNOPSIS
  14. .LP
  15. .nf
  16. #include <semaphore.h>
  17. .P
  18. int sem_close(sem_t *\fIsem\fP);
  19. .fi
  20. .SH DESCRIPTION
  21. The
  22. \fIsem_close\fR()
  23. function shall indicate that the calling process is finished using
  24. the named semaphore indicated by
  25. .IR sem .
  26. The effects of calling
  27. \fIsem_close\fR()
  28. for an unnamed semaphore (one created by
  29. \fIsem_init\fR())
  30. are undefined. The
  31. \fIsem_close\fR()
  32. function shall deallocate (that is, make available for reuse by a
  33. subsequent
  34. \fIsem_open\fR()
  35. by this process) any system resources allocated by the system for use
  36. by this process for this semaphore. The effect of subsequent use of the
  37. semaphore indicated by
  38. .IR sem
  39. by this process is undefined. If any threads in the calling process are
  40. currently blocked on the semaphore, the behavior is undefined.
  41. If the semaphore has not been removed with a successful call to
  42. \fIsem_unlink\fR(),
  43. then
  44. \fIsem_close\fR()
  45. has no effect on the state of the semaphore. If the
  46. \fIsem_unlink\fR()
  47. function has been successfully invoked for
  48. .IR name
  49. after the most recent call to
  50. \fIsem_open\fR()
  51. with O_CREAT for this semaphore,
  52. then when all processes that have opened the semaphore close it, the
  53. semaphore is no longer accessible.
  54. .SH "RETURN VALUE"
  55. Upon successful completion, a value of zero shall be returned.
  56. Otherwise, a value of \-1 shall be returned and
  57. .IR errno
  58. set to indicate the error.
  59. .SH ERRORS
  60. The
  61. \fIsem_close\fR()
  62. function may fail if:
  63. .TP
  64. .BR EINVAL
  65. The
  66. .IR sem
  67. argument is not a valid semaphore descriptor.
  68. .LP
  69. .IR "The following sections are informative."
  70. .SH EXAMPLES
  71. None.
  72. .SH "APPLICATION USAGE"
  73. None.
  74. .SH RATIONALE
  75. None.
  76. .SH "FUTURE DIRECTIONS"
  77. None.
  78. .SH "SEE ALSO"
  79. .IR "\fIsemctl\fR\^(\|)",
  80. .IR "\fIsemget\fR\^(\|)",
  81. .IR "\fIsemop\fR\^(\|)",
  82. .IR "\fIsem_init\fR\^(\|)",
  83. .IR "\fIsem_open\fR\^(\|)",
  84. .IR "\fIsem_unlink\fR\^(\|)"
  85. .P
  86. The Base Definitions volume of POSIX.1\(hy2017,
  87. .IR "\fB<semaphore.h>\fP"
  88. .\"
  89. .SH COPYRIGHT
  90. Portions of this text are reprinted and reproduced in electronic form
  91. from IEEE Std 1003.1-2017, Standard for Information Technology
  92. -- Portable Operating System Interface (POSIX), The Open Group Base
  93. Specifications Issue 7, 2018 Edition,
  94. Copyright (C) 2018 by the Institute of
  95. Electrical and Electronics Engineers, Inc and The Open Group.
  96. In the event of any discrepancy between this version and the original IEEE and
  97. The Open Group Standard, the original IEEE and The Open Group Standard
  98. is the referee document. The original Standard can be obtained online at
  99. http://www.opengroup.org/unix/online.html .
  100. .PP
  101. Any typographical or formatting errors that appear
  102. in this page are most likely
  103. to have been introduced during the conversion of the source files to
  104. man page format. To report such errors, see
  105. https://www.kernel.org/doc/man-pages/reporting_bugs.html .