JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... ir use. In one terminal window, we run the "reader" program, which creates a System V shared memory segment and a System V semaphore set. The program prints out the IDs of the created objects, and then waits for the semaphore to change value. $ ./svshm_st ... un the "writer" program. The "writer" program takes three command-line arguments: the IDs of the shared memory segment and semaphore set created by the "reader", and a string. It attaches the existing shared memory segment, copies the string to the shared ... memory, and modifies the semaphore value. $ ./svshm_string_write 1114194 15 'Hello, world' Returning to the terminal where the "reader" is running, we see th ... ... ir use. In one terminal window, we run the "reader" program, which creates a System V shared memory segment and a System V semaphore set. The program prints out the IDs of the created objects, and then waits for the semaphore to change value. $ ./svshm_st ... un the "writer" program. The "writer" program takes three command-line arguments: the IDs of the shared memory segment and semaphore set created by the "reader", and a string. It attaches the existing shared memory segment, copies the string to the shared ... memory, and modifies the semaphore value. $ ./svshm_string_write 1114194 15 'Hello, world' Returning to the terminal where the "reader" is running, we see th ... ... ir use. In one terminal window, we run the "reader" program, which creates a System V shared memory segment and a System V semaphore set. The program prints out the IDs of the created objects, and then waits for the semaphore to change value. $ ./svshm_st ... un the "writer" program. The "writer" program takes three command-line arguments: the IDs of the shared memory segment and semaphore set created by the "reader", and a string. It attaches the existing shared memory segment, copies the string to the shared ... memory, and modifies the semaphore value. $ ./svshm_string_write 1114194 15 'Hello, world' Returning to the terminal where the "reader" is running, we see th ... ... mnum , int cmd , ...); 説明 semctl () は、 semid で指定された System V セマフォ集合 (semaphore set) またはセマフォ集合の semnun 番目のセマフォに対して、 cmd で指定された制御操作を行なう (集合内のセマフォの番号は 0 から ... structure are as follows: sem_perm This is an ipc_perm structure (see below) that specifies the access permissions on the semaphore set. sem_otime Time of last semop (2) system call. sem_ctime Time of creation of semaphore set or time of last semctl () I ... PCSET , SETVAL , or SETALL operation. sem_nsems Number of semaphores in the set. Each semaphore of the set is referenced by a nonnegative integer ranging from 0 to sem_nsems-1 . ipc_perm 構造 ... ... t nsems , int semflg ); 説明 The semget () system call returns the System V semaphore set identifier associated with the argument key . It may be used either to obtain the identifier of a previously created s ... -1 が返され、 errno にエラーを示す値が設定される。 エラー 失敗した場合は errno には以下の値のどれかが設定される: EACCES A semaphore set exists for key , but the calling process does not have permission to access the set, and does not have the CAP_IPC_OWN ... フォ集合のリソースに関する上限のうち、 semget () に影響を及ぼすものを以下に挙げる: SEMMNI System-wide limit on the number of semaphore sets. On Linux systems before version 3.19, the default value for this limit was 128. Since Linux 3.19, the default value ... ... 。そのファイルシステムは通常 /dev/shm にマウントされる。 例 The programs below employ POSIX shared memory and POSIX unnamed semaphores to exchange a piece of data. The "bounce" program (which must be run first) raises the case of a string that is placed in ... osed on the memory object that is shared between the two programs. #include < sys/mman.h > #include < fcntl.h > #include < semaphore.h > #include < sys/stat.h > #include < stdio.h > #include < stdlib.h > #include < unistd.h > #define errExit(msg) do { per ... */ /* Define a structure that will be imposed on the shared memory object */ struct shmbuf { sem_t sem1; /* POSIX unnamed semaphore */ sem_t sem2; /* POSIX unnamed semaphore */ size_t cnt; /* Number of bytes used in 'buf' */ char buf[BUF_SIZE]; /* Data b ... ... 。そのファイルシステムは通常 /dev/shm にマウントされる。 例 The programs below employ POSIX shared memory and POSIX unnamed semaphores to exchange a piece of data. The "bounce" program (which must be run first) raises the case of a string that is placed in ... osed on the memory object that is shared between the two programs. #include < sys/mman.h > #include < fcntl.h > #include < semaphore.h > #include < sys/stat.h > #include < stdio.h > #include < stdlib.h > #include < unistd.h > #define errExit(msg) do { per ... */ /* Define a structure that will be imposed on the shared memory object */ struct shmbuf { sem_t sem1; /* POSIX unnamed semaphore */ sem_t sem2; /* POSIX unnamed semaphore */ size_t cnt; /* Number of bytes used in 'buf' */ char buf[BUF_SIZE]; /* Data b ... ... の場合、セマフォ値が 0 より大きくなるまで sem_wait (3) 操作は停止 (block) する。 POSIX セマフォには、名前付きセマフォ (named semaphore) と 名前なしセマフォ (unnamed semaphore) の 2つの形がある。 名前付きセマフォ 名前付きセマフォは /somename という形式の名前 ... 有されるメモリー領域、もしくは複数プロセス間で 共有されたメモリー領域に置かれる (前者を スレッド共有セマフォ (thread-shared semaphore) 、 後者を プロセス共有セマフォ (process-shared semaphore) と呼ぶ)。スレッド共有セマフォは、同じプロセス内のスレッド間で共 ... ... ; glibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): semtimedop (): _GNU_SOURCE 説明 System V セマフォ集合 (semaphore set) のメンバーの各セマフォは 以下の関連情報を持っている: unsigned short semval; /* semaphore value */ unsigned short semz ... で許される操作の最大個数である。 EACCES The calling process does not have the permissions required to perform the specified semaphore operations, and does not have the CAP_IPC_OWNER capability in the user namespace that governs its IPC namespace. EAGAIN 操 ... (atomically) に行う。 struct sembuf sops[2]; int semid; /* Code to set semid omitted */ sops[0].sem_num = 0; /* Operate on semaphore 0 */ sops[0].sem_op = 0; /* Wait for value to equal 0 */ sops[0].sem_flg = 0; sops[1].sem_num = 0; /* Operate on semaphore ... ... ; glibc 向けの機能検査マクロの要件 ( feature_test_macros (7) 参照): semtimedop (): _GNU_SOURCE 説明 System V セマフォ集合 (semaphore set) のメンバーの各セマフォは 以下の関連情報を持っている: unsigned short semval; /* semaphore value */ unsigned short semz ... で許される操作の最大個数である。 EACCES The calling process does not have the permissions required to perform the specified semaphore operations, and does not have the CAP_IPC_OWNER capability in the user namespace that governs its IPC namespace. EAGAIN 操 ... (atomically) に行う。 struct sembuf sops[2]; int semid; /* Code to set semid omitted */ sops[0].sem_num = 0; /* Operate on semaphore 0 */ sops[0].sem_op = 0; /* Wait for value to equal 0 */ sops[0].sem_flg = 0; sops[1].sem_num = 0; /* Operate on semaphore ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。