diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | configure.in | 7 | ||||
-rw-r--r-- | db/btree/bt_open.c | 22 | ||||
-rw-r--r-- | db/hash/hash.c | 14 | ||||
-rw-r--r-- | db/hash/hash.h | 22 | ||||
-rw-r--r-- | db/hash/ndbm.c | 21 | ||||
-rw-r--r-- | stdlib/strtol.c | 7 | ||||
-rw-r--r-- | sysdeps/posix/getcwd.c | 4 | ||||
-rw-r--r-- | sysdeps/unix/syscalls.list | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/configure | 4 | ||||
-rw-r--r-- | sysdeps/unix/sysv/syscalls.list | 1 |
11 files changed, 70 insertions, 35 deletions
diff --git a/Makefile b/Makefile index 4f1191de5b..260254a87b 100644 --- a/Makefile +++ b/Makefile @@ -42,7 +42,7 @@ configure: configure.in; $(autoconf-it) include Makeconfig ifndef avoid-generated -include $(objpfx)sysd-dirs +-include $(objpfx)sysd-dirs define \n diff --git a/configure.in b/configure.in index 891859c0c0..6ad4e5190a 100644 --- a/configure.in +++ b/configure.in @@ -419,8 +419,11 @@ for dir in $sysnames; do . $sysdep_dir/$dir/configure fi if test -z "$uname"; then - { test -r $sysdep_dir/$dir/uname.c || test -r $sysdep_dir/$dir/uname.S; } \ - && uname=$dir + if test -r $sysdep_dir/$dir/uname.c || + test -r $sysdep_dir/$dir/uname.S || + { test -r $sysdep_dir/$dir/syscalls.list && + grep '^uname[ ]' $sysdep_dir/$dir/syscalls.list >/dev/null; }; then + uname=$dir fi done diff --git a/db/btree/bt_open.c b/db/btree/bt_open.c index f052249777..503db85274 100644 --- a/db/btree/bt_open.c +++ b/db/btree/bt_open.c @@ -200,7 +200,7 @@ __bt_open(fname, flags, mode, openinfo, dflags) default: goto einval; } - + if ((t->bt_fd = open(fname, flags, mode)) < 0) goto err; @@ -388,18 +388,30 @@ tmp() { sigset_t set, oset; int fd; - char *envtmp; - char path[MAXPATHLEN]; + const char *envtmp; + char *path; + static const char fmt[] = "%s/bt.XXXXXX"; + size_t n; envtmp = getenv("TMPDIR"); - (void)snprintf(path, - sizeof(path), "%s/bt.XXXXXX", envtmp ? envtmp : "/tmp"); + if (!envtmp) + envtmp = "/tmp"; + n = strlen (envtmp) + sizeof fmt; +#ifdef __GNUC__ + path = __builtin_alloca(n); +#else + path = malloc(n); +#endif + (void)snprintf(path, n, fmt, envtmp ? envtmp : "/tmp"); (void)sigfillset(&set); (void)sigprocmask(SIG_BLOCK, &set, &oset); if ((fd = mkstemp(path)) != -1) (void)unlink(path); (void)sigprocmask(SIG_SETMASK, &oset, NULL); +#ifndef __GNUC__ + free(path); +#endif return(fd); } diff --git a/db/hash/hash.c b/db/hash/hash.c index 4b7b732a8f..0db7b32b8c 100644 --- a/db/hash/hash.c +++ b/db/hash/hash.c @@ -505,7 +505,7 @@ flush_meta(hashp) else if (wsize != sizeof(HASHHDR)) { errno = EFTYPE; - hashp->errno = errno; + hashp->errnum = errno; return (-1); } for (i = 0; i < NCACHED; i++) @@ -536,7 +536,7 @@ hash_get(dbp, key, data, flag) hashp = (HTAB *)dbp->internal; if (flag) { - hashp->errno = errno = EINVAL; + hashp->errnum = errno = EINVAL; return (ERROR); } return (hash_access(hashp, HASH_GET, (DBT *)key, data)); @@ -553,11 +553,11 @@ hash_put(dbp, key, data, flag) hashp = (HTAB *)dbp->internal; if (flag && flag != R_NOOVERWRITE) { - hashp->errno = errno = EINVAL; + hashp->errnum = errno = EINVAL; return (ERROR); } if ((hashp->flags & O_ACCMODE) == O_RDONLY) { - hashp->errno = errno = EPERM; + hashp->errnum = errno = EPERM; return (ERROR); } return (hash_access(hashp, flag == R_NOOVERWRITE ? @@ -574,11 +574,11 @@ hash_delete(dbp, key, flag) hashp = (HTAB *)dbp->internal; if (flag && flag != R_CURSOR) { - hashp->errno = errno = EINVAL; + hashp->errnum = errno = EINVAL; return (ERROR); } if ((hashp->flags & O_ACCMODE) == O_RDONLY) { - hashp->errno = errno = EPERM; + hashp->errnum = errno = EPERM; return (ERROR); } return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL)); @@ -729,7 +729,7 @@ hash_seq(dbp, key, data, flag) hashp = (HTAB *)dbp->internal; if (flag && flag != R_FIRST && flag != R_NEXT) { - hashp->errno = errno = EINVAL; + hashp->errnum = errno = EINVAL; return (ERROR); } #ifdef HASH_STATISTICS diff --git a/db/hash/hash.h b/db/hash/hash.h index 913e82b400..1c599c112c 100644 --- a/db/hash/hash.h +++ b/db/hash/hash.h @@ -71,28 +71,28 @@ typedef struct hashhdr { /* Disk resident portion */ int dsize; /* Directory Size */ int ssize; /* Segment Size */ int sshift; /* Segment shift */ - int ovfl_point; /* Where overflow pages are being + int ovfl_point; /* Where overflow pages are being * allocated */ int last_freed; /* Last overflow page freed */ int max_bucket; /* ID of Maximum bucket in use */ int high_mask; /* Mask to modulo into entire table */ - int low_mask; /* Mask to modulo into lower half of + int low_mask; /* Mask to modulo into lower half of * table */ int ffactor; /* Fill factor */ int nkeys; /* Number of keys in hash table */ int hdrpages; /* Size of table header */ int h_charkey; /* value of hash(CHARKEY) */ -#define NCACHED 32 /* number of bit maps and spare +#define NCACHED 32 /* number of bit maps and spare * points */ int spares[NCACHED];/* spare pages for overflow */ - u_int16_t bitmaps[NCACHED]; /* address of overflow page + u_int16_t bitmaps[NCACHED]; /* address of overflow page * bitmaps */ } HASHHDR; typedef struct htab { /* Memory resident data structure */ HASHHDR hdr; /* Header */ int nsegs; /* Number of allocated segments */ - int exsegs; /* Number of extra allocated + int exsegs; /* Number of extra allocated * segments */ u_int32_t /* Hash function */ (*hash)__P((const void *, size_t)); @@ -103,16 +103,16 @@ typedef struct htab { /* Memory resident data structure */ BUFHEAD *cpage; /* Current page */ int cbucket; /* Current bucket */ int cndx; /* Index of next item on cpage */ - int errno; /* Error Number -- for DBM + int errnum; /* Error Number -- for DBM * compatability */ - int new_file; /* Indicates if fd is backing store + int new_file; /* Indicates if fd is backing store * or no */ - int save_file; /* Indicates whether we need to flush + int save_file; /* Indicates whether we need to flush * file at * exit */ u_int32_t *mapp[NCACHED]; /* Pointers to page maps */ int nmaps; /* Initial number of bitmaps */ - int nbufs; /* Number of buffers left to + int nbufs; /* Number of buffers left to * allocate */ BUFHEAD bufhead; /* Header of buffer lru list */ SEGMENT *dir; /* Hash Bucket directory */ @@ -194,7 +194,7 @@ typedef struct htab { /* Memory resident data structure */ * so it starts on this page and continues on the next. * The format of the page is: * KEY_OFF PARTIAL_KEY OVFL_PAGENO OVFLPAGE - * + * * KEY_OFF -- offset of the beginning of the key * PARTIAL_KEY -- 1 * OVFL_PAGENO - page number of the next overflow page @@ -229,7 +229,7 @@ typedef struct htab { /* Memory resident data structure */ * OVFL_PAGENO - page number of the next overflow page * OVFLPAGE -- 0 * - * FULL_KEY_DATA + * FULL_KEY_DATA * This must be the first key/data pair on the page. * There are two cases: * diff --git a/db/hash/ndbm.c b/db/hash/ndbm.c index 2cbbe91368..83aa766c38 100644 --- a/db/hash/ndbm.c +++ b/db/hash/ndbm.c @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)ndbm.c 8.4 (Berkeley) 7/21/94"; #include <stdio.h> #include <string.h> +#include <stdlib.h> #include <ndbm.h> #include "hash.h" @@ -61,8 +62,16 @@ dbm_open(file, flags, mode) const char *file; int flags, mode; { + DBM *db; HASHINFO info; - char path[MAXPATHLEN]; + const size_t len = strlen(file) + sizeof (DBM_SUFFIX); +#ifdef __GNUC__ + char path[len]; +#else + char *path = malloc(len); + if (path == NULL) + return NULL; +#endif info.bsize = 4096; info.ffactor = 40; @@ -72,7 +81,11 @@ dbm_open(file, flags, mode) info.lorder = 0; (void)strcpy(path, file); (void)strcat(path, DBM_SUFFIX); - return ((DBM *)__hash_open(path, flags, mode, &info, 0)); + db = (DBM *)__hash_open(path, flags, mode, &info, 0); +#ifndef __GNUC__ + free(path); +#endif + return db; } extern void @@ -180,7 +193,7 @@ dbm_error(db) HTAB *hp; hp = (HTAB *)db->internal; - return (hp->errno); + return (hp->errnum); } extern int @@ -190,7 +203,7 @@ dbm_clearerr(db) HTAB *hp; hp = (HTAB *)db->internal; - hp->errno = 0; + hp->errnum = 0; return (0); } diff --git a/stdlib/strtol.c b/stdlib/strtol.c index b06063c2c5..289aa04383 100644 --- a/stdlib/strtol.c +++ b/stdlib/strtol.c @@ -1,4 +1,4 @@ -/* 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. @@ -295,5 +295,8 @@ strtol (nptr, endptr, base) } #ifdef weak_symbol -weak_symbol (strtol) +/* We need this indirection when `strtol' is defined as a macro + for one of the other names. */ +#define weak1(x) weak_symbol(x) +weak1 (strtol) #endif diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c index 0724ef59a2..4bebece975 100644 --- a/sysdeps/posix/getcwd.c +++ b/sysdeps/posix/getcwd.c @@ -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 @@ -167,7 +167,7 @@ extern char *alloca (); #endif #endif -#ifndef STDC_HEADERS +#if !defined (STDC_HEADERS) && !defined (__GNU_LIBRARY__) #undef size_t #define size_t unsigned int #endif diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list index 7fba017fc0..add4a1f0de 100644 --- a/sysdeps/unix/syscalls.list +++ b/sysdeps/unix/syscalls.list @@ -49,6 +49,7 @@ sys_fstat fxstat fstat 2 __syscall_fstat sys_mknod xmknod mknod 3 __syscall_mknod sys_stat xstat stat 2 __syscall_stat umask - umask 1 __umask umask +uname - uname 1 uname unlink - unlink 1 __unlink unlink write - write 3 __write write writev - writev 3 writev diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index 63693e088e..62d8538003 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -1,3 +1,7 @@ # On Linux, the default is to use libio instead of stdio. test $stdio = default && stdio=libio + +# Don't bother trying to generate any glue code to be compatible with the +# existing system library, because we are the only system library. +inhibit_glue=yes diff --git a/sysdeps/unix/sysv/syscalls.list b/sysdeps/unix/sysv/syscalls.list index ee40474d28..b7fa490c95 100644 --- a/sysdeps/unix/sysv/syscalls.list +++ b/sysdeps/unix/sysv/syscalls.list @@ -11,5 +11,4 @@ stime - stime 1 stime time - time 1 time times - times 1 __times times ulimit - ulimit 2 ulimit -uname - uname 1 uname utime - utime 2 utime |