diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-03-23 06:54:18 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-03-23 06:54:18 +0000 |
commit | a43d92eade7bbe59e89dc6c8fbc448a77b3a1068 (patch) | |
tree | 31b5441ab202021933f6027cd8e9817a0fa7faf0 /sys/compat | |
parent | 865e76bc5e55662c5383f0411ddb9ae5ce9644d9 (diff) |
Emulate otimes(2)
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/sunos/sunos_misc.c | 36 | ||||
-rw-r--r-- | sys/compat/sunos/sunos_syscall.h | 1 | ||||
-rw-r--r-- | sys/compat/sunos/sunos_syscallargs.h | 5 | ||||
-rw-r--r-- | sys/compat/sunos/sunos_syscalls.c | 2 | ||||
-rw-r--r-- | sys/compat/sunos/sunos_sysent.c | 4 | ||||
-rw-r--r-- | sys/compat/sunos/syscalls.master | 4 |
6 files changed, 46 insertions, 6 deletions
diff --git a/sys/compat/sunos/sunos_misc.c b/sys/compat/sunos/sunos_misc.c index c59ffb7384f..6352a122b4a 100644 --- a/sys/compat/sunos/sunos_misc.c +++ b/sys/compat/sunos/sunos_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sunos_misc.c,v 1.18 1997/11/30 21:40:30 deraadt Exp $ */ +/* $OpenBSD: sunos_misc.c,v 1.19 1998/03/23 06:54:10 millert Exp $ */ /* $NetBSD: sunos_misc.c,v 1.65 1996/04/22 01:44:31 christos Exp $ */ /* @@ -84,6 +84,7 @@ #include <sys/syscallargs.h> #include <sys/conf.h> #include <sys/socketvar.h> +#include <sys/times.h> #include <compat/sunos/sunos.h> #include <compat/sunos/sunos_syscallargs.h> @@ -1220,3 +1221,36 @@ sunos_sys_stime(p, v, retval) microtime(&tv); return copyout(&tv.tv_sec, SCARG(uap, tp), sizeof(*(SCARG(uap, tp)))); } + +/* + * This code is partly stolen from src/lib/libc/gen/times.c + * XXX - CLK_TCK isn't declared in /sys, just in <time.h>, done here + */ + +#define CLK_TCK 100 +#define CONVTCK(r) (r.tv_sec * CLK_TCK + r.tv_usec / (1000000 / CLK_TCK)) + +int +sunos_sys_otimes(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct sunos_sys_otimes_args /* { + syscallarg(struct tms *) tp; + } */ *uap = v; + struct tms tms; + struct rusage ru, *rup; + + /* RUSAGE_SELF */ + calcru(p, &ru.ru_utime, &ru.ru_stime, NULL); + tms.tms_utime = CONVTCK(ru.ru_utime); + tms.tms_stime = CONVTCK(ru.ru_stime); + + /* RUSAGE_CHILDREN */ + rup = &p->p_stats->p_cru; + tms.tms_cutime = CONVTCK(rup->ru_utime); + tms.tms_cstime = CONVTCK(rup->ru_stime); + + return copyout(&tms, SCARG(uap, tp), sizeof(*(SCARG(uap, tp)))); +} diff --git a/sys/compat/sunos/sunos_syscall.h b/sys/compat/sunos/sunos_syscall.h index c030d075794..84315240beb 100644 --- a/sys/compat/sunos/sunos_syscall.h +++ b/sys/compat/sunos/sunos_syscall.h @@ -38,6 +38,7 @@ #define SUNOS_SYS_lstat 40 #define SUNOS_SYS_dup 41 #define SUNOS_SYS_pipe 42 +#define SUNOS_SYS_otimes 43 #define SUNOS_SYS_profil 44 #define SUNOS_SYS_setgid 46 #define SUNOS_SYS_getgid 47 diff --git a/sys/compat/sunos/sunos_syscallargs.h b/sys/compat/sunos/sunos_syscallargs.h index 1553a3144ee..9e89451f0e1 100644 --- a/sys/compat/sunos/sunos_syscallargs.h +++ b/sys/compat/sunos/sunos_syscallargs.h @@ -63,6 +63,10 @@ struct sunos_sys_lstat_args { syscallarg(struct ostat *) ub; }; +struct sunos_sys_otimes_args { + syscallarg(struct tms *) tp; +}; + struct sunos_sys_mctl_args { syscallarg(caddr_t) addr; syscallarg(int) len; @@ -237,6 +241,7 @@ int sunos_sys_stat __P((struct proc *, void *, register_t *)); int sunos_sys_lstat __P((struct proc *, void *, register_t *)); int sys_dup __P((struct proc *, void *, register_t *)); int sys_pipe __P((struct proc *, void *, register_t *)); +int sunos_sys_otimes __P((struct proc *, void *, register_t *)); int sys_profil __P((struct proc *, void *, register_t *)); int sys_setgid __P((struct proc *, void *, register_t *)); int sys_getgid __P((struct proc *, void *, register_t *)); diff --git a/sys/compat/sunos/sunos_syscalls.c b/sys/compat/sunos/sunos_syscalls.c index f325e2fbf95..849fd9e4dd7 100644 --- a/sys/compat/sunos/sunos_syscalls.c +++ b/sys/compat/sunos/sunos_syscalls.c @@ -49,7 +49,7 @@ char *sunos_syscallnames[] = { "lstat", /* 40 = lstat */ "dup", /* 41 = dup */ "pipe", /* 42 = pipe */ - "#43 (unimplemented sunos_times)", /* 43 = unimplemented sunos_times */ + "otimes", /* 43 = otimes */ "profil", /* 44 = profil */ "#45 (unimplemented)", /* 45 = unimplemented */ "setgid", /* 46 = setgid */ diff --git a/sys/compat/sunos/sunos_sysent.c b/sys/compat/sunos/sunos_sysent.c index 1890d58e9ea..4be52569146 100644 --- a/sys/compat/sunos/sunos_sysent.c +++ b/sys/compat/sunos/sunos_sysent.c @@ -121,8 +121,8 @@ struct sysent sunos_sysent[] = { sys_dup }, /* 41 = dup */ { 0, 0, sys_pipe }, /* 42 = pipe */ - { 0, 0, - sys_nosys }, /* 43 = unimplemented sunos_times */ + { 1, s(struct sunos_sys_otimes_args), + sunos_sys_otimes }, /* 43 = otimes */ { 4, s(struct sys_profil_args), sys_profil }, /* 44 = profil */ { 0, 0, diff --git a/sys/compat/sunos/syscalls.master b/sys/compat/sunos/syscalls.master index 2eb3d5c6d35..ec1d1e95a59 100644 --- a/sys/compat/sunos/syscalls.master +++ b/sys/compat/sunos/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.8 1997/11/13 18:35:29 deraadt Exp $ + $OpenBSD: syscalls.master,v 1.9 1998/03/23 06:54:17 millert Exp $ ; $NetBSD: syscalls.master,v 1.33 1996/02/28 16:05:43 pk Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -87,7 +87,7 @@ 40 STD { int sunos_sys_lstat(char *path, struct ostat *ub); } 41 NOARGS { int sys_dup(u_int fd); } 42 NOARGS { int sys_pipe(void); } -43 UNIMPL sunos_times +43 STD { int sunos_sys_otimes(struct tms *tp); } 44 NOARGS { int sys_profil(caddr_t samples, u_int size, \ u_int offset, u_int scale); } 45 UNIMPL |