summaryrefslogtreecommitdiff
path: root/sys/compat/svr4/svr4_stat.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 22:33:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 22:33:19 +0000
commit67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (patch)
tree967b89f6e07398a22bd8c76d30179b648776542d /sys/compat/svr4/svr4_stat.c
parentba95d3c1d69cdb251d15a12ebf70f50b0ea2019b (diff)
partial sync with netbsd 960418, more to come
Diffstat (limited to 'sys/compat/svr4/svr4_stat.c')
-rw-r--r--sys/compat/svr4/svr4_stat.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/sys/compat/svr4/svr4_stat.c b/sys/compat/svr4/svr4_stat.c
index 954ab239382..0de41a326ec 100644
--- a/sys/compat/svr4/svr4_stat.c
+++ b/sys/compat/svr4/svr4_stat.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: svr4_stat.c,v 1.6 1996/02/26 23:32:01 niklas Exp $ */
-/* $NetBSD: svr4_stat.c,v 1.19 1996/02/10 17:12:36 christos Exp $ */
+/* $OpenBSD: svr4_stat.c,v 1.7 1996/04/21 22:18:27 deraadt Exp $ */
+/* $NetBSD: svr4_stat.c,v 1.20 1996/04/11 12:46:41 christos Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -58,6 +58,7 @@
#include <compat/svr4/svr4_utsname.h>
#include <compat/svr4/svr4_systeminfo.h>
#include <compat/svr4/svr4_time.h>
+#include <compat/svr4/svr4_socket.h>
#ifdef sparc
/*
@@ -71,6 +72,12 @@ static void bsd_to_svr4_xstat __P((struct stat *, struct svr4_xstat *));
int svr4_ustat __P((struct proc *, void *, register_t *));
static int svr4_to_bsd_pathconf __P((int));
+/*
+ * SVR4 uses named pipes as named sockets, so we tell programs
+ * that sockets are named pipes with mode 0
+ */
+#define BSD_TO_SVR4_MODE(mode) (S_ISSOCK(mode) ? S_IFIFO : (mode))
+
#ifndef SVR4_NO_OSTAT
static void bsd_to_svr4_stat __P((struct stat *, struct svr4_stat *));
@@ -83,7 +90,7 @@ bsd_to_svr4_stat(st, st4)
bzero(st4, sizeof(*st4));
st4->st_dev = st->st_dev;
st4->st_ino = st->st_ino;
- st4->st_mode = st->st_mode;
+ st4->st_mode = BSD_TO_SVR4_MODE(st->st_mode);
st4->st_nlink = st->st_nlink;
st4->st_uid = st->st_uid;
st4->st_gid = st->st_gid;
@@ -105,7 +112,7 @@ bsd_to_svr4_xstat(st, st4)
bzero(st4, sizeof(*st4));
st4->st_dev = st->st_dev;
st4->st_ino = st->st_ino;
- st4->st_mode = st->st_mode;
+ st4->st_mode = BSD_TO_SVR4_MODE(st->st_mode);
st4->st_nlink = st->st_nlink;
st4->st_uid = st->st_uid;
st4->st_gid = st->st_gid;
@@ -155,6 +162,9 @@ svr4_sys_stat(p, v, retval)
bsd_to_svr4_stat(&st, &svr4_st);
+ if (S_ISSOCK(st.st_mode))
+ (void) svr4_add_socket(p, SCARG(uap, path), &st);
+
if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0)
return error;
@@ -196,6 +206,9 @@ svr4_sys_lstat(p, v, retval)
bsd_to_svr4_stat(&st, &svr4_st);
+ if (S_ISSOCK(st.st_mode))
+ (void) svr4_add_socket(p, SCARG(uap, path), &st);
+
if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0)
return error;
@@ -270,6 +283,9 @@ svr4_sys_xstat(p, v, retval)
bsd_to_svr4_xstat(&st, &svr4_st);
+ if (S_ISSOCK(st.st_mode))
+ (void) svr4_add_socket(p, SCARG(uap, path), &st);
+
if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0)
return error;
@@ -302,6 +318,9 @@ svr4_sys_lxstat(p, v, retval)
bsd_to_svr4_xstat(&st, &svr4_st);
+ if (S_ISSOCK(st.st_mode))
+ (void) svr4_add_socket(p, SCARG(uap, path), &st);
+
if ((error = copyout(&svr4_st, SCARG(uap, ub), sizeof svr4_st)) != 0)
return error;