doorinfo.c

来自「《UNIX进程间通信》中的代码」· C语言 代码 · 共 33 行

C
33
字号
#include	"unpipc.h"intmain(int argc, char **argv){	int		fd;	struct stat	stat;	struct door_info	info;	if (argc != 2)		err_quit("usage: doorinfo <pathname>");	fd = Open(argv[1], O_RDONLY);	Fstat(fd, &stat);	if (S_ISDOOR(stat.st_mode) == 0)		err_quit("pathname is not a door");	Door_info(fd, &info);	printf("server PID = %ld, uniquifier = %ld",		   (long) info.di_target, (long) info.di_uniquifier);	if (info.di_attributes & DOOR_LOCAL)		printf(", DOOR_LOCAL");	if (info.di_attributes & DOOR_PRIVATE)		printf(", DOOR_PRIVATE");	if (info.di_attributes & DOOR_REVOKED)		printf(", DOOR_REVOKED");	if (info.di_attributes & DOOR_UNREF)		printf(", DOOR_UNREF");	printf("\n");	exit(0);}

⌨️ 快捷键说明

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