?? nspipe.c
字號:
/* Create a named stream pipe. Called by server on initialization. */#include "apue.h"#include <sys/socket.h>#include <sys/un.h>int /* returns 0 if all OK, -1 if error (with errno set) */ns_pipe(const char *name, int fd[2]){ int len; struct sockaddr_un unix_addr; if (s_pipe(fd) < 0) /* create unnamed stream pipe */ return(-1); unlink(name); /* remove the name, if it already exists */ memset(&unix_addr, 0, sizeof(unix_addr)); unix_addr.sun_family = AF_UNIX; strcpy(unix_addr.sun_path, name); len = strlen(unix_addr.sun_path) + sizeof(unix_addr.sun_family); return(bind(fd[0], (struct sockaddr *) &unix_addr, len)); /* fd[0] has the name bound to it */}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -