include Makeconfig
ifndef avoid-generated
-include $(objpfx)sysd-dirs
+-include $(objpfx)sysd-dirs
define \n
. $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
default:
goto einval;
}
-
+
if ((t->bt_fd = open(fname, flags, mode)) < 0)
goto err;
{
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);
}
else
if (wsize != sizeof(HASHHDR)) {
errno = EFTYPE;
- hashp->errno = errno;
+ hashp->errnum = errno;
return (-1);
}
for (i = 0; i < NCACHED; i++)
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));
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 ?
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));
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
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));
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 */
* 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
* 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:
*
#include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include <ndbm.h>
#include "hash.h"
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;
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
HTAB *hp;
hp = (HTAB *)db->internal;
- return (hp->errno);
+ return (hp->errnum);
}
extern int
HTAB *hp;
hp = (HTAB *)db->internal;
- hp->errno = 0;
+ hp->errnum = 0;
return (0);
}
-/* 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.
}
#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
-/* 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
#endif
#endif
-#ifndef STDC_HEADERS
+#if !defined (STDC_HEADERS) && !defined (__GNU_LIBRARY__)
#undef size_t
#define size_t unsigned int
#endif
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
# 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
time - time 1 time
times - times 1 __times times
ulimit - ulimit 2 ulimit
-uname - uname 1 uname
utime - utime 2 utime