[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Base Operating System and Extensions Technical Reference, Volume 1

msem_remove Subroutine

Purpose

Removes a semaphore.

Library

Standard C Library (libc.a)

Syntax

#include <sys/mman.h>
int msem_remove (Sem)
msemaphore *Sem;

Description

The msem_remove subroutine removes a binary semaphore. Any subsequent use of the msemaphore structure before it is again initialized by calling the msem_init subroutine will have undefined results.

The msem_remove subroutine also causes any process waiting in the msem_lock subroutine on the removed semaphore to return with an error.

If the msemaphore structure contains any value not resulting from a call to the msem_init subroutine, followed by a (possibly empty) sequence of calls to the msem_lock and msem_unlock subroutines, the result is undefined. The address of an msemaphore structure is significant. If the msemaphore structure contains any value copied from an msemaphore structure at a different address, the result is undefined.

Parameters

Sem Points to an msemaphore structure that specifies the semaphore to be removed.

Return Values

When successful, the msem_remove subroutine returns a value of 0. Otherwise, it returns a -1 and sets the errno global variable to indicate the error.

Error Codes

If the msem_remove subroutine is unsuccessful, the errno global variable is set to the following value:

EINVAL Indicates the Sem parameter points to an msemaphore structure that specifies a semaphore that has been removed.

Implementation Specifics

The msem_remove subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The msem_init subroutine, msem_lock subroutine, msem_unlock subroutine.

List of Memory Mapping Services and Understanding Memory Mapping in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]