JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... mnum , int cmd , ...); 説明 semctl () は、 semid で指定された System V セマフォ集合 (semaphore set) またはセマフォ集合の semnun 番目のセマフォに対して、 cmd で指定された制 ... 元プログラム は、 この共用体 (union) を以下のように定義しなければならない。 union semun { int val; /* SETVAL の値 */ struct semid_ds *buf; /* IPC_STAT, IPC_SET 用のバッファー */ unsigned short *array; /* GETALL, SETALL 用の配列 */ struct seminfo *__buf ... ; /* IPC_INFO 用のバッファー (Linux 固有) */ }; semid_ds データ構造体は < sys/sem.h > で以下のように定義されている: struct semid_ds { struct ipc_perm sem_perm; /* 所有権と許可 ... ... t the IDs of the created objects, and then waits for the semaphore to change value. $ ./svshm_string_read shmid = 1114194; semid = 15 In another terminal window, we run the "writer" program. The "writer" program takes three command-line arguments: the ... xit(msg) do { perror(msg); exit(EXIT_FAILURE); \ } while (0) union semun { /* Used in calls to semctl() */ int val; struct semid_ds * buf; unsigned short * array; #if defined(__linux__) struct seminfo * __buf; #endif }; #define MEM_SIZE 4096 プログラム ... Licensed under GNU General Public License v2 or later. */ #include "svshm_string.h" int main(int argc, char *argv[]) { int semid, shmid; union semun arg, dummy; struct sembuf sop; char *addr; /* Create shared memory and semaphore set containing one se ... ... t the IDs of the created objects, and then waits for the semaphore to change value. $ ./svshm_string_read shmid = 1114194; semid = 15 In another terminal window, we run the "writer" program. The "writer" program takes three command-line arguments: the ... xit(msg) do { perror(msg); exit(EXIT_FAILURE); \ } while (0) union semun { /* Used in calls to semctl() */ int val; struct semid_ds * buf; unsigned short * array; #if defined(__linux__) struct seminfo * __buf; #endif }; #define MEM_SIZE 4096 プログラム ... Licensed under GNU General Public License v2 or later. */ #include "svshm_string.h" int main(int argc, char *argv[]) { int semid, shmid; union semun arg, dummy; struct sembuf sop; char *addr; /* Create shared memory and semaphore set containing one se ... ... t the IDs of the created objects, and then waits for the semaphore to change value. $ ./svshm_string_read shmid = 1114194; semid = 15 In another terminal window, we run the "writer" program. The "writer" program takes three command-line arguments: the ... xit(msg) do { perror(msg); exit(EXIT_FAILURE); \ } while (0) union semun { /* Used in calls to semctl() */ int val; struct semid_ds * buf; unsigned short * array; #if defined(__linux__) struct seminfo * __buf; #endif }; #define MEM_SIZE 4096 プログラム ... Licensed under GNU General Public License v2 or later. */ #include "svshm_string.h" int main(int argc, char *argv[]) { int semid, shmid; union semun arg, dummy; struct sembuf sop; char *addr; /* Create shared memory and semaphore set containing one se ... ... 値の変更 (alter) 許可として機能する)。 新規のセマフォ集合を作成する際、 semget () はセマフォ集合の情報を保持するデータ構造体 semid_ds を次のように初期化する ( semid_ds については semctl (2) を参照): • sem_perm.cuid と sem_perm.uid に、呼び出し元のプロセ ... mykey2 $ ./t_semget -c mykey p 1 ID = 9 $ ./t_semget -c mykey2 p 2 ID = 10 $ ipcs -s ------ Semaphore Arrays -------- key semid owner perms nsems 0x7004136d 9 mtk 600 1 0x70041368 10 mtk 600 2 Next, we demonstrate that when semctl (2) is given the sa ... C_CREAT flag\n"); fprintf(stderr, " -x Use IPC_EXCL flag\n"); exit(EXIT_FAILURE); } int main(int argc, char *argv[]) { int semid, nsems, flags, opt; key_t key; flags = 0; while ((opt = getopt(argc, argv, "cx")) != -1) { switch (opt) { case 'c': flags ... ... mbuf * sops , size_t nsops ); int semtimedop(int semid , struct sembuf * sops , size_t nsops , const struct timespec * timeout ); glibc 向けの機能検査マクロの要件 ( feature_test ... ing for zero */ unsigned short semncnt; /* # waiting for increase */ pid_t sempid; /* PID of process that last semop () は semid で指定されたセマフォ集合の選択されたセマフォに対して操作を行う。 sops は nsops 個の要素の配列を指し、配列の各要素は個々のセ ... R このシステムコールで停止している時にスレッドがシグナルを捕獲した。 single (7) 参照。 EINVAL セマフォ集合が存在しないか、 semid が 0 未満であるか、 nsops が正の数でない。 ENOMEM ある操作で sem_flg に SEM_UNDO が指定されたが、システムにアンドゥ構造体に ... ... mbuf * sops , size_t nsops ); int semtimedop(int semid , struct sembuf * sops , size_t nsops , const struct timespec * timeout ); glibc 向けの機能検査マクロの要件 ( feature_test ... ing for zero */ unsigned short semncnt; /* # waiting for increase */ pid_t sempid; /* PID of process that last semop () は semid で指定されたセマフォ集合の選択されたセマフォに対して操作を行う。 sops は nsops 個の要素の配列を指し、配列の各要素は個々のセ ... R このシステムコールで停止している時にスレッドがシグナルを捕獲した。 single (7) 参照。 EINVAL セマフォ集合が存在しないか、 semid が 0 未満であるか、 nsops が正の数でない。 ENOMEM ある操作で sem_flg に SEM_UNDO が指定されたが、システムにアンドゥ構造体に ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。