Rework indirect reference support as outlined by my recent message to

the tech-userlevel mailing list.
This commit is contained in:
jtc 1994-12-12 22:41:50 +00:00
parent c0b7039208
commit 3c98cdcd84
19 changed files with 500 additions and 100 deletions

View File

@ -1,11 +1,10 @@
# from: @(#)Makefile.inc 5.21 (Berkeley) 5/24/91
# $Id: Makefile.inc,v 1.58 1994/12/11 20:43:48 christos Exp $
# $Id: Makefile.inc,v 1.59 1994/12/12 22:41:50 jtc Exp $
# gen sources
.PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/gen ${.CURDIR}/gen
SRCS+= __err.c _errlist.c _siglist.c \
alarm.c assert.c clock.c closedir.c confstr.c ctermid.c ctime.c \
SRCS+= alarm.c assert.c clock.c closedir.c confstr.c ctermid.c ctime.c \
ctype_.c daemon.c devname.c difftime.c \
disklabel.c err.c errlist.c errno.c exec.c fnmatch.c \
fstab.c ftok.c fts.c \
@ -26,6 +25,10 @@ SRCS+= __err.c _errlist.c _siglist.c \
utime.c valloc.c vis.c wait.c wait3.c \
waitpid.c
# indirect reference stubs, to be removed soon.
SRCS+= _err.c _errx.c _sys_errlist.c _sys_nerr.c _sys_siglist.c \
_verr.c _verrx.c _vwarn.c _vwarnx.c _warn.c _warnx.c
.if (${MACHINE_ARCH} == "m68k")
SRCS+= _setjmp.S alloca.S fabs.S frexp.c ldexp.S modf.S setjmp.S
SRCS+= adddf3.S addsf3.S ashlsi3.S ashrsi3.S cmpdf2.S cmpsf2.S divdf3.S \

8
lib/libc/gen/_err.c Normal file
View File

@ -0,0 +1,8 @@
/*
* J.T. Conklin, December 12, 1994
* Public Domain
*/
#include <sys/cdefs.h>
__weak_reference(_err, err);

8
lib/libc/gen/_errx.c Normal file
View File

@ -0,0 +1,8 @@
/*
* J.T. Conklin, December 12, 1994
* Public Domain
*/
#include <sys/cdefs.h>
__weak_reference(_errx, errx);

View File

@ -0,0 +1,8 @@
/*
* Written by J.T. Conklin, December 12, 1994
* Public domain.
*/
#include <sys/cdefs.h>
__weak_reference(_sys_errlist, sys_errlist);

8
lib/libc/gen/_sys_nerr.c Normal file
View File

@ -0,0 +1,8 @@
/*
* Written by J.T. Conklin, December 12, 1994
* Public domain.
*/
#include <sys/cdefs.h>
__weak_reference(_sys_nerr, sys_nerr);

View File

@ -0,0 +1,8 @@
/*
* Written by J.T. Conklin, December 12, 1994
* Public domain.
*/
#include <sys/cdefs.h>
__weak_reference(__sys_siglist, sys_siglist);

8
lib/libc/gen/_verr.c Normal file
View File

@ -0,0 +1,8 @@
/*
* J.T. Conklin, December 12, 1994
* Public Domain
*/
#include <sys/cdefs.h>
__weak_reference(_verr, verr);

8
lib/libc/gen/_verrx.c Normal file
View File

@ -0,0 +1,8 @@
/*
* J.T. Conklin, December 12, 1994
* Public Domain
*/
#include <sys/cdefs.h>
__weak_reference(_verrx, verrx);

8
lib/libc/gen/_vwarn.c Normal file
View File

@ -0,0 +1,8 @@
/*
* J.T. Conklin, December 12, 1994
* Public Domain
*/
#include <sys/cdefs.h>
__weak_reference(_vwarn, vwarn);

8
lib/libc/gen/_vwarnx.c Normal file
View File

@ -0,0 +1,8 @@
/*
* J.T. Conklin, December 12, 1994
* Public Domain
*/
#include <sys/cdefs.h>
__weak_reference(_vwarnx, vwarnx);

8
lib/libc/gen/_warn.c Normal file
View File

@ -0,0 +1,8 @@
/*
* J.T. Conklin, December 12, 1994
* Public Domain
*/
#include <sys/cdefs.h>
__weak_reference(_warn, warn);

8
lib/libc/gen/_warnx.c Normal file
View File

@ -0,0 +1,8 @@
/*
* J.T. Conklin, December 12, 1994
* Public Domain
*/
#include <sys/cdefs.h>
__weak_reference(_warnx, warnx);

