JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... (int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "Usage: %s /shm-path\n", argv[0]); exit(EXIT_FAILURE); } char *shmpath = argv[1]; /* Create shared memory object and set its size to the size of our structure */ int fd = shm_open(shmpath, O ... d, sizeof(struct shmbuf)) == -1) errExit("ftruncate"); /* Map the object into the caller's address space */ struct shmbuf *shmp = mmap(NULL, sizeof(*shmp), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (shmp == MAP_FAILED) errExit("mmap"); /* Initia ... lize semaphores as process-shared, with value 0 */ if (sem_init(&shmp->sem1, 1, 0) == -1) errExit("sem_init-sem1"); if (sem_init(&shmp->sem2, 1, 0) == -1) errExit("sem_init-sem2"); /* Wait for ... ... (int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "Usage: %s /shm-path\n", argv[0]); exit(EXIT_FAILURE); } char *shmpath = argv[1]; /* Create shared memory object and set its size to the size of our structure */ int fd = shm_open(shmpath, O ... d, sizeof(struct shmbuf)) == -1) errExit("ftruncate"); /* Map the object into the caller's address space */ struct shmbuf *shmp = mmap(NULL, sizeof(*shmp), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (shmp == MAP_FAILED) errExit("mmap"); /* Initia ... lize semaphores as process-shared, with value 0 */ if (sem_init(&shmp->sem1, 1, 0) == -1) errExit("sem_init-sem1"); if (sem_init(&shmp->sem2, 1, 0) == -1) errExit("sem_init-sem2"); /* Wait for ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。