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

📄 acct.c

📁 操作系统SunOS 4.1.3版本的源码
💻 C
字号:
/* * 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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -