Module Name:    src
Committed By:   christos
Date:           Wed May 27 18:55:36 UTC 2020

Modified Files:
        src/lib/librumphijack: hijack.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/lib/librumphijack/hijack.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.130 src/lib/librumphijack/hijack.c:1.131
--- src/lib/librumphijack/hijack.c:1.130	Mon Feb 10 18:21:42 2020
+++ src/lib/librumphijack/hijack.c	Wed May 27 14:55:36 2020
@@ -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 @@ enum dualcall {
 #ifdef __NetBSD__
 	DUALCALL_LINKAT,
 #endif
+	DUALCALL_PATHCONF,
+	DUALCALL_LPATHCONF,
+
 	DUALCALL__NUM
 };
 
@@ -405,6 +408,8 @@ struct sysnames {
 #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 @@ linkat(int fromfd, const char *from, int
 }
 #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)
 {

Reply via email to