mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
Sun Jan 21 00:55:25 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/shmat.c: Include sys/shm.h instead of sys/sem.h. * stdlib/stdlib.h [__USE_SVID]: Declare a64l, l64a. * stdlib/l64a.c: Use 6-bit numbers as indices in CONV_TABLE, not literal byte values. * misc/bsd-compat.c (getpgrp): Define with prototype. * misc/init-misc.c (__progname_full): New variable. (program_invocation_name, program_invocation_short_name): New aliases. (__init_misc): Define with prototype. Set __progname_full. * misc/progname.c: File removed. * misc/Makefile (aux): Remove progname. * misc/hsearch_r.c (isprime): Define with prototype. * sysdeps/unix/sysv/linux/seteuid.c: Just include unix/bsd version. * sysdeps/unix/bsd/seteuid.c: Disallow arg of -1. * sysdeps/unix/bsd/setegid.c: Likewise.
This commit is contained in:
parent
eb63bdd072
commit
bbed653cda
24
ChangeLog
24
ChangeLog
@ -1,3 +1,27 @@
|
||||
Sun Jan 21 00:55:25 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* sysdeps/unix/sysv/linux/shmat.c: Include sys/shm.h instead of
|
||||
sys/sem.h.
|
||||
|
||||
* stdlib/stdlib.h [__USE_SVID]: Declare a64l, l64a.
|
||||
|
||||
* stdlib/l64a.c: Use 6-bit numbers as indices in CONV_TABLE, not
|
||||
literal byte values.
|
||||
|
||||
* misc/bsd-compat.c (getpgrp): Define with prototype.
|
||||
|
||||
* misc/init-misc.c (__progname_full): New variable.
|
||||
(program_invocation_name, program_invocation_short_name): New aliases.
|
||||
(__init_misc): Define with prototype. Set __progname_full.
|
||||
* misc/progname.c: File removed.
|
||||
* misc/Makefile (aux): Remove progname.
|
||||
|
||||
* misc/hsearch_r.c (isprime): Define with prototype.
|
||||
|
||||
* sysdeps/unix/sysv/linux/seteuid.c: Just include unix/bsd version.
|
||||
* sysdeps/unix/bsd/seteuid.c: Disallow arg of -1.
|
||||
* sysdeps/unix/bsd/setegid.c: Likewise.
|
||||
|
||||
Fri Jan 19 13:28:59 1996 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
|
||||
|
||||
* sysdeps/unix/sysv/linux/tcdrain.c: Define tcdrain, not
|
||||
|
@ -53,7 +53,7 @@ routines := brk sbrk sstk ioctl \
|
||||
efgcvt efgcvt_r \
|
||||
hsearch hsearch_r tsearch \
|
||||
err error
|
||||
aux := progname init-misc
|
||||
aux := init-misc
|
||||
distribute := bsd-compat.c
|
||||
extra-objs := bsd-compat.o
|
||||
install-lib := libbsd-compat.a libg.a
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* BSD-compatible versions of functions where BSD and POSIX.1 conflict.
|
||||
|
||||
Copyright (C) 1991, 1992, 1994, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -25,8 +25,7 @@ Cambridge, MA 02139, USA. */
|
||||
extern pid_t __getpgid __P ((pid_t));
|
||||
|
||||
pid_t
|
||||
getpgrp (pid)
|
||||
pid_t pid;
|
||||
getpgrp (pid_t pid)
|
||||
{
|
||||
return __getpgid (pid);
|
||||
}
|
||||
|
21
misc/error.c
21
misc/error.c
@ -1,5 +1,5 @@
|
||||
/* error.c -- error handler for noninteractive utilities
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU C Library. Its master source is NOT part of
|
||||
the C library, however. The master source lives in /gd/gnu/lib.
|
||||
@ -47,23 +47,27 @@ Cambridge, MA 02139, USA. */
|
||||
void exit ();
|
||||
#endif
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
unsigned int error_message_count;
|
||||
|
||||
/* If NULL, error will flush stdout, then print on stderr the program
|
||||
name, a colon and a space. Otherwise, error will call this
|
||||
function without parameters instead. */
|
||||
void (*error_print_progname) () = NULL;
|
||||
void (*error_print_progname) ();
|
||||
|
||||
/* This variable is incremented each time `error' is called. */
|
||||
unsigned int error_message_count;
|
||||
|
||||
#ifdef _LIBC
|
||||
/* In the GNU C library, there is a predefined variable for this. */
|
||||
|
||||
#define program_name program_invocation_name
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#else
|
||||
|
||||
/* The calling program should define program_name and set it to the
|
||||
name of the executing program. */
|
||||
extern char *program_name;
|
||||
|
||||
#if HAVE_STRERROR || _LIBC
|
||||
#if HAVE_STRERROR
|
||||
# ifndef strerror /* On some systems, strerror is a macro */
|
||||
char *strerror ();
|
||||
# endif
|
||||
@ -80,7 +84,8 @@ private_strerror (errnum)
|
||||
return "Unknown system error";
|
||||
}
|
||||
#define strerror private_strerror
|
||||
#endif
|
||||
#endif /* HAVE_STRERROR */
|
||||
#endif /* _LIBC */
|
||||
|
||||
/* Print the program name and error message MESSAGE, which is a printf-style
|
||||
format string with optional args.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
@ -31,7 +31,7 @@ Boston, MA 02111-1307, USA. */
|
||||
Instead the interface of all functions is extended to take an argument
|
||||
which describes the current status. */
|
||||
typedef struct _ENTRY
|
||||
{
|
||||
{
|
||||
int used;
|
||||
ENTRY entry;
|
||||
}
|
||||
@ -44,8 +44,7 @@ _ENTRY;
|
||||
a) the code is (most probably) called a few times per program run and
|
||||
b) the number is small because the table must fit in the core */
|
||||
static int
|
||||
isprime (number)
|
||||
unsigned int number;
|
||||
isprime (unsigned int number)
|
||||
{
|
||||
/* no even number will be passed */
|
||||
unsigned int div = 3;
|
||||
@ -61,7 +60,7 @@ isprime (number)
|
||||
Test for an existing table are done. We allocate one element
|
||||
more as the found prime number says. This is done for more effective
|
||||
indexing as explained in the comment for the hsearch function.
|
||||
The contents of the table is zeroed, especially the field used
|
||||
The contents of the table is zeroed, especially the field used
|
||||
becomes zero. */
|
||||
int
|
||||
hcreate_r (nel, htab)
|
||||
@ -114,7 +113,7 @@ hdestroy_r (htab)
|
||||
/* free used memory */
|
||||
free (htab->table);
|
||||
|
||||
/* the sign for an existing table is an value != NULL in htable */
|
||||
/* the sign for an existing table is an value != NULL in htable */
|
||||
htab->table = NULL;
|
||||
}
|
||||
|
||||
@ -124,7 +123,7 @@ hdestroy_r (htab)
|
||||
probably strings of chars. The function for generating a number of the
|
||||
strings is simple but fast. It can be replaced by a more complex function
|
||||
like ajw (see [Aho,Sethi,Ullman]) if the needs are shown.
|
||||
|
||||
|
||||
We use an trick to speed up the lookup. The table is created by hcreate
|
||||
with one more element available. This enables us to use the index zero
|
||||
special. This index will never be used because we store the first hash
|
||||
@ -144,7 +143,7 @@ hsearch_r (item, action, retval, htab)
|
||||
unsigned int len = strlen (item.key);
|
||||
unsigned int idx;
|
||||
|
||||
/* If table is full and another entry should be entered return with
|
||||
/* If table is full and another entry should be entered return with
|
||||
error. */
|
||||
if (action == ENTER && htab->filled == htab->size)
|
||||
{
|
||||
@ -178,7 +177,7 @@ hsearch_r (item, action, retval, htab)
|
||||
if (htab->table[idx].used == hval
|
||||
&& strcmp (item.key, htab->table[idx].entry.key) == 0)
|
||||
{
|
||||
if (action == ENTER)
|
||||
if (action == ENTER)
|
||||
htab->table[idx].entry.data = item.data;
|
||||
|
||||
*retval = &htab->table[idx].entry;
|
||||
@ -187,7 +186,7 @@ hsearch_r (item, action, retval, htab)
|
||||
|
||||
/* Second hash function, as suggested in [Knuth] */
|
||||
hval2 = 1 + hval % (htab->size - 2);
|
||||
|
||||
|
||||
do
|
||||
{
|
||||
/* Because SIZE is prime this guarantees to step through all
|
||||
@ -201,7 +200,7 @@ hsearch_r (item, action, retval, htab)
|
||||
if (htab->table[idx].used == hval
|
||||
&& strcmp (item.key, htab->table[idx].entry.key) == 0)
|
||||
{
|
||||
if (action == ENTER)
|
||||
if (action == ENTER)
|
||||
htab->table[idx].entry.data = item.data;
|
||||
|
||||
*retval = &htab->table[idx].entry;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Define and initialize `__progname'.
|
||||
Copyright (C) 1994, 1995 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -18,14 +18,15 @@ not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
char *__progname_full = (char *) "";
|
||||
char *__progname = (char *) "";
|
||||
weak_alias (__progname_full, program_invocation_name)
|
||||
weak_alias (__progname, program_invocation_short_name)
|
||||
|
||||
void
|
||||
__init_misc (argc, argv, envp)
|
||||
int argc;
|
||||
char **argv;
|
||||
char **envp;
|
||||
__init_misc (int argc, char **argv, char **envp)
|
||||
{
|
||||
if (argv && argv[0])
|
||||
{
|
||||
@ -34,9 +35,6 @@ __init_misc (argc, argv, envp)
|
||||
__progname = argv[0];
|
||||
else
|
||||
__progname = p + 1;
|
||||
__progname_full = argv[0];
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_GNU_LD
|
||||
text_set_element (__libc_subinit, __init_misc);
|
||||
#endif
|
||||
|
@ -1,53 +0,0 @@
|
||||
/* Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#ifdef HAVE_GNU_LD
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <string.h>
|
||||
|
||||
/* These must be initialized data definitions. Common definitions satisfy
|
||||
references to these variables, but do not cause the whole file to be
|
||||
linked in, and so omit the set-up function. */
|
||||
char *program_invocation_name = NULL;
|
||||
char *program_invocation_short_name = NULL;
|
||||
|
||||
static void
|
||||
DEFUN(set_progname, (argc, argv, envp),
|
||||
int argc AND char **argv AND char **envp)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (argv && argv[0])
|
||||
{
|
||||
program_invocation_name = argv[0];
|
||||
p = strrchr (argv[0], '/');
|
||||
if (p == NULL)
|
||||
program_invocation_short_name = argv[0];
|
||||
else
|
||||
program_invocation_short_name = p + 1;
|
||||
}
|
||||
else
|
||||
program_invocation_name = program_invocation_short_name = 0;
|
||||
|
||||
(void) &set_progname; /* Avoid "defined but not used" warning. */
|
||||
}
|
||||
|
||||
text_set_element (__libc_subinit, set_progname);
|
||||
|
||||
#endif
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
|
||||
|
||||
@ -43,7 +43,7 @@ l64a (n)
|
||||
|
||||
for (cnt = 5; cnt >= 0; --cnt)
|
||||
{
|
||||
result[cnt] = n & 0x3f;
|
||||
result[cnt] = conv_table[n & 0x3f];
|
||||
n >>= 6;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -156,6 +156,17 @@ extern __inline long int atol (__const char *__nptr)
|
||||
#endif /* Optimizing GCC >=2. */
|
||||
|
||||
|
||||
#ifdef __USE_SVID
|
||||
/* Convert N to base 64 using the digits "./0-9A-Za-z", least-significant
|
||||
digit first. Returns a pointer to static storage overwritten by the
|
||||
next call. */
|
||||
extern char *l64a __P ((long int __n));
|
||||
|
||||
/* Read a number from a string in base 64 as above. */
|
||||
extern long int a64l __P ((const char *));
|
||||
#endif
|
||||
|
||||
|
||||
/* Return a random integer between 0 and RAND_MAX inclusive. */
|
||||
extern int rand __P ((void));
|
||||
/* Seed the random number generator with the given number. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -16,12 +16,19 @@ License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int
|
||||
DEFUN(setegid, (gid), gid_t gid)
|
||||
setegid (gid)
|
||||
gid_t gid;
|
||||
{
|
||||
if (gid == (gid_t) ~0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return __setregid (-1, gid);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1993 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -16,12 +16,19 @@ License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <ansidecl.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int
|
||||
DEFUN(seteuid, (uid), uid_t uid)
|
||||
seteuid (uid)
|
||||
uid_t uid;
|
||||
{
|
||||
if (uid == (uid_t) ~0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return __setreuid (-1, uid);
|
||||
}
|
||||
|
@ -1,36 +1 @@
|
||||
/* Copyright (C) 1995 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
int
|
||||
__seteuid (uid)
|
||||
uid_t uid;
|
||||
{
|
||||
if (uid == (uid_t) ~0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return __setreuid (-1, uid);
|
||||
}
|
||||
|
||||
weak_alias (__seteuid, seteuid)
|
||||
#include <sysdeps/unix/bsd/seteuid.c>
|
||||
|
@ -17,7 +17,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If
|
||||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <sys/sem.h>
|
||||
#include <sys/shm.h>
|
||||
|
||||
/* Attach the shared memory segment associated with SHMID to the data
|
||||
segment of the calling process. SHMADDR and SHMFLG determine how
|
||||
|
Loading…
Reference in New Issue
Block a user