acct.c

来自「操作系统SunOS 4.1.3版本的源码」· C语言 代码 · 共 49 行

C
49
字号
/* * systemV acct() system call */#if !defined(lint) && defined(SCCSIDS)static  char sccsid[] = "@(#)acct.c 1.1 92/07/30 SMI";#endif# include "../common/chkpath.h"#include <errno.h>#include <fcntl.h>#include <sys/syscall.h>#include <stdio.h>acct(acctfile)	char *acctfile;{	extern int errno;	int retval;	/*	 * If acctfile is NULL, let the real acct() takes care of it	 */	if (acctfile == (char *)0)		goto real_acct;	/*	 * Now check if the accounting is already on or not.	 */	if (syscall (SYS_acct, (char *)1) != NULL) {	/* accounting is on ? */		errno = EBUSY;		return (-1);	}real_acct:	/*	 * Trap to the real acct() passing the given argument	 */	if ((retval = syscall (SYS_acct, acctfile)) != NULL) {		/*		 * Map errno to ENOENT if acctfile is null string;		 * check after acct() system call to avoid segmentation		 * violation if acctfile is bad address.		 */		if (errno == EACCES) {			if (acctfile != (char *)0 && *acctfile == 0)				errno = ENOENT;		}	}	return (retval);}

⌨️ 快捷键说明

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