操作系统SunOS 4.1.3版本的源码

源代码在线查看: times.c

软件大小: 23768 K
上传用户: yong_715
关键词: SunOS 操作系统 版本 源码
下载地址: 免注册下载 普通下载 VIP

相关代码

				#if !defined(lint) && defined(SCCSIDS)				static	char sccsid[] = "@(#)times.c 1.1 92/07/30 SMI"; /* from UCB 4.2 83/06/02 */				#endif								#include 				#include 								/*				 * Backwards compatible times.				 */				struct tms {					int	tms_utime;		/* user time */					int	tms_stime;		/* system time */					int	tms_cutime;		/* user time, children */					int	tms_cstime;		/* system time, children */				};								times(tmsp)					register struct tms *tmsp;				{					struct rusage ru;									if (getrusage(RUSAGE_SELF, &ru) < 0)						return (-1);					tmsp->tms_utime = scale60(&ru.ru_utime);					tmsp->tms_stime = scale60(&ru.ru_stime);					if (getrusage(RUSAGE_CHILDREN, &ru) < 0)						return (-1);					tmsp->tms_cutime = scale60(&ru.ru_utime);					tmsp->tms_cstime = scale60(&ru.ru_stime);					return (0);				}								static				scale60(tvp)					register struct timeval *tvp;				{									return (tvp->tv_sec * 60 + tvp->tv_usec / 16667);				}							

相关资源