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

semctl

semctl pointed to by arg.array, where arg is the fourth argument to semctl(). When this command is successfully executed, the semadj values corresponding to each specified semaphore in all processes are cleared. Requires alter permission.

The following values of cmd are also available:

  • IPC_STAT: Place the current value of each member of the data structure associated with semid_ds semid into the structure pointed to by arg.buf, where arg is the fourth argument to semctl(). The contents of this structure are defined in <sys/sem.h>. Requires read permission.
  • IPC_SET: Set the value of the following members of the data structure associated with semid_ds semid to the corresponding value found in the structure pointed to by arg.buf, where arg is the fourth argument to semctl(): sem_perm.uid sem_perm.gid sem_perm.mode The mode bits specified in IPC are copied into the corresponding bits of the associated with semid. The stored values of any other

bits aresem_perm.modeunspecified. This command can only be executed by a process that has an effectiveuser ID equal to either that of a process with appropriate privileges or to the value ofor in the data structure associated withsem_perm.cuid sem_perm.uid semid_dssemid.

IPC_RMIDRemove the semaphore-identifier specified by semid from the system and destroy theset of semaphores and data structure associated with it. This command cansemid_dsonly be executed by a process that has an effective user ID equal to either that of aprocess with appropriate privileges or to the value of orsem_perm.cuidin the data structure associated with semid.sem_perm.uid semid_ds

RETURN VALUEIf successful, the value returned by semctl() depends on cmd as follows:

  • GETVALThe value of semval.
  • GETPIDThe value of sempid.
  • GETNCNTThe value of semncnt.
  • GETZCNTThe value of semzcnt.
  • All others0.

Otherwise, semctl() returns -1 and errno indicates the error.

ERRORSThe semctl() function will fail if:

  1. 2 di 3 21/04/2010 14:14
Dettagli
Publisher
A.A. 2012-2013
3 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.