Added utime and utimes

This commit is contained in:
christos 1995-12-19 07:12:53 +00:00
parent 13c61484db
commit 20a2ff3d16
7 changed files with 79 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_stat.c,v 1.14 1995/10/14 20:24:43 christos Exp $ */
/* $NetBSD: svr4_stat.c,v 1.15 1995/12/19 07:12:53 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@ -509,3 +509,48 @@ svr4_sys_utssys(p, v, retval)
}
return ENOSYS;
}
int
svr4_sys_utime(p, v, retval)
register struct proc *p;
void *v;
register_t *retval;
{
struct svr4_sys_utime_args *uap = v;
struct svr4_utimbuf ub;
struct timeval tbuf[2];
struct sys_utimes_args ap;
int error;
caddr_t sg = stackgap_init(p->p_emul);
SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
SCARG(&ap, path) = SCARG(uap, path);
if (SCARG(uap, ubuf) == NULL) {
if ((error = copyin(SCARG(uap, ubuf), &ub, sizeof(ub))) != 0)
return error;
tbuf[0].tv_sec = ub.actime;
tbuf[0].tv_usec = 0;
tbuf[1].tv_sec = ub.modtime;
tbuf[1].tv_usec = 0;
SCARG(&ap, tptr) = stackgap_alloc(&sg, sizeof(tbuf));
if (error = copyout(tbuf, SCARG(&ap, tptr), sizeof(tbuf)) != 0)
return error;
}
else
SCARG(&ap, tptr) = NULL;
return sys_utimes(p, &ap, retval);
}
int
svr4_sys_utimes(p, v, retval)
register struct proc *p;
void *v;
register_t *retval;
{
struct svr4_sys_utimes_args *uap = v;
caddr_t sg = stackgap_init(p->p_emul);
SVR4_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_utimes(p, uap, retval);
}

View File

@ -30,6 +30,7 @@
#define SVR4_SYS_getuid 24
#define SVR4_SYS_alarm 27
#define SVR4_SYS_fstat 28
#define SVR4_SYS_utime 30
#define SVR4_SYS_access 33
#define SVR4_SYS_sync 36
#define SVR4_SYS_kill 37
@ -106,6 +107,7 @@
#define SVR4_SYS_systeminfo 139
#define SVR4_SYS_seteuid 141
#define SVR4_SYS_fchroot 153
#define SVR4_SYS_utimes 154
#define SVR4_SYS_vhangup 155
#define SVR4_SYS_gettimeofday 156
#define SVR4_SYS_getitimer 157

View File

@ -55,6 +55,11 @@ struct svr4_sys_fstat_args {
syscallarg(struct svr4_stat *) sb;
};
struct svr4_sys_utime_args {
syscallarg(char *) path;
syscallarg(struct svr4_utimbuf *) ubuf;
};
struct svr4_sys_access_args {
syscallarg(char *) path;
syscallarg(int) flags;
@ -281,6 +286,11 @@ struct svr4_sys_fchroot_args {
syscallarg(int) fd;
};
struct svr4_sys_utimes_args {
syscallarg(char *) path;
syscallarg(struct timeval *) tptr;
};
struct svr4_sys_gettimeofday_args {
syscallarg(struct timeval *) tp;
};
@ -314,6 +324,7 @@ int sys_setuid __P((struct proc *, void *, register_t *));
int sys_getuid __P((struct proc *, void *, register_t *));
int svr4_sys_alarm __P((struct proc *, void *, register_t *));
int svr4_sys_fstat __P((struct proc *, void *, register_t *));
int svr4_sys_utime __P((struct proc *, void *, register_t *));
int svr4_sys_access __P((struct proc *, void *, register_t *));
int sys_sync __P((struct proc *, void *, register_t *));
int svr4_sys_kill __P((struct proc *, void *, register_t *));
@ -389,6 +400,7 @@ int sys_adjtime __P((struct proc *, void *, register_t *));
int svr4_sys_systeminfo __P((struct proc *, void *, register_t *));
int sys_seteuid __P((struct proc *, void *, register_t *));
int svr4_sys_fchroot __P((struct proc *, void *, register_t *));
int svr4_sys_utimes __P((struct proc *, void *, register_t *));
int svr4_sys_vhangup __P((struct proc *, void *, register_t *));
int svr4_sys_gettimeofday __P((struct proc *, void *, register_t *));
int sys_getitimer __P((struct proc *, void *, register_t *));

View File

@ -36,7 +36,7 @@ char *svr4_syscallnames[] = {
"alarm", /* 27 = alarm */
"fstat", /* 28 = fstat */
"#29 (unimplemented pause)", /* 29 = unimplemented pause */
"#30 (unimplemented utime)", /* 30 = unimplemented utime */
"utime", /* 30 = utime */
"#31 (unimplemented was stty)", /* 31 = unimplemented was stty */
"#32 (unimplemented was gtty)", /* 32 = unimplemented was gtty */
"access", /* 33 = access */
@ -172,7 +172,7 @@ char *svr4_syscallnames[] = {
"#151 (unimplemented)", /* 151 = unimplemented */
"#152 (unimplemented modctl)", /* 152 = unimplemented modctl */
"fchroot", /* 153 = fchroot */
"#154 (unimplemented utimes)", /* 154 = unimplemented utimes */
"utimes", /* 154 = utimes */
"vhangup", /* 155 = vhangup */
"gettimeofday", /* 156 = gettimeofday */
"getitimer", /* 157 = getitimer */

View File

@ -11,6 +11,7 @@
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_time.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_syscallargs.h>
@ -97,8 +98,8 @@ struct sysent svr4_sysent[] = {
svr4_sys_fstat }, /* 28 = fstat */
{ 0, 0,
sys_nosys }, /* 29 = unimplemented pause */
{ 0, 0,
sys_nosys }, /* 30 = unimplemented utime */
{ 2, s(struct svr4_sys_utime_args),
svr4_sys_utime }, /* 30 = utime */
{ 0, 0,
sys_nosys }, /* 31 = unimplemented was stty */
{ 0, 0,
@ -360,8 +361,8 @@ struct sysent svr4_sysent[] = {
sys_nosys }, /* 152 = unimplemented modctl */
{ 1, s(struct svr4_sys_fchroot_args),
svr4_sys_fchroot }, /* 153 = fchroot */
{ 0, 0,
sys_nosys }, /* 154 = unimplemented utimes */
{ 2, s(struct svr4_sys_utimes_args),
svr4_sys_utimes }, /* 154 = utimes */
{ 0, 0,
svr4_sys_vhangup }, /* 155 = vhangup */
{ 1, s(struct svr4_sys_gettimeofday_args),

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_time.h,v 1.3 1994/10/29 00:43:28 christos Exp $ */
/* $NetBSD: svr4_time.h,v 1.4 1995/12/19 07:13:23 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@ -33,4 +33,9 @@
#include <compat/svr4/svr4_types.h>
#include <sys/time.h>
struct svr4_utimbuf {
time_t actime;
time_t modtime;
};
#endif /* !_SVR4_TIME_H_ */

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp $
$NetBSD: syscalls.master,v 1.15 1995/12/19 07:13:27 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -37,6 +37,7 @@
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <compat/svr4/svr4_types.h>
#include <compat/svr4/svr4_time.h>
#include <compat/svr4/svr4_signal.h>
#include <compat/svr4/svr4_ucontext.h>
#include <compat/svr4/svr4_syscallargs.h>
@ -73,7 +74,8 @@
27 STD { int svr4_sys_alarm(unsigned sec); }
28 STD { int svr4_sys_fstat(int fd, struct svr4_stat *sb); }
29 UNIMPL pause
30 UNIMPL utime
30 STD { int svr4_sys_utime(char *path, \
struct svr4_utimbuf *ubuf); }
31 UNIMPL was stty
32 UNIMPL was gtty
33 STD { int svr4_sys_access(char *path, int flags); }
@ -240,7 +242,8 @@
151 UNIMPL
152 UNIMPL modctl
153 STD { int svr4_sys_fchroot(int fd); }
154 UNIMPL utimes
154 STD { int svr4_sys_utimes(char *path, \
struct timeval *tptr); }
155 STD { int svr4_sys_vhangup(void); }
156 STD { int svr4_sys_gettimeofday(struct timeval *tp); }
157 NOARGS { int sys_getitimer(u_int which, \