View File

@ -60,7 +60,7 @@ devname(dev, type)
if (!db && !failure &&
!(db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL))) {
__warn("warning: %s", _PATH_DEVDB);
_warn("warning: %s", _PATH_DEVDB);
failure = 1;
}
if (failure)

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1994 Christos Zoulas
* All rights reserved.
/*-
* Copyright (c) 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
@ -12,15 +12,17 @@
* 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 Christos Zoulas.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* 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 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
* 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
@ -29,37 +31,174 @@
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
/* from: static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; */
static char *rcsid = "$Id: err.c,v 1.9 1994/12/12 22:42:06 jtc Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef __weak_reference
__weak_reference(__err, err);
__weak_reference(__verr, verr);
__weak_reference(__errx, errx);
__weak_reference(__verrx, verrx);
__weak_reference(__warn, warn);
__weak_reference(__vwarn, vwarn);
__weak_reference(__warnx, warnx);
__weak_reference(__vwarnx, vwarnx);
#include <err.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __STDC__
#include <stdarg.h>
#else
/*
* Without weak references, we would have to put one function per file
* in order to be able to replace only a single function without picking
* up all the others. Too bad; I am not going to create 100 little files.
* Also it is not that simple to just create dummy stubs that call __func
* because most of the functions are varyadic and we need to parse the
* argument list anyway.
*/
#define __err err
#define __verr verr
#define __errx errx
#define __verrx verrx
#define __warn warn
#define __vwarn vwarn
#define __warnx warnx
#define __vwarnx vwarnx
#include "__err.c"
#include <varargs.h>
#endif
extern char *__progname; /* Program name, from crt0. */
__dead void
_verr(eval, fmt, ap)
int eval;
const char *fmt;
va_list ap;
{
int sverrno;
sverrno = errno;
(void)fprintf(stderr, "%s: ", __progname);
if (fmt != NULL) {
(void)vfprintf(stderr, fmt, ap);
(void)fprintf(stderr, ": ");
}
(void)fprintf(stderr, "%s\n", strerror(sverrno));
exit(eval);
}
__dead void
#ifdef __STDC__
_err(int eval, const char *fmt, ...)
#else
_err(va_alist)
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
int eval;
const char *fmt;
va_start(ap);
eval = va_arg(ap, int);
fmt = va_arg(ap, const char *);
#endif
__verr(eval, fmt, ap);
va_end(ap);
}
__dead void
_verrx(eval, fmt, ap)
int eval;
const char *fmt;
va_list ap;
{
(void)fprintf(stderr, "%s: ", __progname);
if (fmt != NULL)
(void)vfprintf(stderr, fmt, ap);
(void)fprintf(stderr, "\n");
exit(eval);
}
__dead void
#if __STDC__
_errx(int eval, const char *fmt, ...)
#else
_errx(va_alist)
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
int eval;
const char *fmt;
va_start(ap);
eval = va_arg(ap, int);
fmt = va_arg(ap, const char *);
#endif
__verrx(eval, fmt, ap);
va_end(ap);
}
void
_vwarn(fmt, ap)
const char *fmt;
va_list ap;
{
int sverrno;
sverrno = errno;
(void)fprintf(stderr, "%s: ", __progname);
if (fmt != NULL) {
(void)vfprintf(stderr, fmt, ap);
(void)fprintf(stderr, ": ");
}
(void)fprintf(stderr, "%s\n", strerror(sverrno));
}
void
#if __STDC__
_warn(const char *fmt, ...)
#else
_warn(va_alist)
va_dcl
#endif
{
va_list ap;
#if __STDC__
va_start(ap, fmt);
#else
const char *fmt;
va_start(ap);
fmt = va_arg(ap, const char *);
#endif
__vwarn(fmt, ap);
va_end(ap);
}
void
_vwarnx(fmt, ap)
const char *fmt;
va_list ap;
{
(void)fprintf(stderr, "%s: ", __progname);
if (fmt != NULL)
(void)vfprintf(stderr, fmt, ap);
(void)fprintf(stderr, "\n");
}
void
#ifdef __STDC__
_warnx(const char *fmt, ...)
#else
_warnx(va_alist)
va_dcl
#endif
{
va_list ap;
#ifdef __STDC__
va_start(ap, fmt);
#else
const char *fmt;
va_start(ap);
fmt = va_arg(ap, const char *);
#endif
__vwarnx(fmt, ap);
va_end(ap);
}

View File

