The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]

Интерактивная система просмотра системных руководств (man-ов)

 ТемаНаборКатегория 
 
 [Cписок руководств | Печать]

semctl (2)
  • semctl (2) ( Solaris man: Системные вызовы )
  • >> semctl (2) ( FreeBSD man: Системные вызовы )
  • semctl (2) ( Русские man: Системные вызовы )
  • semctl (2) ( Linux man: Системные вызовы )
  • semctl (3) ( POSIX man: Библиотечные вызовы )

  • BSD mandoc
     

    NAME

    
    
    semctl
    
     - control operations on a semaphore set
    
     
    

    LIBRARY

    Lb libc
    
     
    

    SYNOPSIS

       #include <sys/types.h>
       #include <sys/ipc.h>
       #include <sys/sem.h>
    int semctl (int semid int semnum int cmd ...);
     

    DESCRIPTION

    The semctl ();
    system call performs the operation indicated by Fa cmd on the semaphore set indicated by Fa semid . A fourth argument, a Fa union semun arg , is required for certain values of Fa cmd . For the commands that use the Fa arg argument, Fa union semun is defined as follows:
    union semun {
            int     val;            /* value for SETVAL */
            struct  semid_ds *buf;  /* buffer for IPC_STAT & IPC_SET */
            u_short *array;         /* array for GETALL & SETALL */
    };
    

    Commands are performed as follows:

    IPC_STAT
    Fetch the semaphore set's Fa struct semid_ds , storing it in the memory pointed to by Fa arg.buf .
    IPC_SET
    Changes the Fa sem_perm.uid , Fa sem_perm.gid , and Fa sem_perm.mode members of the semaphore set's Fa struct semid_ds to match those of the struct pointed to by Fa arg.buf . The calling process's effective uid must match either Fa sem_perm.uid or Fa sem_perm.cuid , or it must have superuser privileges.
    IPC_RMID
    Immediately removes the semaphore set from the system. The calling process's effective uid must equal the semaphore set's Fa sem_perm.uid or Fa sem_perm.cuid , or the process must have superuser privileges.
    GETVAL
    Return the value of semaphore number Fa semnum .
    SETVAL
    Set the value of semaphore number Fa semnum to Fa arg.val . Outstanding adjust on exit values for this semaphore in any process are cleared.
    GETPID
    Return the pid of the last process to perform an operation on semaphore number Fa semnum .
    GETNCNT
    Return the number of processes waiting for semaphore number Fa semnum Ns 's value to become greater than its current value.
    GETZCNT
    Return the number of processes waiting for semaphore number Fa semnum Ns 's value to become 0.
    GETALL
    Fetch the value of all of the semaphores in the set into the array pointed to by Fa arg.array .
    SETALL
    Set the values of all of the semaphores in the set to the values in the array pointed to by Fa arg.array . Outstanding adjust on exit values for all semaphores in this set, in any process are cleared.

    The Vt struct semid_ds is defined as follows:

    struct semid_ds {
            struct  ipc_perm sem_perm;      /* operation permission struct */
            struct  sem *sem_base;  /* pointer to first semaphore in set */
            u_short sem_nsems;      /* number of sems in set */
            time_t  sem_otime;      /* last operation time */
            long    sem_pad1;       /* SVABI/386 says I need this here */
            time_t  sem_ctime;      /* last change time */
                                    /* Times measured in secs since */
                                    /* 00:00:00 GMT, Jan. 1, 1970 */
            long    sem_pad2;       /* SVABI/386 says I need this here */
            long    sem_pad3[4];    /* SVABI/386 says I need this here */
    };
    
     

    RETURN VALUES

    On success, when Fa cmd is one of GETVAL , GETPID , GETNCNT or GETZCNT semctl ();
    returns the corresponding value; otherwise, 0 is returned. On failure, -1 is returned, and errno is set to indicate the error.  

    ERRORS

    The semctl ();
    system call will fail if:

    Bq Er EINVAL
    No semaphore set corresponds to Fa semid .
    Bq Er EINVAL
    The Fa semnum argument is not in the range of valid semaphores for given semaphore set.
    Bq Er EPERM
    The calling process's effective uid does not match the uid of the semaphore set's owner or creator.
    Bq Er EACCES
    Permission denied due to mismatch between operation and mode of semaphore set.
    Bq Er ERANGE
    SETVAL or SETALL attempted to set a semaphore outside the allowable range Bq 0 .. Dv SEMVMX .

     

    SEE ALSO

    semget(2), semop(2)  

    BUGS

    SETALL may update some semaphore elements before returning an error.


     

    Index

    NAME
    LIBRARY
    SYNOPSIS
    DESCRIPTION
    RETURN VALUES
    ERRORS
    SEE ALSO
    BUGS


    Поиск по тексту MAN-ов: 




    Партнёры:
    PostgresPro
    Inferno Solutions
    Hosting by Hoster.ru
    Хостинг:

    Закладки на сайте
    Проследить за страницей
    Created 1996-2024 by Maxim Chirkov
    Добавить, Поддержать, Вебмастеру