+1998-08-21 17:21 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/unix/sysv/linux/glob64.c: Define __stat using __xstat64.
+
+1998-08-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * Makefile (elf/ldso_install): Put back. The problem still persists.
+ * elf/Makefile (ldso_install): Likewise.
+
+1998-08-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * db2/db/db.c (db_open) [_LIBC]: Rename to __nss_db_open and
+ create weak alias.
+ * include/db.h: Declare __nss_db_open.
+ * db2/Versions: Export it.
+
+ * db2/makedb.c: Convert to use db2 API.
+ * nss/nss_db/db-XXX.c: Likewise.
+ * nss/nss_db/db-netgrp.c: Likewise.
+ * nss/nss_db/db-alias.c: Likewise.
+ (_nss_db_getaliasent_r): Allow retrying with a larger buffer.
+
+1998-08-19 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Remove
+ sys_setresuid, already built automatically (or not).
+ * sysdeps/unix/sysv/linux/syscalls.list: Define __setresuid
+ instead of __syscall_setresuid and add back setresuid.
+ * sysdeps/unix/sysv/linux/seteuid.c: Use __setresuid instead of
+ __syscall_setresuid.
+
+1998-08-21 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * sysdeps/unix/sysv/linux/sys/mount.h: Fix typo.
+
1998-08-20 Ulrich Drepper <drepper@cygnus.com>
* elf/Makefile (sh-ldd-rewrite): Remove expression to remove
* libio/iolibio.h (_IO_pos_BAD): Define of type _IO_fpos64_t.
- * libio/oldfileops.c (FILEBUF_LITERAL): Also initialize new _offset
+ * libio/libioP.c (FILEBUF_LITERAL): Also initialize new _offset
element.
1998-08-21 Roland McGrath <roland@baalperazim.frob.com>
3.13. When using the db-2 library which comes with glibc is used in
the Perl db modules the testsuite is not passed. This did not
happen with db-1, gdbm, or ndbm.
+3.14. The pow() inline function I get when including <math.h> is broken.
+ I get segmentation faults when I run the program.
4. Miscellaneous
the testsuite so that if you use DB_File v1.60 or later you should not have
any more problems with db-2.
+
+3.14. The pow() inline function I get when including <math.h> is broken.
+ I get segmentation faults when I run the program.
+
+{UD} Nope, the implementation is correct. The problem is with egcs version
+prior to 1.1. I.e., egcs 1.0 to 1.0.3 are all broken (at least on Intel).
+If you have to use this compiler you must define __NO_MATH_INLINES before
+including <math.h> to prevent the inline functions from being used. egcs 1.1
+fixes the problem. I don't know about gcc 2.8 and 2.8.1.
+
\f
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
the testsuite so that if you use DB_File v1.60 or later you should not have
any more problems with db-2.
+?? The pow() inline function I get when including <math.h> is broken.
+ I get segmentation faults when I run the program.
+
+{UD} Nope, the implementation is correct. The problem is with egcs version
+prior to 1.1. I.e., egcs 1.0 to 1.0.3 are all broken (at least on Intel).
+If you have to use this compiler you must define __NO_MATH_INLINES before
+including <math.h> to prevent the inline functions from being used. egcs 1.1
+fixes the problem. I don't know about gcc 2.8 and 2.8.1.
+
? Miscellaneous
# Install from subdirectories too.
install: subdir_install
+# Make sure that the dynamic linker is installed before libc.
+$(inst_slibdir)/libc-$(version).so: elf/ldso_install
+
+.PHONY: elf/ldso_install
+elf/ldso_install:
+ $(MAKE) -C $(@D) $(@F)
+
# Create links for shared libraries using the `ldconfig' program is possible.
# Ignore the error if we cannot update /etc/ld.so.cache.
ifeq (no,$(cross-compiling))
__memp_dump_region;
__txn_init_print;
+ # Functions used by other libraries.
+ __nss_db_open;
+
# Constants
db_rw_conflicts; db_riw_conflicts;
} \
}
+#ifdef _LIBC
+#define db_open(fname, type, flags, mode, dbenv, dbinfo, dbpp) \
+ __nss_db_open(fname, type, flags, mode, dbenv, dbinfo, dbpp)
+#endif
+
/*
* db_open --
* Main library interface to the DB access methods.
return (ret);
}
+#ifdef _LIBC
+# undef db_open
+weak_alias (__nss_db_open, db_open)
+#endif
+
/*
* db_close --
* Close a DB tree.
#include <argp.h>
#include <ctype.h>
-#include <db_185.h>
+#include <db.h>
#include <errno.h>
#include <error.h>
#include <fcntl.h>
/* Special handling if we are asked to print the database. */
if (do_undo)
{
- db_file = dbopen (input_name, O_RDONLY, 0666, DB_BTREE, NULL);
- if (db_file == NULL)
+ status = db_open (input_name, DB_BTREE, DB_RDONLY, 0666, NULL, NULL,
+ &db_file);
+ if (status != 0)
error (EXIT_FAILURE, 0, gettext ("cannot open database file `%s': %s"),
input_name,
- errno == EINVAL ? gettext ("incorrectly formatted file")
- : strerror (errno));
+ (status == EINVAL ? gettext ("incorrectly formatted file")
+ : strerror (status)));
status = print_database (db_file);
- db_file->close (db_file);
+ db_file->close (db_file, 0);
return status;
}
/* Open output file. This must not be standard output so we don't
handle "-" and "/dev/stdout" special. */
- db_file = dbopen (output_name, O_CREAT | O_RDWR | O_TRUNC, mode,
- DB_BTREE, NULL);
- if (db_file == NULL)
- error (EXIT_FAILURE, errno, gettext ("cannot open output file `%s'"),
+ status = db_open (output_name, DB_BTREE, DB_CREATE | DB_TRUNCATE, mode,
+ NULL, NULL, &db_file);
+ if (status != 0)
+ error (EXIT_FAILURE, status, gettext ("cannot open output file `%s'"),
output_name);
/* Start the real work. */
/* Close files. */
if (input_file != stdin)
fclose (input_file);
- db_file->close (db_file);
+ db_file->close (db_file, 0);
return status;
}
continue;
key.size = cp - (char *) key.data;
+ key.flags = 0;
while (isspace (*cp))
++cp;
val.data = cp;
val.size = (&line[n] - cp) + 1;
+ val.flags = 0;
/* Store the value. */
- status = output->put (output, &key, &val, R_NOOVERWRITE);
+ status = output->put (output, NULL, &key, &val, DB_NOOVERWRITE);
if (status != 0)
{
- if (status == 1)
+ if (status == DB_KEYEXIST)
{
if (!be_quiet)
error_at_line (0, 0, inname, linenr,
continue;
}
else
- error (0, errno, gettext ("while writing database file"));
+ error (0, status, gettext ("while writing database file"));
status = EXIT_FAILURE;
{
DBT key;
DBT val;
- int no_more;
+ DBC *cursor;
+ int status;
+
+ status = db->cursor (db, NULL, &cursor);
+ if (status != 0)
+ {
+ error (0, status, gettext ("while reading database"));
+ return EXIT_FAILURE;
+ }
- no_more = db->seq (db, &key, &val, R_FIRST);
- while (!no_more)
+ key.flags = 0;
+ val.flags = 0;
+ status = cursor->c_get (cursor, &key, &val, DB_FIRST);
+ while (status == 0)
{
printf ("%.*s %s\n", (int) key.size, (char *) key.data,
(char *) val.data);
- no_more = db->seq (db, &key, &val, R_NEXT);
+ status = cursor->c_get (cursor, &key, &val, DB_NEXT);
}
- if (no_more == -1)
+ if (status != DB_NOTFOUND)
{
- error (0, errno, gettext ("while reading database"));
+ error (0, status, gettext ("while reading database"));
return EXIT_FAILURE;
}
$(inst_slibdir)/$(rtld-version-installed-name)
$(make-shlib-link)
+# Special target called by parent to install just the dynamic linker.
+.PHONY: ldso_install
+ldso_install: $(inst_slibdir)/$(rtld-installed-name)
+
common-ldd-rewrite = -e 's%@RTLD@%$(slibdir)/$(rtld-installed-name)%g' \
-e 's%@VERSION@%$(version)%g'
#include <db2/db.h>
+
+/* Internal interface for NSS. */
+int __nss_db_open __P((const char *,
+ DBTYPE, u_int32_t, int, DB_ENV *, DB_INFO *, DB **));
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <db_185.h>
+#include <db.h>
#include <fcntl.h>
#include <bits/libc-lock.h>
#include "nsswitch.h"
internal_setent (int stayopen)
{
enum nss_status status = NSS_STATUS_SUCCESS;
+ int err;
if (db == NULL)
{
- db = __dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
+ err = __nss_db_open (DBFILE, DB_BTREE, DB_RDONLY, 0, NULL, NULL, &db);
- if (db == NULL)
- status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
+ if (err != 0)
+ {
+ __set_errno (err);
+ status = err == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
+ }
else
{
/* We have to make sure the file is `closed on exec'. */
+ int fd;
int result, flags;
- result = flags = fcntl ((*db->fd) (db), F_GETFD, 0);
+ err = db->fd (db, &fd);
+ if (err != 0)
+ {
+ __set_errno (err);
+ result = -1;
+ }
+ else
+ result = flags = fcntl (fd, F_GETFD, 0);
if (result >= 0)
{
flags |= FD_CLOEXEC;
- result = fcntl ((*db->fd) (db), F_SETFD, flags);
+ result = fcntl (fd, F_SETFD, flags);
}
if (result < 0)
{
/* Something went wrong. Close the stream and return a
failure. */
- (*db->close) (db);
+ db->close (db, 0);
db = NULL;
status = NSS_STATUS_UNAVAIL;
}
{
if (db != NULL)
{
- (*db->close) (db);
+ db->close (db, 0);
db = NULL;
}
}
\f
/* Do a database lookup for KEY. */
static enum nss_status
-lookup (const DBT *key, struct STRUCTURE *result,
+lookup (DBT *key, struct STRUCTURE *result,
void *buffer, size_t buflen, int *errnop H_ERRNO_PROTO)
{
char *p;
}
/* Succeed iff it matches a value that parses correctly. */
- err = (*db->get) (db, key, &value, 0);
- if (err < 0)
- {
- *errnop = errno;
- H_ERRNO_SET (NETDB_INTERNAL);
- status = NSS_STATUS_UNAVAIL;
- }
- else if (err != 0)
+ value.flags = 0;
+ err = db->get (db, NULL, key, &value, 0);
+ if (err != 0)
{
- H_ERRNO_SET (HOST_NOT_FOUND);
- status = NSS_STATUS_NOTFOUND;
+ if (err == DB_NOTFOUND)
+ {
+ H_ERRNO_SET (HOST_NOT_FOUND);
+ status = NSS_STATUS_NOTFOUND;
+ }
+ else
+ {
+ *errnop = err;
+ H_ERRNO_SET (NETDB_INTERNAL);
+ status = NSS_STATUS_UNAVAIL;
+ }
}
else if (buflen < value.size)
{
const size_t size = (keysize) + 1; \
key.data = __alloca (size); \
key.size = KEYPRINTF keypattern; \
+ key.flags = 0; \
__libc_lock_lock (lock); \
status = lookup (&key, result, buffer, buflen, errnop H_ERRNO_ARG); \
__libc_lock_unlock (lock); \
do
{
key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
+ key.flags = 0;
status = lookup (&key, result, buffer, buflen, errnop H_ERRNO_ARG);
if (status == NSS_STATUS_TRYAGAIN
#ifdef NEED_H_ERRNO
#include <aliases.h>
#include <alloca.h>
#include <ctype.h>
-#include <db_185.h>
+#include <db.h>
#include <errno.h>
#include <fcntl.h>
#include <bits/libc-lock.h>
internal_setent (int stayopen)
{
enum nss_status status = NSS_STATUS_SUCCESS;
+ int err;
if (db == NULL)
{
- db = __dbopen (_PATH_VARDB "aliases.db", O_RDONLY, 0, DB_BTREE, NULL);
+ err = __nss_db_open (_PATH_VARDB "aliases.db", DB_BTREE, DB_RDONLY, 0,
+ NULL, NULL, &db);
- if (db == NULL)
- status = NSS_STATUS_UNAVAIL;
+ if (err != 0)
+ {
+ __set_errno (err);
+ status = NSS_STATUS_UNAVAIL;
+ }
else
{
/* We have to make sure the file is `closed on exec'. */
+ int fd;
int result, flags;
- result = flags = fcntl ((*db->fd) (db), F_GETFD, 0);
+ err = db->fd (db, &fd);
+ if (err != 0)
+ {
+ __set_errno (err);
+ result = -1;
+ }
+ else
+ result = flags = fcntl (fd, F_GETFD, 0);
if (result >= 0)
{
flags |= FD_CLOEXEC;
- result = fcntl ((*db->fd) (db), F_SETFD, flags);
+ result = fcntl (fd, F_SETFD, flags);
}
if (result < 0)
{
/* Something went wrong. Close the stream and return a
failure. */
- (*db->close) (db);
+ db->close (db, 0);
db = NULL;
status = NSS_STATUS_UNAVAIL;
}
{
if (db != NULL)
{
- (*db->close) (db);
+ db->close (db, 0);
db = NULL;
}
}
:include: statements so we simply have to parse the list and store
the result. */
static enum nss_status
-lookup (const DBT *key, struct aliasent *result, char *buffer,
+lookup (DBT *key, struct aliasent *result, char *buffer,
size_t buflen, int *errnop)
{
enum nss_status status;
/* Open the database. */
status = internal_setent (keep_db);
if (status != NSS_STATUS_SUCCESS)
- return status;
+ {
+ *errnop = errno;
+ return status;
+ }
- if ((*db->get) (db, key, &value, 0) == 0)
+ value.flags = 0;
+ if (db->get (db, NULL, key, &value, 0) == 0)
{
const char *src = value.data;
__libc_lock_lock (lock);
key.size = snprintf (key.data = buf, sizeof buf, "0%u", entidx++);
+ key.flags = 0;
status = lookup (&key, result, buffer, buflen, errnop);
+ if (status == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
+ /* Give the user a chance to get the same entry with a larger buffer. */
+ --entidx;
__libc_lock_unlock (lock);
return status;
key.data = __alloca (key.size);
((char *) key.data)[0] = '.';
memcpy (&((char *) key.data)[1], name, key.size - 1);
+ key.flags = 0;
__libc_lock_lock (lock);
status = lookup (&key, result, buffer, buflen, errnop);
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <db_185.h>
+#include <db.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
_nss_db_setnetgrent (const char *group)
{
enum nss_status status = NSS_STATUS_SUCCESS;
+ int err;
__libc_lock_lock (lock);
/* Make sure the data base file is open. */
if (db == NULL)
{
- db = __dbopen (DBFILE, O_RDONLY, 0, DB_BTREE, NULL);
+ err = __nss_db_open (DBFILE, DB_BTREE, O_RDONLY, 0, NULL, NULL, &db);
- if (db == NULL)
- status = errno == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
+ if (err != 0)
+ {
+ __set_errno (err);
+ status = err == EAGAIN ? NSS_STATUS_TRYAGAIN : NSS_STATUS_UNAVAIL;
+ }
else
{
/* We have to make sure the file is `closed on exec'. */
+ int fd;
int result, flags;
- result = flags = fcntl ((*db->fd) (db), F_GETFD, 0);
+ err = db->fd (db, &fd);
+ if (err != 0)
+ {
+ __set_errno (err);
+ result = -1;
+ }
+ else
+ result = flags = fcntl (fd, F_GETFD, 0);
if (result >= 0)
{
flags |= FD_CLOEXEC;
- result = fcntl ((*db->fd) (db), F_SETFD, flags);
+ result = fcntl (fd, F_SETFD, flags);
}
if (result < 0)
{
/* Something went wrong. Close the stream and return a
failure. */
- (*db->close) (db);
+ db->close (db, 0);
db = NULL;
status = NSS_STATUS_UNAVAIL;
}
if (status == NSS_STATUS_SUCCESS)
{
- DBT key = { data: (void *) group, size: strlen (group) };
+ DBT key = { data: (void *) group, size: strlen (group), flags: 0 };
DBT value;
- if ((*db->get) (db, &key, &value, 0) != 0)
+ value.flags = 0;
+ if (db->get (db, NULL, &key, &value, 0) != 0)
status = NSS_STATUS_NOTFOUND;
else
cursor = entry = value.data;
if (db != NULL)
{
- (*db->close) (db);
+ db->close (db, 0);
db = NULL;
}
endif
ifeq ($(subdir),misc)
-sysdep_routines += sysctl clone llseek getresuid getresgid sys_setresuid \
- umount umount2
+sysdep_routines += sysctl clone llseek getresuid getresgid umount umount2
sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
sys/io.h sys/klog.h sys/kdaemon.h \
#undef stat
#define stat stat64
#undef __stat
-#define __stat(file, buf) stat64 (file, buf)
+#define __stat(file, buf) __xstat64 (_STAT_VER, file, buf)
#define NO_GLOB_PATTERN_P 1
#ifdef __NR_setresuid
-extern int __syscall_setresuid (uid_t ruid, uid_t euid, uid_t suid);
+extern int __setresuid (uid_t ruid, uid_t euid, uid_t suid);
int
seteuid (uid_t uid)
}
/* First try the syscall. */
- result = __syscall_setresuid (-1, uid, -1);
+ result = __setresuid (-1, uid, -1);
if (result == -1 && errno == ENOSYS)
/* No system call available. Use emulation. This may not work
since `setreuid' also sets the saved user ID when UID is not
/* Unmount a filesystem. */
extern int umount __P ((__const char *__special_file));
-/* Unmount a filesystem. Forst unmounting if FALGS is set to MNT_FORCE. */
+/* Unmount a filesystem. Force unmounting if FLAGS is set to MNT_FORCE. */
extern int umount2 __P ((__const char *__special_file, int __flags));
__END_DECLS
setfsgid EXTRA setfsgid 1 setfsgid
setfsuid EXTRA setfsuid 1 setfsuid
setpgid - setpgid 2 __setpgid setpgid
+setresuid EXTRA setresuid 3 __setresuid setresuid
setresgid EXTRA setresgid 3 setresgid
sigaltstack - sigaltstack 2 __sigaltstack sigaltstack
sys_fstat fxstat fstat 2 __syscall_fstat
sys_lstat lxstat lstat 2 __syscall_lstat
sys_mknod xmknod mknod 3 __syscall_mknod
sys_readv readv readv 3 __syscall_readv
-sys_setresuid EXTRA setresuid 3 __syscall_setresuid
sys_stat xstat stat 2 __syscall_stat
sys_writev writev writev 3 __syscall_writev
sysinfo EXTRA sysinfo 1 sysinfo