@ -1,23 +1,139 @@
/*
* Written by J.T. Conklin, 10/06/94
* Public domain.
* Copyright (c) 1982, 1985 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.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)errlst.c 5.10 (Berkeley) 2/19/91";*/
static char *rcsid = "$Id: errlist.c,v 1.3 1994/12/12 22:42:07 jtc Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef __weak_reference
__weak_reference(__sys_errlist, sys_errlist);
__weak_reference(__sys_nerr, sys_nerr);
#else
const char *const _sys_errlist[] = {
"Undefined error: 0", /* 0 - ENOERROR */
"Operation not permitted", /* 1 - EPERM */
"No such file or directory", /* 2 - ENOENT */
"No such process", /* 3 - ESRCH */
"Interrupted system call", /* 4 - EINTR */
"Input/output error", /* 5 - EIO */
"Device not configured", /* 6 - ENXIO */
"Argument list too long", /* 7 - E2BIG */
"Exec format error", /* 8 - ENOEXEC */
"Bad file descriptor", /* 9 - EBADF */
"No child processes", /* 10 - ECHILD */
"Resource deadlock avoided", /* 11 - EDEADLK */
"Cannot allocate memory", /* 12 - ENOMEM */
"Permission denied", /* 13 - EACCES */
"Bad address", /* 14 - EFAULT */
"Block device required", /* 15 - ENOTBLK */
"Device busy", /* 16 - EBUSY */
"File exists", /* 17 - EEXIST */
"Cross-device link", /* 18 - EXDEV */
"Operation not supported by device", /* 19 - ENODEV */
"Not a directory", /* 20 - ENOTDIR */
"Is a directory", /* 21 - EISDIR */
"Invalid argument", /* 22 - EINVAL */
"Too many open files in system", /* 23 - ENFILE */
"Too many open files", /* 24 - EMFILE */
"Inappropriate ioctl for device", /* 25 - ENOTTY */
"Text file busy", /* 26 - ETXTBSY */
"File too large", /* 27 - EFBIG */
"No space left on device", /* 28 - ENOSPC */
"Illegal seek", /* 29 - ESPIPE */
"Read-only file system", /* 30 - EROFS */
"Too many links", /* 31 - EMLINK */
"Broken pipe", /* 32 - EPIPE */
/*
* Without weak references, we're forced to have to have two copies of
* the error message string table in the library. Fortunately, unless
* a program uses both sys_errlist[] and strerror(), only one of the
* copies will be linked into the executable.
*/
/* math software */
"Numerical argument out of domain", /* 33 - EDOM */
"Result too large", /* 34 - ERANGE */
#define __sys_errlist sys_errlist
#define __sys_nerr sys_nerr
#include "_errlist.c"
#endif
/* non-blocking and interrupt i/o */
"Resource temporarily unavailable", /* 35 - EAGAIN */
/* 35 - EWOULDBLOCK */
"Operation now in progress", /* 36 - EINPROGRESS */
"Operation already in progress", /* 37 - EALREADY */
/* ipc/network software -- argument errors */
"Socket operation on non-socket", /* 38 - ENOTSOCK */
"Destination address required", /* 39 - EDESTADDRREQ */
"Message too long", /* 40 - EMSGSIZE */
"Protocol wrong type for socket", /* 41 - EPROTOTYPE */
"Protocol not available", /* 42 - ENOPROTOOPT */
"Protocol not supported", /* 43 - EPROTONOSUPPORT */
"Socket type not supported", /* 44 - ESOCKTNOSUPPORT */
"Operation not supported", /* 45 - EOPNOTSUPP */
"Protocol family not supported", /* 46 - EPFNOSUPPORT */
/* 47 - EAFNOSUPPORT */
"Address family not supported by protocol family",
"Address already in use", /* 48 - EADDRINUSE */
"Can't assign requested address", /* 49 - EADDRNOTAVAIL */
/* ipc/network software -- operational errors */
"Network is down", /* 50 - ENETDOWN */
"Network is unreachable", /* 51 - ENETUNREACH */
"Network dropped connection on reset", /* 52 - ENETRESET */
"Software caused connection abort", /* 53 - ECONNABORTED */
"Connection reset by peer", /* 54 - ECONNRESET */
"No buffer space available", /* 55 - ENOBUFS */
"Socket is already connected", /* 56 - EISCONN */
"Socket is not connected", /* 57 - ENOTCONN */
"Can't send after socket shutdown", /* 58 - ESHUTDOWN */
"Too many references: can't splice", /* 59 - ETOOMANYREFS */
"Connection timed out", /* 60 - ETIMEDOUT */
"Connection refused", /* 61 - ECONNREFUSED */
"Too many levels of symbolic links", /* 62 - ELOOP */
"File name too long", /* 63 - ENAMETOOLONG */
/* should be rearranged */
"Host is down", /* 64 - EHOSTDOWN */
"No route to host", /* 65 - EHOSTUNREACH */
"Directory not empty", /* 66 - ENOTEMPTY */
/* quotas & mush */
"Too many processes", /* 67 - EPROCLIM */
"Too many users", /* 68 - EUSERS */
"Disc quota exceeded", /* 69 - EDQUOT */
/* Network File System */
"Stale NFS file handle", /* 70 - ESTALE */
"Too many levels of remote in path", /* 71 - EREMOTE */
"RPC struct is bad", /* 72 - EBADRPC */
"RPC version wrong", /* 73 - ERPCMISMATCH */
"RPC prog. not avail", /* 74 - EPROGUNAVAIL */
"Program version wrong", /* 75 - EPROGMISMATCH */
"Bad procedure for program", /* 76 - EPROCUNAVAIL */
"No locks available", /* 77 - ENOLCK */
"Function not implemented", /* 78 - ENOSYS */
"Inappropriate file type or format", /* 79 - EFTYPE */
};
int _sys_nerr = { sizeof _sys_errlist/sizeof _sys_errlist[0] };

