diff options
Diffstat (limited to 'tools/regression/pjdfstest')
-rw-r--r-- | tools/regression/pjdfstest/Makefile | 2 | ||||
-rw-r--r-- | tools/regression/pjdfstest/pjdfstest.c | 44 |
2 files changed, 45 insertions, 1 deletions
diff --git a/tools/regression/pjdfstest/Makefile b/tools/regression/pjdfstest/Makefile index ca789fe..eec813a 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_LCHFLAGS -DHAS_FREEBSD_ACL"; \ + CFLAGS="$$CFLAGS -DHAS_LCHMOD -DHAS_CHFLAGS -DHAS_FCHFLAGS -DHAS_LCHFLAGS -DHAS_FREEBSD_ACL -DHAS_BINDAT -DHAS_CONNECTAT"; \ 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 c08fafd..6eafc8c 100644 --- a/tools/regression/pjdfstest/pjdfstest.c +++ b/tools/regression/pjdfstest/pjdfstest.c @@ -82,7 +82,13 @@ enum action { ACTION_MKNOD, ACTION_MKNODAT, ACTION_BIND, +#ifdef HAS_BINDAT + ACTION_BINDAT, +#endif ACTION_CONNECT, +#ifdef HAS_CONNECTAT + ACTION_CONNECTAT, +#endif ACTION_CHMOD, ACTION_FCHMOD, #ifdef HAS_LCHMOD @@ -154,7 +160,13 @@ static struct syscall_desc syscalls[] = { { "mknod", ACTION_MKNOD, { TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} }, { "mknodat", ACTION_MKNODAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_STRING, TYPE_NUMBER, TYPE_NUMBER, TYPE_NUMBER, TYPE_NONE} }, { "bind", ACTION_BIND, { TYPE_STRING, TYPE_NONE } }, +#ifdef HAS_BINDAT + { "bindat", ACTION_BINDAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, +#endif { "connect", ACTION_CONNECT, { TYPE_STRING, TYPE_NONE } }, +#ifdef HAS_CONNECTAT + { "connectat", ACTION_CONNECTAT, { TYPE_DESCRIPTOR, TYPE_STRING, TYPE_NONE } }, +#endif { "chmod", ACTION_CHMOD, { TYPE_STRING, TYPE_NUMBER, TYPE_NONE } }, { "fchmod", ACTION_FCHMOD, { TYPE_DESCRIPTOR, TYPE_NUMBER, TYPE_NONE } }, #ifdef HAS_LCHMOD @@ -732,6 +744,22 @@ call_syscall(struct syscall_desc *scall, char *argv[]) rval = bind(rval, (struct sockaddr *)&sunx, sizeof(sunx)); break; } +#ifdef HAS_BINDAT + case ACTION_BINDAT: + { + struct sockaddr_un sunx; + + sunx.sun_family = AF_UNIX; + strncpy(sunx.sun_path, STR(1), sizeof(sunx.sun_path) - 1); + sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0'; + rval = socket(AF_UNIX, SOCK_STREAM, 0); + if (rval < 0) + break; + rval = bindat(NUM(0), rval, (struct sockaddr *)&sunx, + sizeof(sunx)); + break; + } +#endif case ACTION_CONNECT: { struct sockaddr_un sunx; @@ -745,6 +773,22 @@ call_syscall(struct syscall_desc *scall, char *argv[]) rval = connect(rval, (struct sockaddr *)&sunx, sizeof(sunx)); break; } +#ifdef HAS_CONNECTAT + case ACTION_CONNECTAT: + { + struct sockaddr_un sunx; + + sunx.sun_family = AF_UNIX; + strncpy(sunx.sun_path, STR(1), sizeof(sunx.sun_path) - 1); + sunx.sun_path[sizeof(sunx.sun_path) - 1] = '\0'; + rval = socket(AF_UNIX, SOCK_STREAM, 0); + if (rval < 0) + break; + rval = connectat(NUM(0), rval, (struct sockaddr *)&sunx, + sizeof(sunx)); + break; + } +#endif case ACTION_CHMOD: rval = chmod(STR(0), (mode_t)NUM(1)); break; |