summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-19 15:40:31 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-12-19 15:40:31 +0000
commitc570f8073ee1d4f21ec80a9f0709816a1dfa8969 (patch)
treefe0a2c7c1ed6bd809a88f04e55684b00a0dbb3df /sys
parent0a3dfa6333989e63098121e4b2c4f6255ade0b39 (diff)
from christos; add utime() and utimes()
Diffstat (limited to 'sys')
-rw-r--r--sys/compat/svr4/svr4_stat.c47
-rw-r--r--sys/compat/svr4/svr4_syscall.h4
-rw-r--r--sys/compat/svr4/svr4_syscallargs.h14
-rw-r--r--sys/compat/svr4/svr4_syscalls.c6
-rw-r--r--sys/compat/svr4/svr4_sysent.c11
-rw-r--r--sys/compat/svr4/svr4_time.h7
-rw-r--r--sys/compat/svr4/syscalls.master9
7 files changed, 83 insertions, 15 deletions
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c
index f8db45508d6..b09188dfa52 100644
--- a/sys/compat/svr4/svr4_stat.c
+++ b/sys/compat/svr4/svr4_stat.c
@@ -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);
+}
diff --git a/sys/compat/svr4/svr4_syscall.h b/sys/compat/svr4/svr4_syscall.h
index ed736807598..4b6675b1ca1 100644
--- a/sys/compat/svr4/svr4_syscall.h
+++ b/sys/compat/svr4/svr4_syscall.h
@@ -2,7 +2,7 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp
+ * created from NetBSD: syscalls.master,v 1.15 1995/12/19 07:13:27 christos Exp
*/
#define SVR4_SYS_syscall 0
@@ -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
diff --git a/sys/compat/svr4/svr4_syscallargs.h b/sys/compat/svr4/svr4_syscallargs.h
index 9823845dfa3..9b3c286d00c 100644
--- a/sys/compat/svr4/svr4_syscallargs.h
+++ b/sys/compat/svr4/svr4_syscallargs.h
@@ -2,7 +2,7 @@
* System call argument lists.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp
+ * created from NetBSD: syscalls.master,v 1.15 1995/12/19 07:13:27 christos Exp
*/
#define syscallarg(x) union { x datum; register_t pad; }
@@ -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 *));
diff --git a/sys/compat/svr4/svr4_syscalls.c b/sys/compat/svr4/svr4_syscalls.c
index 3998cdb8eee..d6b687c1225 100644
--- a/sys/compat/svr4/svr4_syscalls.c
+++ b/sys/compat/svr4/svr4_syscalls.c
@@ -2,7 +2,7 @@
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp
+ * created from NetBSD: syscalls.master,v 1.15 1995/12/19 07:13:27 christos Exp
*/
char *svr4_syscallnames[] = {
@@ -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 */
diff --git a/sys/compat/svr4/svr4_sysent.c b/sys/compat/svr4/svr4_sysent.c
index c48f9ebf9e1..93e38692f58 100644
--- a/sys/compat/svr4/svr4_sysent.c
+++ b/sys/compat/svr4/svr4_sysent.c
@@ -2,7 +2,7 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * created from NetBSD: syscalls.master,v 1.14 1995/10/14 20:25:06 christos Exp
+ * created from NetBSD: syscalls.master,v 1.15 1995/12/19 07:13:27 christos Exp
*/
#include <sys/param.h>
@@ -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),
diff --git a/sys/compat/svr4/svr4_time.h b/sys/compat/svr4/svr4_time.h
index 8944788c4a2..7644cfcb877 100644
--- a/sys/compat/svr4/svr4_time.h
+++ b/sys/compat/svr4/svr4_time.h
@@ -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_ */
diff --git a/sys/compat/svr4/syscalls.master b/sys/compat/svr4/syscalls.master
index 2b8a3f11a3d..fb07135a50d 100644
--- a/sys/compat/svr4/syscalls.master
+++ b/sys/compat/svr4/syscalls.master
@@ -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, \