View File

@ -33,7 +33,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)getbsize.c 5.3 (Berkeley) 3/9/92";*/
static char rcsid[] = "$Id: getbsize.c,v 1.4 1994/12/11 20:43:56 christos Exp $";
static char rcsid[] = "$Id: getbsize.c,v 1.5 1994/12/12 22:42:08 jtc Exp $";
#endif /* not lint */
#include <err.h>
@ -83,17 +83,17 @@ getbsize(headerlenp, blocksizep)
mul = 1;
break;
default:
fmterr: __warnx("%s: unknown blocksize", p);
fmterr: _warnx("%s: unknown blocksize", p);
n = 512;
mul = 1;
break;
}
if (n > max) {
__warnx("maximum blocksize is %dG", MAXB / GB);
_warnx("maximum blocksize is %dG", MAXB / GB);
n = max;
}
if ((blocksize = n * mul) < 512) {
underflow: __warnx("%s: minimum blocksize is 512");
underflow: _warnx("%s: minimum blocksize is 512");
form = "";
blocksize = n = 512;
}

View File

@ -30,7 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
static char *rcsid = "$Id: getnetgrent.c,v 1.6 1994/12/12 19:05:31 christos Exp $";
static char *rcsid = "$Id: getnetgrent.c,v 1.7 1994/12/12 22:42:10 jtc Exp $";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
@ -82,13 +82,13 @@ _ng_sl_init()
{
struct stringlist *sl = malloc(sizeof(struct stringlist));
if (sl == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
sl->sl_cur = 0;
sl->sl_max = 20;
sl->sl_str = malloc(sl->sl_max * sizeof(char *));
if (sl->sl_str == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
return sl;
}
@ -105,7 +105,7 @@ _ng_sl_add(sl, name)
sl->sl_max += 20;
sl->sl_str = realloc(sl->sl_str, sl->sl_max * sizeof(char *));
if (sl->sl_str == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
}
sl->sl_str[sl->sl_cur++] = name;
}
@ -182,7 +182,7 @@ getstring(pp, del, str)
if (del > 1) {
dp = malloc(del);
if (dp == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
memcpy(dp, sp, del);
dp[del - 1] = '\0';
} else
@ -203,7 +203,7 @@ getnetgroup(pp)
struct netgroup *ng = malloc(sizeof(struct netgroup));
if (ng == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
(*pp)++; /* skip '(' */
if (!getstring(pp, ',', &ng->ng_host))
@ -266,14 +266,14 @@ lookup(ypdom, name, line, bywhat)
free(ks);
*line = strdup(data.data);
if (*line == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
return 1;
case 1:
break;
case -1:
__warn("netgroup: db get");
_warn("netgroup: db get");
break;
}
free(ks);
@ -332,7 +332,7 @@ _ng_parse(p, name, ng)
if (**p == '(') {
if ((*ng = getnetgroup(p)) == NULL) {
__warnx("netgroup: Syntax error `%s'", *p);
_warnx("netgroup: Syntax error `%s'", *p);
return _NG_ERROR;
}
return _NG_GROUP;
@ -346,7 +346,7 @@ _ng_parse(p, name, ng)
i = (*p - np) + 1;
*name = malloc(i);
if (*name == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
memcpy(*name, np, i);
(*name)[i - 1] = '\0';
return _NG_NAME;
@ -376,7 +376,7 @@ addgroup(ypdom, sl, grp)
/* check for cycles */
if (_ng_sl_find(sl, grp) != NULL) {
free(grp);
__warnx("netgroup: Cycle in group `%s'", grp);
_warnx("netgroup: Cycle in group `%s'", grp);
return;
}
_ng_sl_add(sl, grp);
@ -466,7 +466,7 @@ in_find(ypdom, sl, grp, host, user, domain)
/* check for cycles */
if (_ng_sl_find(sl, grp) != NULL) {
free(grp);
__warnx("netgroup: Cycle in group `%s'", grp);
_warnx("netgroup: Cycle in group `%s'", grp);
return 0;
}
_ng_sl_add(sl, grp);
@ -531,7 +531,7 @@ _ng_makekey(s1, s2, len)
{
char *buf = malloc(len);
if (buf == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
(void) snprintf(buf, len, "%s.%s", _NG_STAR(s1), _NG_STAR(s2));
return buf;
}
@ -659,7 +659,7 @@ setnetgrent(ng)
#endif
ng_copy = strdup(ng);
if (ng_copy == NULL)
__err(1, _ngoomem);
_err(1, _ngoomem);
addgroup(ypdom, sl, ng_copy);
_nghead = _nglist;
_ng_sl_free(sl, 1);

View File

@ -33,7 +33,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/*static char sccsid[] = "from: @(#)initgroups.c 8.1 (Berkeley) 6/4/93";*/
static char *rcsid = "$Id: initgroups.c,v 1.6 1994/12/11 20:43:59 christos Exp $";
static char *rcsid = "$Id: initgroups.c,v 1.7 1994/12/12 22:42:11 jtc Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@ -49,10 +49,10 @@ initgroups(uname, agroup)
ngroups = NGROUPS;
if (getgrouplist(uname, agroup, groups, &ngroups) < 0)
__warnx("%s is in too many groups, using first %d",
_warnx("%s is in too many groups, using first %d",
uname, ngroups);
if (setgroups(ngroups, groups) < 0) {
__warn("setgroups");
_warn("setgroups");
return (-1);
}
return (0);

View File

@ -1,21 +1,75 @@
/*
* Written by J.T. Conklin, 10/06/94
* Public domain.
* Copyright (c) 1983 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.
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)siglist.c 5.6 (Berkeley) 2/23/91";*/
static char *rcsid = "$Id: siglist.c,v 1.6 1994/12/12 22:42:13 jtc Exp $";
#endif /* LIBC_SCCS and not lint */
#ifdef __weak_reference
__weak_reference(__sys_siglist, sys_siglist);
#else
#include <signal.h>
#include <unistd.h>
/*
* Without weak references, we're forced to have to have two copies of
* the signal name string table in the library. Fortunately, unless
* a program uses both sys_siglist[] and strsignal(), only one of the
* copies will be linked into the executable.
*/
#define __sys_siglist sys_siglist
#include "_siglist.c"
#endif
const char *const _sys_siglist[NSIG] = {
"Signal 0",
"Hangup", /* SIGHUP */
"Interrupt", /* SIGINT */
"Quit", /* SIGQUIT */
"Illegal instruction", /* SIGILL */
"Trace/BPT trap", /* SIGTRAP */
"Abort trap", /* SIGABRT */
"EMT trap", /* SIGEMT */
"Floating point exception", /* SIGFPE */
"Killed", /* SIGKILL */
"Bus error", /* SIGBUS */
"Segmentation fault", /* SIGSEGV */
"Bad system call", /* SIGSYS */
"Broken pipe", /* SIGPIPE */
"Alarm clock", /* SIGALRM */
"Terminated", /* SIGTERM */
"Urgent I/O condition", /* SIGURG */
"Stopped (signal)", /* SIGSTOP */
"Stopped", /* SIGTSTP */
"Continued", /* SIGCONT */
"Child exited", /* SIGCHLD */
"Stopped (tty input)", /* SIGTTIN */
"Stopped (tty output)", /* SIGTTOU */
"I/O possible", /* SIGIO */
"Cputime limit exceeded", /* SIGXCPU */
"Filesize limit exceeded", /* SIGXFSZ */
"Virtual timer expired", /* SIGVTALRM */
"Profiling timer expired", /* SIGPROF */
"Window size changes", /* SIGWINCH */
"Information request", /* SIGINFO */
"User defined signal 1", /* SIGUSR1 */
"User defined signal 2" /* SIGUSR2 */
};