summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorcvs2svn <cvs2svn@FreeBSD.org>1999-01-21 00:55:32 +0000
committercvs2svn <cvs2svn@FreeBSD.org>1999-01-21 00:55:32 +0000
commit76b5366091f76c9bc73570149ef5055648fc2c39 (patch)
tree590d020e0f2a5bea6e09d66d951a674443b21d67 /lib/libc
parent4b4d01da6f07f7754ff6a6e4f5223e9f0984d1a6 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/alpha/SYS.h4
-rw-r--r--lib/libc/alpha/gen/Makefile.inc8
-rw-r--r--lib/libc/alpha/gen/fpgetmask.c11
-rw-r--r--lib/libc/alpha/gen/fpgetround.c7
-rw-r--r--lib/libc/alpha/gen/fpgetsticky.c10
-rw-r--r--lib/libc/alpha/gen/fpsetmask.c12
-rw-r--r--lib/libc/alpha/gen/fpsetround.c17
-rw-r--r--lib/libc/alpha/gen/fpsetsticky.c16
-rw-r--r--lib/libc/alpha/gen/setjmp.S2
-rw-r--r--lib/libc/alpha/sys/cerror.S6
-rw-r--r--lib/libc/gen/fstab.c29
-rw-r--r--lib/libc/gen/getloadavg.31
-rw-r--r--lib/libc/gen/getobjformat.316
-rw-r--r--lib/libc/gen/getpwent.34
-rw-r--r--lib/libc/gen/getpwent.c4
-rw-r--r--lib/libc/gen/getvfsbyname.c4
-rw-r--r--lib/libc/gen/getvfsent.c11
-rw-r--r--lib/libc/gen/nlist.c136
-rw-r--r--lib/libc/gen/popen.39
-rw-r--r--lib/libc/gen/psignal.34
-rw-r--r--lib/libc/gen/psignal.c6
-rw-r--r--lib/libc/gen/setmode.311
-rw-r--r--lib/libc/gen/sysctl.35
-rw-r--r--lib/libc/gen/sysctl.c12
-rw-r--r--lib/libc/gen/tzset.34
-rw-r--r--lib/libc/i386/sys/sigsuspend.S8
-rw-r--r--lib/libc/locale/ansi.c12
-rw-r--r--lib/libc/quad/moddi3.c2
-rw-r--r--lib/libc/stdio/fclose.312
-rw-r--r--lib/libc/stdio/mktemp.c2
-rw-r--r--lib/libc/stdio/perror.c2
-rw-r--r--lib/libc/stdlib/merge.c7
-rw-r--r--lib/libc/stdlib/qsort.34
-rw-r--r--lib/libc/stdtime/asctime.c7
-rw-r--r--lib/libc/stdtime/ctime.3119
-rw-r--r--lib/libc/stdtime/localtime.c10
-rw-r--r--lib/libc/string/Makefile.inc3
-rw-r--r--lib/libc/string/strerror.313
-rw-r--r--lib/libc/string/strtok.3113
-rw-r--r--lib/libc/string/strtok.c191
-rw-r--r--lib/libc/sys/Makefile.inc6
-rw-r--r--lib/libc/sys/accept.28
-rw-r--r--lib/libc/sys/aio_read.2189
-rw-r--r--lib/libc/sys/fcntl.27
-rw-r--r--lib/libc/sys/getdirentries.22
-rw-r--r--lib/libc/sys/rename.254
-rw-r--r--lib/libc/sys/revoke.211
-rw-r--r--lib/libc/sys/sendfile.2151
-rw-r--r--lib/libc/sys/sigaltstack.25
-rw-r--r--lib/libc/sys/stat.238
-rw-r--r--lib/libc/sys/vfork.24
51 files changed, 334 insertions, 995 deletions
diff --git a/lib/libc/alpha/SYS.h b/lib/libc/alpha/SYS.h
index 01d114d2903a..cfc0909d8d32 100644
--- a/lib/libc/alpha/SYS.h
+++ b/lib/libc/alpha/SYS.h
@@ -1,4 +1,4 @@
-/* $Id: SYS.h,v 1.4 1998/12/23 11:50:51 dfr Exp $ */
+/* $Id: SYS.h,v 1.2 1998/06/09 22:43:34 jb Exp $ */
/* From: NetBSD: SYS.h,v 1.5 1997/05/02 18:15:15 kleink Exp */
/*
@@ -41,7 +41,7 @@
LLABEL(name,0): \
LDGP(gp); \
beq a3, LLABEL(name,1); \
- jmp zero, .cerror; \
+ jmp zero, cerror; \
LLABEL(name,1):
diff --git a/lib/libc/alpha/gen/Makefile.inc b/lib/libc/alpha/gen/Makefile.inc
index cc7a87c10cff..3ff99f001439 100644
--- a/lib/libc/alpha/gen/Makefile.inc
+++ b/lib/libc/alpha/gen/Makefile.inc
@@ -1,8 +1,10 @@
-# $Id: Makefile.inc,v 1.4 1998/08/17 03:38:54 jb Exp $
+# $Id: Makefile.inc,v 1.3 1998/08/08 02:18:07 jb Exp $
SRCS+= _setjmp.S fabs.S frexp.c infinity.c isinf.c ldexp.c modf.c setjmp.S
-SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
- fpsetround.c fpsetsticky.c
+SRCS+= flt_rounds.c
+
+#SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \
+# fpsetround.c fpsetsticky.c
SRCS+= sigsetjmp.S
SRCS+= __divqu.S __divq.S __divlu.S __divl.S
diff --git a/lib/libc/alpha/gen/fpgetmask.c b/lib/libc/alpha/gen/fpgetmask.c
index 516ae981d55c..c52a7ef07112 100644
--- a/lib/libc/alpha/gen/fpgetmask.c
+++ b/lib/libc/alpha/gen/fpgetmask.c
@@ -31,19 +31,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/types.h>
#include <ieeefp.h>
-#include <machine/sysarch.h>
-
-struct params {
- u_int64_t mask;
-};
fp_except
fpgetmask()
{
- struct params p;
- sysarch(ALPHA_GET_FPMASK, (char *) &p);
- return((fp_except) p.mask);
+ /* XXX */
+ abort();
}
diff --git a/lib/libc/alpha/gen/fpgetround.c b/lib/libc/alpha/gen/fpgetround.c
index 46976c2e4c11..39b9b4744a6b 100644
--- a/lib/libc/alpha/gen/fpgetround.c
+++ b/lib/libc/alpha/gen/fpgetround.c
@@ -33,7 +33,6 @@
#include <sys/types.h>
#include <ieeefp.h>
-#include <machine/fpu.h>
fp_rnd
fpgetround()
@@ -41,8 +40,10 @@ fpgetround()
double fpcrval;
u_int64_t old;
- GET_FPCR(fpcrval);
+ __asm__("trapb");
+ __asm__("mf_fpcr %0" : "=f" (fpcrval));
+ __asm__("trapb");
old = *(u_int64_t *)&fpcrval;
- return ((old & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT);
+ return ((old >> 58) & 0x3);
}
diff --git a/lib/libc/alpha/gen/fpgetsticky.c b/lib/libc/alpha/gen/fpgetsticky.c
index c0ff4d75c88a..c36db3913d5f 100644
--- a/lib/libc/alpha/gen/fpgetsticky.c
+++ b/lib/libc/alpha/gen/fpgetsticky.c
@@ -31,18 +31,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/types.h>
#include <ieeefp.h>
-#include <machine/fpu.h>
fp_except
fpgetsticky()
{
- double fpcrval;
- u_int64_t old;
- GET_FPCR(fpcrval);
- old = *(u_int64_t *)&fpcrval;
- return (((old >> IEEE_STATUS_TO_FPCR_SHIFT) & IEEE_STATUS_MASK)
- >> IEEE_STATUS_TO_EXCSUM_SHIFT);
+ /* XXX */
+ abort();
}
diff --git a/lib/libc/alpha/gen/fpsetmask.c b/lib/libc/alpha/gen/fpsetmask.c
index 05201ce81d40..87fc5a2f4b4c 100644
--- a/lib/libc/alpha/gen/fpsetmask.c
+++ b/lib/libc/alpha/gen/fpsetmask.c
@@ -31,21 +31,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/types.h>
#include <ieeefp.h>
-#include <machine/sysarch.h>
-
-struct params {
- u_int64_t mask;
-};
fp_except
fpsetmask(mask)
fp_except mask;
{
- struct params p;
- p.mask = (u_int64_t) mask;
- sysarch(ALPHA_SET_FPMASK, (char *) &p);
- return ((fp_except) p.mask);
+ /* XXX */
+ abort();
}
diff --git a/lib/libc/alpha/gen/fpsetround.c b/lib/libc/alpha/gen/fpsetround.c
index 0d8f40af6d65..c28093cad87c 100644
--- a/lib/libc/alpha/gen/fpsetround.c
+++ b/lib/libc/alpha/gen/fpsetround.c
@@ -33,7 +33,6 @@
#include <sys/types.h>
#include <ieeefp.h>
-#include <machine/fpu.h>
fp_rnd
fpsetround(rnd_dir)
@@ -42,14 +41,18 @@ fpsetround(rnd_dir)
double fpcrval;
u_int64_t old, new;
- GET_FPCR(fpcrval);
+ __asm__("trapb");
+ __asm__("mf_fpcr %0" : "=f" (fpcrval));
+ __asm__("trapb");
old = *(u_int64_t *)&fpcrval;
- new = old & (~FPCR_DYN_MASK);
- new |= ((long) rnd_dir << FPCR_DYN_SHIFT) & FPCR_DYN_MASK;
-
+ new = old & ~(long)0x0c00000000000000;
+ new = (long)rnd_dir << 58;
*(u_int64_t *)&fpcrval = new;
- SET_FPCR(fpcrval);
- return ((old & FPCR_DYN_MASK) >> FPCR_DYN_SHIFT);
+ __asm__("trapb");
+ __asm__("mt_fpcr %0" : : "f" (fpcrval));
+ __asm__("trapb");
+
+ return ((old >> 58) & 0x3);
}
diff --git a/lib/libc/alpha/gen/fpsetsticky.c b/lib/libc/alpha/gen/fpsetsticky.c
index ae0d742f79f0..90a993ee642a 100644
--- a/lib/libc/alpha/gen/fpsetsticky.c
+++ b/lib/libc/alpha/gen/fpsetsticky.c
@@ -31,25 +31,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/types.h>
#include <ieeefp.h>
-#include <machine/fpu.h>
fp_except
fpsetsticky(sticky)
fp_except sticky;
{
- double fpcrval;
- u_int64_t old,new ;
- GET_FPCR(fpcrval);
- old = *(u_int64_t *)&fpcrval;
- new = old & ~ (IEEE_STATUS_MASK << IEEE_STATUS_TO_FPCR_SHIFT);
- new |= ((sticky << IEEE_STATUS_TO_EXCSUM_SHIFT) & IEEE_STATUS_MASK)
- << IEEE_STATUS_TO_FPCR_SHIFT;
- *(u_int64_t *)&fpcrval = new;
- SET_FPCR(fpcrval);
-
- return (((old >> IEEE_STATUS_TO_FPCR_SHIFT) & IEEE_STATUS_MASK)
- >> IEEE_STATUS_TO_EXCSUM_SHIFT);
+ /* XXX */
+ abort();
}
diff --git a/lib/libc/alpha/gen/setjmp.S b/lib/libc/alpha/gen/setjmp.S
index a6d10836ae95..86dbb38f1b90 100644
--- a/lib/libc/alpha/gen/setjmp.S
+++ b/lib/libc/alpha/gen/setjmp.S
@@ -68,7 +68,7 @@ LEAF(setjmp, 1)
lda sp, -24(sp) /* sizeof struct sigaltstack */
mov zero, a0
mov sp, a1
- PCALL(sigaltstack)
+ CALL(sigaltstack)
ldl t0, 16(sp) /* offset of ss_flags */
lda sp, 24(sp) /* sizeof struct sigaltstack */
ldq ra, ((26 + 4) * 8)(s0) /* restore return address */
diff --git a/lib/libc/alpha/sys/cerror.S b/lib/libc/alpha/sys/cerror.S
index 63771c0ffa08..cce30068de6c 100644
--- a/lib/libc/alpha/sys/cerror.S
+++ b/lib/libc/alpha/sys/cerror.S
@@ -1,4 +1,4 @@
-/* $Id: cerror.S,v 1.3 1998/12/23 11:50:51 dfr Exp $ */
+/* $Id$ */
/* From: NetBSD: cerror.S,v 1.4 1996/11/08 00:52:46 cgd Exp */
/*
@@ -34,7 +34,7 @@
#define FRAME_RA_OFFSET 0
#define FRAME_V0_OFFSET 8
-NESTED(.cerror, 0, FRAME_SIZE, ra, IM_RA|IM_V0, 0)
+NESTED(cerror, 0, FRAME_SIZE, ra, IM_RA|IM_V0, 0)
br t0, L1
L1: LDGP(t0)
@@ -51,4 +51,4 @@ L1: LDGP(t0)
ldq ra, FRAME_RA_OFFSET(sp)
lda sp, FRAME_SIZE(sp)
RET
-END(.cerror)
+END(cerror)
diff --git a/lib/libc/gen/fstab.c b/lib/libc/gen/fstab.c
index 65b02c190665..a5260687149a 100644
--- a/lib/libc/gen/fstab.c
+++ b/lib/libc/gen/fstab.c
@@ -35,13 +35,8 @@
static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
-#include <sys/param.h>
-#include <sys/mount.h>
-#include <sys/stat.h>
-
#include <errno.h>
#include <fstab.h>
-#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -52,30 +47,8 @@ static struct fstab _fs_fstab;
static int LineNo = 0;
static void error __P((int));
-static void fixfsfile __P((void));
static int fstabscan __P((void));
-static void
-fixfsfile()
-{
- static char buf[sizeof(_PATH_DEV) + MNAMELEN];
- struct stat sb;
- struct statfs sf;
-
- if (strcmp(_fs_fstab.fs_file, "/") != 0)
- return;
- if (statfs("/", &sf) != 0)
- return;
- if (sf.f_mntfromname[0] == '/')
- buf[0] = '\0';
- else
- strcpy(buf, _PATH_DEV);
- strcat(buf, sf.f_mntfromname);
- if (stat(buf, &sb) != 0 || !S_ISBLK(sb.st_mode))
- return;
- _fs_fstab.fs_spec = buf;
-}
-
static int
fstabscan()
{
@@ -96,7 +69,6 @@ fstabscan()
if (!strpbrk(p, " \t")) {
_fs_fstab.fs_spec = strsep(&p, ":\n");
_fs_fstab.fs_file = strsep(&p, ":\n");
- fixfsfile();
_fs_fstab.fs_type = strsep(&p, ":\n");
if (_fs_fstab.fs_type) {
if (!strcmp(_fs_fstab.fs_type, FSTAB_XX))
@@ -124,7 +96,6 @@ fstabscan()
while ((cp = strsep(&p, " \t\n")) != NULL && *cp == '\0')
;
_fs_fstab.fs_file = cp;
- fixfsfile();
while ((cp = strsep(&p, " \t\n")) != NULL && *cp == '\0')
;
_fs_fstab.fs_vfstype = cp;
diff --git a/lib/libc/gen/getloadavg.3 b/lib/libc/gen/getloadavg.3
index 8d8facf4b8b4..fa5b5715a5ff 100644
--- a/lib/libc/gen/getloadavg.3
+++ b/lib/libc/gen/getloadavg.3
@@ -38,7 +38,6 @@
.Nm getloadavg
.Nd get system load averages
.Sh SYNOPSIS
-.Fd #include <stdlib.h>
.Ft int
.Fn getloadavg "double loadavg[]" "int nelem"
.Sh DESCRIPTION
diff --git a/lib/libc/gen/getobjformat.3 b/lib/libc/gen/getobjformat.3
index ad7ff438b234..228bb5f44883 100644
--- a/lib/libc/gen/getobjformat.3
+++ b/lib/libc/gen/getobjformat.3
@@ -22,7 +22,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $Id: getobjformat.3,v 1.1 1998/09/09 01:21:24 jdp Exp $
+.\" $Id$
.\"
.Dd September 7, 1998
.Dt GETOBJFORMAT 3
@@ -103,22 +103,12 @@ and its null terminator,
returns -1. In that case, the contents of the buffer and argument
vector supplied by the caller are indeterminate.
.Sh ENVIRONMENT
-.Bl -tag -width OBJFORMAT
-.It Ev OBJFORMAT
-If the environment variable
.Ev OBJFORMAT
-is set, it overrides the default object file format.
-.Ev OBJFORMAT takes precedence over
-.Pa /etc/objformat .
.Sh FILES
-.Bl -tag -width /etc/objformat -compact
-.It Pa /etc/objformat
-If present, specifies the object file format to use. Syntax is
-.Ql OBJFORMAT=xxx .
+.Pa /etc/objformat
.Sh SEE ALSO
.Xr objformat 1
.Sh HISTORY
The
.Fn getobjformat
-function first appeared in
-.Fx 3.0 .
+function first appeared in FreeBSD 3.0.
diff --git a/lib/libc/gen/getpwent.3 b/lib/libc/gen/getpwent.3
index 94fc4063f30b..8772a429e7e4 100644
--- a/lib/libc/gen/getpwent.3
+++ b/lib/libc/gen/getpwent.3
@@ -72,8 +72,8 @@ file
struct passwd {
char *pw_name; /* user name */
char *pw_passwd; /* encrypted password */
- uid_t pw_uid; /* user uid */
- gid_t pw_gid; /* user gid */
+ int pw_uid; /* user uid */
+ int pw_gid; /* user gid */
time_t pw_change; /* password change time */
char *pw_class; /* user access class */
char *pw_gecos; /* Honeywell login info */
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 2ee0e32aabc7..02ec190519fe 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -154,9 +154,7 @@ getpwnam(name)
bf[0] = _PW_KEYBYNAME;
len = strlen(name);
- if (len > UT_NAMESIZE)
- return(NULL);
- bcopy(name, bf + 1, len);
+ bcopy(name, bf + 1, MIN(len, UT_NAMESIZE));
key.data = (u_char *)bf;
key.size = len + 1;
rval = __hashpw(&key);
diff --git a/lib/libc/gen/getvfsbyname.c b/lib/libc/gen/getvfsbyname.c
index 7f8a9703710a..57d1db4e7744 100644
--- a/lib/libc/gen/getvfsbyname.c
+++ b/lib/libc/gen/getvfsbyname.c
@@ -36,13 +36,15 @@
static char sccsid[] = "@(#)kvm_getvfsbyname.c 8.1 (Berkeley) 4/3/95";
#endif
static const char rcsid[] =
- "$Id: getvfsbyname.c,v 1.3 1998/03/09 04:36:07 jb Exp $";
+ "$Id: getvfsbyname.c,v 1.2 1997/03/03 13:08:33 bde Exp $";
#endif /* not lint */
+#define _NEW_VFSCONF
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
#include <errno.h>
+#include <kvm.h>
/*
* Given a filesystem name, determine if it is resident in the kernel,
diff --git a/lib/libc/gen/getvfsent.c b/lib/libc/gen/getvfsent.c
index 8aa147db76ab..469ef975c1e9 100644
--- a/lib/libc/gen/getvfsent.c
+++ b/lib/libc/gen/getvfsent.c
@@ -193,7 +193,6 @@ vfspath(const char *name)
int
vfsisloadable(const char *name)
{
-#if 0
int fd;
fd = open("/dev/lkm", O_RDWR, 0);
@@ -203,24 +202,16 @@ vfsisloadable(const char *name)
close(fd);
return !!vfspath(name);
-#else
- return 1;
-#endif
}
int
vfsload(const char *name)
{
- const char *path;
+ const char *path = vfspath(name);
char name_mod[sizeof("_mod") + strlen(name)];
pid_t pid;
int status;
- status = kldload(name);
- if (status != -1)
- return 0;
-
- path = vfspath(name);
if(!path) {
errno = ENOENT;
return -1;
diff --git a/lib/libc/gen/nlist.c b/lib/libc/gen/nlist.c
index 55f4f3978bb0..ebd4234c9c2a 100644
--- a/lib/libc/gen/nlist.c
+++ b/lib/libc/gen/nlist.c
@@ -29,8 +29,6 @@
* 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.
- *
- * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -199,7 +197,18 @@ __aout_fdnlist(fd, list)
#endif
#ifdef _NLIST_DO_ELF
-static void elf_sym_to_nlist __P((struct nlist *, Elf_Sym *, Elf_Shdr *, int));
+
+#if ELF_TARG_CLASS == ELFCLASS32
+
+#define Elf(x) Elf32_##x
+#define ELF(x) ELF32_##x
+
+#else
+
+#define Elf(x) Elf64_##x
+#define ELF(x) ELF64_##x
+
+#endif
/*
* __elf_is_okay__ - Determine if ehdr really
@@ -210,13 +219,13 @@ static void elf_sym_to_nlist __P((struct nlist *, Elf_Sym *, Elf_Shdr *, int));
*/
int
__elf_is_okay__(ehdr)
- register Elf_Ehdr *ehdr;
+ register Elf(Ehdr) *ehdr;
{
register int retval = 0;
/*
* We need to check magic, class size, endianess,
* and version before we look at the rest of the
- * Elf_Ehdr structure. These few elements are
+ * Elf(Ehdr) structure. These few elements are
* represented in a machine independant fashion.
*/
if (IS_ELF(*ehdr) &&
@@ -238,19 +247,15 @@ __elf_fdnlist(fd, list)
register struct nlist *list;
{
register struct nlist *p;
+ register caddr_t strtab;
register Elf_Off symoff = 0, symstroff = 0;
register Elf_Word symsize = 0, symstrsize = 0;
- register Elf_Sword cc, i;
- int nent = -1;
- int errsave;
+ register Elf_Sword nent, cc, i;
Elf_Sym sbuf[1024];
Elf_Sym *s;
Elf_Ehdr ehdr;
- char *strtab = NULL;
Elf_Shdr *shdr = NULL;
- Elf_Shdr *sh;
Elf_Word shdr_size;
- void *base;
struct stat st;
/* Make sure obj is OK */
@@ -270,11 +275,10 @@ __elf_fdnlist(fd, list)
}
/* mmap section header table */
- base = mmap(NULL, (size_t)shdr_size, PROT_READ, 0, fd,
- (off_t)ehdr.e_shoff);
- if (base == MAP_FAILED)
+ shdr = (Elf_Shdr *)mmap(NULL, (size_t)shdr_size,
+ PROT_READ, 0, fd, (off_t) ehdr.e_shoff);
+ if (shdr == (Elf_Shdr *)-1)
return (-1);
- shdr = (Elf_Shdr *)base;
/*
* Find the symbol table entry and it's corresponding
@@ -292,10 +296,13 @@ __elf_fdnlist(fd, list)
}
}
+ /* Flush the section header table */
+ munmap((caddr_t)shdr, shdr_size);
+
/* Check for files too large to mmap. */
if (symstrsize > SIZE_T_MAX) {
errno = EFBIG;
- goto done;
+ return (-1);
}
/*
* Map string table into our address space. This gives us
@@ -303,11 +310,10 @@ __elf_fdnlist(fd, list)
* making the memory allocation permanent as with malloc/free
* (i.e., munmap will return it to the system).
*/
- base = mmap(NULL, (size_t)symstrsize, PROT_READ, 0, fd,
- (off_t)symstroff);
- if (base == MAP_FAILED)
- goto done;
- strtab = (char *)base;
+ strtab = mmap(NULL, (size_t)symstrsize, PROT_READ, 0, fd,
+ (off_t) symstroff);
+ if (strtab == (char *)-1)
+ return (-1);
/*
* clean out any left-over information for all valid entries.
@@ -329,6 +335,7 @@ __elf_fdnlist(fd, list)
}
/* Don't process any further if object is stripped. */
+ /* ELFism - dunno if stripped by looking at header */
if (symoff == 0)
goto done;
@@ -337,24 +344,43 @@ __elf_fdnlist(fd, list)
goto done;
}
- while (symsize > 0 && nent > 0) {
+ while (symsize > 0) {
cc = MIN(symsize, sizeof(sbuf));
if (read(fd, sbuf, cc) != cc)
break;
symsize -= cc;
- for (s = sbuf; cc > 0 && nent > 0; ++s, cc -= sizeof(*s)) {
- char *name;
- struct nlist *p;
+ for (s = sbuf; cc > 0; ++s, cc -= sizeof(*s)) {
+ register int soff = s->st_name;
- name = strtab + s->st_name;
- if (name[0] == '\0')
+ if (soff == 0)
continue;
for (p = list; !ISLAST(p); p++) {
if ((p->n_un.n_name[0] == '_' &&
- strcmp(name, p->n_un.n_name+1) == 0)
- || strcmp(name, p->n_un.n_name) == 0) {
- elf_sym_to_nlist(p, s, shdr,
- ehdr.e_shnum);
+ !strcmp(&strtab[soff], p->n_un.n_name+1))
+ || !strcmp(&strtab[soff], p->n_un.n_name)) {
+ p->n_value = s->st_value;
+
+ /* XXX - type conversion */
+ /* is pretty rude. */
+ switch(ELF(ST_TYPE)(s->st_info)) {
+ case STT_NOTYPE:
+ p->n_type = N_UNDF;
+ break;
+ case STT_OBJECT:
+ p->n_type = N_DATA;
+ break;
+ case STT_FUNC:
+ p->n_type = N_TEXT;
+ break;
+ case STT_FILE:
+ p->n_type = N_FN;
+ break;
+ }
+ if (ELF(ST_BIND)(s->st_info) ==
+ STB_LOCAL)
+ p->n_type = N_EXT;
+ p->n_desc = 0;
+ p->n_other = 0;
if (--nent <= 0)
break;
}
@@ -362,52 +388,8 @@ __elf_fdnlist(fd, list)
}
}
done:
- errsave = errno;
- if (strtab != NULL)
- munmap(strtab, symstrsize);
- if (shdr != NULL)
- munmap(shdr, shdr_size);
- errno = errsave;
- return (nent);
-}
+ munmap(strtab, symstrsize);
-/*
- * Convert an Elf_Sym into an nlist structure. This fills in only the
- * n_value and n_type members.
- */
-static void
-elf_sym_to_nlist(nl, s, shdr, shnum)
- struct nlist *nl;
- Elf_Sym *s;
- Elf_Shdr *shdr;
- int shnum;
-{
- nl->n_value = s->st_value;
-
- switch (s->st_shndx) {
- case SHN_UNDEF:
- case SHN_COMMON:
- nl->n_type = N_UNDF;
- break;
- case SHN_ABS:
- nl->n_type = ELF_ST_TYPE(s->st_info) == STT_FILE ?
- N_FN : N_ABS;
- break;
- default:
- if (s->st_shndx >= shnum)
- nl->n_type = N_UNDF;
- else {
- Elf_Shdr *sh = shdr + s->st_shndx;
-
- nl->n_type = sh->sh_type == SHT_PROGBITS ?
- (sh->sh_flags & SHF_WRITE ? N_DATA : N_TEXT) :
- (sh->sh_type == SHT_NOBITS ? N_BSS : N_UNDF);
- }
- break;
- }
-
- if (ELF_ST_BIND(s->st_info) == STB_GLOBAL ||
- ELF_ST_BIND(s->st_info) == STB_WEAK)
- nl->n_type |= N_EXT;
+ return (nent);
}
#endif /* _NLIST_DO_ELF */
diff --git a/lib/libc/gen/popen.3 b/lib/libc/gen/popen.3
index 600f5d085aad..c4278e5f3e38 100644
--- a/lib/libc/gen/popen.3
+++ b/lib/libc/gen/popen.3
@@ -53,19 +53,16 @@ function
a process by creating a bidirectional pipe
forking,
and invoking the shell.
-Any streams opened by previous
-.Fn popen
-calls in the parent process are closed in the new child process.
Historically,
-.Fn popen
+.Nm popen
was implemented with a unidirectional pipe;
hence many implementations of
-.Fn popen
+.Nm popen
only allow the
.Fa type
argument to specify reading or writing, not both.
Since
-.Fn popen
+.Nm popen
is now implemented using a bidirectional pipe, the
.Fa type
argument may request a bidirectional data flow.
diff --git a/lib/libc/gen/psignal.3 b/lib/libc/gen/psignal.3
index aa78732d55ae..773759c1d89c 100644
--- a/lib/libc/gen/psignal.3
+++ b/lib/libc/gen/psignal.3
@@ -57,9 +57,7 @@ If the argument
.Fa s
is
.Pf non- Dv NULL
-and does not point to the null character,
-.Fa s
-is written to the standard error file descriptor
+it is written to the standard error file descriptor
prior to the message string,
immediately followed by a colon and a space.
If the signal number is not recognized
diff --git a/lib/libc/gen/psignal.c b/lib/libc/gen/psignal.c
index 96eab9d45d14..b7e7ab66761a 100644
--- a/lib/libc/gen/psignal.c
+++ b/lib/libc/gen/psignal.c
@@ -49,13 +49,15 @@ psignal(sig, s)
const char *s;
{
register const char *c;
+ register int n;
if (sig < NSIG)
c = sys_siglist[sig];
else
c = "Unknown signal";
- if (s != NULL && *s != '\0') {
- (void)write(STDERR_FILENO, s, strlen(s));
+ n = strlen(s);
+ if (n) {
+ (void)write(STDERR_FILENO, s, n);
(void)write(STDERR_FILENO, ": ", 2);
}
(void)write(STDERR_FILENO, c, strlen(c));
diff --git a/lib/libc/gen/setmode.3 b/lib/libc/gen/setmode.3
index bc38fd3e1193..4c85b30e2a38 100644
--- a/lib/libc/gen/setmode.3
+++ b/lib/libc/gen/setmode.3
@@ -81,19 +81,10 @@ is to modify future file modes correctly.
.Pp
If the mode passed to
.Fn setmode
-is invalid or if memory cannot be allocated for the return value,
+is invalid,
.Fn setmode
returns
.Dv NULL .
-.Pp
-The value returned from
-.Fn setmode
-is obtained from
-.Fn malloc
-and should be returned to the system with
-.Fn free
-when the program is done with it, generally after a call to
-.Fn getmode .
.Sh ERRORS
The
.Fn setmode
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index 02a185ca848a..30e8e83eb879 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -667,10 +667,9 @@ If the amount of free and cache memory falls below this value, the
pageout daemon will enter "memory conserving mode" to avoid deadlock.
.El
.Sh RETURN VALUES
+If the call to
.Fn sysctl
-and
-.Fn sysctlbyname
-return 0 when successful.
+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/sysctl.c b/lib/libc/gen/sysctl.c
index 19709d5932e9..cb7448af3243 100644
--- a/lib/libc/gen/sysctl.c
+++ b/lib/libc/gen/sysctl.c
@@ -66,20 +66,16 @@ sysctl(name, namelen, oldp, oldlenp, newp, newlen)
switch (name[1]) {
case USER_CS_PATH:
- if (oldp && *oldlenp < sizeof(_PATH_STDPATH)) {
- errno = ENOMEM;
- return -1;
- }
+ if (oldp && *oldlenp < sizeof(_PATH_STDPATH))
+ return (ENOMEM);
*oldlenp = sizeof(_PATH_STDPATH);
if (oldp != NULL)
memmove(oldp, _PATH_STDPATH, sizeof(_PATH_STDPATH));
return (0);
}
- if (oldp && *oldlenp < sizeof(int)) {
- errno = ENOMEM;
- return (-1);
- }
+ if (oldp && *oldlenp < sizeof(int))
+ return (ENOMEM);
*oldlenp = sizeof(int);
if (oldp == NULL)
return (0);
diff --git a/lib/libc/gen/tzset.3 b/lib/libc/gen/tzset.3
index 5d83f335f525..3c5b27650bae 100644
--- a/lib/libc/gen/tzset.3
+++ b/lib/libc/gen/tzset.3
@@ -137,7 +137,7 @@ is required; if
is missing, then summer time does not apply in this locale.
Upper and lowercase letters are explicitly allowed. Any characters
except a leading colon
-.Pq Ql \: ,
+.Pq Ql : ,
digits, comma
.Pq Ql \&, ,
minus
@@ -284,7 +284,7 @@ values in
.El
.Pp
For compatibility with System V Release 3.1, a semicolon
-.Pq Ql \;
+.Pq Ql ;
may be used to separate the
.Em rule
from the rest of the specification.
diff --git a/lib/libc/i386/sys/sigsuspend.S b/lib/libc/i386/sys/sigsuspend.S
index f85b2e1929f1..660eabf85411 100644
--- a/lib/libc/i386/sys/sigsuspend.S
+++ b/lib/libc/i386/sys/sigsuspend.S
@@ -33,12 +33,12 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sigsuspend.S,v 1.6 1997/02/22 14:59:40 peter Exp $
+ * $Id$
*/
#if defined(SYSLIBC_RCS) && !defined(lint)
.text
- .asciz "$Id: sigsuspend.S,v 1.6 1997/02/22 14:59:40 peter Exp $"
+ .asciz "$Id$"
#endif /* SYSLIBC_RCS and not lint */
#include "SYS.h"
@@ -50,9 +50,7 @@ err:
#ifdef _THREAD_SAFE
ENTRY(_thread_sys_sigsuspend)
#else
-ENTRY(_sigsuspend)
- .weak CNAME(sigsuspend) ;
- .set CNAME(sigsuspend), CNAME(_sigsuspend) ;
+ENTRY(sigsuspend)
#endif
movl 4(%esp),%eax # fetch mask arg
movl (%eax),%eax # indirect to mask arg
diff --git a/lib/libc/locale/ansi.c b/lib/libc/locale/ansi.c
index c0871fea6dac..a5a3362d8adf 100644
--- a/lib/libc/locale/ansi.c
+++ b/lib/libc/locale/ansi.c
@@ -127,24 +127,22 @@ wcstombs(s, pwcs, n)
size_t n;
{
char *e;
- int cnt, nb;
+ int cnt = 0;
- if (!pwcs || !s || n > INT_MAX)
+ if (!pwcs || !s)
return (-1);
- nb = n;
- cnt = 0;
- while (nb > 0) {
+ while (n > 0) {
if (*pwcs == 0) {
*s = 0;
break;
}
- if (!sputrune(*pwcs++, s, nb, &e))
+ if (!sputrune(*pwcs++, s, n, &e))
return (-1); /* encoding error */
if (!e) /* too long */
return (cnt);
cnt += e - s;
- nb -= e - s;
+ n -= e - s;
s = e;
}
return (cnt);
diff --git a/lib/libc/quad/moddi3.c b/lib/libc/quad/moddi3.c
index fa76ea3838e3..f31c6e84f2ba 100644
--- a/lib/libc/quad/moddi3.c
+++ b/lib/libc/quad/moddi3.c
@@ -59,7 +59,7 @@ __moddi3(a, b)
else
ua = a, neg = 0;
if (b < 0)
- ub = -(u_quad_t)b;
+ ub = -(u_quad_t)b, neg ^= 1;
else
ub = b;
(void)__qdivrem(ua, ub, &ur);
diff --git a/lib/libc/stdio/fclose.3 b/lib/libc/stdio/fclose.3
index 81f260fc3498..61822e5d7604 100644
--- a/lib/libc/stdio/fclose.3
+++ b/lib/libc/stdio/fclose.3
@@ -63,7 +63,7 @@ is returned and the global variable
.Va errno
is set to indicate the error.
In either case no further access to the stream is possible.
-.Sh ERRORS
+.Pp
The
.Fn fclose
function
@@ -75,12 +75,10 @@ or
.Xr fflush 3 .
.Sh NOTES
.Fn fclose
-does not handle NULL arguments; they will result in a segmentation
-violation.
-This is intentional - it makes it easier to make sure programs written
-under FreeBSD are bug free.
-This behaviour is an implementation detail, and programs should not
-rely upon it.
+does not handle NULL arguments; they will result in a segment
+violation. This is intentional - it makes it easier to make sure
+programs written under FreeBSD are bug free. This behaviour is an
+implementation detail, and programs should not rely upon it.
.Sh SEE ALSO
.Xr close 2 ,
.Xr fflush 3 ,
diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c
index c2da533af8a0..ca3fa5bdac3d 100644
--- a/lib/libc/stdio/mktemp.c
+++ b/lib/libc/stdio/mktemp.c
@@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
- "$Id: mktemp.c,v 1.11 1998/10/20 12:36:36 peter Exp $";
+ "$Id: mktemp.c,v 1.9 1998/03/03 14:38:36 bde Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
diff --git a/lib/libc/stdio/perror.c b/lib/libc/stdio/perror.c
index bb618247e96f..91a7dee8b262 100644
--- a/lib/libc/stdio/perror.c
+++ b/lib/libc/stdio/perror.c
@@ -50,7 +50,7 @@ perror(s)
struct iovec iov[4];
v = iov;
- if (s != NULL && *s != '\0') {
+ if (s != NULL) {
v->iov_base = (char *)s;
v->iov_len = strlen(s);
v++;
diff --git a/lib/libc/stdlib/merge.c b/lib/libc/stdlib/merge.c
index 083a9642502e..a47e3007290e 100644
--- a/lib/libc/stdlib/merge.c
+++ b/lib/libc/stdlib/merge.c
@@ -111,9 +111,6 @@ mergesort(base, nmemb, size, cmp)
return (-1);
}
- if (nmemb == 0)
- return (0);
-
/*
* XXX
* Stupid subtraction for the Cray.
@@ -150,7 +147,7 @@ mergesort(base, nmemb, size, cmp)
sense = 0;
}
if (!big) { /* here i = 0 */
- while ((b += size) < t && cmp(q, b) >sense)
+LINEAR: while ((b += size) < t && cmp(q, b) >sense)
if (++i == 6) {
big = 1;
goto EXPONENTIAL;
@@ -171,7 +168,7 @@ EXPONENTIAL: for (i = size; ; i <<= 1)
goto FASTCASE;
} else
b = p;
- while (t > b+size) {
+SLOWCASE: while (t > b+size) {
i = (((t - b) / size) >> 1) * size;
if ((*cmp)(q, p = b + i) <= sense)
t = p;
diff --git a/lib/libc/stdlib/qsort.3 b/lib/libc/stdlib/qsort.3
index aa2609c7efb0..4f449c752917 100644
--- a/lib/libc/stdlib/qsort.3
+++ b/lib/libc/stdlib/qsort.3
@@ -162,9 +162,7 @@ is set to indicate the error.
.Sh ERRORS
The
.Fn heapsort
-and
-.Fn mergesort
-functions succeed unless:
+function succeeds unless:
.Bl -tag -width Er
.It Bq Er EINVAL
The
diff --git a/lib/libc/stdtime/asctime.c b/lib/libc/stdtime/asctime.c
index 832f18592ff3..b9da143029eb 100644
--- a/lib/libc/stdtime/asctime.c
+++ b/lib/libc/stdtime/asctime.c
@@ -14,6 +14,10 @@ static char elsieid[] = "@(#)asctime.c 7.7";
#include "private.h"
#include "tzfile.h"
+#ifndef _THREAD_SAFE
+static char *asctime_r __P((const struct tm *, char *));
+#endif
+
/*
** A la X3J11, with core dump avoidance.
*/
@@ -28,6 +32,9 @@ const struct tm * timeptr;
return(asctime_r(timeptr, result));
}
+#ifndef _THREAD_SAFE
+static
+#endif
char *
asctime_r(timeptr, result)
const struct tm * timeptr;
diff --git a/lib/libc/stdtime/ctime.3 b/lib/libc/stdtime/ctime.3
index 2b8ca3e45adc..b14a92c47bf9 100644
--- a/lib/libc/stdtime/ctime.3
+++ b/lib/libc/stdtime/ctime.3
@@ -31,22 +31,17 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" From: @(#)ctime.3 8.1 (Berkeley) 6/4/93
-.\" $Id$
+.\" @(#)ctime.3 8.1 (Berkeley) 6/4/93
.\"
-.Dd January 2, 1999
+.Dd June 4, 1993
.Dt CTIME 3
.Os BSD 4.3
.Sh NAME
.Nm asctime ,
-.Nm asctime_r ,
.Nm ctime ,
-.Nm ctime_r ,
.Nm difftime ,
.Nm gmtime ,
-.Nm gmtime_r ,
.Nm localtime ,
-.Nm localtime_r ,
.Nm mktime ,
.Nm timegm
.Nd transform binary date and time values
@@ -67,14 +62,6 @@
.Fn mktime "struct tm *tm"
.Ft time_t
.Fn timegm "struct tm *tm"
-.Ft char *
-.Fn ctime_r "const time_t *clock" "char *buf"
-.Ft struct tm *
-.Fn localtime_r "const time_t *clock" "struct tm *result"
-.Ft struct tm *
-.Fn gmtime_r "const time_t *clock" "struct tm *result"
-.Ft char *
-.Fn asctime_r "const struct tm *tm" "char *buf"
.Sh DESCRIPTION
The functions
.Fn ctime ,
@@ -138,22 +125,6 @@ Thu Nov 24 18:22:48 1986\en\e0
.Pp
All the fields have constant width.
.Pp
-.Fn ctime_r
-provides the same functionality as
-.Fn ctime
-except the caller must provide the output buffer
-.Fa buf
-to store the result, which must be at least 26 characters long.
-.Fn localtime_r
-and
-.Fn gmtime_r
-provide the same functionality as
-.Fn localtime
-and
-.Fn gmtime
-respectively, except the caller must provide the output buffer
-.Fa result .
-.Pp
The
.Fn asctime
function
@@ -164,30 +135,14 @@ pointed at by
to the form
shown in the example above.
.Pp
-.Fn asctime_r
-provides the same functionality as
-.Fn asctime
-except the caller provide the output buffer
-.Fa buf
-to store the result, which must be at least 26 characters long.
-.Pp
-The functions
+The function
.Fn mktime
-and
-.Fn timegm
-converts the broken-down time in the structure
+converts the broken-down time, expressed as local time, in the structure
pointed to by tm into a time value with the same encoding as that of the
values returned by the
.Xr time 3
-function (that is, seconds from the Epoch,
-.Tn UTC ) .
-.Fn mktime
-interprets the input structure according to the current timezone setting
-(see
-.Xr tzset 3 ) .
-.Fn timegm
-interprets the input structure as representing Universal Coordinated Time
-.Pq Tn UTC .
+function, that is, seconds from the Epoch,
+.Tn UTC .
.Pp
The original values of the
.Fa tm_wday
@@ -206,13 +161,7 @@ A negative value for
causes the
.Fn mktime
function to attempt to divine whether summer time is in effect for the
-specified time.
-The
-.Fa tm_isdst
-and
-.Fa tm_gmtoff
-members are forced to zero by
-.Fn timegm . )
+specified time.)
.Pp
On successful completion, the values of the
.Fa tm_wday
@@ -231,6 +180,15 @@ are determined.
returns the specified calendar time; if the calendar time cannot be
represented, it returns \-1;
.Pp
+The function
+.Fn timegm
+is
+.Fn mktime
+analog, but assume that broke-down time expressed as UTC (not local) time.
+This function also set
+.Fa tm_isdst
+field to 0.
+.Pp
The
.Fn difftime
function
@@ -276,33 +234,6 @@ values indicating east of the Prime Meridian.
.Xr time 3 ,
.Xr tzset 3 ,
.Xr tzfile 5
-.Sh STANDARDS
-The
-.Fn asctime ,
-.Fn ctime ,
-.Fn difftime ,
-.Fn gmtime ,
-.Fn localtime ,
-and
-.Fn mktime
-functions conform to
-.St -isoC ,
-and conform to
-.St -p1003.1
-provided the selected local timezone does not contain a leap-second table
-(see
-.Xr zic 8 ) .
-.Pp
-The
-.Fn asctime_r ,
-.Fn ctime_r ,
-.Fn gmtime_r ,
-and
-.Fn localtime_r
-functions are expected to conform to
-.St -iso9945-1
-(again provided the selected local timezone does not contain a leap-second
-table).
.Sh HISTORY
This manual page is derived from
the time package contributed to Berkeley by
@@ -310,23 +241,13 @@ Arthur Olsen and which appeared in
.Bx 4.3 .
.Sh BUGS
Except for
-.Fn difftime ,
+.Fn difftime
+and
.Fn mktime ,
-and the
-.Fn \&_r
-variants of the other functions,
these functions leaves their result in an internal static object and return
a pointer to that object. Subsequent calls to these
function will modify the same object.
.Pp
-The C Standard provides no mechanism for a program to modify its current
-local timezone setting, and the
-.Tn POSIX Ns No \&-standard
-method is not reentrant. (However, thread-safe implementations are provided
-in the
-.Tn POSIX
-threaded environment.)
-.Pp
The
.Fa tm_zone
field of a returned tm structure points to a static array of characters,
@@ -341,3 +262,7 @@ Use of the external variable
is discouraged; the
.Fa tm_zone
entry in the tm structure is preferred.
+.Pp
+Avoid using out-of-range values with
+.Fn mktime
+when setting up lunch with promptness sticklers in Riyadh.
diff --git a/lib/libc/stdtime/localtime.c b/lib/libc/stdtime/localtime.c
index 9e130bd560e2..ad227cf32029 100644
--- a/lib/libc/stdtime/localtime.c
+++ b/lib/libc/stdtime/localtime.c
@@ -1082,21 +1082,19 @@ struct tm * const tmp;
#endif /* defined TM_ZONE */
}
+#ifdef _THREAD_SAFE
struct tm *
localtime_r(timep, p_tm)
const time_t * const timep;
struct tm *p_tm;
{
-#ifdef _THREAD_SAFE
pthread_mutex_lock(&lcl_mutex);
-#endif
tzset();
localsub(timep, 0L, p_tm);
-#ifdef _THREAD_SAFE
pthread_mutex_unlock(&lcl_mutex);
-#endif
return(p_tm);
}
+#endif
struct tm *
localtime(timep)
@@ -1216,12 +1214,14 @@ const time_t * const timep;
#endif
}
+#ifdef _THREAD_SAFE
struct tm *
gmtime_r(const time_t * timep, struct tm * tm)
{
gmtsub(timep, 0L, tm);
return(tm);
}
+#endif
#ifdef STD_INSPIRED
@@ -1350,6 +1350,7 @@ const time_t * const timep;
return asctime(localtime(timep));
}
+#ifdef _THREAD_SAFE
char *
ctime_r(timep, buf)
const time_t * const timep;
@@ -1358,6 +1359,7 @@ char *buf;
struct tm tm;
return asctime_r(localtime_r(timep, &tm), buf);
}
+#endif
/*
** Adapted from code provided by Robert Elz, who writes:
diff --git a/lib/libc/string/Makefile.inc b/lib/libc/string/Makefile.inc
index 42c8c39944c1..587da37b5855 100644
--- a/lib/libc/string/Makefile.inc
+++ b/lib/libc/string/Makefile.inc
@@ -1,5 +1,5 @@
# @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
-# $Id: Makefile.inc,v 1.14 1998/02/20 08:23:55 jb Exp $
+# $Id: Makefile.inc,v 1.13 1997/10/21 08:41:15 bde Exp $
.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/string ${.CURDIR}/../libc/string
@@ -27,5 +27,4 @@ MLINKS+=strcat.3 strncat.3
MLINKS+=strcmp.3 strncmp.3
MLINKS+=strcpy.3 strncpy.3
MLINKS+=strerror.3 perror.3 strerror.3 sys_errlist.3 strerror.3 sys_nerr.3
-MLINKS+=strtok.3 strtok_r.3
.endif
diff --git a/lib/libc/string/strerror.3 b/lib/libc/string/strerror.3
index ecb827841a86..67c22db97f80 100644
--- a/lib/libc/string/strerror.3
+++ b/lib/libc/string/strerror.3
@@ -80,13 +80,16 @@ standard error file descriptor.
If the argument
.Fa string
is
-.Pf non- Dv NULL
-and does not point to the null character,
-this string is prepended to the message
+.Pf non- Dv NULL ,
+it is prepended to the message
string and separated from it by
a colon and space
-.Pq Ql \&:\ \& ;
-otherwise, only the error message string is printed.
+.Pq Ql \&:\ \& .
+If
+.Fa string
+is
+.Dv NULL ,
+only the error message string is printed.
.Pp
If
.Fa errnum
diff --git a/lib/libc/string/strtok.3 b/lib/libc/string/strtok.3
index 92d32ce0f59f..56db2b03c7e3 100644
--- a/lib/libc/string/strtok.3
+++ b/lib/libc/string/strtok.3
@@ -1,8 +1,3 @@
-.\" Copyright (c) 1998 Softweyr LLC. All rights reserved.
-.\"
-.\" strtok_r, from Berkeley strtok
-.\" Oct 13, 1998 by Wes Peters <wes@softweyr.com>
-.\"
.\" Copyright (c) 1988, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -13,54 +8,43 @@
.\" 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
-.\" notices, this list of conditions and the following disclaimer.
-.\"
-.\" 2. Redistributions in binary form must reproduce the above
-.\" copyright notices, 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 Softweyr LLC, the
-.\" University of California, Berkeley, and its contributors.
-.\"
-.\" 4. Neither the name of Softweyr LLC, 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.
+.\" 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 SOFTWEYR LLC, 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 SOFTWEYR LLC, 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
+.\" 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.
.\"
.\" @(#)strtok.3 8.2 (Berkeley) 2/3/94
.\"
-.Dd November 27, 1998
+.Dd February 3, 1994
.Dt STRTOK 3
-.Os FreeBSD 3.0
+.Os BSD 3
.Sh NAME
-.Nm strtok, strtok_r
+.Nm strtok
.Nd string tokens
.Sh SYNOPSIS
.Fd #include <string.h>
.Ft char *
.Fn strtok "char *str" "const char *sep"
-.Ft char *
-.Fn strtok_r "char *str" "const char *sep" "char **last"
.Sh DESCRIPTION
.Bf -symbolic
This interface is obsoleted by strsep(3).
@@ -85,51 +69,13 @@ The separator string,
must be supplied each time, and may change between calls.
.Pp
The
-.Fn strtok_r
-function is a reentrant version of
-.Fn strtok .
-The context pointer
-.Fa last
-must be provided on each call.
-.Fn strtok_r
-may also be used to nest two parsing loops within one another, as
-long as separate context pointers are used.
-.Pp
-The
.Fn strtok
-and
-.Fn strtok_r
-functions
-return a pointer to the beginning of each subsequent token in the string,
+function
+returns a pointer to the beginning of each subsequent token in the string,
after replacing the token itself with a
.Dv NUL
character.
When no more tokens remain, a null pointer is returned.
-.Sh EXAMPLE
-The following uses
-.Fn strtok_r ()
-to parse two strings using separate contexts:
-.Bd -literal
-char test[80], blah[80];
-char *sep = "\\/:;=-";
-char *word, *phrase, *brkt, *brkb;
-
-strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function.");
-
-for (word = strtok_r(test, sep, &brkt);
- word;
- word = strtok_r(NULL, sep, &brkt))
-{
- strcpy(blah, "blah:blat:blab:blag");
-
- for (phrase = strtok_r(blah, sep, &brkb);
- phrase;
- phrase = strtok_r(NULL, sep, &brkb))
- {
- printf("So far we're at %s:%s\n", word, phrase);
- }
-}
-.Ed
.Sh SEE ALSO
.Xr index 3 ,
.Xr memchr 3 ,
@@ -148,6 +94,8 @@ function
conforms to
.St -ansiC .
.Sh BUGS
+There is no way to get tokens from multiple strings simultaneously.
+.Pp
The System V
.Fn strtok ,
if handed a string containing only delimiter characters,
@@ -160,8 +108,3 @@ value.
Since this implementation always alters the next starting point,
such a sequence of calls would always return
.Dv NULL .
-.Sh AUTHOR
-Wes Peters, Softweyr LLC:
-.Xr <wes@softweyr.com>
-.br
-Based on the FreeBSD 3.0 implementation.
diff --git a/lib/libc/string/strtok.c b/lib/libc/string/strtok.c
index 1140bfc73eba..9151cf257aab 100644
--- a/lib/libc/string/strtok.c
+++ b/lib/libc/string/strtok.c
@@ -1,163 +1,90 @@
/*
- * Copyright (c) 1998 Softweyr LLC. All rights reserved.
- *
- * strtok_r, from Berkeley strtok
- * Oct 13, 1998 by Wes Peters <wes@softweyr.com>
- *
* Copyright (c) 1988, 1993
* 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
- * notices, this list of conditions and the following disclaimer.
- *
+ * notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
- * notices, this list of conditions and the following disclaimer in the
+ * 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 Softweyr LLC, the
- * University of California, Berkeley, and its contributors.
- *
+ * 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 SOFTWEYR LLC, 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 SOFTWEYR LLC, 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.
+ * 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_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)strtok.c 8.1 (Berkeley) 6/4/93";
+#endif /* LIBC_SCCS and not lint */
+
#include <stddef.h>
#include <string.h>
char *
-strtok_r(char *s, const char *delim, char **last)
+strtok(s, delim)
+ register char *s;
+ register const char *delim;
{
- char *spanp;
- int c, sc;
- char *tok;
+ register char *spanp;
+ register int c, sc;
+ char *tok;
+ static char *last;
- if (s == NULL && (s = *last) == NULL)
- {
- return NULL;
- }
-
- /*
- * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
- */
-cont:
- c = *s++;
- for (spanp = (char *)delim; (sc = *spanp++) != 0; )
- {
- if (c == sc)
- {
- goto cont;
- }
- }
- if (c == 0) /* no non-delimiter characters */
- {
- *last = NULL;
- return NULL;
- }
- tok = s - 1;
+ if (s == NULL && (s = last) == NULL)
+ return (NULL);
- /*
- * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
- * Note that delim must have one NUL; we stop if we see that, too.
- */
- for (;;)
- {
+ /*
+ * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
+ */
+cont:
c = *s++;
- spanp = (char *)delim;
- do
- {
- if ((sc = *spanp++) == c)
- {
- if (c == 0)
- {
- s = NULL;
- }
- else
- {
- char *w = s - 1;
- *w = '\0';
- }
- *last = s;
- return tok;
- }
+ for (spanp = (char *)delim; (sc = *spanp++) != 0;) {
+ if (c == sc)
+ goto cont;
}
- while (sc != 0);
- }
- /* NOTREACHED */
-}
-
-
-char *
-strtok(char *s, const char *delim)
-{
- static char *last;
-
- return strtok_r(s, delim, &last);
-}
-
-
-#if defined(DEBUG_STRTOK)
-
-/*
- * Test the tokenizer.
- */
-int
-main()
-{
- char test[80], blah[80];
- char *sep = "\\/:;=-";
- char *word, *phrase, *brkt, *brkb;
-
- printf("String tokenizer test:\n");
- strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function.");
-
- for (word = strtok(test, sep);
- word;
- word = strtok(NULL, sep))
- {
- printf("Next word is \"%s\".\n", word);
- }
-
- phrase = "foo";
-
- strcpy(test, "This;is.a:test:of=the/string\\tokenizer-function.");
-
- for (word = strtok_r(test, sep, &brkt);
- word;
- word = strtok_r(NULL, sep, &brkt))
- {
- strcpy(blah, "blah:blat:blab:blag");
-
- for (phrase = strtok_r(blah, sep, &brkb);
- phrase;
- phrase = strtok_r(NULL, sep, &brkb))
- {
- printf("So far we're at %s:%s\n", word, phrase);
+ if (c == 0) { /* no non-delimiter characters */
+ last = NULL;
+ return (NULL);
}
- }
-
- return 0;
+ tok = s - 1;
+
+ /*
+ * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
+ * Note that delim must have one NUL; we stop if we see that, too.
+ */
+ for (;;) {
+ c = *s++;
+ spanp = (char *)delim;
+ do {
+ if ((sc = *spanp++) == c) {
+ if (c == 0)
+ s = NULL;
+ else
+ s[-1] = 0;
+ last = s;
+ return (tok);
+ }
+ } while (sc != 0);
+ }
+ /* NOTREACHED */
}
-
-#endif /* DEBUG_STRTOK */
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 517c4ba5f292..6882621dd5a9 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,5 +1,5 @@
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
-# $Id: Makefile.inc,v 1.56 1998/11/05 14:43:29 dg Exp $
+# $Id: Makefile.inc,v 1.54 1998/07/28 03:33:25 jlemon Exp $
# sys sources
.PATH: ${.CURDIR}/../libc/${MACHINE_ARCH}/sys ${.CURDIR}/../libc/sys
@@ -73,7 +73,7 @@ ${SPSEUDOR}:
> ${.TARGET}
.if ${LIB} == "c"
-MAN2+= _exit.2 accept.2 access.2 acct.2 adjtime.2 aio_read.2 \
+MAN2+= _exit.2 accept.2 access.2 acct.2 adjtime.2 \
bind.2 brk.2 chdir.2 chflags.2 \
chmod.2 chown.2 chroot.2 clock_gettime.2 close.2 \
connect.2 dup.2 execve.2 \
@@ -87,7 +87,7 @@ MAN2+= _exit.2 accept.2 access.2 acct.2 adjtime.2 aio_read.2 \
mount.2 mprotect.2 msync.2 munmap.2 nanosleep.2 \
nfssvc.2 open.2 pathconf.2 pipe.2 poll.2 profil.2 ptrace.2 quotactl.2 \
read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \
- rtprio.2 select.2 semctl.2 semget.2 semop.2 send.2 sendfile.2 \
+ rtprio.2 select.2 semctl.2 semget.2 semop.2 send.2 \
setgroups.2 setpgid.2 setregid.2 setreuid.2 setsid.2 setuid.2 \
shmat.2 shmctl.2 shmget.2 shutdown.2 \
sigaction.2 sigaltstack.2 sigpending.2 sigprocmask.2 sigreturn.2 \
diff --git a/lib/libc/sys/accept.2 b/lib/libc/sys/accept.2
index 041ea5a774ae..8a14cc6aa2e5 100644
--- a/lib/libc/sys/accept.2
+++ b/lib/libc/sys/accept.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)accept.2 8.2 (Berkeley) 12/11/93
-.\" $Id: accept.2,v 1.5 1998/01/11 17:07:20 alex Exp $
+.\" $Id$
.\"
.Dd December 11, 1993
.Dt ACCEPT 2
@@ -171,9 +171,9 @@ The per-process descriptor table is full.
The system file table is full.
.It Bq Er ENOTSOCK
The descriptor references a file, not a socket.
-.It Bq Er EINVAL
-.Xr listen 2
-has not been called on the socket descriptor.
+.It Bq Er EOPNOTSUPP
+The referenced socket is not of type
+.Dv SOCK_STREAM .
.It Bq Er EFAULT
The
.Fa addr
diff --git a/lib/libc/sys/aio_read.2 b/lib/libc/sys/aio_read.2
deleted file mode 100644
index 16dab679519a..000000000000
--- a/lib/libc/sys/aio_read.2
+++ /dev/null
@@ -1,189 +0,0 @@
-.\" Copyright (c) 1998 Terry Lambert
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\" notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Id$
-.\"
-.Dd November 17, 1998
-.Dt AIO_READ 2
-.Os
-.Sh NAME
-.Nm aio_read
-.Nd asynchronus read from a file (REALTIME)
-.Sh SYNOPSIS
-.Fd #include <aio.h>
-.Ft int
-.Fn aio_read "struct aiocb *iocb"
-.Sh DESCRIPTION
-The
-.Fn aio_read
-function allows the calling process to read
-.Ar iocb->aio_nbytes
-from the descriptor
-.Ar iocb->aio_fildes
-beginning at the offset
-.Ar iocb->aio_offset
-into the buffer pointed to by
-.Ar iocb->aio_buf .
-The call returns immediately after the read request has
-been enqueued to the descriptor; the read may or may not have
-completed at the time the call returns.
-.Pp
-If _POSIX_PRIORITIZED_IO is defined, and the descriptor supports it,
-then the enqueued operation is submitted at a priority equal to that
-of the calling process minus
-.Ar iocb->aio_reqprio .
-.Pp
-The
-.Ar iocb->aio_lio_opcode
-is ignored by the
-.Fn aio_read
-call.
-.Pp
-The
-.Ar iocb
-pointer may be subsequently used as an argument to
-.Fn aio_return
-and
-.Fn aio_error
-in order to determine return or error status for the enqueued operation
-while it is in progress.
-.Pp
-If the request could not be enqueued (generally due to invalid arguments),
-then the call returns without having enqueued the request.
-.Pp
-If the request is successfully enqueued, the value of
-.Ar iocb->aio_offset
-can be modified during the request as context, so this value must
-not be referenced after the request is enqueued.
-.Sh RESTRICTIONS
-The Asynchronous I/O Control Block structure pointed to by
-.Ar iocb
-and the buffer that the
-.Ar iocb->aio_buf
-member of that structure references must remain valid until the
-operation has completed. For this reason, use of auto (stack) variables
-for these objects is discouraged.
-.Pp
-Modifications of the Asynchronous I/O Control Block structure or the
-buffer contents after the request has been enqueued, but before the
-request has completed, are not allowed.
-.Pp
-If the file offset in
-.Ar iocb->aio_offset
-is past the offset maximum for
-.Ar iocb->aio_fildes ,
-no I/O will occur.
-.Sh RETURN VALUES
-.Rv -std aio_read
-.Sh STANDARDS
-The
-.Fn aio_read
-call conforms to the
-.St -p1003.2
-standard.
-.Sh DIAGNOSTICS
-None.
-.Sh ERRORS
-The
-.Fn aio_read
-function will fail if:
-.Bl -tag -width Er
-.It Bq Er EAGAIN
-The request was not queued because of system resource limitations.
-.It Bq Er ENOSYS
-The
-.Fn aio_read
-call is not supported.
-.El
-.Pp
-The following conditions may be synchronously detected when the
-.Fn aio_read
-call is made, or asynchronously, at any time thereafter. If they
-are detected at call time,
-.Fn aio_read
-returns -1 and sets
-.Ar errno
-appropriately; otherwise the
-.Fn aio_return
-function must be called, and will return -1, and
-Fn aio_error
-must be called to determine the actual calue that would have been
-returned in
-.Ar errno .
-.Pp
-.Bl -tag -width Er
-.It Bq Er EBADF
-.Ar iocb->aio_fildes
-is invalid.
-.It Bq Er EINVAL
-The offset
-.Ar iocb->aio_offset
-is not valid, the priority specified by
-.Ar iocb->aio_reqprio
-is not a valid priority, or the number of bytes specified by
-.Ar iocb->aio_nbytes
-is not valid.
-.It Bq Er EOVERFLOW
-The file is a regular file,
-.Ar iocb->aio_nbytes
-is greater than zero, the starting offset in
-.Ar iocb->aio_offset
-is before the end of the file, but is at or beyond the
-.Ar iocb->aio_fildes
-offset maximum.
-.El
-.Pp
-If the request is successfully enqueued, but subsequently cancelled
-or an error occurs, the value returned by the
-.Fn aio_return
-function is per the
-.Xr read 2
-call, and the value returned by the
-.Fn aio_error
-function is either one of the error returns from the
-.Xr read 2
-call, or one of:
-.Bl -tag -width Er
-.It Bq Er EBADF
-.Ar iocb->aio_fildes
-is invalid for reading.
-.It Bq Er ECANCELED
-The request was explicitly cancelled via a call to
-.Fn aio_cancel .
-.It Bq Er EINVAL
-The offset
-.Ar iocb->aio_offset
-would be invalid.
-.El
-.Sh HISTORY
-The
-.Nm
-Function first appeared in
-.Fx 3.0 .
-.Sh AUTHOR
-This
-manual page was written by
-.An Terry Lambert Aq terry@whistle.com .
-.Sh BUGS
-The value of iocb->aio_offset is ignored.
diff --git a/lib/libc/sys/fcntl.2 b/lib/libc/sys/fcntl.2
index 51f0ef519007..fdf1941d3cb1 100644
--- a/lib/libc/sys/fcntl.2
+++ b/lib/libc/sys/fcntl.2
@@ -483,13 +483,6 @@ or
.Dv F_SETLKW ,
and satisfying the lock or unlock request would result in the
number of locked regions in the system exceeding a system-imposed limit.
-.It Bq Er EPERM
-.Fa Cmd
-is
-.Dv F_SETOWN
-and
-the process ID or process group given as an argument is in a
-different session than the caller.
.It Bq Er ESRCH
.Fa Cmd
is
diff --git a/lib/libc/sys/getdirentries.2 b/lib/libc/sys/getdirentries.2
index 329b6502b3a7..abc680e7b9b3 100644
--- a/lib/libc/sys/getdirentries.2
+++ b/lib/libc/sys/getdirentries.2
@@ -69,7 +69,7 @@ structures each containing the following entries:
u_int32_t d_fileno;
u_int16_t d_reclen;
u_int8_t d_type;
-u_int8_t d_namlen;
+u_int8_t d_namelen;
char d_name[MAXNAMELEN + 1]; /* see below */
.Ed
.Pp
diff --git a/lib/libc/sys/rename.2 b/lib/libc/sys/rename.2
index 9c5102655c5a..d9e1b8351f0a 100644
--- a/lib/libc/sys/rename.2
+++ b/lib/libc/sys/rename.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)rename.2 8.1 (Berkeley) 6/4/93
-.\" $Id: rename.2,v 1.6 1997/02/22 15:04:16 peter Exp $
+.\" $Id$
.\"
.Dd June 4, 1993
.Dt RENAME 2
@@ -69,32 +69,32 @@ If the final component of
is a symbolic link,
the symbolic link is renamed,
not the file or directory to which it points.
-.\".Sh CAVEAT
-.\"The system can deadlock if a loop in the file system graph is present.
-.\"This loop takes the form of an entry in directory
-.\".Ql Pa a ,
-.\"say
-.\".Ql Pa a/foo ,
-.\"being a hard link to directory
-.\".Ql Pa b ,
-.\"and an entry in
-.\"directory
-.\".Ql Pa b ,
-.\"say
-.\".Ql Pa b/bar ,
-.\"being a hard link
-.\"to directory
-.\".Ql Pa a .
-.\"When such a loop exists and two separate processes attempt to
-.\"perform
-.\".Ql rename a/foo b/bar
-.\"and
-.\".Ql rename b/bar a/foo ,
-.\"respectively,
-.\"the system may deadlock attempting to lock
-.\"both directories for modification.
-.\"Hard links to directories should be
-.\"replaced by symbolic links by the system administrator.
+.Sh CAVEAT
+The system can deadlock if a loop in the file system graph is present.
+This loop takes the form of an entry in directory
+.Ql Pa a ,
+say
+.Ql Pa a/foo ,
+being a hard link to directory
+.Ql Pa b ,
+and an entry in
+directory
+.Ql Pa b ,
+say
+.Ql Pa b/bar ,
+being a hard link
+to directory
+.Ql Pa a .
+When such a loop exists and two separate processes attempt to
+perform
+.Ql rename a/foo b/bar
+and
+.Ql rename b/bar a/foo ,
+respectively,
+the system may deadlock attempting to lock
+both directories for modification.
+Hard links to directories should be
+replaced by symbolic links by the system administrator.
.Sh RETURN VALUES
A 0 value is returned if the operation succeeds, otherwise
.Fn rename
diff --git a/lib/libc/sys/revoke.2 b/lib/libc/sys/revoke.2
index 8787597f8206..b64c9dc5fc88 100644
--- a/lib/libc/sys/revoke.2
+++ b/lib/libc/sys/revoke.2
@@ -65,8 +65,10 @@ is called as if all open references to the file had been closed.
Access to a file may be revoked only by its owner or the super user.
The
.Fn revoke
-function is normally used to prepare a terminal device for a new
-login session, preventing any access by a previous user of the terminal.
+function is currently supported only for block and character special
+device files.
+It is normally used to prepare a terminal device for a new login session,
+preventing any access by a previous user of the terminal.
.Sh RETURN VALUES
A 0 value indicated that the call succeeded. A \-1 return value
indicates an error occurred and
@@ -90,9 +92,8 @@ Too many symbolic links were encountered in translating the pathname.
.Fa Path
points outside the process's allocated address space.
.It Bq Er EINVAL
-The named file does not support the
-.Fn revoke
-operation.
+The named file is neither a character special or block
+special file.
.It Bq Er EPERM
The caller is neither the owner of the file nor the super user.
.El
diff --git a/lib/libc/sys/sendfile.2 b/lib/libc/sys/sendfile.2
deleted file mode 100644
index 58d61571a661..000000000000
--- a/lib/libc/sys/sendfile.2
+++ /dev/null
@@ -1,151 +0,0 @@
-.\" Copyright (c) 1998, David Greenman
-.\" 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 unmodified, this list of conditions, and the following
-.\" disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\" notice, this list of conditions and the following disclaimer in the
-.\" documentation and/or other materials provided with the distribution.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\" $Id: sendfile.2,v 1.1 1998/11/05 14:43:29 dg Exp $
-.\"
-.Dd November 5, 1998
-.Dt SENDFILE 2
-.Os
-.Sh NAME
-.Nm sendfile
-.Nd send a file to a socket
-.Sh SYNOPSIS
-.Fd #include <sys/types.h>
-.Fd #include <sys/socket.h>
-.Fd #include <sys/uio.h>
-.Ft int
-.Fn sendfile "int fd" "int s" "off_t offset" "size_t nbytes" "struct sf_hdtr *hdtr" "off_t *sbytes" "int flags"
-.Sh DESCRIPTION
-.Fn Sendfile
-sends a regular file specified by descriptor
-.Fa fd
-out a stream socket specified by descriptor
-.Fa s .
-.Pp
-The
-.Fa offset
-argument specifies where to begin in the file. The
-.Fa nbytes
-argument specifies how many bytes of the file should be sent, with 0 having the special
-meaning of send until the end of file has been reached.
-.Pp
-An optional header and/or trailer can be sent before and after the file data by specifying
-a pointer to a struct sf_hdtr, which has the following structure:
-.Pp
-.Bd -literal -offset indent -compact
-struct sf_hdtr {
- struct iovec *headers; /* pointer to header iovecs */
- int hdr_cnt; /* number of header iovecs */
- struct iovec *trailers; /* pointer to trailer iovecs */
- int trl_cnt; /* number of trailer iovecs */
-};
-.Ed
-.Pp
-The
-.Fa headers
-and
-.Fa tailers
-pointers, if non-NULL, point to arrays of struct iovec structures. See the
-.Fn writev
-system call for information on the iovec structure. The number of iovecs in these
-arrays is specified by
-.Fa hdr_cnt
-and
-.Fa trl_cnt .
-.Pp
-If non-NULL, the system will write the total number of bytes sent on the socket to the
-variable pointed to by
-.Fa sbytes .
-.Pp
-The
-.Fa flags
-argument is currently undefined and should be specified as 0.
-.Pp
-When using a socket marked for non-blocking I/O,
-.Fn sendfile
-may send fewer bytes than requested. In this case, the number of bytes successfully
-written is returned in
-.Fa *sbytes
-(if specified),
-and the error
-.Er EAGAIN
-is returned.
-.Sh IMPLEMENTATION NOTES
-.Pp
-The FreeBSD implementation of
-.Fn sendfile
-is "zero-copy", meaning that it has been optimized so that copying of the file data is avoided.
-.Sh RETURN VALUES
-Upon successful completion,
-.Fn sendfile
-returns 0. Otherwise a -1 is returned and the global variable
-.Va errno
-is set to indicate the error.
-.Sh ERRORS
-.Bl -tag -width Er
-.It Bq Er EBADF
-.Fa fd
-is not a valid file descriptor.
-.It Bq Er EBADF
-.Fa s
-is not a valid socket descriptor.
-.It Bq Er ENOTSOCK
-.Fa s
-is not a socket.
-.It Bq Er EINVAL
-.Fa fd
-is not a regular file.
-.It Bq Er EINVAL
-.Fa s
-is not a SOCK_STREAM type socket.
-.It Bq Er EINVAL
-.Fa offset
-is negative or out of range.
-.It Bq Er ENOTCONN
-.Fa s
-points to an unconnected socket.
-.It Bq Er EPIPE
-The socket peer has closed the connection.
-.It Bq Er EIO
-An error occurred while reading from
-.Fa fd .
-.It Bq Er EFAULT
-An invalid address was specified for a parameter.
-.It Bq Er EAGAIN
-The socket is marked for non-blocking I/O and not all data was sent due to the socket buffer being filled.
-If specified, the number of bytes successfully sent will be returned in
-.Fa *sbytes .
-.El
-.Sh SEE ALSO
-.Xr open 2 ,
-.Xr socket 2 ,
-.Xr send 2 ,
-.Xr writev 2
-.Sh HISTORY
-.Fn sendfile
-first appeared in FreeBSD 3.0.1.
-.Sh AUTHORS
-.Fn sendfile
-and this manual page were written by David Greenman <dg@root.com>.
diff --git a/lib/libc/sys/sigaltstack.2 b/lib/libc/sys/sigaltstack.2
index 9d77c8525a20..7ea6113a4d53 100644
--- a/lib/libc/sys/sigaltstack.2
+++ b/lib/libc/sys/sigaltstack.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)sigaltstack.2 8.2 (Berkeley) 5/1/95
-.\" $Id: sigaltstack.2,v 1.8 1997/03/12 17:16:22 bde Exp $
+.\" $Id: sigaltstack.2,v 1.7 1997/03/12 16:23:36 mpp Exp $
.\"
.Dd May 1, 1995
.Dt SIGALTSTACK 2
@@ -39,11 +39,12 @@
.Nm sigaltstack
.Nd set and/or get signal stack context
.Sh SYNOPSIS
+.Fd #include <sys/types.h>
.Fd #include <signal.h>
.Bd -literal
struct sigaltstack {
char *ss_sp;
- size_t ss_size;
+ long ss_size;
int ss_flags;
};
.Ed
diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2
index 6e5ffeeab0ca..50d489a75e83 100644
--- a/lib/libc/sys/stat.2
+++ b/lib/libc/sys/stat.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)stat.2 8.4 (Berkeley) 5/1/95
-.\" $Id: stat.2,v 1.13 1998/01/02 19:22:49 alex Exp $
+.\" $Id: stat.2,v 1.12 1997/03/11 11:35:55 peter Exp $
.\"
.Dd May 1, 1995
.Dt STAT 2
@@ -94,30 +94,30 @@ as defined by
and into which information is placed concerning the file.
.Bd -literal
struct stat {
- dev_t st_dev; /* inode's device */
- ino_t st_ino; /* inode's number */
- mode_t st_mode; /* inode protection mode */
- nlink_t st_nlink; /* number of hard links */
- uid_t st_uid; /* user ID of the file's owner */
- gid_t st_gid; /* group ID of the file's group */
- dev_t st_rdev; /* device type */
+ dev_t st_dev; /* inode's device */
+ ino_t st_ino; /* inode's number */
+ mode_t st_mode; /* inode protection mode */
+ nlink_t st_nlink; /* number of hard links */
+ uid_t st_uid; /* user ID of the file's owner */
+ gid_t st_gid; /* group ID of the file's group */
+ dev_t st_rdev; /* device type */
#ifndef _POSIX_SOURCE
struct timespec st_atimespec; /* time of last access */
struct timespec st_mtimespec; /* time of last data modification */
struct timespec st_ctimespec; /* time of last file status change */
#else
- time_t st_atime; /* time of last access */
- long st_atimensec; /* nsec of last access */
- time_t st_mtime; /* time of last data modification */
- long st_mtimensec; /* nsec of last data modification */
- time_t st_ctime; /* time of last file status change */
- long st_ctimensec; /* nsec of last file status change */
+ time_t st_atime; /* time of last access */
+ long st_atimensec; /* nsec of last access */
+ time_t st_mtime; /* time of last data modification */
+ long st_mtimensec; /* nsec of last data modification */
+ time_t st_ctime; /* time of last file status change */
+ long st_ctimensec; /* nsec of last file status change */
#endif
- off_t st_size; /* file size, in bytes */
- int64_t st_blocks; /* blocks allocated for file */
- u_int32_t st_blksize; /* optimal blocksize for I/O */
- u_int32_t st_flags; /* user defined flags for file */
- u_int32_t st_gen; /* file generation number */
+ off_t st_size; /* file size, in bytes */
+ quad_t st_blocks; /* blocks allocated for file */
+ u_long st_blksize; /* optimal blocksize for I/O */
+ u_long st_flags; /* user defined flags for file */
+ u_long st_gen; /* file generation number */
};
.Ed
.Pp
diff --git a/lib/libc/sys/vfork.2 b/lib/libc/sys/vfork.2
index 2c97af94ca40..5fff122a90bd 100644
--- a/lib/libc/sys/vfork.2
+++ b/lib/libc/sys/vfork.2
@@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)vfork.2 8.1 (Berkeley) 6/4/93
-.\" $Id: vfork.2,v 1.10 1998/01/02 19:22:49 alex Exp $
+.\" $Id: vfork.2,v 1.9 1997/11/18 03:59:30 jdp Exp $
.\"
.Dd June 4, 1993
.Dt VFORK 2
@@ -57,7 +57,7 @@ in that the child borrows the parent's memory and thread of
control until a call to
.Xr execve 2
or an exit (either by a call to
-.Xr _exit 2
+.Xr exit 3
or abnormally).
The parent process is suspended while the child is using its resources.
.Pp