libc: minor minix changes for new netbsd files
This commit is contained in:
parent
60d52d68da
commit
ba9990cc00
@ -45,6 +45,8 @@ SRCS+= \
|
|||||||
cuserid.c \
|
cuserid.c \
|
||||||
dirname.c \
|
dirname.c \
|
||||||
environ.c \
|
environ.c \
|
||||||
|
err.c \
|
||||||
|
errx.c \
|
||||||
errno.c \
|
errno.c \
|
||||||
fdopen.c \
|
fdopen.c \
|
||||||
ffs.c \
|
ffs.c \
|
||||||
@ -57,6 +59,7 @@ SRCS+= \
|
|||||||
getopt_long.c \
|
getopt_long.c \
|
||||||
getpagesize.c \
|
getpagesize.c \
|
||||||
getpass.c \
|
getpass.c \
|
||||||
|
getprogname.c \
|
||||||
getpwent.c \
|
getpwent.c \
|
||||||
getttyent.c \
|
getttyent.c \
|
||||||
getw.c \
|
getw.c \
|
||||||
@ -78,16 +81,19 @@ SRCS+= \
|
|||||||
popen.c \
|
popen.c \
|
||||||
putenv.c \
|
putenv.c \
|
||||||
putw.c \
|
putw.c \
|
||||||
|
pwcache.c \
|
||||||
random.c \
|
random.c \
|
||||||
realpath.c \
|
realpath.c \
|
||||||
rindex.c \
|
rindex.c \
|
||||||
rlimit.c \
|
rlimit.c \
|
||||||
setenv.c \
|
setenv.c \
|
||||||
|
setmode.c \
|
||||||
settimeofday.c \
|
settimeofday.c \
|
||||||
stderr.c \
|
stderr.c \
|
||||||
strdup.c \
|
strdup.c \
|
||||||
strlcat.c \
|
strlcat.c \
|
||||||
strlcpy.c \
|
strlcpy.c \
|
||||||
|
strmode.c \
|
||||||
strtok_r.c \
|
strtok_r.c \
|
||||||
strtoll.c \
|
strtoll.c \
|
||||||
swab.c \
|
swab.c \
|
||||||
@ -102,5 +108,9 @@ SRCS+= \
|
|||||||
v8regexp.c \
|
v8regexp.c \
|
||||||
v8regsub.c \
|
v8regsub.c \
|
||||||
vectorio.c \
|
vectorio.c \
|
||||||
|
verr.c \
|
||||||
|
verrx.c \
|
||||||
|
vwarn.c \
|
||||||
vwarnx.c \
|
vwarnx.c \
|
||||||
|
warn.c \
|
||||||
warnx.c
|
warnx.c
|
||||||
|
@ -43,15 +43,13 @@ __RCSID("$NetBSD: getprogname.c,v 1.3 2003/07/26 19:24:42 salo Exp $");
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef __weak_alias
|
extern const char **__prognamep; /* Copy of argv[]. */
|
||||||
__weak_alias(getprogname,_getprogname)
|
extern int __argc; /* Copy of argc. */
|
||||||
#endif
|
|
||||||
|
|
||||||
extern const char *__progname;
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
getprogname(void)
|
getprogname(void)
|
||||||
{
|
{
|
||||||
|
if(__argc > 0 && __prognamep)
|
||||||
return (__progname);
|
return __prognamep[0];
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,6 @@
|
|||||||
* ISO C (C90) section. Most names in libc aren't in ISO C, so they
|
* ISO C (C90) section. Most names in libc aren't in ISO C, so they
|
||||||
* should be here. Most aren't here...
|
* should be here. Most aren't here...
|
||||||
*/
|
*/
|
||||||
#define err _err
|
|
||||||
#define warn _warn
|
|
||||||
#define nsdispatch _nsdispatch
|
#define nsdispatch _nsdispatch
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -72,7 +70,6 @@
|
|||||||
#define getdirentries _getdirentries
|
#define getdirentries _getdirentries
|
||||||
#define getlogin _getlogin
|
#define getlogin _getlogin
|
||||||
#define getpeername _getpeername
|
#define getpeername _getpeername
|
||||||
#define getprogname _getprogname
|
|
||||||
#define getsockname _getsockname
|
#define getsockname _getsockname
|
||||||
#define getsockopt _getsockopt
|
#define getsockopt _getsockopt
|
||||||
#define ioctl _ioctl
|
#define ioctl _ioctl
|
||||||
|
@ -118,11 +118,16 @@ __weak_alias(pwcache_groupdb,_pwcache_groupdb)
|
|||||||
* function pointers to various name lookup routines.
|
* function pointers to various name lookup routines.
|
||||||
* these may be changed as necessary.
|
* these may be changed as necessary.
|
||||||
*/
|
*/
|
||||||
|
#ifndef __minix
|
||||||
static int (*_pwcache_setgroupent)(int) = setgroupent;
|
static int (*_pwcache_setgroupent)(int) = setgroupent;
|
||||||
|
static int (*_pwcache_setpassent)(int) = setpassent;
|
||||||
|
#else
|
||||||
|
static int (*_pwcache_setgroupent)(int) = NULL;
|
||||||
|
static int (*_pwcache_setpassent)(int) = NULL;
|
||||||
|
#endif
|
||||||
static void (*_pwcache_endgrent)(void) = endgrent;
|
static void (*_pwcache_endgrent)(void) = endgrent;
|
||||||
static struct group * (*_pwcache_getgrnam)(const char *) = getgrnam;
|
static struct group * (*_pwcache_getgrnam)(const char *) = getgrnam;
|
||||||
static struct group * (*_pwcache_getgrgid)(gid_t) = getgrgid;
|
static struct group * (*_pwcache_getgrgid)(gid_t) = getgrgid;
|
||||||
static int (*_pwcache_setpassent)(int) = setpassent;
|
|
||||||
static void (*_pwcache_endpwent)(void) = endpwent;
|
static void (*_pwcache_endpwent)(void) = endpwent;
|
||||||
static struct passwd * (*_pwcache_getpwnam)(const char *) = getpwnam;
|
static struct passwd * (*_pwcache_getpwnam)(const char *) = getpwnam;
|
||||||
static struct passwd * (*_pwcache_getpwuid)(uid_t) = getpwuid;
|
static struct passwd * (*_pwcache_getpwuid)(uid_t) = getpwuid;
|
||||||
@ -149,6 +154,7 @@ static int gidtb_start(void);
|
|||||||
static int usrtb_start(void);
|
static int usrtb_start(void);
|
||||||
static int grptb_start(void);
|
static int grptb_start(void);
|
||||||
|
|
||||||
|
#define _DIAGASSERT assert
|
||||||
|
|
||||||
static u_int
|
static u_int
|
||||||
st_hash(const char *name, size_t len, int tabsz)
|
st_hash(const char *name, size_t len, int tabsz)
|
||||||
@ -287,6 +293,8 @@ user_from_uid(uid_t uid, int noname)
|
|||||||
if (!pwopn) {
|
if (!pwopn) {
|
||||||
if (_pwcache_setpassent != NULL)
|
if (_pwcache_setpassent != NULL)
|
||||||
(*_pwcache_setpassent)(1);
|
(*_pwcache_setpassent)(1);
|
||||||
|
else
|
||||||
|
setpwent();
|
||||||
++pwopn;
|
++pwopn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -356,6 +364,8 @@ group_from_gid(gid_t gid, int noname)
|
|||||||
if (!gropn) {
|
if (!gropn) {
|
||||||
if (_pwcache_setgroupent != NULL)
|
if (_pwcache_setgroupent != NULL)
|
||||||
(*_pwcache_setgroupent)(1);
|
(*_pwcache_setgroupent)(1);
|
||||||
|
else
|
||||||
|
setgrent();
|
||||||
++gropn;
|
++gropn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,6 +435,8 @@ uid_from_user(const char *name, uid_t *uid)
|
|||||||
if (!pwopn) {
|
if (!pwopn) {
|
||||||
if (_pwcache_setpassent != NULL)
|
if (_pwcache_setpassent != NULL)
|
||||||
(*_pwcache_setpassent)(1);
|
(*_pwcache_setpassent)(1);
|
||||||
|
else
|
||||||
|
setpwent();
|
||||||
++pwopn;
|
++pwopn;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,6 +501,8 @@ gid_from_group(const char *name, gid_t *gid)
|
|||||||
if (!gropn) {
|
if (!gropn) {
|
||||||
if (_pwcache_setgroupent != NULL)
|
if (_pwcache_setgroupent != NULL)
|
||||||
(*_pwcache_setgroupent)(1);
|
(*_pwcache_setgroupent)(1);
|
||||||
|
else
|
||||||
|
setgrent();
|
||||||
++gropn;
|
++gropn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,10 +77,12 @@ typedef struct bitcmd {
|
|||||||
#define CMD2_OBITS 0x08
|
#define CMD2_OBITS 0x08
|
||||||
#define CMD2_UBITS 0x10
|
#define CMD2_UBITS 0x10
|
||||||
|
|
||||||
static BITCMD *addcmd __P((BITCMD *, mode_t, mode_t, mode_t, mode_t));
|
#define _DIAGASSERT assert
|
||||||
static void compress_mode __P((BITCMD *));
|
|
||||||
|
static BITCMD *addcmd (BITCMD *, mode_t, mode_t, mode_t, mode_t);
|
||||||
|
static void compress_mode (BITCMD *);
|
||||||
#ifdef SETMODE_DEBUG
|
#ifdef SETMODE_DEBUG
|
||||||
static void dumpmode __P((BITCMD *));
|
static void dumpmode (BITCMD *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -227,12 +229,20 @@ setmode(p)
|
|||||||
}
|
}
|
||||||
if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))
|
if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))
|
||||||
goto out;
|
goto out;
|
||||||
if (lval & ~(STANDARD_BITS|S_ISTXT)) {
|
if (lval & ~(STANDARD_BITS
|
||||||
|
#ifdef S_ISTXT
|
||||||
|
|S_ISTXT
|
||||||
|
#endif
|
||||||
|
)) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
perm = (mode_t)lval;
|
perm = (mode_t)lval;
|
||||||
ADDCMD('=', (STANDARD_BITS|S_ISTXT), perm, mask);
|
ADDCMD('=', (STANDARD_BITS
|
||||||
|
#ifdef S_ISTXT
|
||||||
|
|S_ISTXT
|
||||||
|
#endif
|
||||||
|
), perm, mask);
|
||||||
set->cmd = 0;
|
set->cmd = 0;
|
||||||
return (saveset);
|
return (saveset);
|
||||||
}
|
}
|
||||||
@ -242,6 +252,7 @@ setmode(p)
|
|||||||
* each clause of the symbolic mode.
|
* each clause of the symbolic mode.
|
||||||
*/
|
*/
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
|
||||||
/* First, find out which bits might be modified. */
|
/* First, find out which bits might be modified. */
|
||||||
for (who = 0;; ++p) {
|
for (who = 0;; ++p) {
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
@ -261,15 +272,19 @@ setmode(p)
|
|||||||
goto getop;
|
goto getop;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
getop:
|
||||||
getop: if ((op = *p++) != '+' && op != '-' && op != '=') {
|
op = *p;
|
||||||
|
p++;
|
||||||
|
if (op != '+' && op != '-' && op != '=') {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (op == '=')
|
if (op == '=')
|
||||||
equalopdone = 0;
|
equalopdone = 0;
|
||||||
|
|
||||||
|
#ifdef S_ISTXT
|
||||||
who &= ~S_ISTXT;
|
who &= ~S_ISTXT;
|
||||||
|
#endif
|
||||||
for (perm = 0, permXbits = 0;; ++p) {
|
for (perm = 0, permXbits = 0;; ++p) {
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case 'r':
|
case 'r':
|
||||||
@ -283,6 +298,7 @@ getop: if ((op = *p++) != '+' && op != '-' && op != '=') {
|
|||||||
if (who == 0 || (who & ~S_IRWXO))
|
if (who == 0 || (who & ~S_IRWXO))
|
||||||
perm |= S_ISUID|S_ISGID;
|
perm |= S_ISUID|S_ISGID;
|
||||||
break;
|
break;
|
||||||
|
#ifdef S_ISTXT
|
||||||
case 't':
|
case 't':
|
||||||
/*
|
/*
|
||||||
* If specific bits where requested and
|
* If specific bits where requested and
|
||||||
@ -292,6 +308,7 @@ getop: if ((op = *p++) != '+' && op != '-' && op != '=') {
|
|||||||
who |= S_ISTXT;
|
who |= S_ISTXT;
|
||||||
perm |= S_ISTXT;
|
perm |= S_ISTXT;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
perm |= S_IWUSR|S_IWGRP|S_IWOTH;
|
perm |= S_IWUSR|S_IWGRP|S_IWOTH;
|
||||||
@ -367,9 +384,7 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static BITCMD *
|
static BITCMD *
|
||||||
addcmd(set, op, who, oparg, mask)
|
addcmd(BITCMD *set, mode_t op, mode_t who, mode_t oparg, mode_t mask)
|
||||||
BITCMD *set;
|
|
||||||
mode_t oparg, who, op, mask;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
_DIAGASSERT(set != NULL);
|
_DIAGASSERT(set != NULL);
|
||||||
|
@ -49,6 +49,8 @@ __RCSID("$NetBSD: strmode.c,v 1.18 2006/10/07 22:04:18 apb Exp $");
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#define _DIAGASSERT assert
|
||||||
|
|
||||||
#if !HAVE_STRMODE
|
#if !HAVE_STRMODE
|
||||||
void
|
void
|
||||||
strmode(mode, p)
|
strmode(mode, p)
|
||||||
|
@ -53,7 +53,6 @@
|
|||||||
#undef getdirentries
|
#undef getdirentries
|
||||||
#undef getlogin
|
#undef getlogin
|
||||||
#undef getpeername
|
#undef getpeername
|
||||||
#undef getprogname
|
|
||||||
#undef getsockname
|
#undef getsockname
|
||||||
#undef getsockopt
|
#undef getsockopt
|
||||||
#undef ioctl
|
#undef ioctl
|
||||||
@ -146,8 +145,6 @@ int _kevent(int, const struct kevent *, int, struct kevent *,
|
|||||||
int _flock(int, int);
|
int _flock(int, int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef err
|
|
||||||
#undef warn
|
|
||||||
#undef nsdispatch
|
#undef nsdispatch
|
||||||
|
|
||||||
#endif /* _UN_NAMESPACE_H_ */
|
#endif /* _UN_NAMESPACE_H_ */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user