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

mwakeup Subroutine

Purpose

Wakes up a process that is waiting on a semaphore.

Library

Standard C Library (libc.a)

Syntax

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

Description

The mwakeup subroutine wakes up a process that is sleeping and waiting for an idle semaphore. The semaphore should be located in a shared memory region. Use the mmap subroutine to create the shared memory section.

All of the values in the msemaphore structure must result from a msem_init subroutine call. This call may or may not be followed by a sequence of calls to the msem_lock subroutine or the msem_unlock subroutine. If the msemaphore structure value originates in another manner, the results of the mwakeup subroutine are undefined.

The address of the msemaphore structure is significant. You should be careful not to modify the structure's address. If the structure contains values copied from a msemaphore structure at another address, the results of the mwakeup subroutine are undefined.

Parameters

Sem Points to the msemaphore structure that specifies the semaphore.

Return Values

When successful, the mwakeup subroutine returns a value of 0. Otherwise, this routine returns a value of -1 and sets the errno global variable to EFAULT.

Error Codes

A value of EFAULT indicates that the Sem parameter points to an invalid address or that the address does not contain a valid msemaphore structure.

Implementation Specifics

The mwakeup subroutine is part of the Base Operating System (BOS) runtime calls.

Related Information

The mmap subroutine, msem_init subroutine, msem_lock subroutine, msem_unlock subroutine, and the msleep subroutine.

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 ]