Anteprima
Vedrai una selezione di 1 pagina su 2
Sistemi operativi - Syscall semget Pag. 1
1 su 2
D/illustrazione/soddisfatti o rimborsati
Disdici quando
vuoi
Acquista con carta
o PayPal
Scarica i documenti
tutte le volte che vuoi
Estratto del documento

semget

The Single UNIX ® Specification, Version 2

Copyright © 1997 The Open Group

NAME

semget - get set of semaphores

SYNOPSIS

#include <sys/sem.h>
int semget(key_t int intkey, nsems, semflg);

DESCRIPTION

The semget() function returns the semaphore identifier associated with key.

A semaphore identifier with its associated data structure and its associated set of semid_dsnsems semaphores, see <sys/sem.h>, are created for key if one of the following is true:

  • The argument key is equal to IPC_PRIVATE .
  • The argument key does not already have a semaphore identifier associated with it and (semflg & IPC_CREAT) is non-zero.

Upon creation, the data structure associated with the new semaphore identifier is semid_ds initialised as follows:

In the operation permissions structure sem_perm.cuid, sem_perm.uid, sem_perm.cgid and sem_perm.gid are set equal to the effective user ID and effective group ID, respectively, of the calling

The low-order 9 bits of sem_perm.mode are set equal to the low-order 9 bits of semflg.

The variable sem_nsems is set equal to the value of nsems.

The variable sem_otime is set equal to 0 and sem_ctime is set equal to the current time.

The data structure associated with each semaphore in the set is not initialised. The semctl() function with the command SETVAL or SETALL can be used to initialise each semaphore.

RETURN VALUE

Upon successful completion, semget() returns a non-negative integer, namely a semaphore identifier; otherwise, it returns -1 and errno will be set to indicate the error.

ERRORS

The semget() function will fail if:

[EACCES]1 di 2 21/04/2010 14:07

Dettagli
Publisher
A.A. 2012-2013
2 pagine
SSD Scienze matematiche e informatiche INF/01 Informatica

I contenuti di questa pagina costituiscono rielaborazioni personali del Publisher N. A. di informazioni apprese con la frequenza delle lezioni di Sistemi operativi e studio autonomo di eventuali libri di riferimento in preparazione dell'esame finale o della tesi. Non devono intendersi come materiale ufficiale dell'università Università degli studi di Napoli Federico II o del prof Cotroneo Domenico.