01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

INTRO ( 2) INTR0 (2)<br />

A semaphore is a data structure that contains the following<br />

members:<br />

ushort<br />

short<br />

ushort<br />

ushort<br />

semval;<br />

sempid;<br />

semncnt;<br />

semzcnt;<br />

I* semaphore value *I<br />

I* pid of last operation *I<br />

I* # awaiting semval > cval *I<br />

I* # awaiting semval = 0 *I<br />

Semva.l is a non-negative integer. Sempid is equal to the process<br />

ID of the last process that performed a semaphore operation on<br />

this semaphore. Semncnt is a count of the number of processes<br />

that are currently suspended awaiting this semaphore's semval to<br />

become greater than its current value. Semzcnt is a count of the<br />

number of processes that are currently suspended awaiting this<br />

semaphore's semval to become zero.<br />

Semaphore Operation Permissions.<br />

In the semop(2) and semctl(2) system call descriptions, the permission<br />

required for an operation is interpreted as follows:<br />

00400 Read by user<br />

00200 Alter by user<br />

00060 Read, Alter by group<br />

00006 Read, Alter by others<br />

Read and Alter permissions on a semid are granted to a process if<br />

one or more of the following are true:<br />

The process's effective user ID is super-user.<br />

The process's effective user ID matches sem_perm.[c]uid<br />

in the data structure associated with semid and the<br />

appropriate bit of the "user" portion (0600) of<br />

sem_perm.mode is set.<br />

The process's effective user ID does not match<br />

sem_perm.[c]uid and the process's effective group ID<br />

matches sem_perm.[c]gid and the appropriate bit of the<br />

"group" portion (060) of sem_perm.mode is set.<br />

The process's effective user ID does not match<br />

sem_perm.[c]uid and the process's effective group ID<br />

does not match sem_perm.[c]gid and the appropriate bit<br />

of the "other" portion (06) of sem_perm.mode is set.<br />

Otherwise, the corresponding permissions are denied.<br />

Shared Memory Identifier<br />

A shared memory identifier (shmid) is a unique positive integer<br />

created by a shmget(2) system call. Each shmid has a segment of<br />

memory (referred to as a shared memory segment) and a data<br />

structure associated with it. The data structure is referred to as<br />

shmid_ds and contains the following members:<br />

struct<br />

int<br />

ushort<br />

ushort<br />

short<br />

time_t<br />

ipc_perm shm_perm;<br />

shm_segsz;<br />

shm_cpid;<br />

shm_lpid;<br />

shm_nattch;<br />

shm_atime;<br />

- 8-<br />

I* operation permission struct *I<br />

I* size of segment *I<br />

I* creator pid *I<br />

I* pid of last operation *I<br />

I* number of current attaches *I<br />

I* last attach time *I

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!