summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-05-08 23:26:31 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-05-08 23:26:31 +0000
commit2dc1a94e9793fba3e4faeb3e1ef7156fa729a958 (patch)
treeb127207232928c5ffc890daf1f3257fea832cb3b
parent2321232e458a84c459f724406192cc87b757f469 (diff)
move insque(3) and remque(3) from libcompat -> libc; they are now POSIX
-rw-r--r--lib/libc/stdlib/Makefile.inc17
-rw-r--r--lib/libc/stdlib/insque.3 (renamed from lib/libcompat/4.3/insque.3)69
-rw-r--r--lib/libc/stdlib/insque.c (renamed from lib/libcompat/4.3/insque.c)8
-rw-r--r--lib/libc/stdlib/remque.c (renamed from lib/libcompat/4.3/remque.c)7
-rw-r--r--lib/libcompat/Makefile6
5 files changed, 68 insertions, 39 deletions
diff --git a/lib/libc/stdlib/Makefile.inc b/lib/libc/stdlib/Makefile.inc
index d2034982fe2..64039263823 100644
--- a/lib/libc/stdlib/Makefile.inc
+++ b/lib/libc/stdlib/Makefile.inc
@@ -5,11 +5,11 @@
SRCS+= a64l.c abort.c atexit.c atoi.c atof.c atol.c atoll.c bsearch.c \
calloc.c cfree.c exit.c ecvt.c gcvt.c getenv.c getopt.c getopt_long.c \
- getsubopt.c heapsort.c l64a.c lsearch.c malloc.c merge.c multibyte.c \
- putenv.c qsort.c radixsort.c rand.c random.c realpath.c setenv.c \
- strtod.c strtol.c strtoll.c strtoul.c strtoull.c system.c tfind.c \
- tsearch.c _rand48.c drand48.c erand48.c jrand48.c lcong48.c lrand48.c \
- mrand48.c nrand48.c seed48.c srand48.c qabs.c qdiv.c
+ getsubopt.c heapsort.c insque.c l64a.c lsearch.c malloc.c merge.c \
+ multibyte.c putenv.c qsort.c radixsort.c rand.c random.c realpath.c \
+ setenv.c strtod.c strtol.c strtoll.c strtoul.c strtoull.c system.c \
+ tfind.c tsearch.c _rand48.c drand48.c erand48.c jrand48.c lcong48.c \
+ lrand48.c mrand48.c nrand48.c seed48.c srand48.c qabs.c qdiv.c
.if (${MACHINE_ARCH} == "m68k")
SRCS+= abs.S div.c labs.c ldiv.c
@@ -34,13 +34,14 @@ SRCS+= abs.c div.c labs.c ldiv.c
MAN+= a64l.3 abort.3 abs.3 alloca.3 atexit.3 atof.3 atoi.3 atol.3 atoll.3 \
bsearch.3 div.3 ecvt.3 exit.3 getenv.3 getopt.3 getopt_long.3 \
- getsubopt.3 labs.3 ldiv.3 lsearch.3 malloc.3 memory.3 qabs.3 qdiv.3 \
- qsort.3 radixsort.3 rand48.3 rand.3 random.3 realpath.3 strtod.3 \
- strtol.3 strtoul.3 system.3 tsearch.3
+ getsubopt.3 insque.3 labs.3 ldiv.3 lsearch.3 malloc.3 memory.3 qabs.3 \
+ qdiv.3 qsort.3 radixsort.3 rand48.3 rand.3 random.3 realpath.3 \
+ strtod.3 strtol.3 strtoul.3 system.3 tsearch.3
MLINKS+=ecvt.3 fcvt.3 ecvt.3 gcvt.3
MLINKS+=getenv.3 setenv.3 getenv.3 unsetenv.3 getenv.3 putenv.3
MLINKS+=getopt_long.3 getopt_long_only.3
+MLINKS+=insque.3 remque.3
MLINKS+=lsearch.3 lfind.3
MLINKS+=malloc.3 free.3 malloc.3 realloc.3 malloc.3 calloc.3
MLINKS+=malloc.3 cfree.3 malloc.3 malloc.conf.5
diff --git a/lib/libcompat/4.3/insque.3 b/lib/libc/stdlib/insque.3
index 8c6b6d7cc02..b87adb87bcb 100644
--- a/lib/libcompat/4.3/insque.3
+++ b/lib/libc/stdlib/insque.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: insque.3,v 1.6 2002/05/01 08:03:30 mpech Exp $
+.\" $OpenBSD: insque.3,v 1.1 2003/05/08 23:26:30 millert Exp $
.\" Copyright (c) 1993 John Brezak
.\" All rights reserved.
.\"
@@ -35,33 +35,66 @@
.Nd insert/remove element from a queue
.Sh SYNOPSIS
.Fd #include <search.h>
-.Ft struct qelem {
-.br
-.Ft struct qelem *q_forw;
-.br
-.Ft struct qelem *q_back;
-.br
-.Ft char q_data[];
-.br
-.Ft };
-.br
-.br
.Ft void
-.Fn insque "struct qelem *elem" "struct qelem *pred"
+.Fn insque "void *elem" "void *pred"
.Ft void
-.Fn remque "struct qelem *elem"
+.Fn remque "void *elem"
.Sh DESCRIPTION
.Bf -symbolic
-These interfaces are available from the compatibility library, libcompat.
+These interfaces have been superceded by the
+.Xr queue 3
+macros and are provided for compatibility with legacy code.
.Ef
.Pp
.Fn insque
and
.Fn remque
manipulate queues built from doubly linked lists.
-Each element in the queue
-must begin with a "struct qelem".
+The queue can be either circular or linear.
+Each element in the queue must be of the following form:
+.Bd -literal
+struct qelem {
+ struct qelem *q_forw;
+ struct qelem *q_back;
+ char q_data[];
+};
+.Ed
+.Pp
+The first two elements in the struct must be pointers of the
+same type that point to the previous and next elements in
+the queue respectively.
+Any subsequent data in the struct is application-dependent.
+.Pp
+The
+.Fn insque
+function inserts
+.Fa elem
+into a queue immediately after
+.Fa pred .
+.Pp
+The
+.Fn remque
+function removes
+.Fa elem
+from the queue.
.Sh DIAGNOSTICS
These functions are not atomic unless that machine architecture allows it.
+.Sh SEE ALSO
+.Xr queue 3
+.Sh STANDARDS
+The
+.Fn lsearch
+and
+.Fn lfind
+functions conform to the
+.St -p1003.1-01
+and
+.St -xpg4.3 .
+specifications.
.Sh HISTORY
-These are derived from the insque and remque instructions on a VAX.
+The
+.Fn insque
+and
+.Fn remque
+functions are derived from the insque and remque instructions on a
+.Tn VAX .
diff --git a/lib/libcompat/4.3/insque.c b/lib/libc/stdlib/insque.c
index d1c64842f1f..549246c71f5 100644
--- a/lib/libcompat/4.3/insque.c
+++ b/lib/libc/stdlib/insque.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: insque.c,v 1.2 2000/03/02 00:29:48 todd Exp $ */
+/* $OpenBSD: insque.c,v 1.1 2003/05/08 23:26:30 millert Exp $ */
/*
* Copyright (c) 1993 John Brezak
@@ -29,7 +29,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: insque.c,v 1.2 2000/03/02 00:29:48 todd Exp $";
+static char *rcsid = "$OpenBSD: insque.c,v 1.1 2003/05/08 23:26:30 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <search.h>
@@ -40,9 +40,7 @@ struct qelem {
};
void
-insque(entry, pred)
- void *entry;
- void *pred;
+insque(void *entry, void *pred)
{
struct qelem *e = (struct qelem *) entry;
struct qelem *p = (struct qelem *) pred;
diff --git a/lib/libcompat/4.3/remque.c b/lib/libc/stdlib/remque.c
index e316e02868d..f4c5769a8c1 100644
--- a/lib/libcompat/4.3/remque.c
+++ b/lib/libc/stdlib/remque.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remque.c,v 1.2 2000/03/02 00:29:48 todd Exp $ */
+/* $OpenBSD: remque.c,v 1.1 2003/05/08 23:26:30 millert Exp $ */
/*
* Copyright (c) 1993 John Brezak
@@ -29,7 +29,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: remque.c,v 1.2 2000/03/02 00:29:48 todd Exp $";
+static char *rcsid = "$OpenBSD: remque.c,v 1.1 2003/05/08 23:26:30 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <search.h>
@@ -40,8 +40,7 @@ struct qelem {
};
void
-remque(element)
- void *element;
+remque(void *element)
{
struct qelem *e = (struct qelem *) element;
e->q_forw->q_back = e->q_back;
diff --git a/lib/libcompat/Makefile b/lib/libcompat/Makefile
index 477732655ef..c5e1cff1403 100644
--- a/lib/libcompat/Makefile
+++ b/lib/libcompat/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.9 2003/05/08 23:21:36 millert Exp $
+# $OpenBSD: Makefile,v 1.10 2003/05/08 23:26:30 millert Exp $
# $NetBSD: Makefile,v 1.15 1995/09/07 07:17:53 jtc Exp $
LIB= compat
@@ -28,11 +28,9 @@ MLINKS+=stty.3 gtty.3
# compat 4.3 sources
# missing: sibuf.c sobuf.c strout.c
SRCS+= regex.c rexec.c
-SRCS+= insque.c remque.c
-MAN+= insque.3 re_comp.3 rexec.3
+MAN+= re_comp.3 rexec.3
-MLINKS+=insque.3 remque.3
MLINKS+=re_comp.3 re_exec.3
# compat 4.4 sources