figc.21

来自「unix环境编程」· 21 代码 · 共 33 行

21
33
字号
#include "apue.h"#include <errno.h>#include <fcntl.h>#include <sys/socket.h>#include <sys/ioctl.h>#if defined(BSD) || defined(MACOS) || defined(SOLARIS)#include <sys/filio.h>#endifintsetasync(int sockfd){	int n;	if (fcntl(sockfd, F_SETOWN, getpid()) < 0)		return(-1);	n = 1;	if (ioctl(sockfd, FIOASYNC, &n) < 0)		return(-1);	return(0);}intclrasync(int sockfd){	int n;	n = 0;	if (ioctl(sockfd, FIOASYNC, &n) < 0)		return(-1);	return(0);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?