JM プロジェクトは、主に Linux 関連のマニュアルページの日本語ページを翻訳・公開しています。
... perror(msg); exit(EXIT_FAILURE); } while (0) int main(int argc, char *argv[]) { int sfd, cfd; struct sockaddr_un my_addr, peer_addr; socklen_t peer_addr_size; sfd = socket(AF_UNIX, SOCK_STREAM, 0); if (sfd == -1) handle_error("socket"); memset(&my_a ... LISTEN_BACKLOG) == -1) handle_error("listen"); /* Now we can accept incoming connections one at a time using accept (2) */ peer_addr_size = sizeof(peer_addr); cfd = accept(sfd, (struct sockaddr *) &peer_addr, &peer_addr_size); if (cfd == -1) handle_e ... ... nt main(int argc, char *argv[]) { struct addrinfo hints; struct addrinfo *result, *rp; int sfd, s; struct sockaddr_storage peer_addr; socklen_t peer_addr_len; ssize_t nread; char buf[BUF_SIZE]; if (argc != 2) { fprintf(stderr, "Usage: %s port\n", arg ... */ fprintf(stderr, "Could not bind\n"); exit(EXIT_FAILURE); } /* Read datagrams and echo them back to sender */ for (;;) { peer_addr_len = sizeof(peer_addr); nread = recvfrom(sfd, buf, BUF_SIZE, 0, (struct sockaddr *) &peer_addr, &peer_addr_len); if ... -1) continue; /* Ignore failed request */ char host[NI_MAXHOST], service[NI_MAXSERV]; s = getnameinfo((struct sockaddr *) &peer_addr, peer_addr_len, host, NI_MAXHOST, service, NI_MAXSERV, NI_NUMERICSERV); if (s == 0) printf("Received %zd bytes from % ... ... nt main(int argc, char *argv[]) { struct addrinfo hints; struct addrinfo *result, *rp; int sfd, s; struct sockaddr_storage peer_addr; socklen_t peer_addr_len; ssize_t nread; char buf[BUF_SIZE]; if (argc != 2) { fprintf(stderr, "Usage: %s port\n", arg ... */ fprintf(stderr, "Could not bind\n"); exit(EXIT_FAILURE); } /* Read datagrams and echo them back to sender */ for (;;) { peer_addr_len = sizeof(peer_addr); nread = recvfrom(sfd, buf, BUF_SIZE, 0, (struct sockaddr *) &peer_addr, &peer_addr_len); if ... -1) continue; /* Ignore failed request */ char host[NI_MAXHOST], service[NI_MAXSERV]; s = getnameinfo((struct sockaddr *) &peer_addr, peer_addr_len, host, NI_MAXHOST, service, NI_MAXSERV, NI_NUMERICSERV); if (s == 0) printf("Received %zd bytes from % ... ... nt main(int argc, char *argv[]) { struct addrinfo hints; struct addrinfo *result, *rp; int sfd, s; struct sockaddr_storage peer_addr; socklen_t peer_addr_len; ssize_t nread; char buf[BUF_SIZE]; if (argc != 2) { fprintf(stderr, "Usage: %s port\n", arg ... */ fprintf(stderr, "Could not bind\n"); exit(EXIT_FAILURE); } /* Read datagrams and echo them back to sender */ for (;;) { peer_addr_len = sizeof(peer_addr); nread = recvfrom(sfd, buf, BUF_SIZE, 0, (struct sockaddr *) &peer_addr, &peer_addr_len); if ... -1) continue; /* Ignore failed request */ char host[NI_MAXHOST], service[NI_MAXSERV]; s = getnameinfo((struct sockaddr *) &peer_addr, peer_addr_len, host, NI_MAXHOST, service, NI_MAXSERV, NI_NUMERICSERV); if (s == 0) printf("Received %zd bytes from % ... ... Exit("sem_init-sem1"); if (sem_init(&shmp->sem2, 1, 0) == -1) errExit("sem_init-sem2"); /* Wait for 'sem1' to be posted by peer before touching shared memory */ if (sem_wait(&shmp->sem1) == -1) errExit("sem_wait"); /* Convert data in shared memory in ... r (int j = 0; j < shmp->cnt; j++) shmp->buf[j] = toupper((unsigned char) shmp->buf[j]); /* Post 'sem2' to tell the to tell peer that it can now access the modified data in shared memory */ if (sem_post(&shmp->sem2) == -1) errExit("sem_post"); /* Unli ... nk the shared memory object. Even if the peer process is still using the object, this is okay. The object will be removed only after all open references are closed. */ ... ... Exit("sem_init-sem1"); if (sem_init(&shmp->sem2, 1, 0) == -1) errExit("sem_init-sem2"); /* Wait for 'sem1' to be posted by peer before touching shared memory */ if (sem_wait(&shmp->sem1) == -1) errExit("sem_wait"); /* Convert data in shared memory in ... r (int j = 0; j < shmp->cnt; j++) shmp->buf[j] = toupper((unsigned char) shmp->buf[j]); /* Post 'sem2' to tell the to tell peer that it can now access the modified data in shared memory */ if (sem_post(&shmp->sem2) == -1) errExit("sem_post"); /* Unli ... nk the shared memory object. Even if the peer process is still using the object, this is okay. The object will be removed only after all open references are closed. */ ... ... se any mount activity on a mount point, including umount () operations, to be forwarded to every shared mount point in the peer group and every slave mount of that peer group. This means that umount () of any peer in a set of shared mounts will cause ... all of its peers to be unmounted and all of their slaves to be unmounted as well. This propagation of unmount activity can be particularly ... ... se any mount activity on a mount point, including umount () operations, to be forwarded to every shared mount point in the peer group and every slave mount of that peer group. This means that umount () of any peer in a set of shared mounts will cause ... all of its peers to be unmounted and all of their slaves to be unmounted as well. This propagation of unmount activity can be particularly ... ... ), connect (2), sendto (2)) は入力として sockaddr_un 引数を取る。 他のいくつかのシステムコール (例えば getsockname (2), getpeername (2), recvfrom (2), accept (2)) はこの型の引数を返す。 sockaddr_un 構造体では 3 種類のアドレスが区別される。 * pathname ... は 92 バイトしかないという点にも留意しておくとよい。 様々なシステムコール ( accept (2), recvfrom (2), getsockname (2), getpeername (2)) がソケットアドレス構造体を返す。 これらのシステムコールが UNIX ドメインソケットに対して呼ばれた際には、 これらの呼 ... the result of getsockopt (2) is an integer boolean flag. SO_PASSSEC Enables receiving of the SELinux security label of the peer socket in an ancillary message of type SCM_SECURITY (see below). The value given as an argument to setsockopt (2) and retu ... ... or NetLabel is configured on the sending and receiving hosts, this option enables receiving of the security context of the peer socket in an ancillary message of type SCM_SECURITY retrieved using recvmsg (2). This option is supported only for UDP soc ... kets; for TCP or SCTP sockets, see the description of the SO_PEERSEC option below. The value given as an argument to setsockopt (2) and returned as the result of getsockopt (2) is an integ ... he security context returned in the SCM_SECURITY ancillary message is of the same format as the one described under the SO_PEERSEC option below. Note: the reuse of the SCM_SECURITY message type for the IP_PASSSEC socket option was likely a mistake, s ... 日本語の文書やマニュアルを配布している個人/プロジェクトへのリンクです。