summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-13 17:56:30 -0200
committerRenato Botelho <renato@netgate.com>2016-01-13 17:56:30 -0200
commit3e0bf52f358eb969d165c4b1e54942ee94cf2c8d (patch)
tree440bb9907871a5bc578d65b32f0c4aa339096175 /lib
parent4b4ac714f11471e43f18410bcc86da8f9dc3b88c (diff)
parente357bdb742b2696dcb81404917b6247f9e840232 (diff)
downloadFreeBSD-src-3e0bf52f358eb969d165c4b1e54942ee94cf2c8d.zip
FreeBSD-src-3e0bf52f358eb969d165c4b1e54942ee94cf2c8d.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/amd64/sys/Makefile.inc2
-rw-r--r--lib/libc/amd64/sys/reboot.S52
-rw-r--r--lib/libc/gen/popen.c34
-rw-r--r--lib/libc/i386/sys/Makefile.inc2
-rw-r--r--lib/libc/i386/sys/reboot.S45
-rw-r--r--lib/libc/include/libc_private.h4
-rw-r--r--lib/libc/rpc/svc_vc.c18
-rw-r--r--lib/libc/sys/Makefile.inc6
-rw-r--r--lib/libc/sys/Symbol.map2
-rw-r--r--lib/libc/sys/futimens.c97
-rw-r--r--lib/libc/sys/reboot.27
-rw-r--r--lib/libc/sys/utimensat.2292
-rw-r--r--lib/libc/sys/utimensat.c109
-rw-r--r--lib/libdpv/dialogrc.c109
-rw-r--r--lib/libdpv/dialogrc.h4
-rw-r--r--lib/libdpv/util.h4
-rw-r--r--lib/libfigpar/figpar.370
-rw-r--r--lib/libfigpar/figpar.c47
-rw-r--r--lib/libfigpar/figpar.h58
-rw-r--r--lib/libpam/modules/pam_ssh/Makefile3
20 files changed, 709 insertions, 256 deletions
diff --git a/lib/libc/amd64/sys/Makefile.inc b/lib/libc/amd64/sys/Makefile.inc
index 51583d3..32986c9fa 100644
--- a/lib/libc/amd64/sys/Makefile.inc
+++ b/lib/libc/amd64/sys/Makefile.inc
@@ -5,7 +5,7 @@ SRCS+= amd64_get_fsbase.c amd64_get_gsbase.c amd64_set_fsbase.c \
amd64_set_gsbase.c __vdso_gettc.c
MDASM= vfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
- reboot.S sbrk.S setlogin.S sigreturn.S
+ sbrk.S setlogin.S sigreturn.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o
diff --git a/lib/libc/amd64/sys/reboot.S b/lib/libc/amd64/sys/reboot.S
deleted file mode 100644
index fd04ef4..0000000
--- a/lib/libc/amd64/sys/reboot.S
+++ /dev/null
@@ -1,52 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)reboot.s 5.1 (Berkeley) 4/23/90"
-#endif /* SYSLIBC_SCCS and not lint */
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
- .weak _reboot
- .set _reboot,__sys_reboot
- .weak reboot
- .set reboot,__sys_reboot
-ENTRY(__sys_reboot)
- mov $SYS_reboot,%rax
- KERNCALL
- jb HIDENAME(cerror)
- iretq
-END(__sys_reboot)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index b0597c8..f834df0 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -73,6 +73,7 @@ popen(command, type)
struct pid *cur;
FILE *iop;
int pdes[2], pid, twoway, cloexec;
+ int pdes_unused_in_parent;
char *argv[4];
struct pid *p;
@@ -99,6 +100,20 @@ popen(command, type)
return (NULL);
}
+ if (*type == 'r') {
+ iop = fdopen(pdes[0], type);
+ pdes_unused_in_parent = pdes[1];
+ } else {
+ iop = fdopen(pdes[1], type);
+ pdes_unused_in_parent = pdes[0];
+ }
+ if (iop == NULL) {
+ (void)_close(pdes[0]);
+ (void)_close(pdes[1]);
+ free(cur);
+ return (NULL);
+ }
+
argv[0] = "sh";
argv[1] = "-c";
argv[2] = (char *)command;
@@ -108,9 +123,14 @@ popen(command, type)
switch (pid = vfork()) {
case -1: /* Error. */
THREAD_UNLOCK();
- (void)_close(pdes[0]);
- (void)_close(pdes[1]);
+ /*
+ * The _close() closes the unused end of pdes[], while
+ * the fclose() closes the used end of pdes[], *and* cleans
+ * up iop.
+ */
+ (void)_close(pdes_unused_in_parent);
free(cur);
+ (void)fclose(iop);
return (NULL);
/* NOTREACHED */
case 0: /* Child. */
@@ -155,14 +175,8 @@ popen(command, type)
}
THREAD_UNLOCK();
- /* Parent; assume fdopen can't fail. */
- if (*type == 'r') {
- iop = fdopen(pdes[0], type);
- (void)_close(pdes[1]);
- } else {
- iop = fdopen(pdes[1], type);
- (void)_close(pdes[0]);
- }
+ /* Parent. */
+ (void)_close(pdes_unused_in_parent);
/* Link into list of file descriptors. */
cur->fp = iop;
diff --git a/lib/libc/i386/sys/Makefile.inc b/lib/libc/i386/sys/Makefile.inc
index 9eefabc..ce1fed5 100644
--- a/lib/libc/i386/sys/Makefile.inc
+++ b/lib/libc/i386/sys/Makefile.inc
@@ -9,7 +9,7 @@ SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \
__vdso_gettc.c
MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S pipe.S ptrace.S \
- reboot.S sbrk.S setlogin.S sigreturn.S syscall.S
+ sbrk.S setlogin.S sigreturn.S syscall.S
# Don't generate default code for these syscalls:
NOASM= break.o exit.o getlogin.o openbsd_poll.o sstk.o vfork.o yield.o
diff --git a/lib/libc/i386/sys/reboot.S b/lib/libc/i386/sys/reboot.S
deleted file mode 100644
index f11000e..0000000
--- a/lib/libc/i386/sys/reboot.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * William Jolitz.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)reboot.s 5.1 (Berkeley) 4/23/90"
-#endif /* SYSLIBC_SCCS and not lint */
-#include <machine/asm.h>
-__FBSDID("$FreeBSD$");
-
-#include "SYS.h"
-
-SYSCALL(reboot)
- iret
-END(__sys_reboot)
-
- .section .note.GNU-stack,"",%progbits
diff --git a/lib/libc/include/libc_private.h b/lib/libc/include/libc_private.h
index b43e8d1..bf3ff28 100644
--- a/lib/libc/include/libc_private.h
+++ b/lib/libc/include/libc_private.h
@@ -379,6 +379,10 @@ int __libc_system(const char *);
int __libc_tcdrain(int);
int __fcntl_compat(int fd, int cmd, ...);
+int __sys_futimens(int fd, const struct timespec *times) __hidden;
+int __sys_utimensat(int fd, const char *path,
+ const struct timespec *times, int flag) __hidden;
+
/* execve() with PATH processing to implement posix_spawnp() */
int _execvpe(const char *, char * const *, char * const *);
diff --git a/lib/libc/rpc/svc_vc.c b/lib/libc/rpc/svc_vc.c
index 31edb93..304f90a 100644
--- a/lib/libc/rpc/svc_vc.c
+++ b/lib/libc/rpc/svc_vc.c
@@ -292,8 +292,8 @@ rendezvous_request(xprt, msg)
int sock, flags;
struct cf_rendezvous *r;
struct cf_conn *cd;
- struct sockaddr_storage addr;
- socklen_t len;
+ struct sockaddr_storage addr, sslocal;
+ socklen_t len, slen;
struct __rpc_sockinfo si;
SVCXPRT *newxprt;
fd_set cleanfds;
@@ -358,6 +358,20 @@ again:
__xdrrec_setnonblock(&cd->xdrs, cd->maxrec);
} else
cd->nonblock = FALSE;
+ slen = sizeof(struct sockaddr_storage);
+ if(_getsockname(sock, (struct sockaddr *)(void *)&sslocal, &slen) < 0) {
+ warnx("svc_vc_create: could not retrieve local addr");
+ newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = 0;
+ } else {
+ newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = sslocal.ss_len;
+ newxprt->xp_ltaddr.buf = mem_alloc((size_t)sslocal.ss_len);
+ if (newxprt->xp_ltaddr.buf == NULL) {
+ warnx("svc_vc_create: no mem for local addr");
+ newxprt->xp_ltaddr.maxlen = newxprt->xp_ltaddr.len = 0;
+ } else {
+ memcpy(newxprt->xp_ltaddr.buf, &sslocal, (size_t)sslocal.ss_len);
+ }
+ }
gettimeofday(&cd->last_recv_time, NULL);
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 3b1f8fd..25bd4a3 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -38,6 +38,10 @@ SRCS+= ${SYSCALL_COMPAT_SRCS}
NOASM+= ${SYSCALL_COMPAT_SRCS:S/.c/.o/}
.endif
+SRCS+= futimens.c utimensat.c
+NOASM+= futimens.o utimensat.o
+PSEUDO+= _futimens.o _utimensat.o
+
INTERPOSED = \
accept \
accept4 \
@@ -317,6 +321,7 @@ MAN+= sctp_generic_recvmsg.2 \
umask.2 \
undelete.2 \
unlink.2 \
+ utimensat.2 \
utimes.2 \
utrace.2 \
uuidgen.2 \
@@ -449,6 +454,7 @@ MLINKS+=timer_settime.2 timer_getoverrun.2 \
timer_settime.2 timer_gettime.2
MLINKS+=truncate.2 ftruncate.2
MLINKS+=unlink.2 unlinkat.2
+MLINKS+=utimensat.2 futimens.2
MLINKS+=utimes.2 futimes.2 \
utimes.2 futimesat.2 \
utimes.2 lutimes.2
diff --git a/lib/libc/sys/Symbol.map b/lib/libc/sys/Symbol.map
index f1f57ba..194aa5b 100644
--- a/lib/libc/sys/Symbol.map
+++ b/lib/libc/sys/Symbol.map
@@ -397,7 +397,9 @@ FBSD_1.3 {
};
FBSD_1.4 {
+ futimens;
ppoll;
+ utimensat;
};
FBSDprivate_1.0 {
diff --git a/lib/libc/sys/futimens.c b/lib/libc/sys/futimens.c
new file mode 100644
index 0000000..2014cc5
--- /dev/null
+++ b/lib/libc/sys/futimens.c
@@ -0,0 +1,97 @@
+/*-
+ * Copyright (c) 2015 Jilles Tjoelker
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <time.h>
+#include "un-namespace.h"
+
+#include "libc_private.h"
+
+int
+futimens(int fd, const struct timespec times[2])
+{
+ struct timeval now, tv[2], *tvp;
+ struct stat sb;
+
+ if (__getosreldate() >= 1100056)
+ return (__sys_futimens(fd, times));
+
+ if (times == NULL || (times[0].tv_nsec == UTIME_NOW &&
+ times[1].tv_nsec == UTIME_NOW))
+ tvp = NULL;
+ else if (times[0].tv_nsec == UTIME_OMIT &&
+ times[1].tv_nsec == UTIME_OMIT)
+ return (0);
+ else {
+ if ((times[0].tv_nsec < 0 || times[0].tv_nsec > 999999999) &&
+ times[0].tv_nsec != UTIME_NOW &&
+ times[0].tv_nsec != UTIME_OMIT) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if ((times[1].tv_nsec < 0 || times[1].tv_nsec > 999999999) &&
+ times[1].tv_nsec != UTIME_NOW &&
+ times[1].tv_nsec != UTIME_OMIT) {
+ errno = EINVAL;
+ return (-1);
+ }
+ tv[0].tv_sec = times[0].tv_sec;
+ tv[0].tv_usec = times[0].tv_nsec / 1000;
+ tv[1].tv_sec = times[1].tv_sec;
+ tv[1].tv_usec = times[1].tv_nsec / 1000;
+ tvp = tv;
+ if (times[0].tv_nsec == UTIME_OMIT ||
+ times[1].tv_nsec == UTIME_OMIT) {
+ if (_fstat(fd, &sb) == -1)
+ return (-1);
+ if (times[0].tv_nsec == UTIME_OMIT) {
+ tv[0].tv_sec = sb.st_atim.tv_sec;
+ tv[0].tv_usec = sb.st_atim.tv_nsec / 1000;
+ }
+ if (times[1].tv_nsec == UTIME_OMIT) {
+ tv[1].tv_sec = sb.st_mtim.tv_sec;
+ tv[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
+ }
+ }
+ if (times[0].tv_nsec == UTIME_NOW ||
+ times[1].tv_nsec == UTIME_NOW) {
+ if (gettimeofday(&now, NULL) == -1)
+ return (-1);
+ if (times[0].tv_nsec == UTIME_NOW)
+ tv[0] = now;
+ if (times[1].tv_nsec == UTIME_NOW)
+ tv[1] = now;
+ }
+ }
+ return (futimes(fd, tvp));
+}
diff --git a/lib/libc/sys/reboot.2 b/lib/libc/sys/reboot.2
index f5571ae..b010c41 100644
--- a/lib/libc/sys/reboot.2
+++ b/lib/libc/sys/reboot.2
@@ -113,6 +113,13 @@ Normally, the disks are sync'd (see
before the processor is halted or rebooted.
This option may be useful if file system changes have been made manually
or if the processor is on fire.
+.It Dv RB_REROOT
+Instead of rebooting, unmount all filesystems except the one containing
+currently-running executable, and mount root filesystem using the same
+mechanism which is used during normal boot, based on
+vfs.root.mountfrom
+.Xr kenv 8
+variable.
.It Dv RB_RDONLY
Initially mount the root file system read-only.
This is currently the default, and this option has been deprecated.
diff --git a/lib/libc/sys/utimensat.2 b/lib/libc/sys/utimensat.2
new file mode 100644
index 0000000..0f397c6
--- /dev/null
+++ b/lib/libc/sys/utimensat.2
@@ -0,0 +1,292 @@
+.\" $NetBSD: utimes.2,v 1.13 1999/03/22 19:45:11 garbled Exp $
+.\"
+.\" Copyright (c) 1990, 1993
+.\" The Regents of the University of California. All rights reserved.
+.\" Copyright (c) 2012, Jilles Tjoelker
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" @(#)utimes.2 8.1 (Berkeley) 6/4/93
+.\" $FreeBSD$
+.\"
+.Dd January 23, 2015
+.Dt UTIMENSAT 2
+.Os
+.Sh NAME
+.Nm futimens ,
+.Nm utimensat
+.Nd set file access and modification times
+.Sh LIBRARY
+.Lb libc
+.Sh SYNOPSIS
+.In sys/stat.h
+.Ft int
+.Fn futimens "int fd" "const struct timespec times[2]"
+.Ft int
+.Fo utimensat
+.Fa "int fd"
+.Fa "const char *path"
+.Fa "const struct timespec times[2]"
+.Fa "int flag"
+.Fc
+.Sh DESCRIPTION
+The access and modification times of the file named by
+.Fa path
+or referenced by
+.Fa fd
+are changed as specified by the argument
+.Fa times .
+The inode-change-time of the file is set to the current time.
+.Pp
+If
+.Fa path
+specifies a relative path,
+it is relative to the current working directory if
+.Fa fd
+is
+.Dv AT_FDCWD
+and otherwise relative to the directory associated with the file descriptor
+.Fa fd .
+.Pp
+The
+.Va tv_nsec
+field of a
+.Vt timespec
+structure
+can be set to the special value
+.Dv UTIME_NOW
+to set the current time, or to
+.Dv UTIME_OMIT
+to leave the time unchanged.
+In either case, the
+.Va tv_sec
+field is ignored.
+.Pp
+If
+.Fa times
+is
+.No non- Ns Dv NULL ,
+it is assumed to point to an array of two timespec structures.
+The access time is set to the value of the first element, and the
+modification time is set to the value of the second element.
+For file systems that support file birth (creation) times (such as
+.Dv UFS2 ) ,
+the birth time will be set to the value of the second element
+if the second element is older than the currently set birth time.
+To set both a birth time and a modification time,
+two calls are required; the first to set the birth time
+and the second to set the (presumably newer) modification time.
+Ideally a new system call will be added that allows the setting
+of all three times at once.
+If
+.Fa times
+is
+.Dv NULL ,
+this is equivalent to passing
+a pointer to an array of two timespec structures
+with both
+.Va tv_nsec
+fields set to
+.Dv UTIME_NOW .
+.Pp
+If both
+.Va tv_nsec
+fields are
+.Dv UTIME_OMIT ,
+the timestamps remain unchanged and
+no permissions are needed for the file itself,
+although search permissions may be required for the path prefix.
+The call may or may not succeed if the named file does not exist.
+.Pp
+If both
+.Va tv_nsec
+fields are
+.Dv UTIME_NOW ,
+the caller must be the owner of the file, have permission to
+write the file, or be the super-user.
+.Pp
+For all other values of the timestamps,
+the caller must be the owner of the file or be the super-user.
+.Pp
+The values for the
+.Fa flag
+argument of the
+.Fn utimensat
+system call
+are constructed by a bitwise-inclusive OR of flags from the following list,
+defined in
+.In fcntl.h :
+.Bl -tag -width indent
+.It Dv AT_SYMLINK_NOFOLLOW
+If
+.Fa path
+names a symbolic link, the symbolic link's times are changed.
+By default,
+.Fn utimensat
+changes the times of the file referenced by the symbolic link.
+.El
+.Sh RETURN VALUES
+.Rv -std
+.Sh COMPATIBILITY
+If the running kernel does not support this system call,
+a wrapper emulates it using
+.Xr fstatat 2 ,
+.Xr futimesat 2
+and
+.Xr lutimes 2 .
+As a result, timestamps will be rounded down to the nearest microsecond,
+.Dv UTIME_OMIT
+is not atomic and
+.Dv AT_SYMLINK_NOFOLLOW
+is not available with a path relative to a file descriptor.
+.Sh ERRORS
+These system calls will fail if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+The
+.Fa times
+argument is
+.Dv NULL ,
+or both
+.Va tv_nsec
+values are
+.Dv UTIME_NOW ,
+and the effective user ID of the process does not
+match the owner of the file, and is not the super-user, and write
+access is denied.
+.It Bq Er EFAULT
+The
+.Fa times
+argument
+points outside the process's allocated address space.
+.It Bq Er EINVAL
+The
+.Va tv_usec
+component of at least one of the values specified by the
+.Fa times
+argument has a value less than 0 or greater than 999999.
+.It Bq Er EIO
+An I/O error occurred while reading or writing the affected inode.
+.It Bq Er EPERM
+The
+.Fa times
+argument is not
+.Dv NULL
+nor are both
+.Va tv_nsec
+values
+.Dv UTIME_NOW ,
+nor are both
+.Va tv_nsec
+values
+.Dv UTIME_OMIT
+and the calling process's effective user ID
+does not match the owner of the file and is not the super-user.
+.It Bq Er EPERM
+The named file has its immutable or append-only flag set, see the
+.Xr chflags 2
+manual page for more information.
+.It Bq Er EROFS
+The file system containing the file is mounted read-only.
+.El
+.Pp
+The
+.Fn futimens
+system call
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EBADF
+The
+.Fa fd
+argument
+does not refer to a valid descriptor.
+.El
+.Pp
+The
+.Fn utimensat
+system call
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+Search permission is denied for a component of the path prefix.
+.It Bq Er EBADF
+The
+.Fa path
+argument does not specify an absolute path and the
+.Fa fd
+argument is neither
+.Dv AT_FDCWD
+nor a valid file descriptor.
+.It Bq Er EFAULT
+The
+.Fa path
+argument
+points outside the process's allocated address space.
+.It Bq Er ELOOP
+Too many symbolic links were encountered in translating the pathname.
+.It Bq Er ENAMETOOLONG
+A component of a pathname exceeded
+.Dv NAME_MAX
+characters, or an entire path name exceeded
+.Dv PATH_MAX
+characters.
+.It Bq Er ENOENT
+The named file does not exist.
+.It Bq Er ENOTDIR
+A component of the path prefix is not a directory.
+.It Bq Er ENOTDIR
+The
+.Fa path
+argument is not an absolute path and
+.Fa fd
+is neither
+.Dv AT_FDCWD
+nor a file descriptor associated with a directory.
+.It Bq Er ENOTSUP
+The running kernel does not support this system call and
+.Dv AT_SYMLINK_NOFOLLOW
+is used with a path relative to a file descriptor.
+.El
+.Sh SEE ALSO
+.Xr chflags 2 ,
+.Xr stat 2 ,
+.Xr symlink 2 ,
+.Xr utimes 2 ,
+.Xr utime 3 ,
+.Xr symlink 7
+.Sh STANDARDS
+The
+.Fn futimens
+and
+.Fn utimensat
+system calls are expected to conform to
+.St -p1003.1-2008 .
+.Sh HISTORY
+The
+.Fn futimens
+and
+.Fn utimensat
+system calls appeared in
+.Fx 11.0 .
diff --git a/lib/libc/sys/utimensat.c b/lib/libc/sys/utimensat.c
new file mode 100644
index 0000000..67d19cb
--- /dev/null
+++ b/lib/libc/sys/utimensat.c
@@ -0,0 +1,109 @@
+/*-
+ * Copyright (c) 2015 Jilles Tjoelker
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include "namespace.h"
+#include <sys/stat.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <time.h>
+#include "un-namespace.h"
+
+#include "libc_private.h"
+
+int
+utimensat(int fd, const char *path, const struct timespec times[2], int flag)
+{
+ struct timeval now, tv[2], *tvp;
+ struct stat sb;
+
+ if (__getosreldate() >= 1100056)
+ return (__sys_utimensat(fd, path, times, flag));
+
+ if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if (times == NULL || (times[0].tv_nsec == UTIME_NOW &&
+ times[1].tv_nsec == UTIME_NOW))
+ tvp = NULL;
+ else if (times[0].tv_nsec == UTIME_OMIT &&
+ times[1].tv_nsec == UTIME_OMIT)
+ return (0);
+ else {
+ if ((times[0].tv_nsec < 0 || times[0].tv_nsec > 999999999) &&
+ times[0].tv_nsec != UTIME_NOW &&
+ times[0].tv_nsec != UTIME_OMIT) {
+ errno = EINVAL;
+ return (-1);
+ }
+ if ((times[1].tv_nsec < 0 || times[1].tv_nsec > 999999999) &&
+ times[1].tv_nsec != UTIME_NOW &&
+ times[1].tv_nsec != UTIME_OMIT) {
+ errno = EINVAL;
+ return (-1);
+ }
+ tv[0].tv_sec = times[0].tv_sec;
+ tv[0].tv_usec = times[0].tv_nsec / 1000;
+ tv[1].tv_sec = times[1].tv_sec;
+ tv[1].tv_usec = times[1].tv_nsec / 1000;
+ tvp = tv;
+ if (times[0].tv_nsec == UTIME_OMIT ||
+ times[1].tv_nsec == UTIME_OMIT) {
+ if (fstatat(fd, path, &sb, flag) == -1)
+ return (-1);
+ if (times[0].tv_nsec == UTIME_OMIT) {
+ tv[0].tv_sec = sb.st_atim.tv_sec;
+ tv[0].tv_usec = sb.st_atim.tv_nsec / 1000;
+ }
+ if (times[1].tv_nsec == UTIME_OMIT) {
+ tv[1].tv_sec = sb.st_mtim.tv_sec;
+ tv[1].tv_usec = sb.st_mtim.tv_nsec / 1000;
+ }
+ }
+ if (times[0].tv_nsec == UTIME_NOW ||
+ times[1].tv_nsec == UTIME_NOW) {
+ if (gettimeofday(&now, NULL) == -1)
+ return (-1);
+ if (times[0].tv_nsec == UTIME_NOW)
+ tv[0] = now;
+ if (times[1].tv_nsec == UTIME_NOW)
+ tv[1] = now;
+ }
+ }
+ if ((flag & AT_SYMLINK_NOFOLLOW) == 0)
+ return (futimesat(fd, path, tvp));
+ else if ((flag & AT_SYMLINK_NOFOLLOW) != 0 &&
+ (fd == AT_FDCWD || path[0] == '/'))
+ return (lutimes(path, tvp));
+ else {
+ errno = ENOTSUP;
+ return (-1);
+ }
+}
diff --git a/lib/libdpv/dialogrc.c b/lib/libdpv/dialogrc.c
index eb4a536..e199d41 100644
--- a/lib/libdpv/dialogrc.c
+++ b/lib/libdpv/dialogrc.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org>
+ * Copyright (c) 2013-2015 Devin Teske <dteske@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,58 +49,58 @@ char gauge_color[STR_BUFSIZE] = "47b"; /* (BLUE,WHITE,ON) */
char separator[STR_BUFSIZE] = "";
/* Function prototypes */
-static int setattr(struct fp_config *, uint32_t, char *, char *);
-static int setbool(struct fp_config *, uint32_t, char *, char *);
-static int setnum(struct fp_config *, uint32_t, char *, char *);
-static int setstr(struct fp_config *, uint32_t, char *, char *);
+static int setattr(struct figpar_config *, uint32_t, char *, char *);
+static int setbool(struct figpar_config *, uint32_t, char *, char *);
+static int setnum(struct figpar_config *, uint32_t, char *, char *);
+static int setstr(struct figpar_config *, uint32_t, char *, char *);
/*
* Anatomy of DIALOGRC (~/.dialogrc by default)
* NOTE: Must appear after private function prototypes (above)
* NB: Brace-initialization of union requires cast to *first* member of union
*/
-static struct fp_config dialogrc_config[] = {
- /* TYPE Directive DEFAULT HANDLER */
- {FP_TYPE_INT, "aspect", {(void *)0}, &setnum},
- {FP_TYPE_STR, "separate_widget", {separator}, &setstr},
- {FP_TYPE_INT, "tab_len", {(void *)0}, &setnum},
- {FP_TYPE_BOOL, "visit_items", {(void *)0}, &setbool},
- {FP_TYPE_BOOL, "use_shadow", {(void *)1}, &setbool},
- {FP_TYPE_BOOL, "use_colors", {(void *)1}, &setbool},
- {FP_TYPE_STR, "screen_color", {NULL}, &setattr},
- {FP_TYPE_STR, "shadow_color", {NULL}, &setattr},
- {FP_TYPE_STR, "dialog_color", {NULL}, &setattr},
- {FP_TYPE_STR, "title_color", {NULL}, &setattr},
- {FP_TYPE_STR, "border_color", {NULL}, &setattr},
- {FP_TYPE_STR, "button_active_color", {NULL}, &setattr},
- {FP_TYPE_STR, "button_inactive_color", {NULL}, &setattr},
- {FP_TYPE_STR, "button_key_active_color", {NULL}, &setattr},
- {FP_TYPE_STR, "button_key_inactive_color", {NULL}, &setattr},
- {FP_TYPE_STR, "button_label_active_color", {NULL}, &setattr},
- {FP_TYPE_STR, "button_label_inactive_color",{NULL}, &setattr},
- {FP_TYPE_STR, "inputbox_color", {NULL}, &setattr},
- {FP_TYPE_STR, "inputbox_border_color", {NULL}, &setattr},
- {FP_TYPE_STR, "searchbox_color", {NULL}, &setattr},
- {FP_TYPE_STR, "searchbox_title_color", {NULL}, &setattr},
- {FP_TYPE_STR, "searchbox_border_color", {NULL}, &setattr},
- {FP_TYPE_STR, "position_indicator_color", {NULL}, &setattr},
- {FP_TYPE_STR, "menubox_color", {NULL}, &setattr},
- {FP_TYPE_STR, "menubox_border_color", {NULL}, &setattr},
- {FP_TYPE_STR, "item_color", {NULL}, &setattr},
- {FP_TYPE_STR, "item_selected_color", {NULL}, &setattr},
- {FP_TYPE_STR, "tag_color", {NULL}, &setattr},
- {FP_TYPE_STR, "tag_selected_color", {NULL}, &setattr},
- {FP_TYPE_STR, "tag_key_color", {NULL}, &setattr},
- {FP_TYPE_STR, "tag_key_selected_color", {NULL}, &setattr},
- {FP_TYPE_STR, "check_color", {NULL}, &setattr},
- {FP_TYPE_STR, "check_selected_color", {NULL}, &setattr},
- {FP_TYPE_STR, "uarrow_color", {NULL}, &setattr},
- {FP_TYPE_STR, "darrow_color", {NULL}, &setattr},
- {FP_TYPE_STR, "itemhelp_color", {NULL}, &setattr},
- {FP_TYPE_STR, "form_active_text_color", {NULL}, &setattr},
- {FP_TYPE_STR, "form_text_color", {NULL}, &setattr},
- {FP_TYPE_STR, "form_item_readonly_color", {NULL}, &setattr},
- {FP_TYPE_STR, "gauge_color", {gauge_color}, &setattr},
+static struct figpar_config dialogrc_config[] = {
+ /* TYPE DIRECTIVE DEFAULT HANDLER */
+ {FIGPAR_TYPE_INT, "aspect", {(void *)0}, &setnum},
+ {FIGPAR_TYPE_STR, "separate_widget", {separator}, &setstr},
+ {FIGPAR_TYPE_INT, "tab_len", {(void *)0}, &setnum},
+ {FIGPAR_TYPE_BOOL, "visit_items", {(void *)0}, &setbool},
+ {FIGPAR_TYPE_BOOL, "use_shadow", {(void *)1}, &setbool},
+ {FIGPAR_TYPE_BOOL, "use_colors", {(void *)1}, &setbool},
+ {FIGPAR_TYPE_STR, "screen_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "shadow_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "dialog_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "title_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "border_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "button_active_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "button_inactive_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "button_key_active_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "button_key_inactive_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "button_label_active_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "button_label_inactive_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "inputbox_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "inputbox_border_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "searchbox_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "searchbox_title_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "searchbox_border_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "position_indicator_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "menubox_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "menubox_border_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "item_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "item_selected_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "tag_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "tag_selected_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "tag_key_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "tag_key_selected_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "check_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "check_selected_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "uarrow_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "darrow_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "itemhelp_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "form_active_text_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "form_text_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "form_item_readonly_color", {NULL}, &setattr},
+ {FIGPAR_TYPE_STR, "gauge_color", {gauge_color}, &setattr},
{0, NULL, {0}, NULL}
};
@@ -108,7 +108,7 @@ static struct fp_config dialogrc_config[] = {
* figpar call-back for interpreting value as .dialogrc `Attribute'
*/
static int
-setattr(struct fp_config *option, uint32_t line __unused,
+setattr(struct figpar_config *option, uint32_t line __unused,
char *directive __unused, char *value)
{
char *cp = value;
@@ -204,7 +204,7 @@ write_attrbuf:
* figpar call-back for interpreting value as .dialogrc `Boolean'
*/
static int
-setbool(struct fp_config *option, uint32_t line __unused,
+setbool(struct figpar_config *option, uint32_t line __unused,
char *directive __unused, char *value)
{
@@ -227,7 +227,7 @@ setbool(struct fp_config *option, uint32_t line __unused,
* figpar call-back for interpreting value as .dialogrc `Number'
*/
static int
-setnum(struct fp_config *option, uint32_t line __unused,
+setnum(struct figpar_config *option, uint32_t line __unused,
char *directive __unused, char *value)
{
@@ -247,7 +247,7 @@ setnum(struct fp_config *option, uint32_t line __unused,
* figpar call-back for interpreting value as .dialogrc `String'
*/
static int
-setstr(struct fp_config *option, uint32_t line __unused,
+setstr(struct figpar_config *option, uint32_t line __unused,
char *directive __unused, char *value)
{
size_t len;
@@ -315,7 +315,8 @@ parse_dialogrc(void)
}
/* Process file (either $DIALOGRC if set, or `$HOME/.dialogrc') */
- res = parse_config(dialogrc_config, path, NULL, FP_BREAK_ON_EQUALS);
+ res = parse_config(dialogrc_config,
+ path, NULL, FIGPAR_BREAK_ON_EQUALS);
/* Set some globals based on what we parsed */
use_shadow = dialogrc_config_option("use_shadow")->value.boolean;
@@ -328,10 +329,10 @@ parse_dialogrc(void)
/*
* Return a pointer to the `.dialogrc' config option specific to `directive' or
- * static fp_dummy_config (full of NULLs) if none found (see
+ * static figpar_dummy_config (full of NULLs) if none found (see
* get_config_option(3); part of figpar(3)).
*/
-struct fp_config *
+struct figpar_config *
dialogrc_config_option(const char *directive)
{
return (get_config_option(dialogrc_config, directive));
diff --git a/lib/libdpv/dialogrc.h b/lib/libdpv/dialogrc.h
index 7d17235..a2eb1fb 100644
--- a/lib/libdpv/dialogrc.h
+++ b/lib/libdpv/dialogrc.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org>
+ * Copyright (c) 2013-2015 Devin Teske <dteske@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,7 +50,7 @@ extern char separator[];
__BEGIN_DECLS
void dialogrc_free(void);
int parse_dialogrc(void);
-struct fp_config *dialogrc_config_option(const char *_directive);
+struct figpar_config *dialogrc_config_option(const char *_directive);
__END_DECLS
#endif /* !_DIALOGRC_H_ */
diff --git a/lib/libdpv/util.h b/lib/libdpv/util.h
index 7bb3b18..d746cb6 100644
--- a/lib/libdpv/util.h
+++ b/lib/libdpv/util.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2013-2014 Devin Teske <dteske@FreeBSD.org>
+ * Copyright (c) 2013-2016 Devin Teske <dteske@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
#define PATH_SHELL "/bin/sh"
#endif
-#define CMDBUFMAX 4096
+#define CMDBUFMAX 65536
__BEGIN_DECLS
int shell_spawn_pipecmd(const char *_cmd, const char *_label, pid_t *_pid);
diff --git a/lib/libfigpar/figpar.3 b/lib/libfigpar/figpar.3
index 8fd49d3..60ab2b5 100644
--- a/lib/libfigpar/figpar.3
+++ b/lib/libfigpar/figpar.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd Oct 22, 2015
+.Dd Nov 2, 2015
.Dt FIGPAR 3
.Os
.Sh NAME
@@ -38,13 +38,13 @@
.In figpar.h
.Ft int
.Fo parse_config
-.Fa "struct fp_config options[], const char *path"
-.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct fp_config *option, uint32_t line"
+.Fa "struct figpar_config options[], const char *path"
+.Fa "int \*[lp]*unknown\*[rp]\*[lp]struct figpar_config *option, uint32_t line"
.Fa "char *directive, char *value\*[rp], uint8_t processing_options"
.Fc
-.Ft "struct fp_config *"
+.Ft "struct figpar_config *"
.Fo get_config_option
-.Fa "struct fp_config options[], const char *directive"
+.Fa "struct figpar_config options[], const char *directive"
.Fc
.In string_m.h
.Ft int
@@ -91,32 +91,32 @@ Configuration directives, types, and callback functions are provided through
data structures defined in
.In figpar.h :
.Bd -literal -offset indent
-struct fp_config {
- enum fp_cfgtype type; /* value type */
- const char *directive; /* keyword */
- union fp_cfgvalue value; /* value */
+struct figpar_config {
+ enum figpar_cfgtype type; /* value type */
+ const char *directive; /* keyword */
+ union figpar_cfgvalue value; /* value */
/* Pointer to function used when directive is found */
- int (*action)(struct fp_config *option, uint32_t line,
+ int (*action)(struct figpar_config *option, uint32_t line,
char *directive, char *value);
};
-enum fp_cfgtype {
- FP_TYPE_NONE = 0x0000, /* for directives with no value */
- FP_TYPE_BOOL = 0x0001, /* boolean */
- FP_TYPE_INT = 0x0002, /* signed 32 bit integer */
- FP_TYPE_UINT = 0x0004, /* unsigned 32 bit integer */
- FP_TYPE_STR = 0x0008, /* string pointer */
- FP_TYPE_STRARRAY = 0x0010, /* string array pointer */
- FP_TYPE_DATA1 = 0x0020, /* void data type-1 (whatever) */
- FP_TYPE_DATA2 = 0x0040, /* void data type-2 (whatever) */
- FP_TYPE_DATA3 = 0x0080, /* void data type-3 (whatever) */
- FP_TYPE_RESERVED1 = 0x0100, /* reserved data type-1 (future) */
- FP_TYPE_RESERVED2 = 0x0200, /* reserved data type-2 (future) */
- FP_TYPE_RESERVED3 = 0x0400, /* reserved data type-3 (future) */
+enum figpar_cfgtype {
+ FIGPAR_TYPE_NONE = 0x0000, /* directives with no value */
+ FIGPAR_TYPE_BOOL = 0x0001, /* boolean */
+ FIGPAR_TYPE_INT = 0x0002, /* signed 32 bit integer */
+ FIGPAR_TYPE_UINT = 0x0004, /* unsigned 32 bit integer */
+ FIGPAR_TYPE_STR = 0x0008, /* string pointer */
+ FIGPAR_TYPE_STRARRAY = 0x0010, /* string array pointer */
+ FIGPAR_TYPE_DATA1 = 0x0020, /* void data type-1 (open) */
+ FIGPAR_TYPE_DATA2 = 0x0040, /* void data type-2 (open) */
+ FIGPAR_TYPE_DATA3 = 0x0080, /* void data type-3 (open) */
+ FIGPAR_TYPE_RESERVED1 = 0x0100, /* reserved data type-1 */
+ FIGPAR_TYPE_RESERVED2 = 0x0200, /* reserved data type-2 */
+ FIGPAR_TYPE_RESERVED3 = 0x0400, /* reserved data type-3 */
};
-union fp_cfgvalue {
+union figpar_cfgvalue {
void *data; /* Pointer to NUL-terminated string */
char *str; /* Pointer to NUL-terminated string */
char **strarray; /* Pointer to an array of strings */
@@ -133,26 +133,26 @@ argument to
is a mask of bit fields which indicate various
processing options.
The possible flags are as follows:
-.Bl -tag -width FP_BREAK_ON_SEMICOLON
-.It Dv FP_BREAK_ON_EQUALS
+.Bl -tag -width FIGPAR_BREAK_ON_SEMICOLON
+.It Dv FIGPAR_BREAK_ON_EQUALS
An equals sign
.Pq Ql Li =
is normally considered part of the directive.
This flag enables terminating the directive at the equals sign.
Also makes equals sign optional and transient.
-.It Dv FP_BREAK_ON_SEMICOLON
+.It Dv FIGPAR_BREAK_ON_SEMICOLON
A semicolon
.Pq Ql Li \;
is normally considered part of the value.
This flag enables terminating the value at the semicolon.
Also allows multiple statements on a single line separated by semicolon.
-.It Dv FP_CASE_SENSITIVE
+.It Dv FIGPAR_CASE_SENSITIVE
Normally directives are matched case insensitively using
.Xr fnmatch 3 .
This flag enables directive matching to be case sensitive.
-.It Dv FP_REQUIRE_EQUALS
+.It Dv FIGPAR_REQUIRE_EQUALS
If a directive is not followed by an equals, processing is aborted.
-.It Dv FP_STRICT_EQUALS
+.It Dv FIGPAR_STRICT_EQUALS
Equals must be part of the directive to be considered a delimiter between
directive and value.
.El
@@ -163,14 +163,14 @@ struct array pointer can be NULL and every directive will invoke the
.Fn unknown
function argument.
.Pp
-The directive for each fp_config item in the
+The directive for each figpar_config item in the
.Fn parse_config
options argument is matched against each parsed directive using
.Xr fnmatch 3
until a match is found.
If a match is found, the
.Fn action
-function for that fp_config directive is invoked with the line number,
+function for that figpar_config directive is invoked with the line number,
directive, and value.
Otherwise if no match, the
.Fn unknown
@@ -192,11 +192,11 @@ or if no match a pointer to a static dummy struct is returned
.Pq whose values are all zero or NULL .
.Pp
The use of
-.Fa "struct fp_config"
+.Fa "struct figpar_config"
is entirely optional as-is the use of
-.Fa "enum fp_cfgtype"
+.Fa "enum figpar_cfgtype"
or
-.Fa "union fp_cfgvalue" .
+.Fa "union figpar_cfgvalue" .
For example, you could choose to pass a NULL pointer to
.Fn parse_config
for the first argument and then provide a simple
diff --git a/lib/libfigpar/figpar.c b/lib/libfigpar/figpar.c
index a97fc85..0a727ff 100644
--- a/lib/libfigpar/figpar.c
+++ b/lib/libfigpar/figpar.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2002-2014 Devin Teske <dteske@FreeBSD.org>
+ * Copyright (c) 2002-2015 Devin Teske <dteske@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,24 +40,25 @@ __FBSDID("$FreeBSD$");
#include "figpar.h"
#include "string_m.h"
-struct fp_config fp_dummy_config = {0, NULL, {0}, NULL};
+struct figpar_config figpar_dummy_config = {0, NULL, {0}, NULL};
/*
- * Search for config option (struct fp_config) in the array of config options,
- * returning the struct whose directive matches the given parameter. If no
- * match is found, a pointer to the static dummy array (above) is returned.
+ * Search for config option (struct figpar_config) in the array of config
+ * options, returning the struct whose directive matches the given parameter.
+ * If no match is found, a pointer to the static dummy array (above) is
+ * returned.
*
* This is to eliminate dependency on the index position of an item in the
* array, since the index position is more apt to be changed as code grows.
*/
-struct fp_config *
-get_config_option(struct fp_config options[], const char *directive)
+struct figpar_config *
+get_config_option(struct figpar_config options[], const char *directive)
{
uint32_t n;
/* Check arguments */
if (options == NULL || directive == NULL)
- return (&fp_dummy_config);
+ return (&figpar_dummy_config);
/* Loop through the array, return the index of the first match */
for (n = 0; options[n].directive != NULL; n++)
@@ -65,12 +66,12 @@ get_config_option(struct fp_config options[], const char *directive)
return (&(options[n]));
/* Re-initialize the dummy variable in case it was written to */
- fp_dummy_config.directive = NULL;
- fp_dummy_config.type = 0;
- fp_dummy_config.action = NULL;
- fp_dummy_config.value.u_num = 0;
+ figpar_dummy_config.directive = NULL;
+ figpar_dummy_config.type = 0;
+ figpar_dummy_config.action = NULL;
+ figpar_dummy_config.value.u_num = 0;
- return (&fp_dummy_config);
+ return (&figpar_dummy_config);
}
/*
@@ -84,9 +85,9 @@ get_config_option(struct fp_config options[], const char *directive)
* Returns zero on success; otherwise returns -1 and errno should be consulted.
*/
int
-parse_config(struct fp_config options[], const char *path,
- int (*unknown)(struct fp_config *option, uint32_t line, char *directive,
- char *value), uint16_t processing_options)
+parse_config(struct figpar_config options[], const char *path,
+ int (*unknown)(struct figpar_config *option, uint32_t line,
+ char *directive, char *value), uint16_t processing_options)
{
uint8_t bequals;
uint8_t bsemicolon;
@@ -119,11 +120,15 @@ parse_config(struct fp_config options[], const char *path,
return (-1);
/* Processing options */
- bequals = (processing_options & FP_BREAK_ON_EQUALS) == 0 ? 0 : 1;
- bsemicolon = (processing_options & FP_BREAK_ON_SEMICOLON) == 0 ? 0 : 1;
- case_sensitive = (processing_options & FP_CASE_SENSITIVE) == 0 ? 0 : 1;
- require_equals = (processing_options & FP_REQUIRE_EQUALS) == 0 ? 0 : 1;
- strict_equals = (processing_options & FP_STRICT_EQUALS) == 0 ? 0 : 1;
+ bequals = (processing_options & FIGPAR_BREAK_ON_EQUALS) == 0 ? 0 : 1;
+ bsemicolon =
+ (processing_options & FIGPAR_BREAK_ON_SEMICOLON) == 0 ? 0 : 1;
+ case_sensitive =
+ (processing_options & FIGPAR_CASE_SENSITIVE) == 0 ? 0 : 1;
+ require_equals =
+ (processing_options & FIGPAR_REQUIRE_EQUALS) == 0 ? 0 : 1;
+ strict_equals =
+ (processing_options & FIGPAR_STRICT_EQUALS) == 0 ? 0 : 1;
/* Initialize strings */
directive = value = 0;
diff --git a/lib/libfigpar/figpar.h b/lib/libfigpar/figpar.h
index 16f825a..f2dc45b 100644
--- a/lib/libfigpar/figpar.h
+++ b/lib/libfigpar/figpar.h
@@ -1,5 +1,5 @@
/*-
- * Copyright (c) 2002-2014 Devin Teske <dteske@FreeBSD.org>
+ * Copyright (c) 2002-2015 Devin Teske <dteske@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,7 @@
/*
* Union for storing various types of data in a single common container.
*/
-union fp_cfgvalue {
+union figpar_cfgvalue {
void *data; /* Pointer to NUL-terminated string */
char *str; /* Pointer to NUL-terminated string */
char **strarray; /* Pointer to an array of strings */
@@ -46,53 +46,53 @@ union fp_cfgvalue {
/*
* Option types (based on above cfgvalue union)
*/
-enum fp_cfgtype {
- FP_TYPE_NONE = 0x0000, /* for directives with no value */
- FP_TYPE_BOOL = 0x0001, /* boolean */
- FP_TYPE_INT = 0x0002, /* signed 32 bit integer */
- FP_TYPE_UINT = 0x0004, /* unsigned 32 bit integer */
- FP_TYPE_STR = 0x0008, /* string pointer */
- FP_TYPE_STRARRAY = 0x0010, /* string array pointer */
- FP_TYPE_DATA1 = 0x0020, /* void data type-1 (whatever) */
- FP_TYPE_DATA2 = 0x0040, /* void data type-2 (whatever) */
- FP_TYPE_DATA3 = 0x0080, /* void data type-3 (whatever) */
- FP_TYPE_RESERVED1 = 0x0100, /* reserved data type-1 (future) */
- FP_TYPE_RESERVED2 = 0x0200, /* reserved data type-2 (future) */
- FP_TYPE_RESERVED3 = 0x0400, /* reserved data type-3 (future) */
+enum figpar_cfgtype {
+ FIGPAR_TYPE_NONE = 0x0000, /* directives with no value */
+ FIGPAR_TYPE_BOOL = 0x0001, /* boolean */
+ FIGPAR_TYPE_INT = 0x0002, /* signed 32 bit integer */
+ FIGPAR_TYPE_UINT = 0x0004, /* unsigned 32 bit integer */
+ FIGPAR_TYPE_STR = 0x0008, /* string pointer */
+ FIGPAR_TYPE_STRARRAY = 0x0010, /* string array pointer */
+ FIGPAR_TYPE_DATA1 = 0x0020, /* void data type-1 (open) */
+ FIGPAR_TYPE_DATA2 = 0x0040, /* void data type-2 (open) */
+ FIGPAR_TYPE_DATA3 = 0x0080, /* void data type-3 (open) */
+ FIGPAR_TYPE_RESERVED1 = 0x0100, /* reserved data type-1 */
+ FIGPAR_TYPE_RESERVED2 = 0x0200, /* reserved data type-2 */
+ FIGPAR_TYPE_RESERVED3 = 0x0400, /* reserved data type-3 */
};
/*
* Options to parse_config() for processing_options bitmask
*/
-#define FP_BREAK_ON_EQUALS 0x0001 /* stop reading directive at `=' */
-#define FP_BREAK_ON_SEMICOLON 0x0002 /* `;' starts a new line */
-#define FP_CASE_SENSITIVE 0x0004 /* directives are case sensitive */
-#define FP_REQUIRE_EQUALS 0x0008 /* assignment directives only */
-#define FP_STRICT_EQUALS 0x0010 /* `=' must be part of directive */
+#define FIGPAR_BREAK_ON_EQUALS 0x0001 /* stop reading directive at `=' */
+#define FIGPAR_BREAK_ON_SEMICOLON 0x0002 /* `;' starts a new line */
+#define FIGPAR_CASE_SENSITIVE 0x0004 /* directives are case sensitive */
+#define FIGPAR_REQUIRE_EQUALS 0x0008 /* assignment directives only */
+#define FIGPAR_STRICT_EQUALS 0x0010 /* `=' must be part of directive */
/*
* Anatomy of a config file option
*/
-struct fp_config {
- enum fp_cfgtype type; /* Option value type */
+struct figpar_config {
+ enum figpar_cfgtype type; /* Option value type */
const char *directive; /* config file keyword */
- union fp_cfgvalue value; /* NB: set by action */
+ union figpar_cfgvalue value; /* NB: set by action */
/*
* Function pointer; action to be taken when the directive is found
*/
- int (*action)(struct fp_config *option, uint32_t line, char *directive,
- char *value);
+ int (*action)(struct figpar_config *option, uint32_t line,
+ char *directive, char *value);
};
-extern struct fp_config fp_dummy_config;
+extern struct figpar_config figpar_dummy_config;
__BEGIN_DECLS
-int parse_config(struct fp_config _options[],
+int parse_config(struct figpar_config _options[],
const char *_path,
- int (*_unknown)(struct fp_config *_option,
+ int (*_unknown)(struct figpar_config *_option,
uint32_t _line, char *_directive, char *_value),
uint16_t _processing_options);
-struct fp_config *get_config_option(struct fp_config _options[],
+struct figpar_config *get_config_option(struct figpar_config _options[],
const char *_directive);
__END_DECLS
diff --git a/lib/libpam/modules/pam_ssh/Makefile b/lib/libpam/modules/pam_ssh/Makefile
index 886610a..dc86e06 100644
--- a/lib/libpam/modules/pam_ssh/Makefile
+++ b/lib/libpam/modules/pam_ssh/Makefile
@@ -12,6 +12,7 @@ SRCS+= roaming_dummy.c
WARNS?= 3
CFLAGS+= -I${SSHDIR} -include ssh_namespace.h
+SRCS+= ssh_namespace.h
DPADD= ${LIBSSH} ${LIBCRYPTO} ${LIBCRYPT}
LDADD= -lssh -lcrypto -lcrypt
@@ -20,5 +21,3 @@ USEPRIVATELIB= ssh
.include <bsd.lib.mk>
.PATH: ${SSHDIR}
-
-${OBJS} ${POBJS} ${SOBJS}: ssh_namespace.h
OpenPOWER on IntegriCloud