mirror of
git://sourceware.org/git/glibc.git
synced 2024-11-21 01:12:26 +08:00
Mon Jul 1 12:29:50 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu>
* nss/Makefile (databases): Change host to hosts. * nss/host-lookup.c: Renamed to nss/hosts-lookup.c.
This commit is contained in:
parent
7cbc698400
commit
3776d592f1
@ -84,11 +84,11 @@ gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
|
||||
gnu_ld=yes gnu_as=yes ;;
|
||||
esac
|
||||
case "$host_os" in
|
||||
linux*ecoff*)
|
||||
;;
|
||||
gnu* | linux* | sysv4* | solaris2*)
|
||||
# These systems always use the ELF format.
|
||||
if test "$host_cpu" != alpha; then # Linux/Alpha is not fully ELF yet
|
||||
elf=yes
|
||||
fi
|
||||
# These systems (almost) always use the ELF format.
|
||||
elf=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
|
@ -28,7 +28,7 @@ distribute := nsswitch.h XXX-lookup.c getXXbyYY.c getXXbyYY_r.c \
|
||||
routines = nsswitch $(addsuffix -lookup,$(databases))
|
||||
|
||||
# These are the databases that go through nss dispatch.
|
||||
databases = proto service host network grp pwd rpc ethers
|
||||
databases = proto service hosts network grp pwd rpc ethers
|
||||
|
||||
# Specify rules for the nss_* modules. We have some services.
|
||||
services := files dns
|
||||
|
@ -32,6 +32,7 @@ Cambridge, MA 02139, USA. */
|
||||
#define ENTNAME hostent
|
||||
#define DATAFILE _PATH_HOSTS
|
||||
|
||||
#define ENTDATA hostent_data
|
||||
struct hostent_data
|
||||
{
|
||||
unsigned char host_addr[16]; /* IPv4 or IPv6 address. */
|
||||
@ -73,7 +74,7 @@ LINE_PARSER
|
||||
/* Illegal address: ignore line. */
|
||||
return 0;
|
||||
|
||||
/* Store a pointer to the addressin the expected form. */
|
||||
/* Store a pointer to the address in the expected form. */
|
||||
entdata->h_addr_ptrs[0] = entdata->host_addr;
|
||||
entdata->h_addr_ptrs[1] = NULL;
|
||||
result->h_addr_list = entdata->h_addr_ptrs;
|
||||
|
@ -33,17 +33,31 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
struct parser_data
|
||||
{
|
||||
struct CONCAT(ENTNAME,_data) entdata;
|
||||
#ifdef ENTDATA
|
||||
struct ENTDATA entdata;
|
||||
#define ENTDATA_DECL(data) struct ENTDATA *const entdata = &data->entdata
|
||||
#else
|
||||
#define ENTDATA_DECL(data)
|
||||
#endif
|
||||
char linebuffer[0];
|
||||
};
|
||||
|
||||
#ifdef ENTDATA
|
||||
/* The function can't be exported, because the entdata structure
|
||||
is defined only in files-foo.c. */
|
||||
#define parser_stclass static inline
|
||||
#else
|
||||
/* Export the line parser function so it can be used in nss_db. */
|
||||
#define parser_stclass /* Global */
|
||||
#define parse_line CONCAT(_nss_files_parse_,ENTNAME)
|
||||
#endif
|
||||
|
||||
#define LINE_PARSER(BODY) \
|
||||
static inline int \
|
||||
parser_stclass int \
|
||||
parse_line (char *line, struct STRUCTURE *result, \
|
||||
struct parser_data *data, int datalen) \
|
||||
{ \
|
||||
struct CONCAT(ENTNAME,_data) *const entdata __attribute__ ((unused)) \
|
||||
= &data->entdata; \
|
||||
ENTDATA_DECL (data); \
|
||||
BODY; \
|
||||
TRAILING_LIST_PARSER; \
|
||||
return 1; \
|
||||
@ -107,9 +121,10 @@ parse_list (char *line, struct parser_data *data, int datalen)
|
||||
char *eol, **list, **p;
|
||||
|
||||
/* Find the end of the line buffer. */
|
||||
eol = strchr (line, '\0') + 1;
|
||||
eol = strchr (data->linebuffer, '\0') + 1;
|
||||
/* Adjust the pointer so it is aligned for storing pointers. */
|
||||
eol += (eol - (char *) 0) % __alignof__ (char *);
|
||||
eol += __alignof__ (char *) - 1;
|
||||
eol -= (eol - (char *) 0) % __alignof__ (char *);
|
||||
/* We will start the storage here for the vector of pointers. */
|
||||
list = (char **) eol;
|
||||
|
||||
|
@ -249,8 +249,8 @@ nss_lookup_function (service_user *ni, const char *fct_name)
|
||||
+ strlen (fct_name) + 1);
|
||||
char name[namlen];
|
||||
struct link_map *map = ni->library->lib_handle;
|
||||
Elf32_Addr loadbase;
|
||||
const Elf32_Sym *ref = NULL;
|
||||
ElfW(Addr) loadbase;
|
||||
const ElfW(Sym) *ref = NULL;
|
||||
void get_sym (void)
|
||||
{
|
||||
struct link_map *scope[2] = { map, NULL };
|
||||
@ -397,7 +397,7 @@ nss_parse_service_list (const char *line)
|
||||
while (1)
|
||||
{
|
||||
service_user *new_service;
|
||||
char *name;
|
||||
const char *name;
|
||||
|
||||
while (isspace (line[0]))
|
||||
++line;
|
||||
|
@ -69,24 +69,6 @@ static struct cmd {
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Why isn't this in stdlib?
|
||||
*/
|
||||
char *
|
||||
strndup (const char * s, size_t n)
|
||||
{
|
||||
char * retval;
|
||||
|
||||
retval = malloc (n + 1);
|
||||
if (!retval)
|
||||
return retval;
|
||||
|
||||
memcpy (retval, s, n);
|
||||
retval[n] = '\0'; /* ensure return value is terminated */
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
/* Skip white space. */
|
||||
static const char *
|
||||
skip_ws (const char * str)
|
||||
@ -194,7 +176,7 @@ arg_trimdomain_list (const char * fname, int line_num, const char * args,
|
||||
return 0;
|
||||
}
|
||||
_res_hconf.trimdomain[_res_hconf.num_trimdomains++] =
|
||||
strndup (start, len);
|
||||
strndup (start, len);
|
||||
args = skip_ws (args);
|
||||
switch (*args)
|
||||
{
|
||||
|
@ -108,7 +108,7 @@ extern char *strndup __P ((__const char *__string, size_t __n));
|
||||
({ \
|
||||
__const char *__old = (s); \
|
||||
char *__new; \
|
||||
size_t __len = strnlen (__old); \
|
||||
size_t __len = strnlen (__old, (n)); \
|
||||
__new = memcpy (__builtin_alloca (__len + 1), __old, __len); \
|
||||
__new[__len] = '\0'; \
|
||||
__new; \
|
||||
|
85
sunrpc/xdr.c
85
sunrpc/xdr.c
@ -42,6 +42,7 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12";
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
char *malloc();
|
||||
|
||||
#include <rpc/types.h>
|
||||
@ -99,34 +100,28 @@ xdr_int(xdrs, ip)
|
||||
(void) (xdr_short(xdrs, (short *)ip));
|
||||
return (xdr_long(xdrs, (long *)ip));
|
||||
#else
|
||||
if (sizeof (int) < sizeof (long)) {
|
||||
long l;
|
||||
# if INT_MAX < LONG_MAX
|
||||
long l;
|
||||
|
||||
switch (xdrs->x_op) {
|
||||
case XDR_ENCODE:
|
||||
l = (long) *ip;
|
||||
return XDR_PUTLONG(xdrs, &l);
|
||||
switch (xdrs->x_op) {
|
||||
case XDR_ENCODE:
|
||||
l = (long) *ip;
|
||||
return XDR_PUTLONG(xdrs, &l);
|
||||
|
||||
case XDR_DECODE:
|
||||
if (!XDR_GETLONG(xdrs, &l)) {
|
||||
return FALSE;
|
||||
}
|
||||
*ip = (int) l;
|
||||
return TRUE;
|
||||
case XDR_DECODE:
|
||||
if (!XDR_GETLONG(xdrs, &l)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else if (sizeof (int) == sizeof (long)) {
|
||||
return (xdr_long(xdrs, (long *)ip));
|
||||
} else if (sizeof (int) == sizeof (short)) {
|
||||
return (xdr_short(xdrs, (short *)ip));
|
||||
} else {
|
||||
abort (); /* roland@gnu */
|
||||
#if 0
|
||||
/* force unresolved reference (link-time error): */
|
||||
extern unexpected_sizes_in_xdr_int ();
|
||||
|
||||
unexpected_sizes_in_xdr_int();
|
||||
#endif
|
||||
*ip = (int) l;
|
||||
return TRUE;
|
||||
}
|
||||
# elif INT_MAX == LONG_MAX
|
||||
return xdr_long(xdrs, (long *)ip);
|
||||
# elif INT_MAX == SHRT_MAX
|
||||
return xdr_short(xdrs, (short *)ip);
|
||||
# else
|
||||
# error unexpected integer sizes in_xdr_int()
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -142,34 +137,28 @@ xdr_u_int(xdrs, up)
|
||||
(void) (xdr_short(xdrs, (short *)up));
|
||||
return (xdr_u_long(xdrs, (u_long *)up));
|
||||
#else
|
||||
if (sizeof (u_int) < sizeof (u_long)) {
|
||||
u_long l;
|
||||
# if UINT_MAX < ULONG_MAX
|
||||
u_long l;
|
||||
|
||||
switch (xdrs->x_op) {
|
||||
case XDR_ENCODE:
|
||||
l = (u_long) *up;
|
||||
return XDR_PUTLONG(xdrs, &l);
|
||||
switch (xdrs->x_op) {
|
||||
case XDR_ENCODE:
|
||||
l = (u_long) *up;
|
||||
return XDR_PUTLONG(xdrs, &l);
|
||||
|
||||
case XDR_DECODE:
|
||||
if (!XDR_GETLONG(xdrs, &l)) {
|
||||
return FALSE;
|
||||
}
|
||||
*up = (u_int) l;
|
||||
return TRUE;
|
||||
case XDR_DECODE:
|
||||
if (!XDR_GETLONG(xdrs, &l)) {
|
||||
return FALSE;
|
||||
}
|
||||
} else if (sizeof (u_int) == sizeof (u_long)) {
|
||||
return (xdr_u_long(xdrs, (u_long *)up));
|
||||
} else if (sizeof (u_int) == sizeof (u_short)) {
|
||||
return (xdr_short(xdrs, (short *)up));
|
||||
} else {
|
||||
abort (); /* drepper@gnu */
|
||||
#if 0
|
||||
/* force unresolved reference (link-time error): */
|
||||
extern unexpected_sizes_in_xdr_u_int ();
|
||||
|
||||
unexpected_sizes_in_xdr_u_int();
|
||||
#endif
|
||||
*up = (u_int) l;
|
||||
return TRUE;
|
||||
}
|
||||
# elif UINT_MAX == ULONG_MAX
|
||||
return xdr_u_long(xdrs, (u_long *)up);
|
||||
# elif UINT_MAX == USHRT_MAX
|
||||
return xdr_short(xdrs, (short *)up);
|
||||
# else
|
||||
# error unexpected integer sizes in_xdr_u_int()
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ elf_alpha_fix_plt(struct link_map *l,
|
||||
if (edisp >= -0x100000 && edisp < 0x100000)
|
||||
{
|
||||
/* If we are in range, use br to perfect branch prediction and
|
||||
elide the dependancy on the address load. This case happens,
|
||||
elide the dependency on the address load. This case happens,
|
||||
e.g., when a shared library call is resolved to the same library. */
|
||||
|
||||
int hi, lo;
|
||||
@ -179,7 +179,7 @@ elf_machine_rela (struct link_map *map,
|
||||
|
||||
if (resolve)
|
||||
{
|
||||
loadbase = (*resolve)(&sym, (Elf64_Addr)reloc_addr,
|
||||
loadbase = (*resolve)(&sym, (Elf64_Addr)reloc_addr,
|
||||
r_info == R_ALPHA_JMP_SLOT);
|
||||
}
|
||||
else
|
||||
|
@ -26,10 +26,10 @@ Cambridge, MA 02139, USA. */
|
||||
#endif
|
||||
|
||||
LEAF(__syscall_error, 0)
|
||||
ldgp gp, 0(t12)
|
||||
.prologue 1
|
||||
|
||||
/* Store return value in errno... */
|
||||
ldgp gp, 0(t12)
|
||||
stl v0, errno
|
||||
|
||||
/* And just kick back a -1. */
|
||||
|
@ -99,22 +99,12 @@ name/**/: \
|
||||
|
||||
#undef PSEUDO_END
|
||||
|
||||
#ifdef PIC
|
||||
/* When building a shared library, we can use a branch since the text
|
||||
section of the library is much smaller than 4MB. If we ever break
|
||||
this assumption, the linker will tell us. */
|
||||
# define PSEUDO_END(sym) \
|
||||
1996: \
|
||||
br zero, __syscall_error; \
|
||||
END(sym)
|
||||
#else
|
||||
# define PSEUDO_END(sym) \
|
||||
#define PSEUDO_END(sym) \
|
||||
1996: \
|
||||
br gp, 2f; \
|
||||
2: ldgp gp, 0(gp); \
|
||||
jmp zero, __syscall_error; \
|
||||
END(sym)
|
||||
#endif
|
||||
|
||||
#define r0 v0
|
||||
#define r1 a4
|
||||
|
12
sysdeps/unix/sysv/linux/alpha/init-first.h
Normal file
12
sysdeps/unix/sysv/linux/alpha/init-first.h
Normal file
@ -0,0 +1,12 @@
|
||||
/* This fragment is invoked in the stack context of program start.
|
||||
Its job is to set up a pointer to argc as an argument, pass
|
||||
control to `INIT', and, if necessary, clean up after the call
|
||||
to leave the stack in the same condition it was found in. */
|
||||
|
||||
#define SYSDEP_CALL_INIT(NAME, INIT) \
|
||||
asm(".globl " #NAME "\n" \
|
||||
#NAME ":\n\t" \
|
||||
"ldgp $29, 0($27)\n\t" \
|
||||
".prologue 1\n\t" \
|
||||
"mov $30, $16\n\t" \
|
||||
"br $31, " #INIT "..ng");
|
13
sysdeps/unix/sysv/linux/i386/init-first.h
Normal file
13
sysdeps/unix/sysv/linux/i386/init-first.h
Normal file
@ -0,0 +1,13 @@
|
||||
/* This fragment is invoked in the stack context of program start.
|
||||
Its job is to set up a pointer to argc as an argument, pass
|
||||
control to `INIT', and, if necessary, clean up after the call
|
||||
to leave the stack in the same condition it was found in. */
|
||||
|
||||
#define SYSDEP_CALL_INIT(NAME, INIT) \
|
||||
asm(".globl " #NAME "\n\t" \
|
||||
#NAME ":\n\t" \
|
||||
"lea 4(%esp), %eax\n\t" \
|
||||
"pushl %eax\n\t" \
|
||||
"call " #INIT "\n\t" \
|
||||
"popl %eax\n\t" \
|
||||
"ret");
|
@ -19,23 +19,22 @@ Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sysdep.h>
|
||||
#include "fpu_control.h"
|
||||
|
||||
/* This code is mostly the same for all machines. This version works at
|
||||
least for i386 and m68k, and probably any CISCy machine with a normal
|
||||
stack arrangement. */
|
||||
#include <fpu_control.h>
|
||||
#include "init-first.h"
|
||||
|
||||
extern void __libc_init (int, char **, char **);
|
||||
extern void __libc_global_ctors (void);
|
||||
|
||||
/* The function is called from assembly stubs the compiler can't see. */
|
||||
static void init (void *) __attribute__ ((unused));
|
||||
|
||||
static void
|
||||
init (int *data)
|
||||
init (void *data)
|
||||
{
|
||||
extern int __personality (int);
|
||||
|
||||
int argc = *data;
|
||||
char **argv = (void *) (data + 1);
|
||||
int argc = *(long *)data;
|
||||
char **argv = (char **)data + 1;
|
||||
char **envp = &argv[argc + 1];
|
||||
|
||||
/* The `personality' system call takes one argument that chooses the
|
||||
@ -50,33 +49,23 @@ init (int *data)
|
||||
|
||||
__environ = envp;
|
||||
__libc_init (argc, argv, envp);
|
||||
|
||||
#ifdef PIC
|
||||
__libc_global_ctors ();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PIC
|
||||
/* This function is called to initialize the shared C library.
|
||||
It is called just before the user _start code from i386/elf/start.S,
|
||||
with the stack set up as that code gets it. */
|
||||
|
||||
/* NOTE! The linker notices the magical name `_init' and sets the DT_INIT
|
||||
pointer in the dynamic section based solely on that. It is convention
|
||||
for this function to be in the `.init' section, but the symbol name is
|
||||
the only thing that really matters!! */
|
||||
/*void _init (int argc, ...) __attribute__ ((unused, section (".init")));*/
|
||||
SYSDEP_CALL_INIT(_init, init);
|
||||
|
||||
void
|
||||
_init (int argc, ...)
|
||||
__libc_init_first (void)
|
||||
{
|
||||
init (&argc);
|
||||
|
||||
__libc_global_ctors ();
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
SYSDEP_CALL_INIT(__libc_init_first, init);
|
||||
|
||||
void
|
||||
__libc_init_first (int argc __attribute__ ((unused)), ...)
|
||||
{
|
||||
#ifndef PIC
|
||||
init (&argc);
|
||||
#endif
|
||||
}
|
||||
|
12
sysdeps/unix/sysv/linux/m68k/init-first.h
Normal file
12
sysdeps/unix/sysv/linux/m68k/init-first.h
Normal file
@ -0,0 +1,12 @@
|
||||
/* This fragment is invoked in the stack context of program start.
|
||||
Its job is to set up a pointer to argc as an argument, pass
|
||||
control to `INIT', and, if necessary, clean up after the call
|
||||
to leave the stack in the same condition it was found in. */
|
||||
|
||||
#define SYSDEP_CALL_INIT(NAME, INIT) \
|
||||
asm(".globl " #NAME "\n\t" \
|
||||
#NAME ":\n\t" \
|
||||
"pea %sp@(4)\n\t" \
|
||||
"jbsr " #INIT "\n\t" \
|
||||
"addq #4,%sp\n\t" \
|
||||
"rts");
|
Loading…
Reference in New Issue
Block a user