⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 servaccept.c

📁 unix高级编程源代码.<<unix高级编程>>
💻 C
字号:
#include	<sys/types.h>
#include	<sys/stat.h>
#include	<stropts.h>
#include	"ourhdr.h"

/* Wait for a client connection to arrive, and accept it.
 * We also obtain the client's user ID. */

int			/* returns new fd if all OK, -1 on error */
serv_accept(int listenfd, uid_t *uidptr)
{
	struct strrecvfd	recvfd;

	if (ioctl(listenfd, I_RECVFD, &recvfd) < 0)
		return(-1);		/* could be EINTR if signal caught */

	if (uidptr != NULL)
		*uidptr = recvfd.uid;	/* effective uid of caller */

	return(recvfd.fd);	/* return the new descriptor */
}

⌨️ 快捷键说明

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