From 432ab7f1ee3294a246c167fa539f4d13696215c2 Mon Sep 17 00:00:00 2001 From: pjd Date: Thu, 31 Oct 2013 11:38:25 +0000 Subject: [PATCH] Make lpathconf(2) support optional to make it compile again on Linux. Submitted by: Hashem Nasarat @riseup.net --- tools/regression/pjdfstest/Makefile | 2 +- tools/regression/pjdfstest/pjdfstest.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/regression/pjdfstest/Makefile b/tools/regression/pjdfstest/Makefile index eca598f241ec..a3e35f89b382 100644 --- a/tools/regression/pjdfstest/Makefile +++ b/tools/regression/pjdfstest/Makefile @@ -6,7 +6,7 @@ ${PROG}: ${PROG}.c @OSTYPE=`uname`; \ CFLAGS=-D__OS_$${OSTYPE}__; \ if [ $$OSTYPE = "FreeBSD" ]; then \ - CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_CHFLAGSAT -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -DHAS_BINDAT -DHAS_CONNECTAT"; \ + CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_CHFLAGSAT -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -DHAS_BINDAT -DHAS_CONNECTAT -DHAS_LPATHCONF"; \ elif [ $$OSTYPE = "SunOS" ]; then \ CFLAGS="$$CFLAGS -DHAS_TRUNCATE64 -DHAS_STAT64"; \ CFLAGS="$$CFLAGS -lsocket"; \ diff --git a/tools/regression/pjdfstest/pjdfstest.c b/tools/regression/pjdfstest/pjdfstest.c index ceab2dc69201..046df490e4f7 100644 --- a/tools/regression/pjdfstest/pjdfstest.c +++ b/tools/regression/pjdfstest/pjdfstest.c @@ -119,7 +119,9 @@ enum action { ACTION_FSTATAT, ACTION_PATHCONF, ACTION_FPATHCONF, +#ifdef HAS_LPATHCONF ACTION_LPATHCONF, +#endif #ifdef HAS_FREEBSD_ACL ACTION_PREPENDACL, ACTION_READACL, @@ -200,7 +202,9 @@ static struct syscall_desc syscalls[] = { { "fstatat", ACTION_FSTATAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "pathconf", ACTION_PATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "fpathconf", ACTION_FPATHCONF, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, +#ifdef HAS_LPATHCONF { "lpathconf", ACTION_LPATHCONF, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, +#endif #ifdef HAS_FREEBSD_ACL { "prependacl", ACTION_PREPENDACL, { TYPE_STRING, TYPE_STRING, TYPE_NONE } }, { "readacl", ACTION_READACL, { TYPE_STRING, TYPE_NONE } }, @@ -899,7 +903,9 @@ call_syscall(struct syscall_desc *scall, char *argv[]) break; case ACTION_PATHCONF: case ACTION_FPATHCONF: +#ifdef HAS_LPATHCONF case ACTION_LPATHCONF: +#endif { long lrval; @@ -916,9 +922,11 @@ call_syscall(struct syscall_desc *scall, char *argv[]) case ACTION_FPATHCONF: lrval = fpathconf(NUM(0), name); break; +#ifdef HAS_LPATHCONF case ACTION_LPATHCONF: lrval = lpathconf(STR(0), name); break; +#endif default: abort(); }