summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-11 11:29:42 +0000
committerpeter <peter@FreeBSD.org>1997-03-11 11:29:42 +0000
commite0e06d68d52707cbac25844a417ab6919613e9eb (patch)
tree21479b686e8fe46544082e319ecfa70f9bd25fc6 /lib
parent53b81178e2d0aa56f51f680543678a3d7ef8aecd (diff)
downloadFreeBSD-src-e0e06d68d52707cbac25844a417ab6919613e9eb.zip
FreeBSD-src-e0e06d68d52707cbac25844a417ab6919613e9eb.tar.gz
Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branch
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/Makefile.inc18
-rw-r--r--lib/libc/gen/crypt.313
-rw-r--r--lib/libc/gen/devname.312
-rw-r--r--lib/libc/gen/devname.c6
-rw-r--r--lib/libc/gen/disklabel.c5
-rw-r--r--lib/libc/gen/fnmatch.37
-rw-r--r--lib/libc/gen/getcap.36
-rw-r--r--lib/libc/gen/getcwd.c162
-rw-r--r--lib/libc/gen/getgrouplist.c10
-rw-r--r--lib/libc/gen/getnetgrent.c4
-rw-r--r--lib/libc/gen/getpwent.c27
-rw-r--r--lib/libc/gen/getvfsbyname.398
-rw-r--r--lib/libc/gen/opendir.c220
-rw-r--r--lib/libc/gen/popen.346
-rw-r--r--lib/libc/gen/popen.c48
-rw-r--r--lib/libc/gen/psignal.36
-rw-r--r--lib/libc/gen/readdir.c21
-rw-r--r--lib/libc/gen/realpath.3125
-rw-r--r--lib/libc/gen/setmode.36
-rw-r--r--lib/libc/gen/sysctl.332
-rw-r--r--lib/libc/gen/syslog.c4
-rw-r--r--lib/libc/i386/gen/_setjmp.S20
-rw-r--r--lib/libc/i386/gen/alloca.S6
-rw-r--r--lib/libc/i386/gen/fabs.S6
-rw-r--r--lib/libc/i386/gen/modf.S7
-rw-r--r--lib/libc/i386/gen/setjmp.S25
-rw-r--r--lib/libc/i386/stdlib/abs.S7
-rw-r--r--lib/libc/i386/string/bzero.S97
-rw-r--r--lib/libc/i386/sys/Ovfork.S16
-rw-r--r--lib/libc/i386/sys/brk.S32
-rw-r--r--lib/libc/i386/sys/cerror.S15
-rw-r--r--lib/libc/i386/sys/exect.S8
-rw-r--r--lib/libc/i386/sys/fork.S8
-rw-r--r--lib/libc/i386/sys/mount.S8
-rw-r--r--lib/libc/i386/sys/pipe.S8
-rw-r--r--lib/libc/i386/sys/ptrace.S17
-rw-r--r--lib/libc/i386/sys/reboot.S8
-rw-r--r--lib/libc/i386/sys/sbrk.S30
-rw-r--r--lib/libc/i386/sys/setlogin.S17
-rw-r--r--lib/libc/i386/sys/sigpending.S8
-rw-r--r--lib/libc/i386/sys/sigprocmask.S8
-rw-r--r--lib/libc/i386/sys/sigreturn.S8
-rw-r--r--lib/libc/i386/sys/sigsuspend.S6
-rw-r--r--lib/libc/i386/sys/syscall.S10
-rw-r--r--lib/libc/stdio/ftell.c4
-rw-r--r--lib/libc/stdio/local.h34
-rw-r--r--lib/libc/stdlib/Makefile.inc6
-rw-r--r--lib/libc/stdlib/atexit.c4
-rw-r--r--lib/libc/stdlib/atexit.h4
-rw-r--r--lib/libc/stdlib/getopt.334
-rw-r--r--lib/libc/stdlib/getopt.c10
-rw-r--r--lib/libc/stdlib/radixsort.c6
-rw-r--r--lib/libc/stdlib/random.c99
-rw-r--r--lib/libc/string/strmode.36
-rw-r--r--lib/libc/string/strmode.c7
-rw-r--r--lib/libc/sys/Makefile.inc6
-rw-r--r--lib/libc/sys/brk.215
-rw-r--r--lib/libc/sys/chflags.215
-rw-r--r--lib/libc/sys/execve.221
-rw-r--r--lib/libc/sys/getdirentries.212
-rw-r--r--lib/libc/sys/getfsstat.274
-rw-r--r--lib/libc/sys/getitimer.27
-rw-r--r--lib/libc/sys/getsockopt.26
-rw-r--r--lib/libc/sys/gettimeofday.212
-rw-r--r--lib/libc/sys/intro.214
-rw-r--r--lib/libc/sys/mmap.232
-rw-r--r--lib/libc/sys/mount.261
-rw-r--r--lib/libc/sys/msync.221
-rw-r--r--lib/libc/sys/munmap.28
-rw-r--r--lib/libc/sys/quotactl.26
-rw-r--r--lib/libc/sys/sigaltstack.210
-rw-r--r--lib/libc/sys/sigsuspend.26
-rw-r--r--lib/libc/sys/stat.214
-rw-r--r--lib/libc/sys/statfs.285
-rw-r--r--lib/libc/sys/undelete.2105
75 files changed, 1333 insertions, 662 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 28fa723..b24f7da 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -1,4 +1,4 @@
-# @(#)Makefile.inc 8.3 (Berkeley) 4/16/94
+# @(#)Makefile.inc 8.6 (Berkeley) 5/4/95
# machine-independent gen sources
.PATH: ${.CURDIR}/${MACHINE}/gen ${.CURDIR}/gen
@@ -8,10 +8,10 @@ SRCS+= alarm.c assert.c clock.c closedir.c confstr.c crypt.c ctermid.c \
exec.c fnmatch.c frexp.c fstab.c fts.c getbsize.c getcap.c getcwd.c \
getgrent.c getgrouplist.c gethostname.c getloadavg.c getlogin.c \
getmntinfo.c getnetgrent.c getpagesize.c getpass.c getpwent.c \
- getttyent.c getusershell.c glob.c initgroups.c isatty.c nice.c nlist.c \
- opendir.c pause.c popen.c psignal.c pwcache.c raise.c readdir.c \
- rewinddir.c scandir.c seekdir.c sethostname.c setjmperr.c \
- setmode.c siginterrupt.c siglist.c signal.c sigsetjmp.c \
+ getttyent.c getusershell.c getvfsbyname.c glob.c initgroups.c isatty.c \
+ nice.c nlist.c opendir.c pause.c popen.c psignal.c pwcache.c raise.c \
+ readdir.c rewinddir.c scandir.c seekdir.c sethostname.c setjmperr.c \
+ setmode.c siginterrupt.c siglist.c signal.c \
sigsetops.c sleep.c sysconf.c sysctl.c syslog.c telldir.c \
termios.c time.c times.c timezone.c ttyname.c ttyslot.c ualarm.c \
uname.c unvis.c usleep.c utime.c valloc.c vis.c wait.c wait3.c \
@@ -33,10 +33,10 @@ MAN3+= alarm.0 clock.0 confstr.0 crypt.0 ctermid.0 ctime.0 daemon.0 \
getbsize.0 getcap.0 getcwd.0 getdiskbyname.0 getfsent.0 \
getgrent.0 getgrouplist.0 gethostname.0 getloadavg.0 \
getmntinfo.0 getnetgrent.0 getpagesize.0 getpass.0 getpwent.0 \
- getttyent.0 getusershell.0 glob.0 initgroups.0 isinf.0 ldexp.0 \
- modf.0 nice.0 nlist.0 pause.0 popen.0 psignal.0 pwcache.0 \
- raise.0 scandir.0 setjmp.0 setmode.0 siginterrupt.0 signal.0 \
- sigsetops.0 sleep.0 sysconf.0 sysctl.0 syslog.0 tcgetpgrp.0 \
+ getttyent.0 getusershell.0 getvfsbyname.0 glob.0 initgroups.0 isinf.0 \
+ ldexp.0 modf.0 nice.0 nlist.0 pause.0 popen.0 psignal.0 pwcache.0 \
+ raise.0 realpath.0 scandir.0 setjmp.0 setmode.0 siginterrupt.0 \
+ signal.0 sigsetops.0 sleep.0 sysconf.0 sysctl.0 syslog.0 tcgetpgrp.0 \
tcsendbreak.0 tcsetattr.0 tcsetpgrp.0 time.0 times.0 timezone.0 \
ttyname.0 tzset.0 ualarm.0 uname.0 unvis.0 usleep.0 utime.0 \
valloc.0 vis.0
diff --git a/lib/libc/gen/crypt.3 b/lib/libc/gen/crypt.3
index 67ec98d..7ecf0cf 100644
--- a/lib/libc/gen/crypt.3
+++ b/lib/libc/gen/crypt.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)crypt.3 8.2 (Berkeley) 12/11/93
+.\" @(#)crypt.3 8.1.1.1 (Berkeley) 8/18/93
.\"
-.Dd December 11, 1993
+.Dd August 18, 1993
.Dt CRYPT 3
.Os
.Sh NAME
@@ -161,9 +161,8 @@ If the value of
is 0,
the argument
.Fa block
-is encrypted, otherwise it
-is decrypted.
-The encryption or decryption is returned in the original
+is encrypted, otherwise it fails.
+The encryption is returned in the original
array
.Fa block
after using the
@@ -189,9 +188,7 @@ significant bit in each character is ignored and the next 7 bits of each
character are concatenated to yield a 56-bit key.
The function
.Fn des_cipher
-encrypts (or decrypts if
-.Fa count
-is negative) the 64-bits stored in the 8 characters at
+encrypts the 64-bits stored in the 8 characters at
.Fa in
using
.Xr abs 3
diff --git a/lib/libc/gen/devname.3 b/lib/libc/gen/devname.3
index 7583bb4..49fcc78 100644
--- a/lib/libc/gen/devname.3
+++ b/lib/libc/gen/devname.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)devname.3 8.1 (Berkeley) 6/4/93
+.\" @(#)devname.3 8.2 (Berkeley) 4/29/95
.\"
-.Dd June 4, 1993
+.Dd April 29, 1995
.Dt DEVNAME 3
.Os BSD 4.4
.Sh NAME
@@ -53,9 +53,11 @@ and a file type matching the one encoded in
.Fa type
which must be one of S_IFBLK or S_IFCHR.
If no device matches the specified values, or no information is
-available, the string
-.Dq ??
-is returned.
+available, NULL is returned.
+.Pp
+The traditional display for applications when no device is
+found is the string
+.Dq ?? .
.Sh SEE ALSO
.Xr stat 2 ,
.Xr dev_mkdb 8
diff --git a/lib/libc/gen/devname.c b/lib/libc/gen/devname.c
index 3929f92..39178fe 100644
--- a/lib/libc/gen/devname.c
+++ b/lib/libc/gen/devname.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)devname.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)devname.c 8.2 (Berkeley) 4/29/95";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -64,7 +64,7 @@ devname(dev, type)
failure = 1;
}
if (failure)
- return ("??");
+ return (NULL);
/*
* Keys are a mode_t followed by a dev_t. The former is the type of
@@ -76,5 +76,5 @@ devname(dev, type)
bkey.type = type;
key.data = &bkey;
key.size = sizeof(bkey);
- return ((db->get)(db, &key, &data, 0) ? "??" : (char *)data.data);
+ return ((db->get)(db, &key, &data, 0) ? NULL : (char *)data.data);
}
diff --git a/lib/libc/gen/disklabel.c b/lib/libc/gen/disklabel.c
index cc4c3df..eaefbab 100644
--- a/lib/libc/gen/disklabel.c
+++ b/lib/libc/gen/disklabel.c
@@ -32,12 +32,13 @@
*/
#ifndef lint
-static char sccsid[] = "@(#)disklabel.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 5/3/95";
#endif /* not lint */
#include <sys/param.h>
#define DKTYPENAMES
#include <sys/disklabel.h>
+#include <ufs/ufs/dinode.h>
#include <ufs/ffs/fs.h>
#include <errno.h>
@@ -62,7 +63,7 @@ getdiskbyname(name)
char *cp, *cq; /* can't be register */
char p, max, psize[3], pbsize[3],
pfsize[3], poffset[3], ptype[3];
- u_long *dx;
+ u_int32_t *dx;
if (cgetent(&buf, db_array, (char *) name) < 0)
return NULL;
diff --git a/lib/libc/gen/fnmatch.3 b/lib/libc/gen/fnmatch.3
index 5d5dfd5..3b87da1 100644
--- a/lib/libc/gen/fnmatch.3
+++ b/lib/libc/gen/fnmatch.3
@@ -31,9 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)fnmatch.3 8.2 (Berkeley) 4/16/94
+.\" @(#)fnmatch.3 8.3 (Berkeley) 4/28/95
.\"
-.Dd April 16, 1994
+.Dd April 28, 1995
.Dt FNMATCH 3
.Os
.Sh NAME
@@ -107,8 +107,7 @@ otherwise, it returns the value
.Sh SEE ALSO
.Xr sh 1 ,
.Xr glob 3 ,
-.Xr regex 3 ,
-.Xr wordexp 3
+.Xr regex 3
.Sh STANDARDS
The
.Fn fnmatch
diff --git a/lib/libc/gen/getcap.3 b/lib/libc/gen/getcap.3
index c423a98..f8fcc81 100644
--- a/lib/libc/gen/getcap.3
+++ b/lib/libc/gen/getcap.3
@@ -32,9 +32,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getcap.3 8.3 (Berkeley) 4/19/94
+.\" @(#)getcap.3 8.4 (Berkeley) 5/13/94
.\"
-.Dd "April 19, 1994"
+.Dd "May 13, 1994"
.Dt GETCAP 3
.Os
.Sh NAME
@@ -73,7 +73,7 @@
.Fn cgetclose "void"
.Sh DESCRIPTION
.Fn Cgetent
-extracts the capability rec
+extracts the capability
.Fa name
from the database specified by the
.Dv NULL
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c
index 4797f7c..90ecfd7 100644
--- a/lib/libc/gen/getcwd.c
+++ b/lib/libc/gen/getcwd.c
@@ -1,7 +1,10 @@
/*
- * Copyright (c) 1989, 1991, 1993
+ * Copyright (c) 1989, 1991, 1993, 1995
* The Regents of the University of California. All rights reserved.
*
+ * This code is derived from software contributed to Berkeley by
+ * Jan-Simon Pendry.
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -32,19 +35,22 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getcwd.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)getcwd.c 8.5 (Berkeley) 2/7/95";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/stat.h>
-#include <errno.h>
#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+static char *getcwd_physical __P((char *, size_t));
+
#define ISDOT(dp) \
(dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
dp->d_name[1] == '.' && dp->d_name[2] == '\0'))
@@ -54,6 +60,154 @@ getcwd(pt, size)
char *pt;
size_t size;
{
+ char *pwd;
+ size_t pwdlen;
+ dev_t dev;
+ ino_t ino;
+ struct stat s;
+
+ /* Check $PWD -- if it's right, it's fast. */
+ if ((pwd = getenv("PWD")) != NULL && pwd[0] == '/' && !stat(pwd, &s)) {
+ dev = s.st_dev;
+ ino = s.st_ino;
+ if (!stat(".", &s) && dev == s.st_dev && ino == s.st_ino) {
+ pwdlen = strlen(pwd);
+ if (size != 0) {
+ if (pwdlen + 1 > size) {
+ errno = ERANGE;
+ return (NULL);
+ }
+ } else if ((pt = malloc(pwdlen + 1)) == NULL)
+ return (NULL);
+ memmove(pt, pwd, pwdlen);
+ pt[pwdlen] = '\0';
+ return (pt);
+ }
+ }
+
+ return (getcwd_physical(pt, size));
+}
+
+/*
+ * char *realpath(const char *path, char resolved_path[MAXPATHLEN]);
+ *
+ * Find the real name of path, by removing all ".", ".." and symlink
+ * components. Returns (resolved) on success, or (NULL) on failure,
+ * in which case the path which caused trouble is left in (resolved).
+ */
+char *
+realpath(path, resolved)
+ const char *path;
+ char *resolved;
+{
+ struct stat sb;
+ int fd, n, rootd, serrno;
+ char *p, *q, wbuf[MAXPATHLEN];
+
+ /* Save the starting point. */
+ if ((fd = open(".", O_RDONLY)) < 0) {
+ (void)strcpy(resolved, ".");
+ return (NULL);
+ }
+
+ /*
+ * Find the dirname and basename from the path to be resolved.
+ * Change directory to the dirname component.
+ * lstat the basename part.
+ * if it is a symlink, read in the value and loop.
+ * if it is a directory, then change to that directory.
+ * get the current directory name and append the basename.
+ */
+ (void)strncpy(resolved, path, MAXPATHLEN - 1);
+ resolved[MAXPATHLEN - 1] = '\0';
+loop:
+ q = strrchr(resolved, '/');
+ if (q != NULL) {
+ p = q + 1;
+ if (q == resolved)
+ q = "/";
+ else {
+ do {
+ --q;
+ } while (q > resolved && *q == '/');
+ q[1] = '\0';
+ q = resolved;
+ }
+ if (chdir(q) < 0)
+ goto err1;
+ } else
+ p = resolved;
+
+ /* Deal with the last component. */
+ if (lstat(p, &sb) == 0) {
+ if (S_ISLNK(sb.st_mode)) {
+ n = readlink(p, resolved, MAXPATHLEN);
+ if (n < 0)
+ goto err1;
+ resolved[n] = '\0';
+ goto loop;
+ }
+ if (S_ISDIR(sb.st_mode)) {
+ if (chdir(p) < 0)
+ goto err1;
+ p = "";
+ }
+ }
+
+ /*
+ * Save the last component name and get the full pathname of
+ * the current directory.
+ */
+ (void)strcpy(wbuf, p);
+
+ /*
+ * Call the inernal internal version of getcwd which
+ * does a physical search rather than using the $PWD short-cut
+ */
+ if (getcwd_physical(resolved, MAXPATHLEN) == 0)
+ goto err1;
+
+ /*
+ * Join the two strings together, ensuring that the right thing
+ * happens if the last component is empty, or the dirname is root.
+ */
+ if (resolved[0] == '/' && resolved[1] == '\0')
+ rootd = 1;
+ else
+ rootd = 0;
+
+ if (*wbuf) {
+ if (strlen(resolved) + strlen(wbuf) + rootd + 1 > MAXPATHLEN) {
+ errno = ENAMETOOLONG;
+ goto err1;
+ }
+ if (rootd == 0)
+ (void)strcat(resolved, "/");
+ (void)strcat(resolved, wbuf);
+ }
+
+ /* Go back to where we came from. */
+ if (fchdir(fd) < 0) {
+ serrno = errno;
+ goto err2;
+ }
+
+ /* It's okay if the close fails, what's an fd more or less? */
+ (void)close(fd);
+ return (resolved);
+
+err1: serrno = errno;
+ (void)fchdir(fd);
+err2: (void)close(fd);
+ errno = serrno;
+ return (NULL);
+}
+
+static char *
+getcwd_physical(pt, size)
+ char *pt;
+ size_t size;
+{
register struct dirent *dp;
register DIR *dir;
register dev_t dev;
@@ -90,7 +244,7 @@ getcwd(pt, size)
/*
* Allocate bytes (1024 - malloc space) for the string of "../"'s.
* Should always be enough (it's 340 levels). If it's not, allocate
- * as necessary. Special * case the first stat, it's ".", not "..".
+ * as necessary. Special case the first stat, it's ".", not "..".
*/
if ((up = malloc(upsize = 1024 - 4)) == NULL)
goto err;
diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c
index 34ab4ea..daab7f5 100644
--- a/lib/libc/gen/getgrouplist.c
+++ b/lib/libc/gen/getgrouplist.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getgrouplist.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94";
#endif /* LIBC_SCCS and not lint */
/*
@@ -72,12 +72,12 @@ getgrouplist(uname, agroup, groups, grpcnt)
while (grp = getgrent()) {
if (grp->gr_gid == agroup)
continue;
- if (ngroups >= maxgroups) {
- ret = -1;
- break;
- }
for (i = 0; grp->gr_mem[i]; i++) {
if (!strcmp(grp->gr_mem[i], uname)) {
+ if (ngroups >= maxgroups) {
+ ret = -1;
+ break;
+ }
groups[ngroups++] = grp->gr_gid;
break;
}
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c
index cc70c96..b34b78b 100644
--- a/lib/libc/gen/getnetgrent.c
+++ b/lib/libc/gen/getnetgrent.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getnetgrent.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)getnetgrent.c 8.2 (Berkeley) 4/27/95";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -248,6 +248,8 @@ parse_netgrp(group)
if (parse_netgrp(spos))
return (1);
}
+ if (pos == NULL)
+ break;
while (*pos == ' ' || *pos == ',' || *pos == '\t')
pos++;
}
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 1da045e..155ba56 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getpwent.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)getpwent.c 8.2 (Berkeley) 4/27/95";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -47,6 +47,11 @@ static char sccsid[] = "@(#)getpwent.c 8.1 (Berkeley) 6/4/93";
#include <string.h>
#include <limits.h>
+/*
+ * The lookup techniques and data extraction code here must be kept
+ * in sync with that in `pwd_mkdb'.
+ */
+
static struct passwd _pw_passwd; /* password structure */
static DB *_pw_db; /* password database */
static int _pw_keynum; /* key counter */
@@ -96,12 +101,8 @@ getpwnam(name)
}
struct passwd *
-#ifdef __STDC__
-getpwuid(uid_t uid)
-#else
getpwuid(uid)
- int uid;
-#endif
+ uid_t uid;
{
DBT key;
int keyuid, rval;
@@ -181,21 +182,19 @@ __hashpw(key)
if (data.size > max && !(line = realloc(line, max += 1024)))
return(0);
+ /* THIS CODE MUST MATCH THAT IN pwd_mkdb. */
t = line;
#define EXPAND(e) e = t; while (*t++ = *p++);
+#define SCALAR(v) memmove(&(v), p, sizeof v); p += sizeof v
EXPAND(_pw_passwd.pw_name);
EXPAND(_pw_passwd.pw_passwd);
- bcopy(p, (char *)&_pw_passwd.pw_uid, sizeof(int));
- p += sizeof(int);
- bcopy(p, (char *)&_pw_passwd.pw_gid, sizeof(int));
- p += sizeof(int);
- bcopy(p, (char *)&_pw_passwd.pw_change, sizeof(time_t));
- p += sizeof(time_t);
+ SCALAR(_pw_passwd.pw_uid);
+ SCALAR(_pw_passwd.pw_gid);
+ SCALAR(_pw_passwd.pw_change);
EXPAND(_pw_passwd.pw_class);
EXPAND(_pw_passwd.pw_gecos);
EXPAND(_pw_passwd.pw_dir);
EXPAND(_pw_passwd.pw_shell);
- bcopy(p, (char *)&_pw_passwd.pw_expire, sizeof(time_t));
- p += sizeof(time_t);
+ SCALAR(_pw_passwd.pw_expire);
return(1);
}
diff --git a/lib/libc/gen/getvfsbyname.3 b/lib/libc/gen/getvfsbyname.3
new file mode 100644
index 0000000..746d4df
--- /dev/null
+++ b/lib/libc/gen/getvfsbyname.3
@@ -0,0 +1,98 @@
+.\" Copyright (c) 1995
+.\" The Regents of the University of California. 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 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.
+.\"
+.\" @(#)kvm_getvfsbyname.3 8.3 (Berkeley) 5/4/95
+.\"
+.Dd May 4, 1995
+.Dt GETVFSBYNAME 3
+.Os
+.Sh NAME
+.Nm getvfsbyname
+.Nd get information about a filesystem
+.Sh SYNOPSIS
+.Fd #include <sys/types.h>
+.Fd #include <sys/mount.h>
+.Fd #include <kvm.h>
+.br
+.Ft int
+.Fn getvfsbyname "const char *name" "struct vfsconf *vfc"
+.Sh DESCRIPTION
+The
+.Fn getvfsbyname
+function provides access to information about a
+filesystem module that is configured in the kernel.
+If successful,
+the requested filesystem
+.Fa vfsconf
+is returned in the location pointed to by
+.Nm vfc .
+The fields in a
+.Dq Li struct vfsconf
+are defined as follows:
+.Pp
+.Bl -tag -compact -width vfc_refcount
+.It vfc_name
+the name of the filesystem
+.It vfc_typenum
+the filesystem type number assigned by the kernel
+.It vfc_refcount
+the number of active mount points using the filesystem
+.It vfc_flags
+flag bits that are used to initialize a new mount point
+using the filesystem
+.El
+.Sh RETURN VALUES
+If the call to
+.Nm getvfsbyname
+is successful, 0 is returned.
+Otherwise \-1 is returned and
+.Va errno
+is set appropriately.
+.Sh ERRORS
+The following errors may be reported:
+.Bl -tag -width Er
+.It Bq Er EFAULT
+The
+.Fa vfc
+pointer contains an invalid address.
+.It Bq Er ENOENT
+The
+.Fa name
+specifies a filesystem that is unknown or not configured in the kernel.
+.Sh SEE ALSO
+.Xr sysctl 1 ,
+.Xr mount 2 ,
+.Xr sysctl 3 ,
+.Xr mount 8
+.Sh HISTORY
+A variant of the
+.Fn getvfsbyname
+function first appeared in FreeBSD 2.0.
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index 83e041d..9c2b0ad 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -32,56 +32,234 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)opendir.c 8.2 (Berkeley) 2/12/94";
+static char sccsid[] = "@(#)opendir.c 8.8 (Berkeley) 5/1/95";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/stat.h>
#include <dirent.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
/*
- * open a directory.
+ * Open a directory.
*/
DIR *
opendir(name)
const char *name;
{
- register DIR *dirp;
- register int fd;
- if ((fd = open(name, 0)) == -1)
- return NULL;
+ return (__opendir2(name, DTF_HIDEW|DTF_NODUP));
+}
+
+DIR *
+__opendir2(name, flags)
+ const char *name;
+ int flags;
+{
+ DIR *dirp;
+ int fd;
+ int incr;
+ int unionstack;
+ struct stat statb;
+
+ if ((fd = open(name, O_RDONLY)) == -1)
+ return (NULL);
+ if (fstat(fd, &statb) || !S_ISDIR(statb.st_mode)) {
+ errno = ENOTDIR;
+ close(fd);
+ return (NULL);
+ }
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 ||
(dirp = (DIR *)malloc(sizeof(DIR))) == NULL) {
- close (fd);
- return NULL;
+ close(fd);
+ return (NULL);
}
+
/*
* If CLBYTES is an exact multiple of DIRBLKSIZ, use a CLBYTES
* buffer that it cluster boundary aligned.
- * Hopefully this can be a big win someday by allowing page trades
- * to user space to be done by getdirentries()
+ * Hopefully this can be a big win someday by allowing page
+ * trades to user space to be done by getdirentries()
*/
- if ((CLBYTES % DIRBLKSIZ) == 0) {
- dirp->dd_buf = malloc(CLBYTES);
- dirp->dd_len = CLBYTES;
+ if ((CLBYTES % DIRBLKSIZ) == 0)
+ incr = CLBYTES;
+ else
+ incr = DIRBLKSIZ;
+
+ /*
+ * Determine whether this directory is the top of a union stack.
+ */
+ if (flags & DTF_NODUP) {
+ struct statfs sfb;
+
+ if (fstatfs(fd, &sfb) < 0) {
+ free(dirp);
+ close(fd);
+ return (NULL);
+ }
+ unionstack = !strcmp(sfb.f_fstypename, "union");
} else {
- dirp->dd_buf = malloc(DIRBLKSIZ);
- dirp->dd_len = DIRBLKSIZ;
+ unionstack = 0;
}
- if (dirp->dd_buf == NULL) {
- close (fd);
- return NULL;
+
+ if (unionstack) {
+ int len = 0;
+ int space = 0;
+ char *buf = 0;
+ char *ddptr = 0;
+ char *ddeptr;
+ int n;
+ struct dirent **dpv;
+
+ /*
+ * The strategy here is to read all the directory
+ * entries into a buffer, sort the buffer, and
+ * remove duplicate entries by setting the inode
+ * number to zero.
+ */
+
+ do {
+ /*
+ * Always make at least DIRBLKSIZ bytes
+ * available to getdirentries
+ */
+ if (space < DIRBLKSIZ) {
+ space += incr;
+ len += incr;
+ buf = realloc(buf, len);
+ if (buf == NULL) {
+ free(dirp);
+ close(fd);
+ return (NULL);
+ }
+ ddptr = buf + (len - space);
+ }
+
+ n = getdirentries(fd, ddptr, space, &dirp->dd_seek);
+ if (n > 0) {
+ ddptr += n;
+ space -= n;
+ }
+ } while (n > 0);
+
+ ddeptr = ddptr;
+ flags |= __DTF_READALL;
+
+ /*
+ * Re-open the directory.
+ * This has the effect of rewinding back to the
+ * top of the union stack and is needed by
+ * programs which plan to fchdir to a descriptor
+ * which has also been read -- see fts.c.
+ */
+ if (flags & DTF_REWIND) {
+ (void) close(fd);
+ if ((fd = open(name, O_RDONLY)) == -1) {
+ free(buf);
+ free(dirp);
+ return (NULL);
+ }
+ }
+
+ /*
+ * There is now a buffer full of (possibly) duplicate
+ * names.
+ */
+ dirp->dd_buf = buf;
+
+ /*
+ * Go round this loop twice...
+ *
+ * Scan through the buffer, counting entries.
+ * On the second pass, save pointers to each one.
+ * Then sort the pointers and remove duplicate names.
+ */
+ for (dpv = 0;;) {
+ n = 0;
+ ddptr = buf;
+ while (ddptr < ddeptr) {
+ struct dirent *dp;
+
+ dp = (struct dirent *) ddptr;
+ if ((int)dp & 03)
+ break;
+ if ((dp->d_reclen <= 0) ||
+ (dp->d_reclen > (ddeptr + 1 - ddptr)))
+ break;
+ ddptr += dp->d_reclen;
+ if (dp->d_fileno) {
+ if (dpv)
+ dpv[n] = dp;
+ n++;
+ }
+ }
+
+ if (dpv) {
+ struct dirent *xp;
+
+ /*
+ * This sort must be stable.
+ */
+ mergesort(dpv, n, sizeof(*dpv), alphasort);
+
+ dpv[n] = NULL;
+ xp = NULL;
+
+ /*
+ * Scan through the buffer in sort order,
+ * zapping the inode number of any
+ * duplicate names.
+ */
+ for (n = 0; dpv[n]; n++) {
+ struct dirent *dp = dpv[n];
+
+ if ((xp == NULL) ||
+ strcmp(dp->d_name, xp->d_name)) {
+ xp = dp;
+ } else {
+ dp->d_fileno = 0;
+ }
+ if (dp->d_type == DT_WHT &&
+ (flags & DTF_HIDEW))
+ dp->d_fileno = 0;
+ }
+
+ free(dpv);
+ break;
+ } else {
+ dpv = malloc((n+1) * sizeof(struct dirent *));
+ if (dpv == NULL)
+ break;
+ }
+ }
+
+ dirp->dd_len = len;
+ dirp->dd_size = ddptr - dirp->dd_buf;
+ } else {
+ dirp->dd_len = incr;
+ dirp->dd_buf = malloc(dirp->dd_len);
+ if (dirp->dd_buf == NULL) {
+ free(dirp);
+ close (fd);
+ return (NULL);
+ }
+ dirp->dd_seek = 0;
+ flags &= ~DTF_REWIND;
}
- dirp->dd_fd = fd;
+
dirp->dd_loc = 0;
- dirp->dd_seek = 0;
+ dirp->dd_fd = fd;
+ dirp->dd_flags = flags;
+
/*
* Set up seek point for rewinddir.
*/
dirp->dd_rewind = telldir(dirp);
- return dirp;
+
+ return (dirp);
}
diff --git a/lib/libc/gen/popen.3 b/lib/libc/gen/popen.3
index 6f89a5c..9ca1bb3 100644
--- a/lib/libc/gen/popen.3
+++ b/lib/libc/gen/popen.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)popen.3 8.1 (Berkeley) 6/4/93
+.\" @(#)popen.3 8.2 (Berkeley) 5/3/95
.\"
-.Dd June 4, 1993
+.Dd May 3, 1995
.Dt POPEN 3
.Os
.Sh NAME
@@ -50,13 +50,32 @@ The
.Fn popen
function
.Dq opens
-a process by creating a pipe,
+a process by creating an IPC connection,
forking,
and invoking the shell.
-Since a pipe is by definition unidirectional, the
+Historically,
+.Nm popen
+was implemented with a unidirectional pipe;
+hence many implementations of
+.Nm popen
+only allow the
.Fa type
-argument may specify only reading or writing, not both;
-the resulting stream is correspondingly read-only or write-only.
+argument to specify reading or writing, not both.
+Since
+.Nm popen
+is now implemented using sockets, the
+.Fa type
+may request a bidirectional data flow.
+The
+.Fa type
+argument is a pointer to a null-terminated string
+which must be
+.Ql r
+for reading,
+.Ql w
+for writing, or
+.Ql r+
+for reading and writing.
.Pp
The
.Fa command
@@ -67,15 +86,6 @@ This command is passed to
using the
.Fl c
flag; interpretation, if any, is performed by the shell.
-The
-.Fa mode
-argument is a pointer to a null-terminated string
-which must be either
-.Ql r
-for reading
-or
-.Ql w
-for writing.
.Pp
The return value from
.Fn popen
@@ -113,9 +123,10 @@ The
function returns
.Dv NULL
if the
-.Xr fork 2
+.Xr fork 2 ,
+.Xr pipe 2 ,
or
-.Xr pipe 2
+.Xr socketpair 2
calls fail,
or if it cannot allocate memory.
.Pp
@@ -142,6 +153,7 @@ function does not reliably set
.Xr fork 2 ,
.Xr sh 1 ,
.Xr pipe 2 ,
+.Xr socketpair 2 ,
.Xr wait4 2 ,
.Xr fflush 3 ,
.Xr fclose 3 ,
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index 89aba16..3c3bd6f 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -35,11 +35,12 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)popen.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 5/3/95";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/wait.h>
+#include <sys/socket.h>
#include <signal.h>
#include <errno.h>
@@ -56,25 +57,28 @@ static struct pid {
} *pidlist;
FILE *
-popen(program, type)
- const char *program;
- const char *type;
+popen(command, type)
+ const char *command, *type;
{
struct pid *cur;
FILE *iop;
- int pdes[2], pid;
-
- if (*type != 'r' && *type != 'w' || type[1])
- return (NULL);
+ int pdes[2], pid, twoway;
+
+ if (strchr(type, '+')) {
+ twoway = 1;
+ type = "r+";
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, pdes) < 0)
+ return (NULL);
+ } else {
+ twoway = 0;
+ if (*type != 'r' && *type != 'w' || type[1] ||
+ (pipe(pdes) < 0))
+ return (NULL);
+ }
if ((cur = malloc(sizeof(struct pid))) == NULL)
return (NULL);
- if (pipe(pdes) < 0) {
- (void)free(cur);
- return (NULL);
- }
-
switch (pid = vfork()) {
case -1: /* Error. */
(void)close(pdes[0]);
@@ -87,8 +91,11 @@ popen(program, type)
if (pdes[1] != STDOUT_FILENO) {
(void)dup2(pdes[1], STDOUT_FILENO);
(void)close(pdes[1]);
+ pdes[1] = STDOUT_FILENO;
}
(void) close(pdes[0]);
+ if (twoway && (pdes[1] != STDIN_FILENO))
+ (void)dup2(pdes[1], STDIN_FILENO);
} else {
if (pdes[0] != STDIN_FILENO) {
(void)dup2(pdes[0], STDIN_FILENO);
@@ -96,7 +103,7 @@ popen(program, type)
}
(void)close(pdes[1]);
}
- execl(_PATH_BSHELL, "sh", "-c", program, NULL);
+ execl(_PATH_BSHELL, "sh", "-c", command, NULL);
_exit(127);
/* NOTREACHED */
}
@@ -130,11 +137,9 @@ pclose(iop)
{
register struct pid *cur, *last;
int omask;
- union wait pstat;
+ int pstat;
pid_t pid;
- (void)fclose(iop);
-
/* Find the appropriate file pointer. */
for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next)
if (cur->fp == iop)
@@ -142,12 +147,11 @@ pclose(iop)
if (cur == NULL)
return (-1);
- /* Get the status of the process. */
- omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP));
+ (void)fclose(iop);
+
do {
- pid = waitpid(cur->pid, (int *) &pstat, 0);
+ pid = waitpid(cur->pid, &pstat, 0);
} while (pid == -1 && errno == EINTR);
- (void)sigsetmask(omask);
/* Remove the entry from the linked list. */
if (last == NULL)
@@ -156,5 +160,5 @@ pclose(iop)
last->next = cur->next;
free(cur);
- return (pid == -1 ? -1 : pstat.w_status);
+ return (pid == -1 ? -1 : pstat);
}
diff --git a/lib/libc/gen/psignal.3 b/lib/libc/gen/psignal.3
index 4e7cfb8..1fdcbad 100644
--- a/lib/libc/gen/psignal.3
+++ b/lib/libc/gen/psignal.3
@@ -29,14 +29,14 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)psignal.3 8.1 (Berkeley) 6/4/93
+.\" @(#)psignal.3 8.2 (Berkeley) 2/27/95
.\"
-.Dd June 4, 1993
+.Dd February 27, 1995
.Dt PSIGNAL 3
.Os BSD 4.2
.Sh NAME
.Nm psignal ,
-.Nm sys_siglist
+.Nm sys_siglist ,
.Nm sys_signame
.Nd system signal messages
.Sh SYNOPSIS
diff --git a/lib/libc/gen/readdir.c b/lib/libc/gen/readdir.c
index d0651da..2e97661 100644
--- a/lib/libc/gen/readdir.c
+++ b/lib/libc/gen/readdir.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)readdir.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)readdir.c 8.3 (Berkeley) 9/29/94";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -48,25 +48,28 @@ readdir(dirp)
register struct dirent *dp;
for (;;) {
- if (dirp->dd_loc == 0) {
+ if (dirp->dd_loc >= dirp->dd_size) {
+ if (dirp->dd_flags & __DTF_READALL)
+ return (NULL);
+ dirp->dd_loc = 0;
+ }
+ if (dirp->dd_loc == 0 && !(dirp->dd_flags & __DTF_READALL)) {
dirp->dd_size = getdirentries(dirp->dd_fd,
dirp->dd_buf, dirp->dd_len, &dirp->dd_seek);
if (dirp->dd_size <= 0)
- return NULL;
- }
- if (dirp->dd_loc >= dirp->dd_size) {
- dirp->dd_loc = 0;
- continue;
+ return (NULL);
}
dp = (struct dirent *)(dirp->dd_buf + dirp->dd_loc);
if ((int)dp & 03) /* bogus pointer check */
- return NULL;
+ return (NULL);
if (dp->d_reclen <= 0 ||
dp->d_reclen > dirp->dd_len + 1 - dirp->dd_loc)
- return NULL;
+ return (NULL);
dirp->dd_loc += dp->d_reclen;
if (dp->d_ino == 0)
continue;
+ if (dp->d_type == DT_WHT && (dirp->dd_flags & DTF_HIDEW))
+ continue;
return (dp);
}
}
diff --git a/lib/libc/gen/realpath.3 b/lib/libc/gen/realpath.3
new file mode 100644
index 0000000..83f4a43
--- /dev/null
+++ b/lib/libc/gen/realpath.3
@@ -0,0 +1,125 @@
+.\" Copyright (c) 1994
+.\" The Regents of the University of California. All rights reserved.
+.\"
+.\" This code is derived from software contributed to Berkeley by
+.\" Jan-Simon Pendry.
+.\"
+.\" 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 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.
+.\"
+.\" @(#)realpath.3 8.2 (Berkeley) 2/16/94
+.\"
+.Dd "February 16, 1994"
+.Dt REALPATH 3
+.Os
+.Sh NAME
+.Nm realpath
+.Nd returns the canonicalized absolute pathname
+.Sh SYNOPSIS
+.Fd #include <sys/param.h>
+.Fd #include <stdlib.h>
+.Ft "char *"
+.Fn realpath "const char *pathname" "char resolvedname[MAXPATHLEN]"
+.Sh DESCRIPTION
+The
+.Fn realpath
+function resolves all symbolic links, extra
+.Dq /
+characters and references to
+.Pa /./
+and
+.Pa /../
+in
+.Fa pathname ,
+and copies the resulting absolute pathname into
+the memory referenced by
+.Fa resolvedname .
+The
+.Fa resolvedname
+argument
+.Em must
+refer to a buffer capable of storing at least
+.Dv MAXPATHLEN
+characters.
+.Pp
+The
+.Fn realpath
+function will resolve both absolute and relative paths
+and return the absolute pathname corresponding to
+.Fa pathname .
+All but the last component of
+.Fa pathname
+must exist when
+.Fn realpath
+is called.
+.Sh "RETURN VALUES"
+The
+.Fn realpath
+function returns
+.Fa resolved_name
+on success.
+If an error occurs,
+.Fn realpath
+returns
+.Dv NULL ,
+and
+.Fa resolved_name
+contains the pathname which caused the problem.
+.Sh ERRORS
+The function
+.Fn realpath
+may fail and set the external variable
+.Va errno
+for any of the errors specified for the library functions
+.Xr chdir 2 ,
+.Xr close 2 ,
+.Xr fchdir 2 ,
+.Xr lstat 2 ,
+.Xr open 2 ,
+.Xr readlink 2
+and
+.Xr getcwd 3 .
+.Sh CAVEATS
+This implementation of
+.Fn realpath
+differs slightly from the Solaris implementation.
+The
+.Bx 4.4
+version always returns absolute pathnames,
+whereas the Solaris implementation will,
+under certain circumstances, return a relative
+.Fa resolved_path
+when given a relative
+.Fa pathname .
+.Sh "SEE ALSO"
+.Xr getcwd 3
+.Sh HISTORY
+The
+.Fn realpath
+function call first appeared in
+.Bx 4.4 .
diff --git a/lib/libc/gen/setmode.3 b/lib/libc/gen/setmode.3
index b73ea08..04c2a6b 100644
--- a/lib/libc/gen/setmode.3
+++ b/lib/libc/gen/setmode.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)setmode.3 8.1 (Berkeley) 6/9/93
+.\" @(#)setmode.3 8.2 (Berkeley) 4/28/95
.\"
-.Dd June 9, 1993
+.Dd April 28, 1995
.Dt SETMODE 3
.Os
.Sh NAME
@@ -41,7 +41,7 @@
.Sh SYNOPSIS
.Ft mode_t
.Fn getmode "const void *set" "mode_t mode"
-.Ft void
+.Ft void *
.Fn setmode "const char *mode_str"
.Sh DESCRIPTION
The
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index 602b559..5470574 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sysctl.3 8.1 (Berkeley) 6/4/93
+.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95
.\"
-.Dd "June 4, 1993"
+.Dd "May 9, 1995"
.Dt SYSCTL 3
.Os
.Sh NAME
@@ -117,7 +117,7 @@ listed here, and described in separate sections below.
.Bl -column CTLXMACHDEPXXX "Next level namesXXXXXX" -offset indent
.It Sy Pa Name Next level names Description
.It CTL\_DEBUG sys/sysctl.h Debugging
-.It CTL\_FS sys/sysctl.h File system
+.It CTL\_VFS sys/mount.h Filesystem
.It CTL\_HW sys/sysctl.h Generic CPU, I/O
.It CTL\_KERN sys/sysctl.h High kernel limits
.It CTL\_MACHDEP sys/sysctl.h Machine dependent
@@ -176,8 +176,23 @@ as a debugging variable, the following declaration would be used:
int dospecialcheck = 1;
struct ctldebug debug5 = { "dospecialcheck", &dospecialcheck };
.Ed
-.Sh CTL_FS
-There are currently no second level names for the file system.
+.Sh CTL_VFS
+A distinguished second level name, VFS_GENERIC,
+is used to get general information about all filesystems.
+One of its third level identifiers is VFS_MAXTYPENUM
+that gives the highest valid filesystem type number.
+Its other third level identifier is VFS_CONF that
+returns configuration information about the filesystem
+type given as a fourth level identifier (see
+.Xr getvfsbyname 3
+as an example of its use).
+The remaining second level identifiers are the
+filesystem type number returned by a
+.Xr statfs 2
+call or from VFS_CONF.
+The third level identifiers available for each filesystem
+are given in the header file that defines the mount
+argument structure for that filesystem.
.Sh CTL_HW
The string and integer information available for the CTL_HW level
is detailed below.
@@ -203,6 +218,7 @@ The machine class.
The machine model
.It Li HW_NCPU
The number of cpus.
+.ne 1i
.It Li HW_BYTEORDER
The byteorder (4,321, or 1,234).
.It Li HW_PHYSMEM
@@ -256,6 +272,7 @@ information.
.It KERN\_VERSION string no
.It KERN\_VNODE struct vnode no
.El
+.ne 1i
.Pp
.Bl -tag -width "123456"
.It Li KERN_ARGMAX
@@ -371,6 +388,7 @@ describing destination of calls and their counts.
.It Li GPROF_GMONPARAM
Structure giving the sizes of the above arrays.
.El
+.ne 1i
.It Li KERN_SAVED_IDS
Returns 1 if saved set-group and saved set-user ID is available.
.It Li KERN_SECURELVL
@@ -433,6 +451,7 @@ Get or set various global information about the internet protocols.
The third level name is the protocol.
The fourth level name is the variable name.
The currently defined protocols and names are:
+.ne 1i
.Bl -column "Protocol nameXXXXXX" "Variable nameXXX" "integerXXX" -offset indent
.It Pa Protocol name Variable name Type Changeable
.It ip forwarding integer yes
@@ -550,6 +569,7 @@ The version of POSIX 1003.2 with which the system attempts to comply.
.It Li USER_RE_DUP_MAX
The maximum number of repeated occurrences of a regular expression
permitted when using interval notation.
+.ne 1i
.It Li USER_STREAM_MAX
The minimum maximum number of streams that a process may have open
at any one time.
@@ -581,7 +601,7 @@ The returned data consists of a
.Sh RETURN VALUES
If the call to
.Nm sysctl
-is successful, 0 is returned.
+is successful, the number of bytes copied out is returned.
Otherwise \-1 is returned and
.Va errno
is set appropriately.
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index ba82e23..c18c776 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94";
+static char sccsid[] = "@(#)syslog.c 8.5 (Berkeley) 4/29/95";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -109,7 +109,7 @@ vsyslog(pri, fmt, ap)
}
/* Check priority against setlogmask values. */
- if (!LOG_MASK(LOG_PRI(pri)) & LogMask)
+ if (!(LOG_MASK(LOG_PRI(pri)) & LogMask))
return;
saved_errno = errno;
diff --git a/lib/libc/i386/gen/_setjmp.S b/lib/libc/i386/gen/_setjmp.S
index 7aa3e69..47e319a 100644
--- a/lib/libc/i386/gen/_setjmp.S
+++ b/lib/libc/i386/gen/_setjmp.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -35,8 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)_setjmp.s 5.1 (Berkeley) 4/23/90"
- .align 2,0x90
+ .asciz "@(#)_setjmp.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
@@ -45,7 +44,7 @@
* _longjmp(a,v)
* will generate a "return(v)" from the last call to
* _setjmp(a)
- * by restoring registers from the environment 'a'.
+ * by restoring registers from the stack.
* The previous signal state is NOT restored.
*/
@@ -60,8 +59,7 @@ ENTRY(_setjmp)
movl %ebp,12(%eax)
movl %esi,16(%eax)
movl %edi,20(%eax)
- fnstcw 28(%eax)
- xorl %eax,%eax
+ movl $0,%eax
ret
ENTRY(_longjmp)
@@ -73,10 +71,8 @@ ENTRY(_longjmp)
movl 12(%edx),%ebp
movl 16(%edx),%esi
movl 20(%edx),%edi
- fninit
- fldcw 28(%edx)
- testl %eax,%eax
- jnz 1f
- incl %eax
+ cmpl $0,%eax
+ jne 1f
+ movl $1,%eax
1: movl %ecx,0(%esp)
ret
diff --git a/lib/libc/i386/gen/alloca.S b/lib/libc/i386/gen/alloca.S
index 65378f5..a2d6a41 100644
--- a/lib/libc/i386/gen/alloca.S
+++ b/lib/libc/i386/gen/alloca.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)alloca.s 5.2 (Berkeley) 5/14/90"
+ .asciz "@(#)alloca.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/* like alloc, but automatic automatic free in return */
diff --git a/lib/libc/i386/gen/fabs.S b/lib/libc/i386/gen/fabs.S
index 2519e8b..40e72c8 100644
--- a/lib/libc/i386/gen/fabs.S
+++ b/lib/libc/i386/gen/fabs.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)fabs.s 5.2 (Berkeley) 12/17/90"
+ .asciz "@(#)fabs.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
diff --git a/lib/libc/i386/gen/modf.S b/lib/libc/i386/gen/modf.S
index 246729f..2551237 100644
--- a/lib/libc/i386/gen/modf.S
+++ b/lib/libc/i386/gen/modf.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Sean Eric Fagan.
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)modf.s 5.5 (Berkeley) 3/18/91"
+ .asciz "@(#)modf.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
@@ -49,7 +49,6 @@
/* With CHOP mode on, frndint behaves as TRUNC does. Useful. */
.text
.globl _modf
-.type _modf,@function
_modf:
pushl %ebp
movl %esp,%ebp
diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S
index d9fc66e..b24da11 100644
--- a/lib/libc/i386/gen/setjmp.S
+++ b/lib/libc/i386/gen/setjmp.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -35,8 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)setjmp.s 5.1 (Berkeley) 4/23/90"
- .align 2,0x90
+ .asciz "@(#)setjmp.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
/*
@@ -45,16 +44,15 @@
* longjmp(a,v)
* will generate a "return(v)" from the last call to
* setjmp(a)
- * by restoring registers from the environment 'a'.
+ * by restoring registers from the stack.
* The previous signal state is restored.
*/
#include "DEFS.h"
-#include "SYS.h"
ENTRY(setjmp)
pushl $0
- call PIC_PLT(_sigblock)
+ call _sigblock
popl %edx
movl 4(%esp),%ecx
movl 0(%esp),%edx
@@ -65,14 +63,13 @@ ENTRY(setjmp)
movl %esi,16(%ecx)
movl %edi,20(%ecx)
movl %eax,24(%ecx)
- fnstcw 28(%ecx)
- xorl %eax,%eax
+ movl $0,%eax
ret
ENTRY(longjmp)
movl 4(%esp),%edx
pushl 24(%edx)
- call PIC_PLT(_sigsetmask) /* XXX this is not reentrant */
+ call _sigsetmask
popl %eax
movl 4(%esp),%edx
movl 8(%esp),%eax
@@ -82,10 +79,8 @@ ENTRY(longjmp)
movl 12(%edx),%ebp
movl 16(%edx),%esi
movl 20(%edx),%edi
- fninit
- fldcw 28(%edx)
- testl %eax,%eax
- jnz 1f
- incl %eax
+ cmpl $0,%eax
+ jne 1f
+ movl $1,%eax
1: movl %ecx,0(%esp)
ret
diff --git a/lib/libc/i386/stdlib/abs.S b/lib/libc/i386/stdlib/abs.S
index 3122fcb..755ea56 100644
--- a/lib/libc/i386/stdlib/abs.S
+++ b/lib/libc/i386/stdlib/abs.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -35,8 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
- .text
- .asciz "@(#)abs.s 5.2 (Berkeley) 12/17/90"
+ .asciz "@(#)abs.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "DEFS.h"
diff --git a/lib/libc/i386/string/bzero.S b/lib/libc/i386/string/bzero.S
index 7e0dcdc..79a5a69 100644
--- a/lib/libc/i386/string/bzero.S
+++ b/lib/libc/i386/string/bzero.S
@@ -1,6 +1,9 @@
-/*
- * Copyright (c) 1993 Winning Strategies, Inc.
- * All rights reserved.
+/*-
+ * Copyright (c) 1990, 1993
+ * 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
@@ -12,75 +15,39 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Winning Strategies, Inc.
- * 4. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 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.
*
- * $Id: bzero.S,v 1.1 1993/12/05 13:01:42 ats Exp $
+ * 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(LIBC_RCS) && !defined(lint)
- .asciz "$Id: bzero.S,v 1.1 1993/12/05 13:01:42 ats Exp $"
-#endif /* LIBC_RCS and not lint */
+#if defined(LIBC_SCCS) && !defined(lint)
+ .asciz "@(#)bzero.s 8.1 (Berkeley) 6/4/93"
+#endif /* LIBC_SCCS and not lint */
-#include "DEFS.h"
+/* bzero (base,cnt) */
-/*
- * bzero (void *b, size_t len)
- * write len zero bytes to the string b.
- *
- * Written by:
- * J.T. Conklin (jtc@wimsey.com), Winning Strategies, Inc.
- */
-
-ENTRY(bzero)
+ .globl _bzero
+_bzero:
pushl %edi
- pushl %ebx
- movl 12(%esp),%edi
- movl 16(%esp),%ecx
-
- cld /* set fill direction forward */
- xorl %eax,%eax /* set fill data to 0 */
-
- /*
- * if the string is too short, it's really not worth the overhead
- * of aligning to word boundries, etc. So we jump to a plain
- * unaligned set.
- */
- cmpl $0x0f,%ecx
- jle L1
-
- movl %edi,%edx /* compute misalignment */
- negl %edx
- andl $3,%edx
- movl %ecx,%ebx
- subl %edx,%ebx
-
- movl %edx,%ecx /* zero until word aligned */
+ movl 8(%esp),%edi
+ movl 12(%esp),%ecx
+ movb $0x00,%al
+ cld
rep
stosb
-
- movl %ebx,%ecx /* zero by words */
- shrl $2,%ecx
- rep
- stosl
-
- movl %ebx,%ecx
- andl $3,%ecx /* zero remainder by bytes */
-L1: rep
- stosb
-
- popl %ebx
popl %edi
ret
diff --git a/lib/libc/i386/sys/Ovfork.S b/lib/libc/i386/sys/Ovfork.S
index 181dae5..c7e6b8a 100644
--- a/lib/libc/i386/sys/Ovfork.S
+++ b/lib/libc/i386/sys/Ovfork.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: Ovfork.S,v 1.3 1994/02/21 05:19:08 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)Ovfork.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)Ovfork.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
@@ -51,7 +49,6 @@
*/
.set vfork,66
.globl _vfork
-.type _vfork,@function
_vfork:
popl %ecx /* my rta into ecx */
@@ -64,14 +61,7 @@ vforkok:
jmp parent
.globl _errno
verror:
-#ifdef PIC
- PIC_PROLOGUE
- movl PIC_GOT(_errno), %edx
- movl %eax,(%edx)
- PIC_EPILOGUE
-#else
movl %eax,_errno
-#endif
movl $-1,%eax
jmp %ecx
child:
diff --git a/lib/libc/i386/sys/brk.S b/lib/libc/i386/sys/brk.S
index e884ac2..f85186c 100644
--- a/lib/libc/i386/sys/brk.S
+++ b/lib/libc/i386/sys/brk.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: brk.S,v 1.3 1994/02/21 05:13:26 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)brk.s 5.2 (Berkeley) 12/17/90"
+ .asciz "@(#)brk.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
@@ -50,29 +48,6 @@ ENTRY(_brk)
jmp ok
ENTRY(brk)
-#ifdef PIC
- movl 4(%esp),%eax
- PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx # set up GOT addressing
- movl PIC_GOT(minbrk),%ecx #
- cmpl %eax,(%ecx)
- PIC_EPILOGUE
- jl ok
- movl (%ecx),%eax
- movl %eax,4(%esp)
-ok:
- lea SYS_brk,%eax
- LCALL(7,0)
- jb err
- movl 4(%esp),%eax
- movl %eax,(%edx)
- movl $0,%eax
- ret
-err:
- jmp PIC_PLT(cerror)
-
-#else
-
movl 4(%esp),%eax
cmpl %eax,minbrk
jl ok
@@ -88,4 +63,3 @@ ok:
ret
err:
jmp cerror
-#endif
diff --git a/lib/libc/i386/sys/cerror.S b/lib/libc/i386/sys/cerror.S
index 27fec0a..cc2d82f 100644
--- a/lib/libc/i386/sys/cerror.S
+++ b/lib/libc/i386/sys/cerror.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,25 +32,16 @@
* 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.
- *
- * $Id: cerror.S,v 1.2 1994/02/21 05:19:09 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)cerror.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)cerror.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
.globl _errno
cerror:
-#ifdef PIC
- PIC_PROLOGUE
- movl PIC_GOT(_errno),%ecx
- movl %eax,(%ecx)
- PIC_EPILOGUE
-#else
movl %eax,_errno
-#endif
movl $-1,%eax
ret
diff --git a/lib/libc/i386/sys/exect.S b/lib/libc/i386/sys/exect.S
index 1739760..6b42cf8 100644
--- a/lib/libc/i386/sys/exect.S
+++ b/lib/libc/i386/sys/exect.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: exect.S,v 1.2 1994/02/21 05:19:10 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)exect.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)exect.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/fork.S b/lib/libc/i386/sys/fork.S
index 15b7c46..ff4d948 100644
--- a/lib/libc/i386/sys/fork.S
+++ b/lib/libc/i386/sys/fork.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: fork.S,v 1.2 1994/02/21 05:19:11 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)fork.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)fork.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/mount.S b/lib/libc/i386/sys/mount.S
index e0366db..ac418f7 100644
--- a/lib/libc/i386/sys/mount.S
+++ b/lib/libc/i386/sys/mount.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: mount.S,v 1.2 1994/02/21 05:19:12 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)mount.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)mount.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/pipe.S b/lib/libc/i386/sys/pipe.S
index 2aeae58..6469397 100644
--- a/lib/libc/i386/sys/pipe.S
+++ b/lib/libc/i386/sys/pipe.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: pipe.S,v 1.2 1994/02/21 05:19:13 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)pipe.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)pipe.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/ptrace.S b/lib/libc/i386/sys/ptrace.S
index 6137098..98994ea 100644
--- a/lib/libc/i386/sys/ptrace.S
+++ b/lib/libc/i386/sys/ptrace.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,26 +32,17 @@
* 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.
- *
- * $Id: ptrace.S,v 1.2 1994/02/21 05:19:14 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)ptrace.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)ptrace.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
ENTRY(ptrace)
xorl %eax,%eax
-#ifdef PIC
- PIC_PROLOGUE
- movl PIC_GOT(_errno),%edx
- movl %eax,(%edx)
- PIC_EPILOGUE
-#else
- movl %eax,_errno
-#endif
+ movl %eax,_errno
lea SYS_ptrace,%eax
LCALL(7,0)
jb err
diff --git a/lib/libc/i386/sys/reboot.S b/lib/libc/i386/sys/reboot.S
index 47e2f0a..020bea0 100644
--- a/lib/libc/i386/sys/reboot.S
+++ b/lib/libc/i386/sys/reboot.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: reboot.S,v 1.2 1994/02/21 05:19:15 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)reboot.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)reboot.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/sbrk.S b/lib/libc/i386/sys/sbrk.S
index fef35cb..7fecd93 100644
--- a/lib/libc/i386/sys/sbrk.S
+++ b/lib/libc/i386/sys/sbrk.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: sbrk.S,v 1.2 1994/02/21 05:19:16 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sbrk.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)sbrk.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
@@ -54,27 +52,6 @@ curbrk: .long _end
.text
ENTRY(sbrk)
-#ifdef PIC
- movl 4(%esp),%ecx
- PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx
- movl (%edx),%eax
- PIC_EPILOGUE
- addl %eax,4(%esp)
- lea SYS_brk,%eax
- LCALL(7,0)
- jb err
- PIC_PROLOGUE
- movl PIC_GOT(curbrk),%edx
- movl (%edx),%eax
- addl %ecx,(%edx)
- PIC_EPILOGUE
- ret
-err:
- jmp PIC_PLT(cerror)
-
-#else
-
movl 4(%esp),%ecx
movl curbrk,%eax
addl %eax,4(%esp)
@@ -86,4 +63,3 @@ err:
ret
err:
jmp cerror
-#endif
diff --git a/lib/libc/i386/sys/setlogin.S b/lib/libc/i386/sys/setlogin.S
index 92d761a..43d31d7 100644
--- a/lib/libc/i386/sys/setlogin.S
+++ b/lib/libc/i386/sys/setlogin.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1991 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1991, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: setlogin.S,v 1.2 1994/02/21 05:19:17 rgrimes Exp $
*/
#if defined(LIBC_SCCS) && !defined(lint)
- .asciz "@(#)setlogin.s 5.2 (Berkeley) 4/12/91"
+ .asciz "@(#)setlogin.s 8.1 (Berkeley) 6/4/93"
#endif /* LIBC_SCCS and not lint */
#include "SYS.h"
@@ -45,14 +43,5 @@
.globl __logname_valid /* in getlogin() */
SYSCALL(setlogin)
-#ifdef PIC
- PIC_PROLOGUE
- pushl %eax
- movl PIC_GOT(__logname_valid),%eax
- movl $0,(%eax)
- popl %eax
- PIC_EPILOGUE
-#else
movl $0,__logname_valid
-#endif
ret /* setlogin(name) */
diff --git a/lib/libc/i386/sys/sigpending.S b/lib/libc/i386/sys/sigpending.S
index 4318b6d..63b06a2 100644
--- a/lib/libc/i386/sys/sigpending.S
+++ b/lib/libc/i386/sys/sigpending.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: sigpending.S,v 1.2 1994/02/21 05:19:19 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sigpending.s 5.1 (Berkeley) 7/1/90"
+ .asciz "@(#)sigpending.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/sigprocmask.S b/lib/libc/i386/sys/sigprocmask.S
index ce929a0..ef91e80 100644
--- a/lib/libc/i386/sys/sigprocmask.S
+++ b/lib/libc/i386/sys/sigprocmask.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: sigprocmask.S,v 1.2 1994/02/21 05:19:20 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sigprocmask.s 5.2 (Berkeley) 12/17/90"
+ .asciz "@(#)sigprocmask.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/sigreturn.S b/lib/libc/i386/sys/sigreturn.S
index b98c950..1bd6a3b 100644
--- a/lib/libc/i386/sys/sigreturn.S
+++ b/lib/libc/i386/sys/sigreturn.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: sigreturn.S,v 1.2 1994/02/21 05:19:21 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sigreturn.s 5.2 (Berkeley) 12/17/90"
+ .asciz "@(#)sigreturn.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/sigsuspend.S b/lib/libc/i386/sys/sigsuspend.S
index 1db4c1a..afbc1ba 100644
--- a/lib/libc/i386/sys/sigsuspend.S
+++ b/lib/libc/i386/sys/sigsuspend.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -35,7 +35,7 @@
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)sigsuspend.s 5.2 (Berkeley) 12/17/90"
+ .asciz "@(#)sigsuspend.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
diff --git a/lib/libc/i386/sys/syscall.S b/lib/libc/i386/sys/syscall.S
index 37d1804..189f4dd 100644
--- a/lib/libc/i386/sys/syscall.S
+++ b/lib/libc/i386/sys/syscall.S
@@ -1,6 +1,6 @@
/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* William Jolitz.
@@ -32,12 +32,10 @@
* 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.
- *
- * $Id: syscall.S,v 1.2 1994/02/21 05:19:22 rgrimes Exp $
*/
#if defined(SYSLIBC_SCCS) && !defined(lint)
- .asciz "@(#)syscall.s 5.1 (Berkeley) 4/23/90"
+ .asciz "@(#)syscall.s 8.1 (Berkeley) 6/4/93"
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
@@ -47,8 +45,6 @@ ENTRY(syscall)
pop %eax /* syscall number */
push %ecx
LCALL(7,0)
- push %ecx /* need to push a word to keep stack frame intact
- upon return; the word must be the return address. */
jb 1f
ret
1:
diff --git a/lib/libc/stdio/ftell.c b/lib/libc/stdio/ftell.c
index 724e543..e7a5923 100644
--- a/lib/libc/stdio/ftell.c
+++ b/lib/libc/stdio/ftell.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)ftell.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)ftell.c 8.2 (Berkeley) 5/4/95";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -47,7 +47,7 @@ static char sccsid[] = "@(#)ftell.c 8.1 (Berkeley) 6/4/93";
*/
long
ftell(fp)
- register const FILE *fp;
+ register FILE *fp;
{
register fpos_t pos;
diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h
index 9021d74..cbc07a9 100644
--- a/lib/libc/stdio/local.h
+++ b/lib/libc/stdio/local.h
@@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)local.h 8.2 (Berkeley) 1/2/94
+ * @(#)local.h 8.3 (Berkeley) 7/3/94
*/
/*
@@ -41,23 +41,23 @@
* in particular, macros and private variables.
*/
-int __sflush __P((FILE *));
-FILE *__sfp __P((void));
-int __srefill __P((FILE *));
-int __sread __P((void *, char *, int));
-int __swrite __P((void *, char const *, int));
-fpos_t __sseek __P((void *, fpos_t, int));
-int __sclose __P((void *));
-void __sinit __P((void));
-void _cleanup __P((void));
-void (*__cleanup) __P((void));
-void __smakebuf __P((FILE *));
-int __swhatbuf __P((FILE *, size_t *, int *));
-int _fwalk __P((int (*)(FILE *)));
-int __swsetup __P((FILE *));
-int __sflags __P((const char *, int *));
+extern int __sflush __P((FILE *));
+extern FILE *__sfp __P((void));
+extern int __srefill __P((FILE *));
+extern int __sread __P((void *, char *, int));
+extern int __swrite __P((void *, char const *, int));
+extern fpos_t __sseek __P((void *, fpos_t, int));
+extern int __sclose __P((void *));
+extern void __sinit __P((void));
+extern void _cleanup __P((void));
+extern void (*__cleanup) __P((void));
+extern void __smakebuf __P((FILE *));
+extern int __swhatbuf __P((FILE *, size_t *, int *));
+extern int _fwalk __P((int (*)(FILE *)));
+extern int __swsetup __P((FILE *));
+extern int __sflags __P((const char *, int *));
-extern int __sdidinit;
+extern int __sdidinit;
/*
* Return true iff the given FILE cannot be written now.
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc
index 5298202..9982037 100644
--- a/lib/libc/stdlib/Makefile.inc
+++ b/lib/libc/stdlib/Makefile.inc
@@ -1,4 +1,4 @@
-# @(#)Makefile.inc 8.2 (Berkeley) 2/16/94
+# @(#)Makefile.inc 8.3 (Berkeley) 2/4/95
# machine-independent stdlib sources
.PATH: ${.CURDIR}/${MACHINE}/stdlib ${.CURDIR}/stdlib
@@ -6,7 +6,7 @@
SRCS+= abort.c atexit.c atof.c atoi.c atol.c bsearch.c calloc.c div.c \
exit.c getenv.c getopt.c getsubopt.c heapsort.c labs.c ldiv.c \
malloc.c merge.c putenv.c qsort.c radixsort.c rand.c random.c \
- realpath.c setenv.c strtod.c strtol.c strtoq.c strtoul.c \
+ setenv.c strtod.c strtol.c strtoq.c strtoul.c \
strtouq.c system.c
# machine-dependent stdlib sources
@@ -15,7 +15,7 @@ SRCS+= abort.c atexit.c atof.c atoi.c atol.c bsearch.c calloc.c div.c \
MAN3+= abort.0 abs.0 alloca.0 atexit.0 atof.0 atoi.0 atol.0 bsearch.0 \
calloc.0 div.0 exit.0 free.0 getenv.0 getopt.0 getsubopt.0 labs.0 \
ldiv.0 malloc.0 memory.0 qsort.0 radixsort.0 rand.0 random.0 \
- realloc.0 realpath.0 strtod.0 strtol.0 strtoul.0 system.0
+ realloc.0 strtol.0 strtoul.0 system.0
MLINKS+=getenv.3 setenv.3 getenv.3 unsetenv.3 getenv.3 putenv.3
MLINKS+=qsort.3 heapsort.3 qsort.3 mergesort.3
diff --git a/lib/libc/stdlib/atexit.c b/lib/libc/stdlib/atexit.c
index 9c4caed..bbf374e 100644
--- a/lib/libc/stdlib/atexit.c
+++ b/lib/libc/stdlib/atexit.c
@@ -35,13 +35,15 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)atexit.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)atexit.c 8.2 (Berkeley) 7/3/94";
#endif /* LIBC_SCCS and not lint */
#include <stddef.h>
#include <stdlib.h>
#include "atexit.h"
+struct atexit *__atexit; /* points to head of LIFO stack */
+
/*
* Register a function to be performed at exit.
*/
diff --git a/lib/libc/stdlib/atexit.h b/lib/libc/stdlib/atexit.h
index 3067e8d..819151e 100644
--- a/lib/libc/stdlib/atexit.h
+++ b/lib/libc/stdlib/atexit.h
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)atexit.h 8.1 (Berkeley) 6/4/93
+ * @(#)atexit.h 8.2 (Berkeley) 7/3/94
*/
/* must be at least 32 to guarantee ANSI conformance */
@@ -42,4 +42,4 @@ struct atexit {
void (*fns[ATEXIT_SIZE])(); /* the table itself */
};
-struct atexit *__atexit; /* points to head of LIFO stack */
+extern struct atexit *__atexit; /* points to head of LIFO stack */
diff --git a/lib/libc/stdlib/getopt.3 b/lib/libc/stdlib/getopt.3
index 95ff6e6..39cc5de 100644
--- a/lib/libc/stdlib/getopt.3
+++ b/lib/libc/stdlib/getopt.3
@@ -29,16 +29,16 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getopt.3 8.4 (Berkeley) 4/19/94
+.\" @(#)getopt.3 8.5 (Berkeley) 4/27/95
.\"
-.Dd April 19, 1994
+.Dd April 27, 1995
.Dt GETOPT 3
.Os BSD 4.3
.Sh NAME
.Nm getopt
.Nd get option character from command line argument list
.Sh SYNOPSIS
-.Fd #include <stdlib.h>
+.Fd #include <unistd.h>
.Vt extern char *optarg;
.Vt extern int optind;
.Vt extern int optopt;
@@ -120,8 +120,7 @@ must be reinitialized.
The
.Fn getopt
function
-returns an
-.Dv EOF
+returns \-1
when the argument list is exhausted, or a non-recognized
option is encountered.
The interpretation of options in the argument list may be cancelled
@@ -129,13 +128,11 @@ by the option
.Ql --
(double dash) which causes
.Fn getopt
-to signal the end of argument processing and return an
-.Dv EOF .
+to signal the end of argument processing and returns \-1.
When all options have been processed (i.e., up to the first non-option
argument),
.Fn getopt
-returns
-.Dv EOF .
+returns \-1.
.Sh DIAGNOSTICS
If the
.Fn getopt
@@ -177,7 +174,7 @@ extern int optind;
int bflag, ch, fd;
bflag = 0;
-while ((ch = getopt(argc, argv, "bf:")) != EOF)
+while ((ch = getopt(argc, argv, "bf:")) != -1)
switch(ch) {
case 'b':
bflag = 1;
@@ -202,6 +199,18 @@ The
function appeared
.Bx 4.3 .
.Sh BUGS
+The
+.Fn getopt
+function was once specified to return
+.Dv EOF
+instead of \-1.
+This was changed by
+.St -p1003.2-92
+to decouple
+.Fn getopt
+from
+.Pa <stdio.h> .
+.Pp
A single dash
.Dq Li -
may be specified as an character in
@@ -219,8 +228,7 @@ It is provided for backward compatibility
.Em only .
By default, a single dash causes
.Fn getopt
-to return
-.Dv EOF .
+to return \-1.
This is, we believe, compatible with System V.
.Pp
It is also possible to handle digits as option letters.
@@ -237,7 +245,7 @@ The following code fragment works in most cases.
int length;
char *p;
-while ((c = getopt(argc, argv, "0123456789")) != EOF)
+while ((c = getopt(argc, argv, "0123456789")) != -1)
switch (c) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
diff --git a/lib/libc/stdlib/getopt.c b/lib/libc/stdlib/getopt.c
index 994d757..5dddf86 100644
--- a/lib/libc/stdlib/getopt.c
+++ b/lib/libc/stdlib/getopt.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getopt.c 8.2 (Berkeley) 4/2/94";
+static char sccsid[] = "@(#)getopt.c 8.3 (Berkeley) 4/27/95";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -67,22 +67,22 @@ getopt(nargc, nargv, ostr)
optreset = 0;
if (optind >= nargc || *(place = nargv[optind]) != '-') {
place = EMSG;
- return (EOF);
+ return (-1);
}
if (place[1] && *++place == '-') { /* found "--" */
++optind;
place = EMSG;
- return (EOF);
+ return (-1);
}
} /* option letter okay? */
if ((optopt = (int)*place++) == (int)':' ||
!(oli = strchr(ostr, optopt))) {
/*
* if the user didn't specify '-' as an option,
- * assume it means EOF.
+ * assume it means -1.
*/
if (optopt == (int)'-')
- return (EOF);
+ return (-1);
if (!*place)
++optind;
if (opterr && *ostr != ':')
diff --git a/lib/libc/stdlib/radixsort.c b/lib/libc/stdlib/radixsort.c
index d211f3d..b932bf5 100644
--- a/lib/libc/stdlib/radixsort.c
+++ b/lib/libc/stdlib/radixsort.c
@@ -35,7 +35,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)radixsort.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)radixsort.c 8.2 (Berkeley) 4/28/95";
#endif /* LIBC_SCCS and not lint */
/*
@@ -132,7 +132,7 @@ sradixsort(a, n, tab, endch)
#define swap(a, b, t) t = a, a = b, b = t
/* Unstable, in-place sort. */
-void
+static void
r_sort_a(a, n, i, tr, endch)
const u_char **a;
int n, i;
@@ -223,7 +223,7 @@ r_sort_a(a, n, i, tr, endch)
}
/* Stable sort, requiring additional memory. */
-void
+static void
r_sort_b(a, ta, n, i, tr, endch)
const u_char **a, **ta;
int n, i;
diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c
index 18babba..7c76158 100644
--- a/lib/libc/stdlib/random.c
+++ b/lib/libc/stdlib/random.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@@ -76,6 +76,25 @@ static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 6/4/93";
* large deg, when the period of the shift register is the dominant factor.
* With deg equal to seven, the period is actually much longer than the
* 7*(2**7 - 1) predicted by this formula.
+ *
+ * Modified 28 December 1994 by Jacob S. Rosenberg.
+ * The following changes have been made:
+ * All references to the type u_int have been changed to unsigned long.
+ * All references to type int have been changed to type long. Other
+ * cleanups have been made as well. A warning for both initstate and
+ * setstate has been inserted to the effect that on Sparc platforms
+ * the 'arg_state' variable must be forced to begin on word boundaries.
+ * This can be easily done by casting a long integer array to char *.
+ * The overall logic has been left STRICTLY alone. This software was
+ * tested on both a VAX and Sun SpacsStation with exactly the same
+ * results. The new version and the original give IDENTICAL results.
+ * The new version is somewhat faster than the original. As the
+ * documentation says: "By default, the package runs with 128 bytes of
+ * state information and generates far better random numbers than a linear
+ * congruential generator. If the amount of state information is less than
+ * 32 bytes, a simple linear congruential R.N.G. is used." For a buffer of
+ * 128 bytes, this new version runs about 19 percent faster and for a 16
+ * byte buffer it is about 5 percent faster.
*/
/*
@@ -116,8 +135,8 @@ static char sccsid[] = "@(#)random.c 8.1 (Berkeley) 6/4/93";
*/
#define MAX_TYPES 5 /* max number of types above */
-static int degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
-static int seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
+static long degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 };
+static long seps [MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 };
/*
* Initially, everything is set up as if from:
@@ -171,9 +190,9 @@ static long *rptr = &randtbl[1];
* the last element to see if the front and rear pointers have wrapped.
*/
static long *state = &randtbl[1];
-static int rand_type = TYPE_3;
-static int rand_deg = DEG_3;
-static int rand_sep = SEP_3;
+static long rand_type = TYPE_3;
+static long rand_deg = DEG_3;
+static long rand_sep = SEP_3;
static long *end_ptr = &randtbl[DEG_3 + 1];
/*
@@ -190,14 +209,13 @@ static long *end_ptr = &randtbl[DEG_3 + 1];
*/
void
srandom(x)
- u_int x;
+ unsigned long x;
{
- register int i, j;
+ register long i;
if (rand_type == TYPE_0)
state[0] = x;
else {
- j = 1;
state[0] = x;
for (i = 1; i < rand_deg; i++)
state[i] = 1103515245 * state[i - 1] + 12345;
@@ -226,14 +244,19 @@ srandom(x)
* setstate() so that it doesn't matter when initstate is called.
*
* Returns a pointer to the old state.
+ *
+ * Note: The Sparc platform requires that arg_state begin on a long
+ * word boundary; otherwise a bus error will occur. Even so, lint will
+ * complain about mis-alignment, but you should disregard these messages.
*/
char *
initstate(seed, arg_state, n)
- u_int seed; /* seed for R.N.G. */
+ unsigned long seed; /* seed for R.N.G. */
char *arg_state; /* pointer to state array */
- int n; /* # bytes of state info */
+ long n; /* # bytes of state info */
{
register char *ostate = (char *)(&state[-1]);
+ register long *long_arg_state = (long *) arg_state;
if (rand_type == TYPE_0)
state[-1] = rand_type;
@@ -241,7 +264,7 @@ initstate(seed, arg_state, n)
state[-1] = MAX_TYPES * (rptr - state) + rand_type;
if (n < BREAK_0) {
(void)fprintf(stderr,
- "random: not enough state (%d bytes); ignored.\n", n);
+ "random: not enough state (%ld bytes); ignored.\n", n);
return(0);
}
if (n < BREAK_1) {
@@ -265,13 +288,13 @@ initstate(seed, arg_state, n)
rand_deg = DEG_4;
rand_sep = SEP_4;
}
- state = &(((long *)arg_state)[1]); /* first location */
+ state = (long *) (long_arg_state + 1); /* first location */
end_ptr = &state[rand_deg]; /* must set end_ptr before srandom */
srandom(seed);
if (rand_type == TYPE_0)
- state[-1] = rand_type;
+ long_arg_state[0] = rand_type;
else
- state[-1] = MAX_TYPES*(rptr - state) + rand_type;
+ long_arg_state[0] = MAX_TYPES * (rptr - state) + rand_type;
return(ostate);
}
@@ -289,14 +312,18 @@ initstate(seed, arg_state, n)
* setstate() with the same state as the current state.
*
* Returns a pointer to the old state information.
+ *
+ * Note: The Sparc platform requires that arg_state begin on a long
+ * word boundary; otherwise a bus error will occur. Even so, lint will
+ * complain about mis-alignment, but you should disregard these messages.
*/
char *
setstate(arg_state)
- char *arg_state;
+ char *arg_state; /* pointer to state array */
{
- register long *new_state = (long *)arg_state;
- register int type = new_state[0] % MAX_TYPES;
- register int rear = new_state[0] / MAX_TYPES;
+ register long *new_state = (long *) arg_state;
+ register long type = new_state[0] % MAX_TYPES;
+ register long rear = new_state[0] / MAX_TYPES;
char *ostate = (char *)(&state[-1]);
if (rand_type == TYPE_0)
@@ -317,7 +344,7 @@ setstate(arg_state)
(void)fprintf(stderr,
"random: state info corrupted; not changed.\n");
}
- state = &new_state[1];
+ state = (long *) (new_state + 1);
if (rand_type != TYPE_0) {
rptr = &state[rear];
fptr = &state[(rear + rand_sep) % rand_deg];
@@ -346,18 +373,28 @@ setstate(arg_state)
long
random()
{
- long i;
+ register long i;
+ register long *f, *r;
- if (rand_type == TYPE_0)
- i = state[0] = (state[0] * 1103515245 + 12345) & 0x7fffffff;
- else {
- *fptr += *rptr;
- i = (*fptr >> 1) & 0x7fffffff; /* chucking least random bit */
- if (++fptr >= end_ptr) {
- fptr = state;
- ++rptr;
- } else if (++rptr >= end_ptr)
- rptr = state;
+ if (rand_type == TYPE_0) {
+ i = state[0];
+ state[0] = i = (i * 1103515245 + 12345) & 0x7fffffff;
+ } else {
+ /*
+ * Use local variables rather than static variables for speed.
+ */
+ f = fptr; r = rptr;
+ *f += *r;
+ i = (*f >> 1) & 0x7fffffff; /* chucking least random bit */
+ if (++f >= end_ptr) {
+ f = state;
+ ++r;
+ }
+ else if (++r >= end_ptr) {
+ r = state;
+ }
+
+ fptr = f; rptr = r;
}
return(i);
}
diff --git a/lib/libc/string/strmode.3 b/lib/libc/string/strmode.3
index 0cedd55..43d0cf1 100644
--- a/lib/libc/string/strmode.3
+++ b/lib/libc/string/strmode.3
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)strmode.3 8.2 (Berkeley) 12/11/93
+.\" @(#)strmode.3 8.3 (Berkeley) 7/28/94
.\"
-.Dd December 11, 1993
+.Dd July 28, 1994
.Dt STRMODE 3
.Os
.Sh NAME
@@ -71,6 +71,8 @@ symbolic link
fifo
.It s
socket
+.It w
+whiteout
.It ?
unknown inode type
.El
diff --git a/lib/libc/string/strmode.c b/lib/libc/string/strmode.c
index 651b263..2c3f44a 100644
--- a/lib/libc/string/strmode.c
+++ b/lib/libc/string/strmode.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strmode.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)strmode.c 8.3 (Berkeley) 8/15/94";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -69,6 +69,11 @@ strmode(mode, p)
*p++ = 'p';
break;
#endif
+#ifdef S_IFWHT
+ case S_IFWHT: /* whiteout */
+ *p++ = 'w';
+ break;
+#endif
default: /* unknown */
*p++ = '?';
break;
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 8677f7d..c89e36e 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,4 +1,4 @@
-# @(#)Makefile.inc 8.1 (Berkeley) 6/17/93
+# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
.PATH: ${.CURDIR}/${MACHINE}/sys ${.CURDIR}/sys
@@ -29,7 +29,7 @@ ASM= accept.o access.o acct.o adjtime.o bind.o chdir.o chflags.o chmod.o \
setgroups.o setitimer.o setpgid.o setpriority.o setrlimit.o \
setsid.o setsockopt.o settimeofday.o setuid.o shutdown.o \
sigaction.o sigaltstack.o socket.o socketpair.o stat.o statfs.o \
- swapon.o symlink.o sync.o umask.o unlink.o unmount.o \
+ swapon.o symlink.o sync.o umask.o undelete.o unlink.o unmount.o \
utimes.o vadvise.o wait4.o write.o writev.o __syscall.o __sysctl.o
PSEUDO= _exit.o _getlogin.o
@@ -76,7 +76,7 @@ MAN2+= accept.0 access.0 acct.0 adjtime.0 bind.0 brk.0 chdir.0 chflags.0 \
sigaction.0 sigpending.0 sigprocmask.0 sigreturn.0 sigaltstack.0 \
sigstack.0 sigsuspend.0 socket.0 socketpair.0 stat.0 statfs.0 \
swapon.0 symlink.0 sync.0 syscall.0 truncate.0 umask.0 unlink.0 \
- utimes.0 vfork.0 wait.0 write.0
+ undelete.0 utimes.0 vfork.0 wait.0 write.0
MLINKS+=brk.2 sbrk.2
MLINKS+=dup.2 dup2.2
diff --git a/lib/libc/sys/brk.2 b/lib/libc/sys/brk.2
index c84393d..e3c825e 100644
--- a/lib/libc/sys/brk.2
+++ b/lib/libc/sys/brk.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)brk.2 8.2 (Berkeley) 12/11/93
+.\" @(#)brk.2 8.4 (Berkeley) 5/1/95
.\"
-.Dd December 11, 1993
+.Dd May 1, 1995
.Dt BRK 2
.Os BSD 4
.Sh NAME
@@ -96,25 +96,26 @@ beyond the
value returned from a call to
.Xr getrlimit ,
e.g.
-.Dq qetext + rlp\(->rlim_max.
+.Dq etext + rlp\(->rlim_max.
(see
.Xr end 3
for the definition of
.Em etext ) .
.Sh RETURN VALUES
.Nm Brk
-returns a pointer to the new end of memory if successful;
+returns 0 if successful;
otherwise -1 with
.Va errno
set to indicate why the allocation failed.
-The
-.Nm sbrk
+.Nm Sbrk
returns a pointer to the base of the new storage if successful;
otherwise -1 with
.Va errno
set to indicate why the allocation failed.
.Sh ERRORS
-.Xr Sbrk
+.Xr Brk
+or
+.Xr sbrk
will fail and no additional memory will be allocated if
one of the following are true:
.Bl -tag -width [ENOMEM]
diff --git a/lib/libc/sys/chflags.2 b/lib/libc/sys/chflags.2
index 8481851..e10d98d 100644
--- a/lib/libc/sys/chflags.2
+++ b/lib/libc/sys/chflags.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)chflags.2 8.1 (Berkeley) 6/9/93
+.\" @(#)chflags.2 8.3 (Berkeley) 5/2/95
.\"
-.Dd June 9, 1993
+.Dd May 2, 1995
.Dt CHFLAGS 2
.Os
.Sh NAME
@@ -65,6 +65,8 @@ Do not dump the file.
The file may not be changed.
.It UF_APPEND
The file may only be appended to.
+.It UF_OPAQUE
+The directory is opaque when viewed through a union stack.
.\".It ARCHIVED
.\"File is archived.
.It SF_IMMUTABLE
@@ -84,7 +86,9 @@ The
and
.Dq SF_APPEND
flags may only be set or unset by the super-user.
-They may be set at any time, but normally may only be unset when
+Attempts by the non-super-user to set the super-user only flags
+are silently ignored.
+These flags may be set at any time, but normally may only be unset when
the system is in single-user mode.
(See
.Xr init 8
@@ -144,8 +148,9 @@ An
error occurred while reading from or writing to the file system.
.El
.Sh SEE ALSO
-.Xr chflags 1,
-.Xr init 8
+.Xr chflags 1 ,
+.Xr init 8 ,
+.Xr mount_union 8
.Sh HISTORY
The
.Nm chflags
diff --git a/lib/libc/sys/execve.2 b/lib/libc/sys/execve.2
index ba47e6d..ca44793 100644
--- a/lib/libc/sys/execve.2
+++ b/lib/libc/sys/execve.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)execve.2 8.3 (Berkeley) 1/24/94
+.\" @(#)execve.2 8.5 (Berkeley) 6/1/94
.\"
-.Dd January 24, 1994
+.Dd June 1, 1994
.Dt EXECVE 2
.Os BSD 4
.Sh NAME
@@ -66,9 +66,11 @@ An interpreter file begins with a line of the form:
.Ed
.Pp
When an interpreter file is
-.Fn execve Ap d ,
+.\" was .Fn execve Ap d ,
+\fBexecve\fP'd,
the system
-.Fn execve Ap s
+.\" was .Fn execve Ap s
+\fBexecve\fP's
runs the specified
.Em interpreter .
If the optional
@@ -76,13 +78,16 @@ If the optional
is specified, it becomes the first argument to the
.Em interpreter ,
and the name of the originally
-.Fn execve Ap d
+.\" was .Fn execve Ap d
+\fBexecve\fP'd
file becomes the second argument;
otherwise, the name of the originally
-.Fn execve Ap d
+.\" was .Fn execve Ap d
+\fBexecve\fP'd
file becomes the first argument. The original arguments are shifted over to
become the subsequent arguments. The zeroth argument, normally the name of the
-.Fn execve Ap d
+.\" was .Fn execve Ap d
+\fBexecve\fP'd
file, is left unchanged.
.Pp
The argument
@@ -140,6 +145,7 @@ the effective user ID is recorded as the saved set-user-ID,
and the effective group ID is recorded as the saved set-group-ID.
These values may be used in changing the effective IDs later (see
.Xr setuid 2 ) .
+.ne 1i
.Pp
The new process also inherits the following attributes from
the calling process:
@@ -217,6 +223,7 @@ permission, but has an invalid magic number in its header.
.It Bq Er ETXTBSY
The new process file is a pure procedure (shared text)
file that is currently open for writing or reading by some process.
+.ne 1i
.It Bq Er ENOMEM
The new process requires more virtual memory than
is allowed by the imposed maximum
diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2
index 6df9444..532bec1 100644
--- a/lib/libc/sys/getdirentries.2
+++ b/lib/libc/sys/getdirentries.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getdirentries.2 8.1 (Berkeley) 6/9/93
+.\" @(#)getdirentries.2 8.2 (Berkeley) 5/3/95
.\"
-.Dd June 9, 1993
+.Dd May 3, 1995
.Dt GETDIRENTRIES 2
.Os
.Sh NAME
@@ -67,7 +67,8 @@ structures each containing the following entries:
.Bd -literal -offset indent
unsigned long d_fileno;
unsigned short d_reclen;
-unsigned short d_namlen;
+unsigned char d_type;
+unsigned char d_namlen;
char d_name[MAXNAMELEN + 1]; /* see below */
.Ed
.Pp
@@ -83,6 +84,11 @@ The
.Fa d_reclen
entry is the length, in bytes, of the directory record.
The
+.Fa d_type
+entry is the type of the file pointed to by the directory record.
+The file type values are defined in
+.Fa <sys/dirent.h> .
+The
.Fa d_name
entry contains a null terminated file name.
The
diff --git a/lib/libc/sys/getfsstat.2 b/lib/libc/sys/getfsstat.2
index 9d2a0d7..b25261c 100644
--- a/lib/libc/sys/getfsstat.2
+++ b/lib/libc/sys/getfsstat.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getfsstat.2 8.1 (Berkeley) 6/9/93
+.\" @(#)getfsstat.2 8.3 (Berkeley) 5/25/95
.\"
-.Dd June 9, 1993
+.Dd May 25, 1995
.Dt GETFSSTAT 2
.Os
.Sh NAME
@@ -53,31 +53,61 @@ structures defined as follows:
.Bd -literal
typedef quad fsid_t;
-#define MNAMELEN 32 /* length of buffer for returned name */
+#define MFSNAMELEN 16 /* length of fs type name, including null */
+#define MNAMELEN 90 /* length of buffer for returned name */
struct statfs {
- short f_type; /* type of filesystem (see below) */
- short f_flags; /* copy of mount flags */
- long f_bsize; /* fundamental filesystem block size */
- long f_iosize; /* optimal transfer block size */
- long f_blocks; /* total data blocks in filesystem */
- long f_bfree; /* free blocks in fs */
- long f_bavail; /* free blocks avail to non-superuser */
- long f_files; /* total file nodes in filesystem */
- long f_ffree; /* free file nodes in fs */
- fsid_t f_fsid; /* filesystem id */
- long f_spare[6]; /* spare for later */
- char f_mntonname[MNAMELEN]; /* directory on which mounted */
- char f_mntfromname[MNAMELEN]; /* mounted filesystem */
+ short f_type; /* filesystem type number */
+ short f_flags; /* copy of mount flags */
+ long f_bsize; /* fundamental file system block size */
+ long f_iosize; /* optimal transfer block size */
+ long f_blocks; /* total data blocks in file system */
+ long f_bfree; /* free blocks in fs */
+ long f_bavail; /* free blocks avail to non-superuser */
+ long f_files; /* total file nodes in file system */
+ long f_ffree; /* free file nodes in fs */
+ fsid_t f_fsid; /* file system id */
+ uid_t f_owner; /* user that mounted the filesystem */
+ long f_spare[4]; /* spare for later */
+ char f_fstypename[MFSNAMELEN]; /* fs type name */
+ char f_mntonname[MNAMELEN]; /* directory on which mounted */
+ char f_mntfromname[MNAMELEN];/* mounted filesystem */
};
-/*
- * File system types.
- */
-#define MOUNT_UFS 1
-#define MOUNT_NFS 2
-#define MOUNT_PC 3
.Ed
.Pp
+The flags that may be returned include:
+.Bl -tag -width MNT_ASYNCHRONOUS
+.It Dv MNT_RDONLY
+The filesystem is mounted read-only;
+Even the super-user may not write on it.
+.It Dv MNT_NOEXEC
+Files may not be executed from the filesystem.
+.It Dv MNT_NOSUID
+Setuid and setgid bits on files are not honored when they are executed.
+.It Dv MNT_NODEV
+Special files in the filesystem may not be opened.
+.It Dv MNT_SYNCHRONOUS
+All I/O to the filesystem is done synchronously.
+.It Dv MNT_ASYNCHRONOUS
+No filesystem I/O is done synchronously.
+.It Dv MNT_LOCAL
+The filesystem resides locally.
+.It Dv MNT_QUOTA
+The filesystem has quotas enabled on it.
+.It Dv MNT_ROOTFS
+Identifies the root filesystem.
+.It Dv MNT_EXRDONLY
+The filesystem is exported read-only.
+.It Dv MNT_EXPORTED
+The filesystem is exported for both reading and writing.
+.It Dv MNT_DEFEXPORTED
+The filesystem is exported for both reading and writing to any Internet host.
+.It Dv MNT_EXPORTANON
+The filesystem maps all remote accesses to the anonymous user.
+.It Dv MNT_EXKERB
+The filesystem is exported with Kerberos uid mapping.
+.El
+.Pp
Fields that are undefined for a particular filesystem are set to -1.
The buffer is filled with an array of
.Fa fsstat
diff --git a/lib/libc/sys/getitimer.2 b/lib/libc/sys/getitimer.2
index ac2e59a..f39501d 100644
--- a/lib/libc/sys/getitimer.2
+++ b/lib/libc/sys/getitimer.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getitimer.2 8.2 (Berkeley) 12/11/93
+.\" @(#)getitimer.2 8.3 (Berkeley) 5/16/95
.\"
-.Dd December 11, 1993
+.Dd May 16, 1995
.Dt GETITIMER 2
.Os BSD 4.2
.Sh NAME
@@ -132,8 +132,7 @@ sets a time value to zero,
.Fa timerisset
tests if a time value is non-zero, and
.Fa timercmp
-compares two time values (beware that >= and <= do not
-work with this macro).
+compares two time values.
.Sh RETURN VALUES
If the calls succeed, a value of 0 is returned. If an error occurs,
the value -1 is returned, and a more precise error code is placed
diff --git a/lib/libc/sys/getsockopt.2 b/lib/libc/sys/getsockopt.2
index 46d3d8a..8362d5e 100644
--- a/lib/libc/sys/getsockopt.2
+++ b/lib/libc/sys/getsockopt.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)getsockopt.2 8.3 (Berkeley) 4/19/94
+.\" @(#)getsockopt.2 8.4 (Berkeley) 5/2/95
.\"
-.Dd April 19, 1994
+.Dd May 2, 1995
.Dt GETSOCKOPT 2
.Os BSD 4.3r
.Sh NAME
@@ -192,7 +192,7 @@ the system will block the process on the
.Xr close
attempt until it is able to transmit the data or until it decides it
is unable to deliver the information (a timeout period, termed the
-linger interval, is specified in the
+linger interval, is specified in seconds in the
.Fn setsockopt
call when
.Dv SO_LINGER
diff --git a/lib/libc/sys/gettimeofday.2 b/lib/libc/sys/gettimeofday.2
index 9426de6..b4d0429 100644
--- a/lib/libc/sys/gettimeofday.2
+++ b/lib/libc/sys/gettimeofday.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)gettimeofday.2 8.1 (Berkeley) 6/4/93
+.\" @(#)gettimeofday.2 8.2 (Berkeley) 5/26/95
.\"
-.Dd June 4, 1993
+.Dd May 26, 1995
.Dt GETTIMEOFDAY 2
.Os BSD 4
.Sh NAME
@@ -93,6 +93,14 @@ Daylight Saving time applies locally during
the appropriate part of the year.
.Pp
Only the super-user may set the time of day or time zone.
+If the system is running in secure mode (see
+.Xr init 8 ),
+the time may only be advanced.
+This limitation is imposed to prevent a malicious super-user
+from setting arbitrary time stamps on files.
+The system time can still be adjusted backwards using the
+.Xr adjtime 2
+system call even when the system is secure.
.Sh RETURN
A 0 return value indicates that the call succeeded.
A -1 return value indicates an error occurred, and in this
diff --git a/lib/libc/sys/intro.2 b/lib/libc/sys/intro.2
index bf43809..ddda2ba 100644
--- a/lib/libc/sys/intro.2
+++ b/lib/libc/sys/intro.2
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1993, 1980198319861991
+.\" Copyright (c) 1980, 1983, 1986, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)intro.2 8.3 (Berkeley) 12/11/93
+.\" @(#)intro.2 8.5 (Berkeley) 2/27/95
.\"
-.Dd December 11, 1993
+.Dd February 27, 1995
.Dt INTRO 2
.Os BSD 4
.Sh NAME
@@ -121,6 +121,7 @@ executable file.
A file descriptor argument was out of range, referred to no open file,
or a read (write) request was made to a file that was only open for
writing (reading).
+.sp
.It Er 10 ECHILD Em "\&No child processes" .
A
.Xr wait
@@ -288,6 +289,7 @@ addresses with
Internet protocols.
.It Er 48 EADDRINUSE Em "Address already in use" .
Only one usage of each address is normally permitted.
+.sp
.It Er 49 EADDRNOTAVAIL Em "Cannot assign requested address" .
Normally results from an attempt to create a socket with an
address not on this machine.
@@ -368,6 +370,7 @@ entry failed because the user's quota of disk blocks was
exhausted, or the allocation of an inode for a newly
created file failed because the user's quota of inodes
was exhausted.
+.ne 1i
.It Er 70 ESTALE Em "Stale NFS file handle" .
An attempt was made to access an open file (on an
.Tn NFS
@@ -440,6 +443,7 @@ A session leader with a controlling terminal is a controlling process.
.It Controlling terminal
A terminal that is associated with a session is known as the controlling
terminal for that session and its members.
+.ne 1i
.It "Terminal Process Group ID"
A terminal may be acquired by a session leader as its controlling terminal.
Once a terminal is associated with a session, any of the process groups
@@ -517,6 +521,7 @@ for the super-user.)
A process is recognized as a
.Em super-user
process and is granted special privileges if its effective user ID is 0.
+.ne 1i
.It Special Processes
The processes with process IDs of 0, 1, and 2 are special.
Process 0 is the scheduler. Process 1 is the initialization process
@@ -665,4 +670,5 @@ of a certain format. An Address Family is the set of addresses
for a specific group of protocols. Each socket has an address
chosen from the address family in which the socket was created.
.Sh SEE ALSO
-intro(3), perror(3)
+.Xr intro 3 ,
+.Xr perror 3
diff --git a/lib/libc/sys/mmap.2 b/lib/libc/sys/mmap.2
index 1c0d84a..7313134 100644
--- a/lib/libc/sys/mmap.2
+++ b/lib/libc/sys/mmap.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mmap.2 8.1 (Berkeley) 6/4/93
+.\" @(#)mmap.2 8.4 (Berkeley) 5/11/95
.\"
-.Dd "June 4, 1993"
+.Dd "May 11, 1995"
.Dt MMAP 2
.Os BSD 4
.Sh NAME
@@ -54,11 +54,10 @@ bytes to be mapped from the object described by
starting at byte offset
.Fa offset .
If
-.Fa offset
-or
.Fa len
is not a multiple of the pagesize, the mapped region may extend past the
specified range.
+Any such extension beyond the end of the mapped object will be zero-filled.
.Pp
If
.Fa addr
@@ -104,9 +103,10 @@ the following values:
Map anonymous memory not associated with any specific file.
The file descriptor used for creating
.Dv MAP_ANON
-regions is used only for
-naming, and may be specified as \-1 if no name is associated with the
-region.
+must be \-1.
+The
+.Fa offset
+parameter is ignored.
.\".It Dv MAP_FILE
.\"Mapped from a regular file or character-special device memory.
.It Dv MAP_FIXED
@@ -165,12 +165,10 @@ parameter and
.Fa fd
was not open for reading.
The flags
-.Dv PROT_WRITE ,
.Dv MAP_SHARED
and
-.Dv MAP_WRITE
-were specified as part
-of the
+.Dv PROT_WRITE
+were specified as part of the
.Fa flags
and
.Fa prot
@@ -180,7 +178,7 @@ was not open for writing.
.It Bq Er EBADF
.Fa Fd
is not a valid open file descriptor.
-.\".It Bq Er EINVAL
+.It Bq Er EINVAL
.\"One of
.\".Dv MAP_ANON
.\"or
@@ -190,10 +188,16 @@ is not a valid open file descriptor.
.\"parameter.
.Dv MAP_FIXED
was specified and the
-.I addr
-parameter was not page aligned.
+.Fa addr
+parameter was not page aligned or was outside of the
+valid address range for a process.
+.Dv MAP_ANON was specified and
+.Fa fd
+was not \-1.
.Fa Fd
did not reference a regular or character special file.
+.Fa Len
+was less than zero.
.It Bq Er ENOMEM
.Dv MAP_FIXED
was specified and the
diff --git a/lib/libc/sys/mount.2 b/lib/libc/sys/mount.2
index 6829a3e..0d95386 100644
--- a/lib/libc/sys/mount.2
+++ b/lib/libc/sys/mount.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mount.2 8.2 (Berkeley) 12/11/93
+.\" @(#)mount.2 8.3 (Berkeley) 5/24/95
.\"
-.Dd December 11, 1993
+.Dd May 24, 1995
.Dt MOUNT 2
.Os BSD 4
.Sh NAME
@@ -101,46 +101,27 @@ most filesystems will not allow a change from read-write to read-only.
.Pp
The
.Fa type
-argument defines the type of the filesystem.
-The types of filesystems known to the system are defined in
-.Aq Pa sys/mount.h .
+argument names the filesystem.
+The types of filesystems known to the system can be obtained with
+.Xr sysctl 8
+by using the command:
+.Bd -literal -offset indent
+sysctl vfs
+.Ed
+.Pp
.Fa Data
is a pointer to a structure that contains the type
specific arguments to mount.
-The currently supported types of filesystems and
-their type specific data are:
-.Pp
-.Dv MOUNT_UFS
-.Bd -literal -offset indent -compact
-struct ufs_args {
- char *fspec; /* Block special file to mount */
- int exflags; /* export related flags */
- uid_t exroot; /* mapping for root uid */
-};
-.Ed
-.Pp
-.Dv MOUNT_NFS
-.Bd -literal -offset indent -compact
-struct nfs_args {
- struct sockaddr_in *addr; /* file server address */
- nfsv2fh_t *fh; /* File handle to be mounted */
- int flags; /* flags */
- int wsize; /* write size in bytes */
- int rsize; /* read size in bytes */
- int timeo; /* initial timeout 0.1 secs */
- int retrans; /* times to retry send */
- char *hostname; /* server's name */
-};
-.Ed
-.Pp
-.Dv MOUNT_MFS
-.Bd -literal -offset indent -compact
-struct mfs_args {
- char *name; /* name of backing process */
- caddr_t base; /* base address of the filesystem */
- u_long size; /* size of the filesystem */
-};
-.Ed
+The format for these argument structures is described in the
+manual page for each filesystem.
+By convention filesystem manual pages are named
+by prefixing ``mount_'' to the name of the filesystem as returned by
+.Xr sysctl 8 .
+Thus the
+.Nm NFS
+filesystem is described by the
+.Xr mount_nfs 8
+manual page.
.Pp
The
.Fn umount
@@ -304,7 +285,7 @@ mounted.
.Sh SEE ALSO
.Xr mount 8 ,
.Xr umount 8 ,
-.Xr mfs 8
+.Xr sysctl 8
.Sh BUGS
Some of the error codes need translation to more obvious messages.
.Sh HISTORY
diff --git a/lib/libc/sys/msync.2 b/lib/libc/sys/msync.2
index 2583c15..2e648c4 100644
--- a/lib/libc/sys/msync.2
+++ b/lib/libc/sys/msync.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)msync.2 8.1 (Berkeley) 6/9/93
+.\" @(#)msync.2 8.2 (Berkeley) 6/21/94
.\"
-.Dd June 9, 1993
+.Dd June 21, 1994
.Dt MSYNC 2
.Os
.Sh NAME
@@ -62,6 +62,23 @@ will also take place at this time.
Filesystem operations on a file that is mapped for shared modifications
are unpredictable except after an
.Fn msync .
+.Sh ERRORS
+The following errors may be reported:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The
+.Fa addr
+parameter was not page aligned.
+.It Bq Er EINVAL
+The
+.Fa addr
+parameter did not specify an address part of a mapped region.
+.It Bq Er EINVAL
+The
+.Fa len
+parameter was negative.
+.It Bq Er EIO
+An I/O error occured while writing to the file system.
.Sh SEE ALSO
.Xr madvise 2 ,
.Xr munmap 2 ,
diff --git a/lib/libc/sys/munmap.2 b/lib/libc/sys/munmap.2
index b9e8a1b..97692af 100644
--- a/lib/libc/sys/munmap.2
+++ b/lib/libc/sys/munmap.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)munmap.2 8.2 (Berkeley) 4/15/94
+.\" @(#)munmap.2 8.3 (Berkeley) 5/27/94
.\"
-.Dd April 15, 1994
+.Dd May 27, 1994
.Dt MUNMAP 2
.Os
.Sh NAME
@@ -63,8 +63,8 @@ The
parameter was not page aligned, the
.Fa len
parameter was negative, or
-some part of the region being unmapped is not part of the currently
-valid address space.
+some part of the region being unmapped is outside the
+valid address range for a process.
.Sh "SEE ALSO"
.Xr getpagesize 2 ,
.Xr msync 2 ,
diff --git a/lib/libc/sys/quotactl.2 b/lib/libc/sys/quotactl.2
index acf9127..1bcdb8b 100644
--- a/lib/libc/sys/quotactl.2
+++ b/lib/libc/sys/quotactl.2
@@ -32,16 +32,16 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)quotactl.2 8.1 (Berkeley) 6/4/93
+.\" @(#)quotactl.2 8.2 (Berkeley) 3/10/95
.\"
-.Dd June 4, 1993
+.Dd March 10, 1995
.Dt QUOTACTL 2
.Os
.Sh NAME
.Nm quotactl
.Nd manipulate filesystem quotas
.Sh SYNOPSIS
-.Ft #include <ufs/quota.h> /* for ufs quotas */
+.Fd #include <ufs/quota.h> /* for ufs quotas */
.Ft int
.Fn quotactl "const char *path" "int cmd" "int id" "char *addr"
.Sh DESCRIPTION
diff --git a/lib/libc/sys/sigaltstack.2 b/lib/libc/sys/sigaltstack.2
index f1ed718..1626025 100644
--- a/lib/libc/sys/sigaltstack.2
+++ b/lib/libc/sys/sigaltstack.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sigaltstack.2 8.1 (Berkeley) 6/4/93
+.\" @(#)sigaltstack.2 8.2 (Berkeley) 5/1/95
.\"
-.Dd June 4, 1993
+.Dd May 1, 1995
.Dt SIGALTSTACK 2
.Os BSD 4.2
.Sh NAME
@@ -42,7 +42,7 @@
.Fd #include <signal.h>
.Bd -literal
struct sigaltstack {
- caddr_t ss_sp;
+ caddr_t ss_base;
long ss_size;
int ss_flags;
};
@@ -74,7 +74,7 @@ If
.Dv SA_DISABLE
is set in
.Fa ss_flags ,
-.Fa ss_sp
+.Fa ss_base
and
.Fa ss_size
are ignored and the signal stack will be disabled.
@@ -106,7 +106,7 @@ is defined to be the number of bytes/chars that would be used to cover
the usual case when allocating an alternate stack area.
The following code fragment is typically used to allocate an alternate stack.
.Bd -literal -offset indent
-if ((sigstk.ss_sp = malloc(SIGSTKSZ)) == NULL)
+if ((sigstk.ss_base = malloc(SIGSTKSZ)) == NULL)
/* error return */
sigstk.ss_size = SIGSTKSZ;
sigstk.ss_flags = 0;
diff --git a/lib/libc/sys/sigsuspend.2 b/lib/libc/sys/sigsuspend.2
index a234454..2fa3c8d 100644
--- a/lib/libc/sys/sigsuspend.2
+++ b/lib/libc/sys/sigsuspend.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)sigsuspend.2 8.1 (Berkeley) 6/4/93
+.\" @(#)sigsuspend.2 8.2 (Berkeley) 5/16/95
.\"
-.Dd June 4, 1993
+.Dd May 16, 1995
.Dt SIGSUSPEND 2
.Os
.Sh NAME
@@ -74,7 +74,7 @@ set to
.Xr sigsetops 3
.Sh STANDARDS
The
-.Nm sigsupend
+.Nm sigsuspend
function call
conforms to
.St -p1003.1-88 .
diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2
index 8f78621..6c39663 100644
--- a/lib/libc/sys/stat.2
+++ b/lib/libc/sys/stat.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)stat.2 8.3 (Berkeley) 4/19/94
+.\" @(#)stat.2 8.4 (Berkeley) 5/1/95
.\"
-.Dd April 19, 1994
+.Dd May 1, 1995
.Dt STAT 2
.Os BSD 4
.Sh NAME
@@ -239,16 +239,6 @@ points to an invalid address.
.It Bq Er EIO
An I/O error occurred while reading from or writing to the file system.
.El
-.Sh CAVEAT
-The fields in the stat structure currently marked
-.Fa st_spare1 ,
-.Fa st_spare2 ,
-and
-.Fa st_spare3
-are present in preparation for inode time stamps expanding
-to 64 bits. This, however, can break certain programs that
-depend on the time stamps being contiguous (in calls to
-.Xr utimes 2 ) .
.Sh SEE ALSO
.Xr chmod 2 ,
.Xr chown 2 ,
diff --git a/lib/libc/sys/statfs.2 b/lib/libc/sys/statfs.2
index a7a1da2..6db63c6 100644
--- a/lib/libc/sys/statfs.2
+++ b/lib/libc/sys/statfs.2
@@ -29,9 +29,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)statfs.2 8.3 (Berkeley) 2/11/94
+.\" @(#)statfs.2 8.5 (Berkeley) 5/24/95
.\"
-.Dd February 11, 1994
+.Dd May 24, 1995
.Dt STATFS 2
.Os
.Sh NAME
@@ -56,42 +56,59 @@ structure defined as follows:
.Bd -literal
typedef quad fsid_t;
-#define MNAMELEN 90 /* length of buffer for returned name */
+#define MFSNAMELEN 16 /* length of fs type name, including null */
+#define MNAMELEN 90 /* length of buffer for returned name */
struct statfs {
-short f_type; /* type of filesystem (see below) */
-short f_flags; /* copy of mount flags */
-long f_bsize; /* fundamental file system block size */
-long f_iosize; /* optimal transfer block size */
-long f_blocks; /* total data blocks in file system */
-long f_bfree; /* free blocks in fs */
-long f_bavail; /* free blocks avail to non-superuser */
-long f_files; /* total file nodes in file system */
-long f_ffree; /* free file nodes in fs */
-fsid_t f_fsid; /* file system id */
-long f_spare[9]; /* spare for later */
-char f_mntonname[MNAMELEN]; /* mount point */
-char f_mntfromname[MNAMELEN]; /* mounted filesystem */
+ short f_type; /* filesystem type number */
+ short f_flags; /* copy of mount flags */
+ long f_bsize; /* fundamental file system block size */
+ long f_iosize; /* optimal transfer block size */
+ long f_blocks; /* total data blocks in file system */
+ long f_bfree; /* free blocks in fs */
+ long f_bavail; /* free blocks avail to non-superuser */
+ long f_files; /* total file nodes in file system */
+ long f_ffree; /* free file nodes in fs */
+ fsid_t f_fsid; /* file system id */
+ uid_t f_owner; /* user that mounted the filesystem */
+ long f_spare[4]; /* spare for later */
+ char f_fstypename[MFSNAMELEN]; /* fs type name */
+ char f_mntonname[MNAMELEN]; /* directory on which mounted */
+ char f_mntfromname[MNAMELEN];/* mounted filesystem */
};
-/*
-* File system types.
-*/
-#define MOUNT_UFS 1 /* Fast Filesystem */
-#define MOUNT_NFS 2 /* Sun-compatible Network Filesystem */
-#define MOUNT_MFS 3 /* Memory-based Filesystem */
-#define MOUNT_MSDOS 4 /* MS/DOS Filesystem */
-#define MOUNT_LFS 5 /* Log-based Filesystem */
-#define MOUNT_LOFS 6 /* Loopback Filesystem */
-#define MOUNT_FDESC 7 /* File Descriptor Filesystem */
-#define MOUNT_PORTAL 8 /* Portal Filesystem */
-#define MOUNT_NULL 9 /* Minimal Filesystem Layer */
-#define MOUNT_UMAP 10 /* Uid/Gid Remapping Filesystem */
-#define MOUNT_KERNFS 11 /* Kernel Information Filesystem */
-#define MOUNT_PROCFS 12 /* /proc Filesystem */
-#define MOUNT_AFS 13 /* Andrew Filesystem */
-#define MOUNT_CD9660 14 /* ISO9660 (aka CDROM) Filesystem */
-#define MOUNT_UNION 15 /* Union (translucent) Filesystem */
.Ed
+The flags that may be returned include:
+.Bl -tag -width MNT_ASYNCHRONOUS
+.It Dv MNT_RDONLY
+The filesystem is mounted read-only;
+Even the super-user may not write on it.
+.It Dv MNT_NOEXEC
+Files may not be executed from the filesystem.
+.It Dv MNT_NOSUID
+Setuid and setgid bits on files are not honored when they are executed.
+.It Dv MNT_NODEV
+Special files in the filesystem may not be opened.
+.It Dv MNT_SYNCHRONOUS
+All I/O to the filesystem is done synchronously.
+.It Dv MNT_ASYNCHRONOUS
+No filesystem I/O is done synchronously.
+.It Dv MNT_LOCAL
+The filesystem resides locally.
+.It Dv MNT_QUOTA
+The filesystem has quotas enabled on it.
+.It Dv MNT_ROOTFS
+Identifies the root filesystem.
+.It Dv MNT_EXRDONLY
+The filesystem is exported read-only.
+.It Dv MNT_EXPORTED
+The filesystem is exported for both reading and writing.
+.It Dv MNT_DEFEXPORTED
+The filesystem is exported for both reading and writing to any Internet host.
+.It Dv MNT_EXPORTANON
+The filesystem maps all remote accesses to the anonymous user.
+.It Dv MNT_EXKERB
+The filesystem is exported with Kerberos uid mapping.
+.El
.Pp
Fields that are undefined for a particular file system are set to -1.
.Fn Fstatfs
diff --git a/lib/libc/sys/undelete.2 b/lib/libc/sys/undelete.2
new file mode 100644
index 0000000..317397c
--- /dev/null
+++ b/lib/libc/sys/undelete.2
@@ -0,0 +1,105 @@
+.\" Copyright (c) 1994
+.\" Jan-Simon Pendry
+.\" The Regents of the University of California. 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.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by the University of
+.\" California, Berkeley and its contributors.
+.\" 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.
+.\"
+.\" @(#)undelete.2 8.4 (Berkeley) 10/18/94
+.\"
+.Dd October 18, 1994
+.Dt UNDELETE 2
+.Os BSD 4
+.Sh NAME
+.Nm undelete
+.Nd attempt to recover a deleted file
+.Sh SYNOPSIS
+.Fd #include <unistd.h>
+.Ft int
+.Fn undelete "const char *path"
+.Sh DESCRIPTION
+The
+.Fn undelete
+function attempts to recover the deleted file named by
+.Fa path .
+Currently, this works only when the named object
+is a whiteout in a union filesystem.
+The system call removes the whiteout causing
+any objects in a lower layer of the
+union stack to become visible once more.
+.Pp
+Eventually, the
+.Nm undelete
+functionality may be expanded to other filesystems able to recover
+deleted files such as the log-structured filesystem.
+.Sh RETURN VALUES
+Upon successful completion, a value of 0 is returned.
+Otherwise, a value of -1 is returned and
+.Va errno
+is set to indicate the error.
+.Sh ERRORS
+The
+.Fn undelete
+succeeds unless:
+.Bl -tag -width ENAMETOOLONGAA
+.It Bq Er ENOTDIR
+A component of the path prefix is not a directory.
+.It Bq Er EINVAL
+The pathname contains a character with the high-order bit set.
+.It Bq Er ENAMETOOLONG
+A component of a pathname exceeded 255 characters,
+or an entire path name exceeded 1023 characters.
+.It Bq Er EEXIST
+The path does not reference a whiteout.
+.It Bq Er ENOENT
+The named whiteout does not exist.
+.It Bq Er EACCES
+Search permission is denied for a component of the path prefix.
+.It Bq Er EACCES
+Write permission is denied on the directory containing the name
+to be undeleted.
+.It Bq Er ELOOP
+Too many symbolic links were encountered in translating the pathname.
+.It Bq Er EPERM
+The directory containing the name is marked sticky,
+and the containing directory is not owned by the effective user ID.
+.It Bq Er EIO
+An I/O error occurred while updating the directory entry.
+.It Bq Er EROFS
+The name resides on a read-only file system.
+.It Bq Er EFAULT
+.Fa Path
+points outside the process's allocated address space.
+.El
+.Sh SEE ALSO
+.Xr unlink 2 ,
+.Xr mount_union 8
+.Sh HISTORY
+An
+.Nm undelete
+function call first appeared in 4.4BSD-Lite.
OpenPOWER on IntegriCloud