Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/osf1 new syscalls
details: https://anonhg.NetBSD.org/src/rev/e6e15d816334
branches: trunk
changeset: 508029:e6e15d816334
user: ross <ross%NetBSD.org@localhost>
date: Wed Apr 04 19:52:18 2001 +0000
description:
new syscalls
diffstat:
sys/compat/osf1/osf1.h | 37 ++++++++++++++++++++-
sys/compat/osf1/osf1_cvt.c | 29 +++++++++++++++-
sys/compat/osf1/osf1_cvt.h | 4 +-
sys/compat/osf1/osf1_descrip.c | 48 ++++++++++++++++++++++++++-
sys/compat/osf1/osf1_file.c | 68 +++++++++++++++++++++++++++++++++++++-
sys/compat/osf1/osf1_syscall.h | 11 +++++-
sys/compat/osf1/osf1_syscallargs.h | 20 ++++++++++-
sys/compat/osf1/osf1_syscalls.c | 14 +++---
sys/compat/osf1/osf1_sysent.c | 20 +++++-----
9 files changed, 227 insertions(+), 24 deletions(-)
diffs (truncated from 401 to 300 lines):
diff -r 84050aeff9d8 -r e6e15d816334 sys/compat/osf1/osf1.h
--- a/sys/compat/osf1/osf1.h Wed Apr 04 19:41:00 2001 +0000
+++ b/sys/compat/osf1/osf1.h Wed Apr 04 19:52:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1.h,v 1.22 2000/11/17 03:06:28 erh Exp $ */
+/* $NetBSD: osf1.h,v 1.23 2001/04/04 19:52:18 ross Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -71,6 +71,8 @@
typedef void *osf1_fcn_ptr; /* XXX hard to fix size, bogus */
typedef osf1_int osf1_key_t;
typedef osf1_int osf1_pid_t;
+typedef u_int64_t osf1_blksize_t;
+typedef u_int64_t osf1_blkcnt_t;
struct osf1_timeval { /* time.h */
osf1_time_t tv_sec;
@@ -502,6 +504,39 @@
osf1_uint_t st_gen;
};
+struct osf1_stat2 {
+ osf1_dev_t st_dev;
+ osf1_int st_dead1; /* was st_ino */
+ osf1_mode_t st_mode;
+ osf1_nlink_t st_nlink;
+ osf1_short st_dead2; /* something to do with nlink? */
+ osf1_uid_t st_uid;
+ osf1_gid_t st_gid;
+ osf1_dev_t st_rdev;
+ osf1_dev_t st_rdev2;
+ osf1_off_t st_size;
+ osf1_time_t st_dead3;
+ osf1_int st_uatime;
+ osf1_time_t st_dead4;
+ osf1_int st_umtime;
+ osf1_time_t st_dead5;
+ osf1_int st_uctime;
+ osf1_int st_dead6;
+ osf1_int st_dead7;
+ osf1_uint_t st_flags;
+ osf1_uint_t st_generation;
+ osf1_long st_unused1[4];
+ osf1_ino_t st_ino;
+ osf1_int st_unused;
+ osf1_time_t st_atime_sec;
+ osf1_int st_unused2;
+ osf1_time_t st_mtime_sec;
+ osf1_int st_unused3;
+ osf1_time_t st_ctime_sec;
+ osf1_int st_unused4;
+ osf1_blksize_t st_blocksize;
+ osf1_blkcnt_t st_blocks;
+};
/* systeminfo.h */
diff -r 84050aeff9d8 -r e6e15d816334 sys/compat/osf1/osf1_cvt.c
--- a/sys/compat/osf1/osf1_cvt.c Wed Apr 04 19:41:00 2001 +0000
+++ b/sys/compat/osf1/osf1_cvt.c Wed Apr 04 19:52:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_cvt.c,v 1.10 2000/12/01 12:28:34 jdolecek Exp $ */
+/* $NetBSD: osf1_cvt.c,v 1.11 2001/04/04 19:52:18 ross Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -646,6 +646,33 @@
ost->st_gen = st->st_gen;
}
+/*
+ * Convert from a stat structure to an osf1 stat structure.
+ */
+void
+osf1_cvt_stat2_from_native(st, ost)
+ const struct stat *st;
+ struct osf1_stat2 *ost;
+{
+
+ memset(ost, 0, sizeof *ost);
+ ost->st_dev = osf1_cvt_dev_from_native(st->st_dev);
+ ost->st_ino = st->st_ino;
+ ost->st_mode = st->st_mode;
+ ost->st_nlink = st->st_nlink;
+ ost->st_uid = st->st_uid == -2 ? (u_int16_t) -2 : st->st_uid;
+ ost->st_gid = st->st_gid == -2 ? (u_int16_t) -2 : st->st_gid;
+ ost->st_rdev = osf1_cvt_dev_from_native(st->st_rdev);
+ ost->st_size = st->st_size;
+ ost->st_atime_sec = st->st_atime;
+ ost->st_mtime_sec = st->st_mtime;
+ ost->st_ctime_sec = st->st_ctime;
+ ost->st_blocksize = st->st_blksize;
+ ost->st_blocks = st->st_blocks;
+ ost->st_flags = st->st_flags;
+ ost->st_generation = st->st_gen;
+}
+
void
osf1_cvt_statfs_from_native(bsfs, osfs)
const struct statfs *bsfs;
diff -r 84050aeff9d8 -r e6e15d816334 sys/compat/osf1/osf1_cvt.h
--- a/sys/compat/osf1/osf1_cvt.h Wed Apr 04 19:41:00 2001 +0000
+++ b/sys/compat/osf1/osf1_cvt.h Wed Apr 04 19:52:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_cvt.h,v 1.6 1999/06/26 01:23:25 cgd Exp $ */
+/* $NetBSD: osf1_cvt.h,v 1.7 2001/04/04 19:52:18 ross Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -69,6 +69,8 @@
int osf1_cvt_sigset_to_native(const osf1_sigset_t *oss, sigset_t *nss);
void osf1_cvt_stat_from_native(const struct stat *nst,
struct osf1_stat *ost);
+void osf1_cvt_stat2_from_native(const struct stat *nst,
+ struct osf1_stat2 *ost);
void osf1_cvt_statfs_from_native(const struct statfs *nsfs,
struct osf1_statfs *osfs);
diff -r 84050aeff9d8 -r e6e15d816334 sys/compat/osf1/osf1_descrip.c
--- a/sys/compat/osf1/osf1_descrip.c Wed Apr 04 19:41:00 2001 +0000
+++ b/sys/compat/osf1/osf1_descrip.c Wed Apr 04 19:52:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_descrip.c,v 1.6 2000/06/28 15:39:33 mrg Exp $ */
+/* $NetBSD: osf1_descrip.c,v 1.7 2001/04/04 19:52:18 ross Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -272,6 +272,52 @@
return (error);
}
+/*
+ * Return status information about a file descriptor.
+ */
+int
+osf1_sys_fstat2(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct osf1_sys_fstat2_args *uap = v;
+ struct filedesc *fdp = p->p_fd;
+ struct file *fp;
+ struct stat ub;
+ struct osf1_stat2 oub;
+ int error;
+
+ if ((unsigned)SCARG(uap, fd) >= fdp->fd_nfiles ||
+ (fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL ||
+ (fp->f_iflags & FIF_WANTCLOSE) != 0)
+ return (EBADF);
+
+ FILE_USE(fp);
+
+ switch (fp->f_type) {
+
+ case DTYPE_VNODE:
+ error = vn_stat((struct vnode *)fp->f_data, &ub, p);
+ break;
+
+ case DTYPE_SOCKET:
+ error = soo_stat((struct socket *)fp->f_data, &ub);
+ break;
+
+ default:
+ panic("ofstat");
+ /*NOTREACHED*/
+ }
+ osf1_cvt_stat2_from_native(&ub, &oub);
+ if (error == 0)
+ error = copyout((caddr_t)&oub, (caddr_t)SCARG(uap, sb),
+ sizeof (oub));
+
+ FILE_UNUSE(fp, p);
+ return (error);
+}
+
int
osf1_sys_ftruncate(p, v, retval)
struct proc *p;
diff -r 84050aeff9d8 -r e6e15d816334 sys/compat/osf1/osf1_file.c
--- a/sys/compat/osf1/osf1_file.c Wed Apr 04 19:41:00 2001 +0000
+++ b/sys/compat/osf1/osf1_file.c Wed Apr 04 19:52:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_file.c,v 1.9 2000/12/01 19:20:56 jdolecek Exp $ */
+/* $NetBSD: osf1_file.c,v 1.10 2001/04/04 19:52:18 ross Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -166,6 +166,39 @@
return (error);
}
+/*
+ * Get file status; this version does not follow links.
+ */
+/* ARGSUSED */
+int
+osf1_sys_lstat2(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct osf1_sys_lstat2_args *uap = v;
+ struct stat sb;
+ struct osf1_stat2 osb;
+ int error;
+ struct nameidata nd;
+ caddr_t sg;
+
+ sg = stackgap_init(p->p_emul);
+ CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+
+ NDINIT(&nd, LOOKUP, NOFOLLOW | LOCKLEAF, UIO_USERSPACE,
+ SCARG(uap, path), p);
+ if ((error = namei(&nd)))
+ return (error);
+ error = vn_stat(nd.ni_vp, &sb, p);
+ vput(nd.ni_vp);
+ if (error)
+ return (error);
+ osf1_cvt_stat2_from_native(&sb, &osb);
+ error = copyout((caddr_t)&osb, (caddr_t)SCARG(uap, ub), sizeof (osb));
+ return (error);
+}
+
int
osf1_sys_mknod(p, v, retval)
struct proc *p;
@@ -285,6 +318,39 @@
return (error);
}
+/*
+ * Get file status; this version follows links.
+ */
+/* ARGSUSED */
+int
+osf1_sys_stat2(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct osf1_sys_stat2_args *uap = v;
+ struct stat sb;
+ struct osf1_stat2 osb;
+ int error;
+ struct nameidata nd;
+ caddr_t sg;
+
+ sg = stackgap_init(p->p_emul);
+ CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
+ SCARG(uap, path), p);
+ if ((error = namei(&nd)))
+ return (error);
+ error = vn_stat(nd.ni_vp, &sb, p);
+ vput(nd.ni_vp);
+ if (error)
+ return (error);
+ osf1_cvt_stat2_from_native(&sb, &osb);
+ error = copyout((caddr_t)&osb, (caddr_t)SCARG(uap, ub), sizeof (osb));
+ return (error);
+}
+
int
osf1_sys_truncate(p, v, retval)
struct proc *p;
diff -r 84050aeff9d8 -r e6e15d816334 sys/compat/osf1/osf1_syscall.h
--- a/sys/compat/osf1/osf1_syscall.h Wed Apr 04 19:41:00 2001 +0000
+++ b/sys/compat/osf1/osf1_syscall.h Wed Apr 04 19:52:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_syscall.h,v 1.42 2001/01/27 07:29:05 thorpej Exp $ */
+/* $NetBSD: osf1_syscall.h,v 1.43 2001/04/04 19:52:19 ross Exp $ */
/*
* System call numbers.
@@ -370,6 +370,15 @@
/* syscall: "shmget" ret: "int" args: "osf1_key_t" "size_t" "int" */
#define OSF1_SYS_shmget 212
+/* syscall: "stat2" ret: "int" args: "const char *" "struct osf1_stat2 *" */
+#define OSF1_SYS_stat2 224
+
+/* syscall: "lstat2" ret: "int" args: "const char *" "struct osf1_stat2 *" */
+#define OSF1_SYS_lstat2 225
+
+/* syscall: "fstat2" ret: "int" args: "int" "struct osf1_stat2 *" */
+#define OSF1_SYS_fstat2 226
+
/* syscall: "getsid" ret: "pid_t" args: "pid_t" */
#define OSF1_SYS_getsid 234
diff -r 84050aeff9d8 -r e6e15d816334 sys/compat/osf1/osf1_syscallargs.h
--- a/sys/compat/osf1/osf1_syscallargs.h Wed Apr 04 19:41:00 2001 +0000
+++ b/sys/compat/osf1/osf1_syscallargs.h Wed Apr 04 19:52:18 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_syscallargs.h,v 1.43 2001/01/27 07:29:05 thorpej Exp $ */
Home |
Main Index |
Thread Index |
Old Index