Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/librumphijack Add pathconf and lpathconf (fixes lib/libr...



details:   https://anonhg.NetBSD.org/src/rev/6ee43b51a8c5
branches:  trunk
changeset: 933575:6ee43b51a8c5
user:      christos <christos%NetBSD.org@localhost>
date:      Wed May 27 18:55:36 2020 +0000

description:
Add pathconf and lpathconf (fixes lib/librumphijack/nfs test which uses ls
which now uses lpathconf)

diffstat:

 lib/librumphijack/hijack.c |  42 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diffs (77 lines):

diff -r 6ca9bf4db7bc -r 6ee43b51a8c5 lib/librumphijack/hijack.c
--- a/lib/librumphijack/hijack.c        Wed May 27 18:47:13 2020 +0000
+++ b/lib/librumphijack/hijack.c        Wed May 27 18:55:36 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: hijack.c,v 1.130 2020/02/10 23:21:42 kamil Exp $      */
+/*      $NetBSD: hijack.c,v 1.131 2020/05/27 18:55:36 christos Exp $   */
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -34,7 +34,7 @@
 #include <rump/rumpuser_port.h>
 
 #if !defined(lint)
-__RCSID("$NetBSD: hijack.c,v 1.130 2020/02/10 23:21:42 kamil Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.131 2020/05/27 18:55:36 christos Exp $");
 #endif
 
 #include <sys/param.h>
@@ -170,6 +170,9 @@
 #ifdef __NetBSD__
        DUALCALL_LINKAT,
 #endif
+       DUALCALL_PATHCONF,
+       DUALCALL_LPATHCONF,
+
        DUALCALL__NUM
 };
 
@@ -405,6 +408,8 @@
 #ifdef __NetBSD__
        { DUALCALL_LINKAT,      "linkat",       RSYS_NAME(LINKAT)       },
 #endif
+       { DUALCALL_PATHCONF,    "pathconf",     RSYS_NAME(PATHCONF)     },
+       { DUALCALL_LPATHCONF,   "lpathconf",    RSYS_NAME(LPATHCONF)    },
 };
 #undef S
 
@@ -1335,6 +1340,39 @@
 }
 #endif
 
+static long
+do_pathconf(const char *path, int name, int link)
+{
+       long (*op_pathconf)(const char *, int);
+       enum pathtype pt;
+
+       if ((pt = path_isrump(path)) != PATH_HOST) {
+               op_pathconf = link ?
+                   GETSYSCALL(rump, LPATHCONF) :
+                   GETSYSCALL(rump, PATHCONF);
+               if (pt == PATH_RUMP)
+                       path = path_host2rump(path);
+       } else {
+               op_pathconf = link ? 
+                   GETSYSCALL(host, LPATHCONF) :
+                   GETSYSCALL(host, PATHCONF);
+       }
+
+       return op_pathconf(path, name);
+}
+
+long
+lpathconf(const char *path, int name)
+{
+       return do_pathconf(path, name, 1);
+}
+
+long
+pathconf(const char *path, int name)
+{
+       return do_pathconf(path, name, 0);
+}
+
 int
 link(const char *from, const char *to)
 {



Home | Main Index | Thread Index | Old Index