Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

sem_close(2) [osx man page]

SEM_CLOSE(2)						      BSD System Calls Manual						      SEM_CLOSE(2)

NAME
sem_close -- close a named semaphore SYNOPSIS
#include <semaphore.h> int sem_close(sem_t *sem); DESCRIPTION
The system resources associated with the named semaphore referenced by sem are deallocated and the descriptor is invalidated. If successful, sem_close() will return 0. Otherwise, -1 is returned and errno is set. ERRORS
sem_close() succeeds unless: [EINVAL] sem is not a valid semaphore descriptor. SEE ALSO
sem_init(2), sem_open(2), sem_unlink(2), semctl(2), semget(2), semop(2) HISTORY
sem_close() is specified in the POSIX Realtime Extension (1003.1b-1993/1003.1i-1995). Darwin June 8, 2000 Darwin

Check Out this Related Man Page

SEM_CLOSE(P)						     POSIX Programmer's Manual						      SEM_CLOSE(P)

NAME
sem_close - close a named semaphore (REALTIME) SYNOPSIS
#include <semaphore.h> int sem_close(sem_t *sem); DESCRIPTION
The sem_close() function shall indicate that the calling process is finished using the named semaphore indicated by sem. The effects of calling sem_close() for an unnamed semaphore (one created by sem_init()) are undefined. The sem_close() function shall deallocate (that is, make available for reuse by a subsequent sem_open() by this process) any system resources allocated by the system for use by this process for this semaphore. The effect of subsequent use of the semaphore indicated by sem by this process is undefined. If the semaphore has not been removed with a successful call to sem_unlink(), then sem_close() has no effect on the state of the semaphore. If the sem_unlink() function has been successfully invoked for name after the most recent call to sem_open() with O_CREAT for this semaphore, then when all processes that have opened the semaphore close it, the semaphore is no longer accessible. RETURN VALUE
Upon successful completion, a value of zero shall be returned. Otherwise, a value of -1 shall be returned and errno set to indicate the error. ERRORS
The sem_close() function shall fail if: EINVAL The sem argument is not a valid semaphore descriptor. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
The sem_close() function is part of the Semaphores option and need not be available on all implementations. RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
semctl() , semget() , semop() , sem_init() , sem_open() , sem_unlink() , the Base Definitions volume of IEEE Std 1003.1-2001, <semaphore.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version 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 . IEEE
/The Open Group 2003 SEM_CLOSE(P)
Man Page

5 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

sem_open problem

I can't compile these codes with g++. my system is linux (kernel is 2.4.0 ). When I try to compile this program with g++ -o semw semw.cpp It always tells me that sem_open sem_close,sem_post do not exist.But I have checked semaphore.h,I can not find any problems. Anyone can compile these codes... (2 Replies)
Discussion started by: lance
2 Replies

2. Programming

Problem with releasing semaphore lock

Hi, I am trying to write stuff to a shared memory using a writer, and reading the corresponding stuff using a reader. I am facing problems while releasing the lock, as a result of which I am having segmentation faults. The code is as follows... /********** writer.c ***********/ ... (1 Reply)
Discussion started by: jacques83
1 Replies

3. HP-UX

sem_open(), -lrt and creating a library

I am on HP-UX delta B.11.11 I am using sem_open() and compiling/linking the library by specifying -lrt. Then, I am creating library like below: ar cr $libdir/liboscfe.a `cat fe.libs.$$ com.libs.$$` ranlib $libdir/liboscfe.a Now, I am compiling another utility sch2db which requires this... (1 Reply)
Discussion started by: apadha
1 Replies

4. Solaris

Apache config issue

I want to build a little website on a Sun Blade 100 running Solaris 10. I just went out to apache.org and downloaded Unix Source: httpd-2.2.8.tar.gz After unpacking the tarball, I CD'd into the subdirectory and ran the configure utility. Of course, it crapped out. I see that it is... (17 Replies)
Discussion started by: BrewDudeBob
17 Replies

5. AIX

Compiling problem - AIX 7.2

Hi We meet errors while running configuration scripts to prepare compiling source code on AIX 7.2. This error does not happen on AIX5.3 and AIX6.1 With the “/usr/bin/sh” from AIX7.2, sometimes , the script runs sucessfully, sometimes not. It’s unstable, and I don’t know why. When... (10 Replies)
Discussion started by: bobochacha29
10 Replies