*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->HP-UX 11i man pages -> sem_unlink (2)              


 sem_unlink(2)                                                 sem_unlink(2)

 NAME    [Toc]    [Back]
      sem_unlink - unlink a named POSIX semaphore

 SYNOPSIS    [Toc]    [Back]
      #include <sys/semaphore.h>

      int sem_unlink(const char *name);

 DESCRIPTION    [Toc]    [Back]
      sem_unlink() is used to unlink named semaphores.  A successful call to
      sem_unlink() marks the semaphore, specified by name, for removal.
      Calling sem_unlink() does not affect processes, including the calling
      process, which currently have a descriptor, obtained from a call to
      sem_open().  Named semaphores are uniquely identified by character
      strings.  All character string names will be pre-processed to ensure
      variations of a pathname resolve to the same semaphore name.  If the
      semaphore is successfully marked for removal by a call to
      sem_unlink(), the semaphore will be removed when all processes remove
      their descriptors to the specified semaphore by calling sem_close().
      Subsequent calls to sem_open() using the string name will refer to a
      new semaphore.

      To use this function, link in the realtime library by specifying -lrt
      on the compiler or linker command line.

 EXAMPLES    [Toc]    [Back]
      The following call to sem_unlink() will remove the named semaphore
      named by the string name.  If the semaphore is currently referenced by
      one or more processes, the semaphore will be marked for removal and
      removed when there are no more processes referencing it.


 RETURN VALUE    [Toc]    [Back]
      If the semaphore was unlinked successfully, sem_unlink() returns 0.

      If the semaphore could not be unlinked, the call returns -1 and sets
      errno to indicate the error.

 ERRORS    [Toc]    [Back]
      sem_unlink() fails and does not perform the requested operation if any
      of the following conditions are encountered:

           [EACCES]       The named semaphore exists and the process does
                          not have the permissions to unlink the semaphore.

           [ENAMETOOLONG] The name string is longer than {PATH_MAX}.

           [ENOENT]       The flag O_CREAT is not set in oflag (see
                          sem_open(2)) and the named semaphore does not

 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003

 sem_unlink(2)                                                 sem_unlink(2)

 SEE ALSO    [Toc]    [Back]
      sem_close(2), sem_open(2), <semaphore.h>.

      sem_unlink(): POSIX

 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003
[ Back ]
 Similar pages
Name OS Title
pipcrm HP-UX remove a POSIX message queue or a POSIX named semaphore
sem_close IRIX close a posix named semaphore
sem_open IRIX open a posix named semaphore
sem_unlink IRIX deletes a posix named semaphore
sem_close HP-UX close a named POSIX semaphore
sem_getvalue IRIX get the value of a posix named or unnamed semaphore
sem_wait IRIX acquire a posix named or unnamed semaphore
sem_post IRIX release a posix named or unnamed semaphore
sem_open HP-UX create/open a named POSIX semaphore
sem_getvalue HP-UX get the value of a POSIX semaphore
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service