1997-08-27 20:26:10 +00:00
|
|
|
/*-
|
|
|
|
* See the file LICENSE for redistribution information.
|
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Copyright (c) 1996, 1997, 1998
|
1997-08-27 20:26:10 +00:00
|
|
|
* Sleepycat Software. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#ifndef lint
|
1999-06-13 13:36:34 +00:00
|
|
|
static const char sccsid[] = "@(#)db_region.c 10.53 (Sleepycat) 11/10/98";
|
1997-08-27 20:26:10 +00:00
|
|
|
#endif /* not lint */
|
|
|
|
|
|
|
|
#ifndef NO_SYSTEM_INCLUDES
|
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "db_int.h"
|
|
|
|
#include "common_ext.h"
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
static int __db_growregion __P((REGINFO *, size_t));
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* __db_rattach --
|
|
|
|
* Optionally create and attach to a shared memory region.
|
1997-08-27 20:26:10 +00:00
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* PUBLIC: int __db_rattach __P((REGINFO *));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
int
|
1998-06-09 15:16:55 +00:00
|
|
|
__db_rattach(infop)
|
|
|
|
REGINFO *infop;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1998-06-09 15:16:55 +00:00
|
|
|
RLAYOUT *rlp, rl;
|
|
|
|
size_t grow_region, size;
|
|
|
|
ssize_t nr, nw;
|
|
|
|
u_int32_t flags, mbytes, bytes;
|
|
|
|
u_int8_t *p;
|
|
|
|
int malloc_possible, ret, retry_cnt;
|
|
|
|
|
|
|
|
grow_region = 0;
|
|
|
|
malloc_possible = 1;
|
|
|
|
ret = retry_cnt = 0;
|
|
|
|
|
|
|
|
/* Round off the requested size to the next page boundary. */
|
1999-06-13 13:36:34 +00:00
|
|
|
DB_ROUNDOFF(infop->size, DB_VMPAGESIZE);
|
1998-06-09 15:16:55 +00:00
|
|
|
|
|
|
|
/* Some architectures have hard limits on the maximum region size. */
|
|
|
|
#ifdef DB_REGIONSIZE_MAX
|
|
|
|
if (infop->size > DB_REGIONSIZE_MAX) {
|
|
|
|
__db_err(infop->dbenv, "__db_rattach: cache size too large");
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
#endif
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Intialize the return information in the REGINFO structure. */
|
|
|
|
loop: infop->addr = NULL;
|
|
|
|
infop->fd = -1;
|
|
|
|
infop->segid = INVALID_SEGID;
|
|
|
|
if (infop->name != NULL) {
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_freestr(infop->name);
|
1998-06-09 15:16:55 +00:00
|
|
|
infop->name = NULL;
|
|
|
|
}
|
|
|
|
F_CLR(infop, REGION_CANGROW | REGION_CREATED);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
#ifndef HAVE_SPINLOCKS
|
1997-08-27 20:26:10 +00:00
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* XXX
|
|
|
|
* Lacking spinlocks, we must have a file descriptor for fcntl(2)
|
|
|
|
* locking, which implies using mmap(2) to map in a regular file.
|
|
|
|
* (Theoretically, we could probably get a file descriptor to lock
|
|
|
|
* other types of shared regions, but I don't see any reason to
|
|
|
|
* bother.)
|
1999-06-13 13:36:34 +00:00
|
|
|
*
|
|
|
|
* Since we may be using shared memory regions, e.g., shmget(2),
|
|
|
|
* and not mmap of regular files, the backing file may be only a
|
|
|
|
* few tens of bytes in length. So, this depends on the ability
|
|
|
|
* to fcntl lock file offsets much larger than the physical file.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1998-06-09 15:16:55 +00:00
|
|
|
malloc_possible = 0;
|
|
|
|
#endif
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
#ifdef __hppa
|
1997-08-27 20:26:10 +00:00
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* XXX
|
|
|
|
* HP-UX won't permit mutexes to live in anything but shared memory.
|
|
|
|
* Instantiate a shared region file on that architecture, regardless.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1998-06-09 15:16:55 +00:00
|
|
|
malloc_possible = 0;
|
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
* If a region is truly private, malloc the memory. That's faster
|
|
|
|
* than either anonymous memory or a shared file.
|
|
|
|
*/
|
|
|
|
if (malloc_possible && F_ISSET(infop, REGION_PRIVATE)) {
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_malloc(infop->size, NULL, &infop->addr)) != 0)
|
|
|
|
return (ret);
|
1998-06-09 15:16:55 +00:00
|
|
|
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* It's sometimes significantly faster to page-fault in all of
|
|
|
|
* the region's pages before we run the application, as we see
|
|
|
|
* nasty side-effects when we page-fault while holding various
|
|
|
|
* locks, i.e., the lock takes a long time to acquire because
|
|
|
|
* of the underlying page fault, and the other threads convoy
|
|
|
|
* behind the lock holder.
|
1998-06-09 15:16:55 +00:00
|
|
|
*/
|
|
|
|
if (DB_GLOBAL(db_region_init))
|
|
|
|
for (p = infop->addr;
|
|
|
|
p < (u_int8_t *)infop->addr + infop->size;
|
|
|
|
p += DB_VMPAGESIZE)
|
|
|
|
p[0] = '\0';
|
|
|
|
|
|
|
|
F_SET(infop, REGION_CREATED | REGION_MALLOC);
|
|
|
|
goto region_init;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* Get the name of the region (creating the file if a temporary file
|
|
|
|
* is being used). The dbenv contains the current DB environment,
|
|
|
|
* including naming information. The path argument may be a file or
|
|
|
|
* a directory. If path is a directory, it must exist and file is the
|
|
|
|
* file name to be created inside the directory. If path is a file,
|
|
|
|
* then file must be NULL.
|
|
|
|
*/
|
|
|
|
if ((ret = __db_appname(infop->dbenv, infop->appname, infop->path,
|
|
|
|
infop->file, infop->dbflags, &infop->fd, &infop->name)) != 0)
|
|
|
|
return (ret);
|
|
|
|
if (infop->fd != -1)
|
|
|
|
F_SET(infop, REGION_CREATED);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* Try to create the file, if we have authority. We have to make sure
|
|
|
|
* that multiple threads/processes attempting to simultaneously create
|
|
|
|
* the region are properly ordered, so we open it using DB_CREATE and
|
|
|
|
* DB_EXCL, so two attempts to create the region will return failure in
|
|
|
|
* one.
|
|
|
|
*/
|
|
|
|
if (infop->fd == -1 && infop->dbflags & DB_CREATE) {
|
|
|
|
flags = infop->dbflags;
|
|
|
|
LF_SET(DB_EXCL);
|
|
|
|
if ((ret = __db_open(infop->name,
|
|
|
|
flags, flags, infop->mode, &infop->fd)) == 0)
|
|
|
|
F_SET(infop, REGION_CREATED);
|
|
|
|
else
|
|
|
|
if (ret != EEXIST)
|
|
|
|
goto errmsg;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* If we couldn't create the file, try and open it. */
|
|
|
|
if (infop->fd == -1) {
|
|
|
|
flags = infop->dbflags;
|
|
|
|
LF_CLR(DB_CREATE | DB_EXCL);
|
|
|
|
if ((ret = __db_open(infop->name,
|
|
|
|
flags, flags, infop->mode, &infop->fd)) != 0)
|
|
|
|
goto errmsg;
|
|
|
|
}
|
Update.
1997-11-11 21:30 Ulrich Drepper <drepper@cygnus.com>
* include/sys/stat.h: Define stat, fstat, lstat and *64 variants
as macros so the the library compiles correctly even without
optimization.
* io/fstat.c: Undef fstat.
* io/fstat64.c: Undef fstat64
* io/lstat.c: Undef lstat.
* io/lstat64.c: Undef lstat64
* io/stat.c: Undef stat.
* io/stat64.c: Undef stat64
* io/fts.c: Include <include/sys/stat.h> to get macro definitions.
* io/ftw.c: Likewise.
* io/getdirname.c: Likewise.
* Makefile (install): Run test-installation.pl if possible.
* db2/Makefile: Update from db-2.3.12.
* db2/db.h: Likewise.
* db2/db_int.h: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/common/db_appinit.c: Likewise.
* db2/common/db_apprec.c: Likewise.
* db2/common/db_byteorder.c: Likewise.
* db2/common/db_region.c: Likewise.
* db2/db/db.c: Likewise
* db2/db/db.src: Likewise
* db2/db/db_auto.c: Likewise
* db2/db/db_dispatch.c: Likewise
* db2/db/db_dup.c: Likewise
* db2/db/db_overflow.c: Likewise
* db2/db/db_pr.c: Likewise
* db2/db/db_rec.c: Likewise
* db2/db/db_ret.c: Likewise
* db2/db/db_thread.c: Likewise
* db2/db185/db185.c: Likewise.
* db2/hash/hash.c: Likewise.
* db2/hash/hash.src: Likewise.
* db2/hash/hash_auto.c: Likewise.
* db2/hash/hash_dup.c: Likewise.
* db2/hash/hash_page.c: Likewise.
* db2/hash/hash_rec.c: Likewise.
* db2/include/btree_auto.h: Likewise.
* db2/include/btree_ext.h: Likewise.
* db2/include/clib_ext.h: Likewise.
* db2/include/common_ext.h: Likewise.
* db2/include/db.h.src: Likewise.
* db2/include/db_am.h: Likewise.
* db2/include/db_auto.h: Likewise.
* db2/include/db_cxx.h: Likewise.
* db2/include/db_ext.h: Likewise.
* db2/include/db_int.h.src: Likewise.
* db2/include/hash.h: Likewise.
* db2/include/hash_auto.h: Likewise.
* db2/include/hash_ext.h: Likewise.
* db2/include/lock.h: Likewise.
* db2/include/lock_ext.h: Likewise.
* db2/include/log.h: Likewise.
* db2/include/log_ext.h: Likewise.
* db2/include/mp.h: Likewise.
* db2/include/mp_ext.h: Likewise.
* db2/include/mutex_ext.h: Likewise.
* db2/include/os_ext.h: Likewise.
* db2/include/os_func.h: Likewise.
* db2/include/txn.h: Likewise.
* db2/include/txn_ext.h: Likewise.
* db2/lock/lock.c: Likewise.
* db2/lock/lock_deadlock.c: Likewise.
* db2/log/log.c: Likewise.
* db2/log/log_archive.c: Likewise.
* db2/log/log_auto.c: Likewise.
* db2/log/log_findckp.c: Likewise.
* db2/log/log_get.c: Likewise.
* db2/log/log_put.c: Likewise.
* db2/log/log_rec.c: Likewise.
* db2/log/log_register.c: Likewise.
* db2/mp/mp_bh.c: Likewise.
* db2/mp/mp_fget.c: Likewise.
* db2/mp/mp_fopen.c: Likewise.
* db2/mp/mp_fput.c: Likewise.
* db2/mp/mp_fset.c: Likewise.
* db2/mp/mp_open.c: Likewise.
* db2/mp/mp_pr.c: Likewise.
* db2/mp/mp_region.c: Likewise.
* db2/mp/mp_sync.c: Likewise.
* db2/mutex/mutex.c: Likewise.
* db2/os/os_abs.c: Likewise.
* db2/os/os_dir.c: Likewise.
* db2/os/os_fid.c: Likewise.
* db2/os/os_fsync.c: Likewise.
* db2/os/os_func.c: Likewise.
* db2/os/os_map.c: Likewise.
* db2/os/os_oflags.c: Likewise.
* db2/os/os_open.c: Likewise.
* db2/os/os_rpath.c: Likewise.
* db2/os/os_rw.c: Likewise.
* db2/os/os_seek.c: Likewise.
* db2/os/os_sleep.c: Likewise.
* db2/os/os_stat.c: Likewise.
* db2/os/os_unlink.c: Likewise.
* db2/progs/db_deadlock/db_deadlock.c: Likewise.
* db2/progs/db_dump/db_dump.c: Likewise.
* db2/progs/db_load/db_load.c: Likewise.
* db2/progs/db_recover/db_recover.c: Likewise.
* db2/progs/db_stat/db_stat.c: Likewise.
* db2/txn/txn.c: Likewise.
* db2/txn/txn_auto.c: Likewise.
* db2/txn/txn_rec.c: Likewise.
* db2/os/db_os_abs.c: Removed.
* db2/os/db_os_dir.c: Removed.
* db2/os/db_os_fid.c: Removed.
* db2/os/db_os_lseek.c: Removed.
* db2/os/db_os_mmap.c: Removed.
* db2/os/db_os_open.c: Removed.
* db2/os/db_os_rw.c: Removed.
* db2/os/db_os_sleep.c: Removed.
* db2/os/db_os_stat.c: Removed.
* db2/os/db_os_unlink.c: Removed.
* libio/stdio.h (fopen): Add __restrict to parameters.
* manual/process.texi (system): Describe behaviour for NULL argument.
* stdio-common/printf-parse.h: Parse hh modifier.
* stdio-common/vfprintf.c: Handle hh modifier.
* stdio-common/vfscanf.c: Likewise.
* manual/stdio.texi: Describe hh modifier for scanf/printf.
* math/complex.h: Don't define _Imaginary_I, but instead _Complex_I.
gcc does no yet know the `imaginary' keyword.
* math/test-math.c: Add little test for know gcc bug.
* math/tgmath.h: Make complex versions of log10() only available
if __USE_GNU.
* stdlib/test-canon.c: Fix typo.
* sysdeps/generic/setenv.c: Avoid compilation warnings.
Reported by Jim Meyering.
* sysdeps/generic/bits/errno.h: EILSEQ is an ISO C error number.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/i386/i586/memcpy.S: New file.
* sysdeps/i386/i586/mempcpy.S: New file.
* sysdeps/i386/i586/memset.S: Fix typo.
* sysdeps/posix/getcwd.c: Define HAVE_MEMPCPY for _LIBC. Add casts.
* sysdeps/posix/system.c: Add comment to explain code.
* sysdeps/wordsize-32/inttypes.h: Include <stddef.h> for wchar_t.
Define PTRDIFF_{MIN,MAX}, SIG_ATOMIC_{MIN,MAX}, SIZE_MAX,
WCHAR_{MIN,MAX}, WINT_{MIN,MAX}.
Define wcstoimax, wcstoumax.
* sysdeps/wordsize-64/inttypes.h: Likewise.
* wcsmbs/wchar.h: Define WCHAR_{MIN,MAX} if not already defined.
Declare __wcsto{l,ul,ll,ull}_internal only if not already done.
* time/Makefile (routines): Add strfxtime.
* time/strftime.c: Implement %F and %f format.
* time/strfxtime.c: New file.
* time/time.h: Define new types and symbols from ISO C 9X.
* time/mktime.c: Little comment correction.
1997-11-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/libm-ieee754/s_sincosl.c: Fix typo.
* sysdeps/libm-ieee754/s_tanl.c: Fix typo.
* sysdeps/libm-ieee754/s_floorl.c: Correct typos.
* sysdeps/libm-ieee754/e_remainderl.c: Replace
EXTRACT_LDOUBLE_WORDS by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/e_atan2l.c: Replace EXTRACT_LDOUBLE_WORDS
by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/s_scalbnl.c: Replace ";" by "," for correct
variable declaration.
* sysdeps/libm-ieee754/s_scalblnl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c (__lrint): Correct function.
* math/libm-test.c (sqrt_test): Add test for sqrt (0.25).
(asin_test): Add more test.
1997-11-10 23:34 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/e_asin.c: Add braces to make code clearer
and to not confuse the poor compiler.
* sysdeps/libm-ieee754/e_asinf.c: Likewise.
Reported by vertex@cagent.com.
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-lookup.c (do_lookup): Don't accept the base version if we
require a specific one.
* libio/oldfreopen.c: Bind old symbols to version GLIBC_2.0.
* libio/oldiofopen.c: Likewise.
* libio/oldstdfiles.c: Likewise.
* libc.map: Export them.
1997-11-10 07:40 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdlib/exit.c (exit): Handle recursive calls to exit ().
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/s_llrint.c: Fixed to take double argument
instead of long double.
* sysdeps/m68k/fpu/s_llrintf.c: New file.
* sysdeps/m68k/fpu/s_llrintl.c: New file.
* sysdeps/libm-ieee754/s_llrint.c: Make compilable and fix
overflow condition.
* sysdeps/libm-ieee754/s_llrintf.c: Fix overflow condition.
* sysdeps/libm-ieee754/s_llrintl.c: Likewise.
* sysdeps/libm-ieee754/s_llround.c: Likewise.
* sysdeps/libm-ieee754/s_llroundf.c: Likewise.
* sysdeps/libm-ieee754/s_llroundl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c: Likewise.
* sysdeps/libm-ieee754/s_lrintf.c: Likewise.
* sysdeps/libm-ieee754/s_lrintl.c: Likewise.
* sysdeps/libm-ieee754/s_lround.c: Likewise.
* sysdeps/libm-ieee754/s_lroundf.c: Likewise.
* sysdeps/libm-ieee754/s_lroundl.c: Likewise.
* math/libm-test.c: Test all three variants of lrint and llrint.
Fix typos in lround and llround tests. Add tests for boundary
cases for lrint and llround.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi: Misc doc fixes.
* manual/ctype.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/terminal.texi: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/xstatconv.c: Use struct assignment
instead of memcpy to let the compiler use whatever it regards as
optimal.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
[$(subdir)=misc]: Add sys/prctl.h.
* sysdeps/unix/sysv/linux/Dist: Distribute it.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/ftwtest-sh: Don't use the unknown which command, instead try
pwd as /bin/pwd and /usr/bin/pwd.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/maint.texi (Tools for Installation): Don't recommend
broken version 3.76.1 of make.
(Porting): Fix wording.
1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
* config.make.in (build-pic-default): New, defined with
pic_default.
* configure.in (pic_default): New, set to yes if PIC is
default.
* Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
1997-11-09 18:15 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Fix typo.
* csu/Makefile (CFLAGS-initfini.s): Correctly fix moving function
definition. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
* stdlib/strtod.c: Handle numbers like 0.0e10000 correctly which
produce 0.0. Reported by Joe Keane <jgk@jgk.org>.
* sysdeps/libm-ieee754/s_ceill.c: Fix typos.
* sysdeps/libm-ieee754/s_llrint.c: Correct code, it never worked.
1997-11-06 07:00 H.J. Lu <hjl@gnu.ai.mit.edu>
* sysdeps/unix/sysv/i386/i686/time.S: Removed.
1997-11-08 14:07 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/libnsl.map: Add __do_niscall2 for nis_cachemgr.
* nis/nis_call.c: Set UDP resend timeout correct.
* nis/nss_compat/compat-grp.c: Rewritten to make it faster.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/ypclnt.c: Fix UDP resend timeout, fix yp_bind/do_ypcall
interaction.
* inet/protocols/routed.h: Include sys/socket.h.
* inet/protocols/talkd.h: Likewise.
* inet/protocols/timed.h: Include rpc/types.h.
* sunrpc/rpc/pmap_clnt.h: Include rpc/clnt.h.
1997-11-06 01:39 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Add missing closing brace.
1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
* libio.h (__P): Name its arg `p' instead of `params'.
This was added solely to work around problems with
the definition of __P in the Solaris math.h header.
1997-11-12 00:06:02 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* There are three cases we support:
|
|
|
|
* 1. Named anonymous memory (shmget(2)).
|
|
|
|
* 2. Unnamed anonymous memory (mmap(2): MAP_ANON/MAP_ANONYMOUS).
|
|
|
|
* 3. Memory backed by a regular file (mmap(2)).
|
|
|
|
*
|
|
|
|
* We instantiate a backing file in all cases, which contains at least
|
1999-06-13 13:36:34 +00:00
|
|
|
* the RLAYOUT structure, and in case #3, contains the actual region.
|
1998-06-09 15:16:55 +00:00
|
|
|
* This is necessary for a couple of reasons:
|
|
|
|
*
|
|
|
|
* First, the mpool region uses temporary files to name regions, and
|
|
|
|
* since you may have multiple regions in the same directory, we need
|
|
|
|
* a filesystem name to ensure that they don't collide.
|
|
|
|
*
|
|
|
|
* Second, applications are allowed to forcibly remove regions, even
|
|
|
|
* if they don't know anything about them other than the name. If a
|
|
|
|
* region is backed by anonymous memory, there has to be some way for
|
|
|
|
* the application to find out that information, and, in some cases,
|
|
|
|
* determine ID information for the anonymous memory.
|
|
|
|
*/
|
|
|
|
if (F_ISSET(infop, REGION_CREATED)) {
|
|
|
|
/*
|
|
|
|
* If we're using anonymous memory to back this region, set
|
|
|
|
* the flag.
|
|
|
|
*/
|
|
|
|
if (DB_GLOBAL(db_region_anon))
|
|
|
|
F_SET(infop, REGION_ANONYMOUS);
|
Update.
1997-11-11 21:30 Ulrich Drepper <drepper@cygnus.com>
* include/sys/stat.h: Define stat, fstat, lstat and *64 variants
as macros so the the library compiles correctly even without
optimization.
* io/fstat.c: Undef fstat.
* io/fstat64.c: Undef fstat64
* io/lstat.c: Undef lstat.
* io/lstat64.c: Undef lstat64
* io/stat.c: Undef stat.
* io/stat64.c: Undef stat64
* io/fts.c: Include <include/sys/stat.h> to get macro definitions.
* io/ftw.c: Likewise.
* io/getdirname.c: Likewise.
* Makefile (install): Run test-installation.pl if possible.
* db2/Makefile: Update from db-2.3.12.
* db2/db.h: Likewise.
* db2/db_int.h: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/common/db_appinit.c: Likewise.
* db2/common/db_apprec.c: Likewise.
* db2/common/db_byteorder.c: Likewise.
* db2/common/db_region.c: Likewise.
* db2/db/db.c: Likewise
* db2/db/db.src: Likewise
* db2/db/db_auto.c: Likewise
* db2/db/db_dispatch.c: Likewise
* db2/db/db_dup.c: Likewise
* db2/db/db_overflow.c: Likewise
* db2/db/db_pr.c: Likewise
* db2/db/db_rec.c: Likewise
* db2/db/db_ret.c: Likewise
* db2/db/db_thread.c: Likewise
* db2/db185/db185.c: Likewise.
* db2/hash/hash.c: Likewise.
* db2/hash/hash.src: Likewise.
* db2/hash/hash_auto.c: Likewise.
* db2/hash/hash_dup.c: Likewise.
* db2/hash/hash_page.c: Likewise.
* db2/hash/hash_rec.c: Likewise.
* db2/include/btree_auto.h: Likewise.
* db2/include/btree_ext.h: Likewise.
* db2/include/clib_ext.h: Likewise.
* db2/include/common_ext.h: Likewise.
* db2/include/db.h.src: Likewise.
* db2/include/db_am.h: Likewise.
* db2/include/db_auto.h: Likewise.
* db2/include/db_cxx.h: Likewise.
* db2/include/db_ext.h: Likewise.
* db2/include/db_int.h.src: Likewise.
* db2/include/hash.h: Likewise.
* db2/include/hash_auto.h: Likewise.
* db2/include/hash_ext.h: Likewise.
* db2/include/lock.h: Likewise.
* db2/include/lock_ext.h: Likewise.
* db2/include/log.h: Likewise.
* db2/include/log_ext.h: Likewise.
* db2/include/mp.h: Likewise.
* db2/include/mp_ext.h: Likewise.
* db2/include/mutex_ext.h: Likewise.
* db2/include/os_ext.h: Likewise.
* db2/include/os_func.h: Likewise.
* db2/include/txn.h: Likewise.
* db2/include/txn_ext.h: Likewise.
* db2/lock/lock.c: Likewise.
* db2/lock/lock_deadlock.c: Likewise.
* db2/log/log.c: Likewise.
* db2/log/log_archive.c: Likewise.
* db2/log/log_auto.c: Likewise.
* db2/log/log_findckp.c: Likewise.
* db2/log/log_get.c: Likewise.
* db2/log/log_put.c: Likewise.
* db2/log/log_rec.c: Likewise.
* db2/log/log_register.c: Likewise.
* db2/mp/mp_bh.c: Likewise.
* db2/mp/mp_fget.c: Likewise.
* db2/mp/mp_fopen.c: Likewise.
* db2/mp/mp_fput.c: Likewise.
* db2/mp/mp_fset.c: Likewise.
* db2/mp/mp_open.c: Likewise.
* db2/mp/mp_pr.c: Likewise.
* db2/mp/mp_region.c: Likewise.
* db2/mp/mp_sync.c: Likewise.
* db2/mutex/mutex.c: Likewise.
* db2/os/os_abs.c: Likewise.
* db2/os/os_dir.c: Likewise.
* db2/os/os_fid.c: Likewise.
* db2/os/os_fsync.c: Likewise.
* db2/os/os_func.c: Likewise.
* db2/os/os_map.c: Likewise.
* db2/os/os_oflags.c: Likewise.
* db2/os/os_open.c: Likewise.
* db2/os/os_rpath.c: Likewise.
* db2/os/os_rw.c: Likewise.
* db2/os/os_seek.c: Likewise.
* db2/os/os_sleep.c: Likewise.
* db2/os/os_stat.c: Likewise.
* db2/os/os_unlink.c: Likewise.
* db2/progs/db_deadlock/db_deadlock.c: Likewise.
* db2/progs/db_dump/db_dump.c: Likewise.
* db2/progs/db_load/db_load.c: Likewise.
* db2/progs/db_recover/db_recover.c: Likewise.
* db2/progs/db_stat/db_stat.c: Likewise.
* db2/txn/txn.c: Likewise.
* db2/txn/txn_auto.c: Likewise.
* db2/txn/txn_rec.c: Likewise.
* db2/os/db_os_abs.c: Removed.
* db2/os/db_os_dir.c: Removed.
* db2/os/db_os_fid.c: Removed.
* db2/os/db_os_lseek.c: Removed.
* db2/os/db_os_mmap.c: Removed.
* db2/os/db_os_open.c: Removed.
* db2/os/db_os_rw.c: Removed.
* db2/os/db_os_sleep.c: Removed.
* db2/os/db_os_stat.c: Removed.
* db2/os/db_os_unlink.c: Removed.
* libio/stdio.h (fopen): Add __restrict to parameters.
* manual/process.texi (system): Describe behaviour for NULL argument.
* stdio-common/printf-parse.h: Parse hh modifier.
* stdio-common/vfprintf.c: Handle hh modifier.
* stdio-common/vfscanf.c: Likewise.
* manual/stdio.texi: Describe hh modifier for scanf/printf.
* math/complex.h: Don't define _Imaginary_I, but instead _Complex_I.
gcc does no yet know the `imaginary' keyword.
* math/test-math.c: Add little test for know gcc bug.
* math/tgmath.h: Make complex versions of log10() only available
if __USE_GNU.
* stdlib/test-canon.c: Fix typo.
* sysdeps/generic/setenv.c: Avoid compilation warnings.
Reported by Jim Meyering.
* sysdeps/generic/bits/errno.h: EILSEQ is an ISO C error number.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/i386/i586/memcpy.S: New file.
* sysdeps/i386/i586/mempcpy.S: New file.
* sysdeps/i386/i586/memset.S: Fix typo.
* sysdeps/posix/getcwd.c: Define HAVE_MEMPCPY for _LIBC. Add casts.
* sysdeps/posix/system.c: Add comment to explain code.
* sysdeps/wordsize-32/inttypes.h: Include <stddef.h> for wchar_t.
Define PTRDIFF_{MIN,MAX}, SIG_ATOMIC_{MIN,MAX}, SIZE_MAX,
WCHAR_{MIN,MAX}, WINT_{MIN,MAX}.
Define wcstoimax, wcstoumax.
* sysdeps/wordsize-64/inttypes.h: Likewise.
* wcsmbs/wchar.h: Define WCHAR_{MIN,MAX} if not already defined.
Declare __wcsto{l,ul,ll,ull}_internal only if not already done.
* time/Makefile (routines): Add strfxtime.
* time/strftime.c: Implement %F and %f format.
* time/strfxtime.c: New file.
* time/time.h: Define new types and symbols from ISO C 9X.
* time/mktime.c: Little comment correction.
1997-11-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/libm-ieee754/s_sincosl.c: Fix typo.
* sysdeps/libm-ieee754/s_tanl.c: Fix typo.
* sysdeps/libm-ieee754/s_floorl.c: Correct typos.
* sysdeps/libm-ieee754/e_remainderl.c: Replace
EXTRACT_LDOUBLE_WORDS by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/e_atan2l.c: Replace EXTRACT_LDOUBLE_WORDS
by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/s_scalbnl.c: Replace ";" by "," for correct
variable declaration.
* sysdeps/libm-ieee754/s_scalblnl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c (__lrint): Correct function.
* math/libm-test.c (sqrt_test): Add test for sqrt (0.25).
(asin_test): Add more test.
1997-11-10 23:34 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/e_asin.c: Add braces to make code clearer
and to not confuse the poor compiler.
* sysdeps/libm-ieee754/e_asinf.c: Likewise.
Reported by vertex@cagent.com.
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-lookup.c (do_lookup): Don't accept the base version if we
require a specific one.
* libio/oldfreopen.c: Bind old symbols to version GLIBC_2.0.
* libio/oldiofopen.c: Likewise.
* libio/oldstdfiles.c: Likewise.
* libc.map: Export them.
1997-11-10 07:40 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdlib/exit.c (exit): Handle recursive calls to exit ().
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/s_llrint.c: Fixed to take double argument
instead of long double.
* sysdeps/m68k/fpu/s_llrintf.c: New file.
* sysdeps/m68k/fpu/s_llrintl.c: New file.
* sysdeps/libm-ieee754/s_llrint.c: Make compilable and fix
overflow condition.
* sysdeps/libm-ieee754/s_llrintf.c: Fix overflow condition.
* sysdeps/libm-ieee754/s_llrintl.c: Likewise.
* sysdeps/libm-ieee754/s_llround.c: Likewise.
* sysdeps/libm-ieee754/s_llroundf.c: Likewise.
* sysdeps/libm-ieee754/s_llroundl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c: Likewise.
* sysdeps/libm-ieee754/s_lrintf.c: Likewise.
* sysdeps/libm-ieee754/s_lrintl.c: Likewise.
* sysdeps/libm-ieee754/s_lround.c: Likewise.
* sysdeps/libm-ieee754/s_lroundf.c: Likewise.
* sysdeps/libm-ieee754/s_lroundl.c: Likewise.
* math/libm-test.c: Test all three variants of lrint and llrint.
Fix typos in lround and llround tests. Add tests for boundary
cases for lrint and llround.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi: Misc doc fixes.
* manual/ctype.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/terminal.texi: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/xstatconv.c: Use struct assignment
instead of memcpy to let the compiler use whatever it regards as
optimal.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
[$(subdir)=misc]: Add sys/prctl.h.
* sysdeps/unix/sysv/linux/Dist: Distribute it.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/ftwtest-sh: Don't use the unknown which command, instead try
pwd as /bin/pwd and /usr/bin/pwd.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/maint.texi (Tools for Installation): Don't recommend
broken version 3.76.1 of make.
(Porting): Fix wording.
1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
* config.make.in (build-pic-default): New, defined with
pic_default.
* configure.in (pic_default): New, set to yes if PIC is
default.
* Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
1997-11-09 18:15 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Fix typo.
* csu/Makefile (CFLAGS-initfini.s): Correctly fix moving function
definition. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
* stdlib/strtod.c: Handle numbers like 0.0e10000 correctly which
produce 0.0. Reported by Joe Keane <jgk@jgk.org>.
* sysdeps/libm-ieee754/s_ceill.c: Fix typos.
* sysdeps/libm-ieee754/s_llrint.c: Correct code, it never worked.
1997-11-06 07:00 H.J. Lu <hjl@gnu.ai.mit.edu>
* sysdeps/unix/sysv/i386/i686/time.S: Removed.
1997-11-08 14:07 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/libnsl.map: Add __do_niscall2 for nis_cachemgr.
* nis/nis_call.c: Set UDP resend timeout correct.
* nis/nss_compat/compat-grp.c: Rewritten to make it faster.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/ypclnt.c: Fix UDP resend timeout, fix yp_bind/do_ypcall
interaction.
* inet/protocols/routed.h: Include sys/socket.h.
* inet/protocols/talkd.h: Likewise.
* inet/protocols/timed.h: Include rpc/types.h.
* sunrpc/rpc/pmap_clnt.h: Include rpc/clnt.h.
1997-11-06 01:39 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Add missing closing brace.
1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
* libio.h (__P): Name its arg `p' instead of `params'.
This was added solely to work around problems with
the definition of __P in the Solaris math.h header.
1997-11-12 00:06:02 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* If we're using a regular file to back a region we created,
|
|
|
|
* grow it to the specified size.
|
|
|
|
*/
|
|
|
|
if (!DB_GLOBAL(db_region_anon) &&
|
|
|
|
(ret = __db_growregion(infop, infop->size)) != 0)
|
|
|
|
goto err;
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* If we're joining a region, figure out what it looks like.
|
|
|
|
*
|
|
|
|
* XXX
|
|
|
|
* We have to figure out if the file is a regular file backing
|
|
|
|
* a region that we want to map into our address space, or a
|
|
|
|
* file with the information we need to find a shared anonymous
|
|
|
|
* region that we want to map into our address space.
|
|
|
|
*
|
|
|
|
* All this noise is because some systems don't have a coherent
|
|
|
|
* VM and buffer cache, and worse, if you mix operations on the
|
|
|
|
* VM and buffer cache, half the time you hang the system.
|
|
|
|
*
|
|
|
|
* There are two possibilities. If the file is the size of an
|
|
|
|
* RLAYOUT structure, then we know that the real region is in
|
|
|
|
* shared memory, because otherwise it would be bigger. (As
|
|
|
|
* the RLAYOUT structure size is smaller than a disk sector,
|
|
|
|
* the only way it can be this size is if deliberately written
|
|
|
|
* that way.) In which case, retrieve the information we need
|
|
|
|
* from the RLAYOUT structure and use it to acquire the shared
|
|
|
|
* memory.
|
|
|
|
*
|
|
|
|
* If the structure is larger than an RLAYOUT structure, then
|
|
|
|
* the file is backing the shared memory region, and we use
|
|
|
|
* the current size of the file without reading any information
|
|
|
|
* from the file itself so that we don't confuse the VM.
|
|
|
|
*
|
|
|
|
* And yes, this makes me want to take somebody and kill them,
|
|
|
|
* but I can't think of any other solution.
|
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_ioinfo(infop->name,
|
1998-06-09 15:16:55 +00:00
|
|
|
infop->fd, &mbytes, &bytes, NULL)) != 0)
|
|
|
|
goto errmsg;
|
|
|
|
size = mbytes * MEGABYTE + bytes;
|
|
|
|
|
|
|
|
if (size <= sizeof(RLAYOUT)) {
|
|
|
|
/*
|
|
|
|
* If the size is too small, the read fails or the
|
|
|
|
* valid flag is incorrect, assume it's because the
|
|
|
|
* RLAYOUT information hasn't been written out yet,
|
|
|
|
* and retry.
|
|
|
|
*/
|
|
|
|
if (size < sizeof(RLAYOUT))
|
|
|
|
goto retry;
|
|
|
|
if ((ret =
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_read(infop->fd, &rl, sizeof(rl), &nr)) != 0)
|
1998-06-09 15:16:55 +00:00
|
|
|
goto retry;
|
|
|
|
if (rl.valid != DB_REGIONMAGIC)
|
|
|
|
goto retry;
|
|
|
|
|
|
|
|
/* Copy the size, memory id and characteristics. */
|
|
|
|
size = rl.size;
|
|
|
|
infop->segid = rl.segid;
|
|
|
|
if (F_ISSET(&rl, REGION_ANONYMOUS))
|
|
|
|
F_SET(infop, REGION_ANONYMOUS);
|
|
|
|
}
|
Update.
1997-11-11 21:30 Ulrich Drepper <drepper@cygnus.com>
* include/sys/stat.h: Define stat, fstat, lstat and *64 variants
as macros so the the library compiles correctly even without
optimization.
* io/fstat.c: Undef fstat.
* io/fstat64.c: Undef fstat64
* io/lstat.c: Undef lstat.
* io/lstat64.c: Undef lstat64
* io/stat.c: Undef stat.
* io/stat64.c: Undef stat64
* io/fts.c: Include <include/sys/stat.h> to get macro definitions.
* io/ftw.c: Likewise.
* io/getdirname.c: Likewise.
* Makefile (install): Run test-installation.pl if possible.
* db2/Makefile: Update from db-2.3.12.
* db2/db.h: Likewise.
* db2/db_int.h: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/common/db_appinit.c: Likewise.
* db2/common/db_apprec.c: Likewise.
* db2/common/db_byteorder.c: Likewise.
* db2/common/db_region.c: Likewise.
* db2/db/db.c: Likewise
* db2/db/db.src: Likewise
* db2/db/db_auto.c: Likewise
* db2/db/db_dispatch.c: Likewise
* db2/db/db_dup.c: Likewise
* db2/db/db_overflow.c: Likewise
* db2/db/db_pr.c: Likewise
* db2/db/db_rec.c: Likewise
* db2/db/db_ret.c: Likewise
* db2/db/db_thread.c: Likewise
* db2/db185/db185.c: Likewise.
* db2/hash/hash.c: Likewise.
* db2/hash/hash.src: Likewise.
* db2/hash/hash_auto.c: Likewise.
* db2/hash/hash_dup.c: Likewise.
* db2/hash/hash_page.c: Likewise.
* db2/hash/hash_rec.c: Likewise.
* db2/include/btree_auto.h: Likewise.
* db2/include/btree_ext.h: Likewise.
* db2/include/clib_ext.h: Likewise.
* db2/include/common_ext.h: Likewise.
* db2/include/db.h.src: Likewise.
* db2/include/db_am.h: Likewise.
* db2/include/db_auto.h: Likewise.
* db2/include/db_cxx.h: Likewise.
* db2/include/db_ext.h: Likewise.
* db2/include/db_int.h.src: Likewise.
* db2/include/hash.h: Likewise.
* db2/include/hash_auto.h: Likewise.
* db2/include/hash_ext.h: Likewise.
* db2/include/lock.h: Likewise.
* db2/include/lock_ext.h: Likewise.
* db2/include/log.h: Likewise.
* db2/include/log_ext.h: Likewise.
* db2/include/mp.h: Likewise.
* db2/include/mp_ext.h: Likewise.
* db2/include/mutex_ext.h: Likewise.
* db2/include/os_ext.h: Likewise.
* db2/include/os_func.h: Likewise.
* db2/include/txn.h: Likewise.
* db2/include/txn_ext.h: Likewise.
* db2/lock/lock.c: Likewise.
* db2/lock/lock_deadlock.c: Likewise.
* db2/log/log.c: Likewise.
* db2/log/log_archive.c: Likewise.
* db2/log/log_auto.c: Likewise.
* db2/log/log_findckp.c: Likewise.
* db2/log/log_get.c: Likewise.
* db2/log/log_put.c: Likewise.
* db2/log/log_rec.c: Likewise.
* db2/log/log_register.c: Likewise.
* db2/mp/mp_bh.c: Likewise.
* db2/mp/mp_fget.c: Likewise.
* db2/mp/mp_fopen.c: Likewise.
* db2/mp/mp_fput.c: Likewise.
* db2/mp/mp_fset.c: Likewise.
* db2/mp/mp_open.c: Likewise.
* db2/mp/mp_pr.c: Likewise.
* db2/mp/mp_region.c: Likewise.
* db2/mp/mp_sync.c: Likewise.
* db2/mutex/mutex.c: Likewise.
* db2/os/os_abs.c: Likewise.
* db2/os/os_dir.c: Likewise.
* db2/os/os_fid.c: Likewise.
* db2/os/os_fsync.c: Likewise.
* db2/os/os_func.c: Likewise.
* db2/os/os_map.c: Likewise.
* db2/os/os_oflags.c: Likewise.
* db2/os/os_open.c: Likewise.
* db2/os/os_rpath.c: Likewise.
* db2/os/os_rw.c: Likewise.
* db2/os/os_seek.c: Likewise.
* db2/os/os_sleep.c: Likewise.
* db2/os/os_stat.c: Likewise.
* db2/os/os_unlink.c: Likewise.
* db2/progs/db_deadlock/db_deadlock.c: Likewise.
* db2/progs/db_dump/db_dump.c: Likewise.
* db2/progs/db_load/db_load.c: Likewise.
* db2/progs/db_recover/db_recover.c: Likewise.
* db2/progs/db_stat/db_stat.c: Likewise.
* db2/txn/txn.c: Likewise.
* db2/txn/txn_auto.c: Likewise.
* db2/txn/txn_rec.c: Likewise.
* db2/os/db_os_abs.c: Removed.
* db2/os/db_os_dir.c: Removed.
* db2/os/db_os_fid.c: Removed.
* db2/os/db_os_lseek.c: Removed.
* db2/os/db_os_mmap.c: Removed.
* db2/os/db_os_open.c: Removed.
* db2/os/db_os_rw.c: Removed.
* db2/os/db_os_sleep.c: Removed.
* db2/os/db_os_stat.c: Removed.
* db2/os/db_os_unlink.c: Removed.
* libio/stdio.h (fopen): Add __restrict to parameters.
* manual/process.texi (system): Describe behaviour for NULL argument.
* stdio-common/printf-parse.h: Parse hh modifier.
* stdio-common/vfprintf.c: Handle hh modifier.
* stdio-common/vfscanf.c: Likewise.
* manual/stdio.texi: Describe hh modifier for scanf/printf.
* math/complex.h: Don't define _Imaginary_I, but instead _Complex_I.
gcc does no yet know the `imaginary' keyword.
* math/test-math.c: Add little test for know gcc bug.
* math/tgmath.h: Make complex versions of log10() only available
if __USE_GNU.
* stdlib/test-canon.c: Fix typo.
* sysdeps/generic/setenv.c: Avoid compilation warnings.
Reported by Jim Meyering.
* sysdeps/generic/bits/errno.h: EILSEQ is an ISO C error number.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/i386/i586/memcpy.S: New file.
* sysdeps/i386/i586/mempcpy.S: New file.
* sysdeps/i386/i586/memset.S: Fix typo.
* sysdeps/posix/getcwd.c: Define HAVE_MEMPCPY for _LIBC. Add casts.
* sysdeps/posix/system.c: Add comment to explain code.
* sysdeps/wordsize-32/inttypes.h: Include <stddef.h> for wchar_t.
Define PTRDIFF_{MIN,MAX}, SIG_ATOMIC_{MIN,MAX}, SIZE_MAX,
WCHAR_{MIN,MAX}, WINT_{MIN,MAX}.
Define wcstoimax, wcstoumax.
* sysdeps/wordsize-64/inttypes.h: Likewise.
* wcsmbs/wchar.h: Define WCHAR_{MIN,MAX} if not already defined.
Declare __wcsto{l,ul,ll,ull}_internal only if not already done.
* time/Makefile (routines): Add strfxtime.
* time/strftime.c: Implement %F and %f format.
* time/strfxtime.c: New file.
* time/time.h: Define new types and symbols from ISO C 9X.
* time/mktime.c: Little comment correction.
1997-11-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/libm-ieee754/s_sincosl.c: Fix typo.
* sysdeps/libm-ieee754/s_tanl.c: Fix typo.
* sysdeps/libm-ieee754/s_floorl.c: Correct typos.
* sysdeps/libm-ieee754/e_remainderl.c: Replace
EXTRACT_LDOUBLE_WORDS by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/e_atan2l.c: Replace EXTRACT_LDOUBLE_WORDS
by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/s_scalbnl.c: Replace ";" by "," for correct
variable declaration.
* sysdeps/libm-ieee754/s_scalblnl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c (__lrint): Correct function.
* math/libm-test.c (sqrt_test): Add test for sqrt (0.25).
(asin_test): Add more test.
1997-11-10 23:34 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/e_asin.c: Add braces to make code clearer
and to not confuse the poor compiler.
* sysdeps/libm-ieee754/e_asinf.c: Likewise.
Reported by vertex@cagent.com.
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-lookup.c (do_lookup): Don't accept the base version if we
require a specific one.
* libio/oldfreopen.c: Bind old symbols to version GLIBC_2.0.
* libio/oldiofopen.c: Likewise.
* libio/oldstdfiles.c: Likewise.
* libc.map: Export them.
1997-11-10 07:40 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdlib/exit.c (exit): Handle recursive calls to exit ().
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/s_llrint.c: Fixed to take double argument
instead of long double.
* sysdeps/m68k/fpu/s_llrintf.c: New file.
* sysdeps/m68k/fpu/s_llrintl.c: New file.
* sysdeps/libm-ieee754/s_llrint.c: Make compilable and fix
overflow condition.
* sysdeps/libm-ieee754/s_llrintf.c: Fix overflow condition.
* sysdeps/libm-ieee754/s_llrintl.c: Likewise.
* sysdeps/libm-ieee754/s_llround.c: Likewise.
* sysdeps/libm-ieee754/s_llroundf.c: Likewise.
* sysdeps/libm-ieee754/s_llroundl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c: Likewise.
* sysdeps/libm-ieee754/s_lrintf.c: Likewise.
* sysdeps/libm-ieee754/s_lrintl.c: Likewise.
* sysdeps/libm-ieee754/s_lround.c: Likewise.
* sysdeps/libm-ieee754/s_lroundf.c: Likewise.
* sysdeps/libm-ieee754/s_lroundl.c: Likewise.
* math/libm-test.c: Test all three variants of lrint and llrint.
Fix typos in lround and llround tests. Add tests for boundary
cases for lrint and llround.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi: Misc doc fixes.
* manual/ctype.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/terminal.texi: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/xstatconv.c: Use struct assignment
instead of memcpy to let the compiler use whatever it regards as
optimal.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
[$(subdir)=misc]: Add sys/prctl.h.
* sysdeps/unix/sysv/linux/Dist: Distribute it.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/ftwtest-sh: Don't use the unknown which command, instead try
pwd as /bin/pwd and /usr/bin/pwd.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/maint.texi (Tools for Installation): Don't recommend
broken version 3.76.1 of make.
(Porting): Fix wording.
1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
* config.make.in (build-pic-default): New, defined with
pic_default.
* configure.in (pic_default): New, set to yes if PIC is
default.
* Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
1997-11-09 18:15 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Fix typo.
* csu/Makefile (CFLAGS-initfini.s): Correctly fix moving function
definition. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
* stdlib/strtod.c: Handle numbers like 0.0e10000 correctly which
produce 0.0. Reported by Joe Keane <jgk@jgk.org>.
* sysdeps/libm-ieee754/s_ceill.c: Fix typos.
* sysdeps/libm-ieee754/s_llrint.c: Correct code, it never worked.
1997-11-06 07:00 H.J. Lu <hjl@gnu.ai.mit.edu>
* sysdeps/unix/sysv/i386/i686/time.S: Removed.
1997-11-08 14:07 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/libnsl.map: Add __do_niscall2 for nis_cachemgr.
* nis/nis_call.c: Set UDP resend timeout correct.
* nis/nss_compat/compat-grp.c: Rewritten to make it faster.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/ypclnt.c: Fix UDP resend timeout, fix yp_bind/do_ypcall
interaction.
* inet/protocols/routed.h: Include sys/socket.h.
* inet/protocols/talkd.h: Likewise.
* inet/protocols/timed.h: Include rpc/types.h.
* sunrpc/rpc/pmap_clnt.h: Include rpc/clnt.h.
1997-11-06 01:39 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Add missing closing brace.
1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
* libio.h (__P): Name its arg `p' instead of `params'.
This was added solely to work around problems with
the definition of __P in the Solaris math.h header.
1997-11-12 00:06:02 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* If the region is larger than we think, that's okay, use the
|
|
|
|
* current size. If it's smaller than we think, and we were
|
|
|
|
* just using the default size, that's okay, use the current
|
|
|
|
* size. If it's smaller than we think and we really care,
|
|
|
|
* save the size and we'll catch that further down -- we can't
|
|
|
|
* correct it here because we have to have a lock to grow the
|
|
|
|
* region.
|
|
|
|
*/
|
|
|
|
if (infop->size > size && !F_ISSET(infop, REGION_SIZEDEF))
|
|
|
|
grow_region = infop->size;
|
|
|
|
infop->size = size;
|
Update.
1997-11-11 21:30 Ulrich Drepper <drepper@cygnus.com>
* include/sys/stat.h: Define stat, fstat, lstat and *64 variants
as macros so the the library compiles correctly even without
optimization.
* io/fstat.c: Undef fstat.
* io/fstat64.c: Undef fstat64
* io/lstat.c: Undef lstat.
* io/lstat64.c: Undef lstat64
* io/stat.c: Undef stat.
* io/stat64.c: Undef stat64
* io/fts.c: Include <include/sys/stat.h> to get macro definitions.
* io/ftw.c: Likewise.
* io/getdirname.c: Likewise.
* Makefile (install): Run test-installation.pl if possible.
* db2/Makefile: Update from db-2.3.12.
* db2/db.h: Likewise.
* db2/db_int.h: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/btree/bt_cursor.c: Likewise.
* db2/btree/bt_delete.c: Likewise.
* db2/btree/bt_open.c: Likewise.
* db2/btree/bt_put.c: Likewise.
* db2/btree/bt_rec.c: Likewise.
* db2/btree/bt_recno.c: Likewise.
* db2/btree/bt_search.c: Likewise.
* db2/btree/bt_split.c: Likewise.
* db2/btree/bt_stat.c: Likewise.
* db2/btree/btree.src: Likewise.
* db2/btree/btree_auto.c: Likewise.
* db2/common/db_appinit.c: Likewise.
* db2/common/db_apprec.c: Likewise.
* db2/common/db_byteorder.c: Likewise.
* db2/common/db_region.c: Likewise.
* db2/db/db.c: Likewise
* db2/db/db.src: Likewise
* db2/db/db_auto.c: Likewise
* db2/db/db_dispatch.c: Likewise
* db2/db/db_dup.c: Likewise
* db2/db/db_overflow.c: Likewise
* db2/db/db_pr.c: Likewise
* db2/db/db_rec.c: Likewise
* db2/db/db_ret.c: Likewise
* db2/db/db_thread.c: Likewise
* db2/db185/db185.c: Likewise.
* db2/hash/hash.c: Likewise.
* db2/hash/hash.src: Likewise.
* db2/hash/hash_auto.c: Likewise.
* db2/hash/hash_dup.c: Likewise.
* db2/hash/hash_page.c: Likewise.
* db2/hash/hash_rec.c: Likewise.
* db2/include/btree_auto.h: Likewise.
* db2/include/btree_ext.h: Likewise.
* db2/include/clib_ext.h: Likewise.
* db2/include/common_ext.h: Likewise.
* db2/include/db.h.src: Likewise.
* db2/include/db_am.h: Likewise.
* db2/include/db_auto.h: Likewise.
* db2/include/db_cxx.h: Likewise.
* db2/include/db_ext.h: Likewise.
* db2/include/db_int.h.src: Likewise.
* db2/include/hash.h: Likewise.
* db2/include/hash_auto.h: Likewise.
* db2/include/hash_ext.h: Likewise.
* db2/include/lock.h: Likewise.
* db2/include/lock_ext.h: Likewise.
* db2/include/log.h: Likewise.
* db2/include/log_ext.h: Likewise.
* db2/include/mp.h: Likewise.
* db2/include/mp_ext.h: Likewise.
* db2/include/mutex_ext.h: Likewise.
* db2/include/os_ext.h: Likewise.
* db2/include/os_func.h: Likewise.
* db2/include/txn.h: Likewise.
* db2/include/txn_ext.h: Likewise.
* db2/lock/lock.c: Likewise.
* db2/lock/lock_deadlock.c: Likewise.
* db2/log/log.c: Likewise.
* db2/log/log_archive.c: Likewise.
* db2/log/log_auto.c: Likewise.
* db2/log/log_findckp.c: Likewise.
* db2/log/log_get.c: Likewise.
* db2/log/log_put.c: Likewise.
* db2/log/log_rec.c: Likewise.
* db2/log/log_register.c: Likewise.
* db2/mp/mp_bh.c: Likewise.
* db2/mp/mp_fget.c: Likewise.
* db2/mp/mp_fopen.c: Likewise.
* db2/mp/mp_fput.c: Likewise.
* db2/mp/mp_fset.c: Likewise.
* db2/mp/mp_open.c: Likewise.
* db2/mp/mp_pr.c: Likewise.
* db2/mp/mp_region.c: Likewise.
* db2/mp/mp_sync.c: Likewise.
* db2/mutex/mutex.c: Likewise.
* db2/os/os_abs.c: Likewise.
* db2/os/os_dir.c: Likewise.
* db2/os/os_fid.c: Likewise.
* db2/os/os_fsync.c: Likewise.
* db2/os/os_func.c: Likewise.
* db2/os/os_map.c: Likewise.
* db2/os/os_oflags.c: Likewise.
* db2/os/os_open.c: Likewise.
* db2/os/os_rpath.c: Likewise.
* db2/os/os_rw.c: Likewise.
* db2/os/os_seek.c: Likewise.
* db2/os/os_sleep.c: Likewise.
* db2/os/os_stat.c: Likewise.
* db2/os/os_unlink.c: Likewise.
* db2/progs/db_deadlock/db_deadlock.c: Likewise.
* db2/progs/db_dump/db_dump.c: Likewise.
* db2/progs/db_load/db_load.c: Likewise.
* db2/progs/db_recover/db_recover.c: Likewise.
* db2/progs/db_stat/db_stat.c: Likewise.
* db2/txn/txn.c: Likewise.
* db2/txn/txn_auto.c: Likewise.
* db2/txn/txn_rec.c: Likewise.
* db2/os/db_os_abs.c: Removed.
* db2/os/db_os_dir.c: Removed.
* db2/os/db_os_fid.c: Removed.
* db2/os/db_os_lseek.c: Removed.
* db2/os/db_os_mmap.c: Removed.
* db2/os/db_os_open.c: Removed.
* db2/os/db_os_rw.c: Removed.
* db2/os/db_os_sleep.c: Removed.
* db2/os/db_os_stat.c: Removed.
* db2/os/db_os_unlink.c: Removed.
* libio/stdio.h (fopen): Add __restrict to parameters.
* manual/process.texi (system): Describe behaviour for NULL argument.
* stdio-common/printf-parse.h: Parse hh modifier.
* stdio-common/vfprintf.c: Handle hh modifier.
* stdio-common/vfscanf.c: Likewise.
* manual/stdio.texi: Describe hh modifier for scanf/printf.
* math/complex.h: Don't define _Imaginary_I, but instead _Complex_I.
gcc does no yet know the `imaginary' keyword.
* math/test-math.c: Add little test for know gcc bug.
* math/tgmath.h: Make complex versions of log10() only available
if __USE_GNU.
* stdlib/test-canon.c: Fix typo.
* sysdeps/generic/setenv.c: Avoid compilation warnings.
Reported by Jim Meyering.
* sysdeps/generic/bits/errno.h: EILSEQ is an ISO C error number.
* sysdeps/mach/hurd/bits/errno.h: Likewise.
* sysdeps/standalone/bits/errno.h: Likewise.
* sysdeps/unix/sysv/linux/bits/errno.h: Likewise.
* sysdeps/i386/i586/memcpy.S: New file.
* sysdeps/i386/i586/mempcpy.S: New file.
* sysdeps/i386/i586/memset.S: Fix typo.
* sysdeps/posix/getcwd.c: Define HAVE_MEMPCPY for _LIBC. Add casts.
* sysdeps/posix/system.c: Add comment to explain code.
* sysdeps/wordsize-32/inttypes.h: Include <stddef.h> for wchar_t.
Define PTRDIFF_{MIN,MAX}, SIG_ATOMIC_{MIN,MAX}, SIZE_MAX,
WCHAR_{MIN,MAX}, WINT_{MIN,MAX}.
Define wcstoimax, wcstoumax.
* sysdeps/wordsize-64/inttypes.h: Likewise.
* wcsmbs/wchar.h: Define WCHAR_{MIN,MAX} if not already defined.
Declare __wcsto{l,ul,ll,ull}_internal only if not already done.
* time/Makefile (routines): Add strfxtime.
* time/strftime.c: Implement %F and %f format.
* time/strfxtime.c: New file.
* time/time.h: Define new types and symbols from ISO C 9X.
* time/mktime.c: Little comment correction.
1997-11-10 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* sysdeps/libm-ieee754/s_sincosl.c: Fix typo.
* sysdeps/libm-ieee754/s_tanl.c: Fix typo.
* sysdeps/libm-ieee754/s_floorl.c: Correct typos.
* sysdeps/libm-ieee754/e_remainderl.c: Replace
EXTRACT_LDOUBLE_WORDS by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/e_atan2l.c: Replace EXTRACT_LDOUBLE_WORDS
by GET_LDOUBLE_WORDS.
* sysdeps/libm-ieee754/s_scalbnl.c: Replace ";" by "," for correct
variable declaration.
* sysdeps/libm-ieee754/s_scalblnl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c (__lrint): Correct function.
* math/libm-test.c (sqrt_test): Add test for sqrt (0.25).
(asin_test): Add more test.
1997-11-10 23:34 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/libm-ieee754/e_asin.c: Add braces to make code clearer
and to not confuse the poor compiler.
* sysdeps/libm-ieee754/e_asinf.c: Likewise.
Reported by vertex@cagent.com.
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* elf/dl-lookup.c (do_lookup): Don't accept the base version if we
require a specific one.
* libio/oldfreopen.c: Bind old symbols to version GLIBC_2.0.
* libio/oldiofopen.c: Likewise.
* libio/oldstdfiles.c: Likewise.
* libc.map: Export them.
1997-11-10 07:40 H.J. Lu <hjl@gnu.ai.mit.edu>
* stdlib/exit.c (exit): Handle recursive calls to exit ().
1997-11-09 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/fpu/s_llrint.c: Fixed to take double argument
instead of long double.
* sysdeps/m68k/fpu/s_llrintf.c: New file.
* sysdeps/m68k/fpu/s_llrintl.c: New file.
* sysdeps/libm-ieee754/s_llrint.c: Make compilable and fix
overflow condition.
* sysdeps/libm-ieee754/s_llrintf.c: Fix overflow condition.
* sysdeps/libm-ieee754/s_llrintl.c: Likewise.
* sysdeps/libm-ieee754/s_llround.c: Likewise.
* sysdeps/libm-ieee754/s_llroundf.c: Likewise.
* sysdeps/libm-ieee754/s_llroundl.c: Likewise.
* sysdeps/libm-ieee754/s_lrint.c: Likewise.
* sysdeps/libm-ieee754/s_lrintf.c: Likewise.
* sysdeps/libm-ieee754/s_lrintl.c: Likewise.
* sysdeps/libm-ieee754/s_lround.c: Likewise.
* sysdeps/libm-ieee754/s_lroundf.c: Likewise.
* sysdeps/libm-ieee754/s_lroundl.c: Likewise.
* math/libm-test.c: Test all three variants of lrint and llrint.
Fix typos in lround and llround tests. Add tests for boundary
cases for lrint and llround.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/arith.texi: Misc doc fixes.
* manual/ctype.texi: Likewise.
* manual/pattern.texi: Likewise.
* manual/terminal.texi: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/xstatconv.c: Use struct assignment
instead of memcpy to let the compiler use whatever it regards as
optimal.
* sysdeps/unix/sysv/linux/alpha/xstatconv.c: Likewise.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers)
[$(subdir)=misc]: Add sys/prctl.h.
* sysdeps/unix/sysv/linux/Dist: Distribute it.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* io/ftwtest-sh: Don't use the unknown which command, instead try
pwd as /bin/pwd and /usr/bin/pwd.
1997-11-08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* manual/maint.texi (Tools for Installation): Don't recommend
broken version 3.76.1 of make.
(Porting): Fix wording.
1997-11-06 06:13 H.J. Lu <hjl@gnu.ai.mit.edu>
* config.make.in (build-pic-default): New, defined with
pic_default.
* configure.in (pic_default): New, set to yes if PIC is
default.
* Makeconfig (CPPFLAGS-.o, CPPFLAGS-.op, CPPFLAGS-.og,
CPPFLAGS-.ob): Add -DPIC if $(build-pic-default) is yes.
1997-11-09 18:15 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Fix typo.
* csu/Makefile (CFLAGS-initfini.s): Correctly fix moving function
definition. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
* stdlib/strtod.c: Handle numbers like 0.0e10000 correctly which
produce 0.0. Reported by Joe Keane <jgk@jgk.org>.
* sysdeps/libm-ieee754/s_ceill.c: Fix typos.
* sysdeps/libm-ieee754/s_llrint.c: Correct code, it never worked.
1997-11-06 07:00 H.J. Lu <hjl@gnu.ai.mit.edu>
* sysdeps/unix/sysv/i386/i686/time.S: Removed.
1997-11-08 14:07 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/libnsl.map: Add __do_niscall2 for nis_cachemgr.
* nis/nis_call.c: Set UDP resend timeout correct.
* nis/nss_compat/compat-grp.c: Rewritten to make it faster.
* nis/nss_compat/compat-pwd.c: Likewise.
* nis/nss_compat/compat-spwd.c: Likewise.
* nis/ypclnt.c: Fix UDP resend timeout, fix yp_bind/do_ypcall
interaction.
* inet/protocols/routed.h: Include sys/socket.h.
* inet/protocols/talkd.h: Likewise.
* inet/protocols/timed.h: Include rpc/types.h.
* sunrpc/rpc/pmap_clnt.h: Include rpc/clnt.h.
1997-11-06 01:39 Ulrich Drepper <drepper@cygnus.com>
* Makerules (libc.so): Add missing closing brace.
1997-11-05 Brendan Kehoe <brendan@lisa.cygnus.com>
* libio.h (__P): Name its arg `p' instead of `params'.
This was added solely to work around problems with
the definition of __P in the Solaris math.h header.
1997-11-12 00:06:02 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* Map the region into our address space. If we're creating it, the
|
|
|
|
* underlying routines will make it the right size.
|
|
|
|
*
|
|
|
|
* There are at least two cases where we can "reasonably" fail when
|
|
|
|
* we attempt to map in the region. On Windows/95, closing the last
|
|
|
|
* reference to a region causes it to be zeroed out. On UNIX, when
|
|
|
|
* using the shmget(2) interfaces, the region will no longer exist
|
|
|
|
* if the system was rebooted. In these cases, the underlying map call
|
|
|
|
* returns EAGAIN, and we *remove* our file and try again. There are
|
|
|
|
* obvious races in doing this, but it should eventually settle down
|
|
|
|
* to a winner and then things should proceed normally.
|
|
|
|
*/
|
1998-09-07 11:07:34 +00:00
|
|
|
if ((ret = __db_mapregion(infop->name, infop)) != 0) {
|
1998-06-09 15:16:55 +00:00
|
|
|
if (ret == EAGAIN) {
|
|
|
|
/*
|
|
|
|
* Pretend we created the region even if we didn't so
|
|
|
|
* that our error processing unlinks it.
|
|
|
|
*/
|
|
|
|
F_SET(infop, REGION_CREATED);
|
|
|
|
ret = 0;
|
|
|
|
goto retry;
|
|
|
|
} else
|
|
|
|
goto err;
|
1998-09-07 11:07:34 +00:00
|
|
|
}
|
1999-06-13 13:36:34 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
region_init:
|
1997-08-27 20:26:10 +00:00
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Initialize the common region information.
|
1997-08-27 20:26:10 +00:00
|
|
|
*
|
|
|
|
* !!!
|
|
|
|
* We have to order the region creates so that two processes don't try
|
1998-06-09 15:16:55 +00:00
|
|
|
* to simultaneously create the region. This is handled by using the
|
|
|
|
* DB_CREATE and DB_EXCL flags when we create the "backing" region file.
|
1997-08-27 20:26:10 +00:00
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* We also have to order region joins so that processes joining regions
|
|
|
|
* never see inconsistent data. We'd like to play permissions games
|
|
|
|
* with the backing file, but we can't because WNT filesystems won't
|
|
|
|
* open a file mode 0.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1998-06-09 15:16:55 +00:00
|
|
|
rlp = (RLAYOUT *)infop->addr;
|
|
|
|
if (F_ISSET(infop, REGION_CREATED)) {
|
|
|
|
/*
|
|
|
|
* The process creating the region acquires a lock before it
|
|
|
|
* sets the valid flag. Any processes joining the region will
|
|
|
|
* check the valid flag before acquiring the lock.
|
|
|
|
*
|
|
|
|
* Check the return of __db_mutex_init() and __db_mutex_lock(),
|
|
|
|
* even though we don't usually check elsewhere. This is the
|
|
|
|
* first lock we initialize and acquire, and we have to know if
|
|
|
|
* it fails. (It CAN fail, e.g., SunOS, when using fcntl(2)
|
|
|
|
* for locking, with an in-memory filesystem specified as the
|
|
|
|
* database home.)
|
|
|
|
*/
|
|
|
|
if ((ret = __db_mutex_init(&rlp->lock,
|
|
|
|
MUTEX_LOCK_OFFSET(rlp, &rlp->lock))) != 0 ||
|
|
|
|
(ret = __db_mutex_lock(&rlp->lock, infop->fd)) != 0)
|
|
|
|
goto err;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Initialize the remaining region information. */
|
|
|
|
rlp->refcnt = 1;
|
|
|
|
rlp->size = infop->size;
|
|
|
|
db_version(&rlp->majver, &rlp->minver, &rlp->patch);
|
1999-06-13 13:36:34 +00:00
|
|
|
rlp->panic = 0;
|
1998-06-09 15:16:55 +00:00
|
|
|
rlp->segid = infop->segid;
|
|
|
|
rlp->flags = 0;
|
|
|
|
if (F_ISSET(infop, REGION_ANONYMOUS))
|
|
|
|
F_SET(rlp, REGION_ANONYMOUS);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* Fill in the valid field last -- use a magic number, memory
|
|
|
|
* may not be zero-filled, and we want to minimize the chance
|
|
|
|
* for collision.
|
|
|
|
*/
|
|
|
|
rlp->valid = DB_REGIONMAGIC;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* If the region is anonymous, write the RLAYOUT information
|
|
|
|
* into the backing file so that future region join and unlink
|
|
|
|
* calls can find it.
|
|
|
|
*
|
|
|
|
* XXX
|
|
|
|
* We MUST do the seek before we do the write. On Win95, while
|
|
|
|
* closing the last reference to an anonymous shared region
|
|
|
|
* doesn't discard the region, it does zero it out. So, the
|
|
|
|
* REGION_CREATED may be set, but the file may have already
|
|
|
|
* been written and the file descriptor may be at the end of
|
|
|
|
* the file.
|
|
|
|
*/
|
|
|
|
if (F_ISSET(infop, REGION_ANONYMOUS)) {
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_seek(infop->fd, 0, 0, 0, 0, 0)) != 0)
|
1998-06-09 15:16:55 +00:00
|
|
|
goto err;
|
|
|
|
if ((ret =
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_write(infop->fd, rlp, sizeof(*rlp), &nw)) != 0)
|
1998-06-09 15:16:55 +00:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
} else {
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Check to see if the region has had catastrophic failure. */
|
|
|
|
if (rlp->panic) {
|
|
|
|
ret = DB_RUNRECOVERY;
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* Check the valid flag to ensure the region is initialized.
|
|
|
|
* If the valid flag has not been set, the mutex may not have
|
|
|
|
* been initialized, and an attempt to get it could lead to
|
|
|
|
* random behavior.
|
|
|
|
*/
|
|
|
|
if (rlp->valid != DB_REGIONMAGIC)
|
|
|
|
goto retry;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Get the region lock. */
|
|
|
|
(void)__db_mutex_lock(&rlp->lock, infop->fd);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* We now own the region. There are a couple of things that
|
|
|
|
* may have gone wrong, however.
|
|
|
|
*
|
|
|
|
* Problem #1: while we were waiting for the lock, the region
|
|
|
|
* was deleted. Detected by re-checking the valid flag, since
|
|
|
|
* it's cleared by the delete region routines.
|
|
|
|
*/
|
|
|
|
if (rlp->valid != DB_REGIONMAGIC) {
|
|
|
|
(void)__db_mutex_unlock(&rlp->lock, infop->fd);
|
|
|
|
goto retry;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* Problem #3: when we checked the size of the file, it was
|
|
|
|
* still growing as part of creation. Detected by the fact
|
|
|
|
* that infop->size isn't the same size as the region.
|
|
|
|
*/
|
|
|
|
if (infop->size != rlp->size) {
|
|
|
|
(void)__db_mutex_unlock(&rlp->lock, infop->fd);
|
|
|
|
goto retry;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Increment the reference count. */
|
|
|
|
++rlp->refcnt;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Return the region in a locked condition. */
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
if (0) {
|
|
|
|
errmsg: __db_err(infop->dbenv, "%s: %s", infop->name, strerror(ret));
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
err:
|
|
|
|
retry: /* Discard the region. */
|
|
|
|
if (infop->addr != NULL) {
|
|
|
|
(void)__db_unmapregion(infop);
|
|
|
|
infop->addr = NULL;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Discard the backing file. */
|
|
|
|
if (infop->fd != -1) {
|
1999-06-13 13:36:34 +00:00
|
|
|
(void)__os_close(infop->fd);
|
1998-06-09 15:16:55 +00:00
|
|
|
infop->fd = -1;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
if (F_ISSET(infop, REGION_CREATED))
|
1999-06-13 13:36:34 +00:00
|
|
|
(void)__os_unlink(infop->name);
|
1998-06-09 15:16:55 +00:00
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Discard the name. */
|
|
|
|
if (infop->name != NULL) {
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_freestr(infop->name);
|
1998-06-09 15:16:55 +00:00
|
|
|
infop->name = NULL;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* If we had a temporary error, wait a few seconds and
|
|
|
|
* try again.
|
|
|
|
*/
|
|
|
|
if (ret == 0) {
|
|
|
|
if (++retry_cnt <= 3) {
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_sleep(retry_cnt * 2, 0);
|
1998-06-09 15:16:55 +00:00
|
|
|
goto loop;
|
|
|
|
}
|
|
|
|
ret = EAGAIN;
|
|
|
|
}
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* XXX
|
|
|
|
* HP-UX won't permit mutexes to live in anything but shared memory.
|
|
|
|
* Instantiate a shared region file on that architecture, regardless.
|
|
|
|
*
|
|
|
|
* XXX
|
|
|
|
* There's a problem in cleaning this up on application exit, or on
|
|
|
|
* application failure. If an application opens a database without
|
|
|
|
* an environment, we create a temporary backing mpool region for it.
|
|
|
|
* That region is marked REGION_PRIVATE, but as HP-UX won't permit
|
|
|
|
* mutexes to live in anything but shared memory, we instantiate a
|
|
|
|
* real file plus a memory region of some form. If the application
|
|
|
|
* crashes, the necessary information to delete the backing file and
|
|
|
|
* any system region (e.g., the shmget(2) segment ID) is no longer
|
|
|
|
* available. We can't completely fix the problem, but we try.
|
|
|
|
*
|
|
|
|
* The underlying UNIX __db_mapregion() code preferentially uses the
|
|
|
|
* mmap(2) interface with the MAP_ANON/MAP_ANONYMOUS flags for regions
|
|
|
|
* that are marked REGION_PRIVATE. This means that we normally aren't
|
|
|
|
* holding any system resources when we get here, in which case we can
|
|
|
|
* delete the backing file. This results in a short race, from the
|
|
|
|
* __db_open() call above to here.
|
|
|
|
*
|
|
|
|
* If, for some reason, we are holding system resources when we get
|
|
|
|
* here, we don't have any choice -- we can't delete the backing file
|
|
|
|
* because we may need it to detach from the resources. Set the
|
|
|
|
* REGION_LASTDETACH flag, so that we do all necessary cleanup when
|
|
|
|
* the application closes the region.
|
|
|
|
*/
|
1998-09-07 11:07:34 +00:00
|
|
|
if (F_ISSET(infop, REGION_PRIVATE) && !F_ISSET(infop, REGION_MALLOC)) {
|
1998-06-09 15:16:55 +00:00
|
|
|
if (F_ISSET(infop, REGION_HOLDINGSYS))
|
|
|
|
F_SET(infop, REGION_LASTDETACH);
|
|
|
|
else {
|
|
|
|
F_SET(infop, REGION_REMOVED);
|
|
|
|
F_CLR(infop, REGION_CANGROW);
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
(void)__os_close(infop->fd);
|
|
|
|
(void)__os_unlink(infop->name);
|
1998-06-09 15:16:55 +00:00
|
|
|
}
|
1998-09-07 11:07:34 +00:00
|
|
|
}
|
1999-06-13 13:36:34 +00:00
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* __db_rdetach --
|
|
|
|
* De-attach from a shared memory region.
|
1997-08-27 20:26:10 +00:00
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* PUBLIC: int __db_rdetach __P((REGINFO *));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
int
|
1998-06-09 15:16:55 +00:00
|
|
|
__db_rdetach(infop)
|
|
|
|
REGINFO *infop;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1998-06-09 15:16:55 +00:00
|
|
|
RLAYOUT *rlp;
|
|
|
|
int detach, ret, t_ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
ret = 0;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* If the region was removed when it was created, no further action
|
|
|
|
* is required.
|
|
|
|
*/
|
|
|
|
if (F_ISSET(infop, REGION_REMOVED))
|
|
|
|
goto done;
|
|
|
|
/*
|
|
|
|
* If the region was created in memory returned by malloc, the only
|
|
|
|
* action required is freeing the memory.
|
|
|
|
*/
|
|
|
|
if (F_ISSET(infop, REGION_MALLOC)) {
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_free(infop->addr, 0);
|
1998-06-09 15:16:55 +00:00
|
|
|
goto done;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Otherwise, attach to the region and optionally delete it. */
|
|
|
|
rlp = infop->addr;
|
|
|
|
|
|
|
|
/* Get the lock. */
|
|
|
|
(void)__db_mutex_lock(&rlp->lock, infop->fd);
|
|
|
|
|
1997-08-27 20:26:10 +00:00
|
|
|
/* Decrement the reference count. */
|
1998-06-09 15:16:55 +00:00
|
|
|
if (rlp->refcnt == 0)
|
|
|
|
__db_err(infop->dbenv,
|
|
|
|
"region rdetach: reference count went to zero!");
|
|
|
|
else
|
|
|
|
--rlp->refcnt;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we're going to remove the region, clear the valid flag so
|
|
|
|
* that any region join that's blocked waiting for us will know
|
|
|
|
* what happened.
|
|
|
|
*/
|
|
|
|
detach = 0;
|
1998-09-07 11:07:34 +00:00
|
|
|
if (F_ISSET(infop, REGION_LASTDETACH)) {
|
1998-06-09 15:16:55 +00:00
|
|
|
if (rlp->refcnt == 0) {
|
|
|
|
detach = 1;
|
|
|
|
rlp->valid = 0;
|
|
|
|
} else
|
|
|
|
ret = EBUSY;
|
1998-09-07 11:07:34 +00:00
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Release the lock. */
|
1998-06-09 15:16:55 +00:00
|
|
|
(void)__db_mutex_unlock(&rlp->lock, infop->fd);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Close the backing file descriptor. */
|
1999-06-13 13:36:34 +00:00
|
|
|
(void)__os_close(infop->fd);
|
1998-06-09 15:16:55 +00:00
|
|
|
infop->fd = -1;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Discard our mapping of the region. */
|
|
|
|
if ((t_ret = __db_unmapregion(infop)) != 0 && ret == 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
ret = t_ret;
|
1998-06-09 15:16:55 +00:00
|
|
|
|
|
|
|
/* Discard the region itself. */
|
|
|
|
if (detach) {
|
|
|
|
if ((t_ret =
|
|
|
|
__db_unlinkregion(infop->name, infop) != 0) && ret == 0)
|
|
|
|
ret = t_ret;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((t_ret = __os_unlink(infop->name) != 0) && ret == 0)
|
1998-06-09 15:16:55 +00:00
|
|
|
ret = t_ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
done: /* Discard the name. */
|
|
|
|
if (infop->name != NULL) {
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_freestr(infop->name);
|
1998-06-09 15:16:55 +00:00
|
|
|
infop->name = NULL;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __db_runlink --
|
1998-06-09 15:16:55 +00:00
|
|
|
* Remove a region.
|
1997-08-27 20:26:10 +00:00
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* PUBLIC: int __db_runlink __P((REGINFO *, int));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
int
|
1998-06-09 15:16:55 +00:00
|
|
|
__db_runlink(infop, force)
|
|
|
|
REGINFO *infop;
|
1997-08-27 20:26:10 +00:00
|
|
|
int force;
|
|
|
|
{
|
1998-06-09 15:16:55 +00:00
|
|
|
RLAYOUT rl, *rlp;
|
|
|
|
size_t size;
|
|
|
|
ssize_t nr;
|
|
|
|
u_int32_t mbytes, bytes;
|
|
|
|
int fd, ret, t_ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
char *name;
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* XXX
|
|
|
|
* We assume that we've created a new REGINFO structure for this
|
|
|
|
* call, not used one that was already initialized. Regardless,
|
|
|
|
* if anyone is planning to use it after we're done, they're going
|
|
|
|
* to be sorely disappointed.
|
|
|
|
*
|
|
|
|
* If force isn't set, we attach to the region, set a flag to delete
|
|
|
|
* the region on last close, and let the region delete code do the
|
|
|
|
* work.
|
|
|
|
*/
|
|
|
|
if (!force) {
|
|
|
|
if ((ret = __db_rattach(infop)) != 0)
|
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
rlp = (RLAYOUT *)infop->addr;
|
|
|
|
(void)__db_mutex_unlock(&rlp->lock, infop->fd);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
F_SET(infop, REGION_LASTDETACH);
|
|
|
|
|
|
|
|
return (__db_rdetach(infop));
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Otherwise, we don't want to attach to the region. We may have been
|
|
|
|
* called to clean up if a process died leaving a region locked and/or
|
|
|
|
* corrupted, which could cause the attach to hang.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1998-06-09 15:16:55 +00:00
|
|
|
if ((ret = __db_appname(infop->dbenv, infop->appname,
|
|
|
|
infop->path, infop->file, infop->dbflags, NULL, &name)) != 0)
|
|
|
|
return (ret);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* An underlying file is created for all regions other than private
|
|
|
|
* (REGION_PRIVATE) ones, regardless of whether or not it's used to
|
|
|
|
* back the region. If that file doesn't exist, we're done.
|
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
if (__os_exists(name, NULL) != 0) {
|
|
|
|
__os_freestr(name);
|
1998-06-09 15:16:55 +00:00
|
|
|
return (0);
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/*
|
|
|
|
* See the comments in __db_rattach -- figure out if this is a regular
|
|
|
|
* file backing a region or if it's a regular file with information
|
|
|
|
* about a region.
|
|
|
|
*/
|
|
|
|
if ((ret = __db_open(name, DB_RDONLY, DB_RDONLY, 0, &fd)) != 0)
|
|
|
|
goto errmsg;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_ioinfo(name, fd, &mbytes, &bytes, NULL)) != 0)
|
1998-06-09 15:16:55 +00:00
|
|
|
goto errmsg;
|
|
|
|
size = mbytes * MEGABYTE + bytes;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
if (size <= sizeof(RLAYOUT)) {
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_read(fd, &rl, sizeof(rl), &nr)) != 0)
|
1998-06-09 15:16:55 +00:00
|
|
|
goto errmsg;
|
|
|
|
if (rl.valid != DB_REGIONMAGIC) {
|
|
|
|
__db_err(infop->dbenv,
|
|
|
|
"%s: illegal region magic number", name);
|
|
|
|
ret = EINVAL;
|
|
|
|
goto err;
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Set the size, memory id and characteristics. */
|
|
|
|
infop->size = rl.size;
|
|
|
|
infop->segid = rl.segid;
|
|
|
|
if (F_ISSET(&rl, REGION_ANONYMOUS))
|
|
|
|
F_SET(infop, REGION_ANONYMOUS);
|
|
|
|
} else {
|
|
|
|
infop->size = size;
|
|
|
|
infop->segid = INVALID_SEGID;
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Remove the underlying region. */
|
|
|
|
ret = __db_unlinkregion(name, infop);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Unlink the backing file. Close the open file descriptor first,
|
|
|
|
* because some architectures (e.g., Win32) won't unlink a file if
|
|
|
|
* open file descriptors remain.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1999-06-13 13:36:34 +00:00
|
|
|
(void)__os_close(fd);
|
|
|
|
if ((t_ret = __os_unlink(name)) != 0 && ret == 0)
|
1998-06-09 15:16:55 +00:00
|
|
|
ret = t_ret;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
if (0) {
|
|
|
|
errmsg: __db_err(infop->dbenv, "%s: %s", name, strerror(ret));
|
1999-06-13 13:36:34 +00:00
|
|
|
err: (void)__os_close(fd);
|
1998-06-09 15:16:55 +00:00
|
|
|
}
|
1997-12-01 17:16:22 +00:00
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_freestr(name);
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __db_rgrow --
|
1998-06-09 15:16:55 +00:00
|
|
|
* Extend a region.
|
1997-08-27 20:26:10 +00:00
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* PUBLIC: int __db_rgrow __P((REGINFO *, size_t));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
int
|
1998-06-09 15:16:55 +00:00
|
|
|
__db_rgrow(infop, new_size)
|
|
|
|
REGINFO *infop;
|
|
|
|
size_t new_size;
|
|
|
|
{
|
|
|
|
RLAYOUT *rlp;
|
|
|
|
size_t increment;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* !!!
|
|
|
|
* This routine MUST be called with the region already locked.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* The underlying routines have flagged if this region can grow. */
|
|
|
|
if (!F_ISSET(infop, REGION_CANGROW))
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Round off the requested size to the next page boundary, and
|
|
|
|
* determine the additional space required.
|
|
|
|
*/
|
|
|
|
rlp = (RLAYOUT *)infop->addr;
|
1999-06-13 13:36:34 +00:00
|
|
|
DB_ROUNDOFF(new_size, DB_VMPAGESIZE);
|
1998-06-09 15:16:55 +00:00
|
|
|
increment = new_size - rlp->size;
|
|
|
|
|
|
|
|
if ((ret = __db_growregion(infop, increment)) != 0)
|
|
|
|
return (ret);
|
|
|
|
|
|
|
|
/* Update the on-disk region size. */
|
|
|
|
rlp->size = new_size;
|
|
|
|
|
|
|
|
/* Detach from and reattach to the region. */
|
|
|
|
return (__db_rreattach(infop, new_size));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* __db_growregion --
|
|
|
|
* Grow a shared memory region.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
__db_growregion(infop, increment)
|
|
|
|
REGINFO *infop;
|
|
|
|
size_t increment;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
1998-06-09 15:16:55 +00:00
|
|
|
db_pgno_t pages;
|
1997-08-27 20:26:10 +00:00
|
|
|
size_t i;
|
1998-06-09 15:16:55 +00:00
|
|
|
ssize_t nr, nw;
|
|
|
|
u_int32_t relative;
|
|
|
|
int ret;
|
|
|
|
char buf[DB_VMPAGESIZE];
|
1997-08-27 20:26:10 +00:00
|
|
|
|
|
|
|
/* Seek to the end of the region. */
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_seek(infop->fd, 0, 0, 0, 0, SEEK_END)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
|
|
|
|
/* Write nuls to the new bytes. */
|
|
|
|
memset(buf, 0, sizeof(buf));
|
|
|
|
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Some systems require that all of the bytes of the region be
|
|
|
|
* written before it can be mapped and accessed randomly, and
|
|
|
|
* other systems don't zero out the pages.
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
1998-06-09 15:16:55 +00:00
|
|
|
if (__db_mapinit())
|
1998-01-25 17:01:47 +00:00
|
|
|
/* Extend the region by writing each new page. */
|
1998-06-09 15:16:55 +00:00
|
|
|
for (i = 0; i < increment; i += DB_VMPAGESIZE) {
|
|
|
|
if ((ret =
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_write(infop->fd, buf, sizeof(buf), &nw)) != 0)
|
1998-01-25 17:01:47 +00:00
|
|
|
goto err;
|
|
|
|
if (nw != sizeof(buf))
|
|
|
|
goto eio;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* Extend the region by writing the last page. If the region
|
|
|
|
* is >4Gb, increment may be larger than the maximum possible
|
|
|
|
* seek "relative" argument, as it's an unsigned 32-bit value.
|
|
|
|
* Break the offset into pages of 1MB each so that we don't
|
|
|
|
* overflow (2^20 + 2^32 is bigger than any memory I expect
|
|
|
|
* to see for awhile).
|
1998-01-25 17:01:47 +00:00
|
|
|
*/
|
1998-06-09 15:16:55 +00:00
|
|
|
pages = (increment - DB_VMPAGESIZE) / MEGABYTE;
|
|
|
|
relative = (increment - DB_VMPAGESIZE) % MEGABYTE;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_seek(infop->fd,
|
1998-06-09 15:16:55 +00:00
|
|
|
MEGABYTE, pages, relative, 0, SEEK_CUR)) != 0)
|
1998-01-25 17:01:47 +00:00
|
|
|
goto err;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_write(infop->fd, buf, sizeof(buf), &nw)) != 0)
|
1997-08-27 20:26:10 +00:00
|
|
|
goto err;
|
|
|
|
if (nw != sizeof(buf))
|
|
|
|
goto eio;
|
1998-06-09 15:16:55 +00:00
|
|
|
|
|
|
|
/*
|
1999-06-13 13:36:34 +00:00
|
|
|
* It's sometimes significantly faster to page-fault in all of
|
|
|
|
* the region's pages before we run the application, as we see
|
|
|
|
* nasty side-effects when we page-fault while holding various
|
|
|
|
* locks, i.e., the lock takes a long time to acquire because
|
|
|
|
* of the underlying page fault, and the other threads convoy
|
|
|
|
* behind the lock holder.
|
|
|
|
*
|
|
|
|
* We also use REGION_INIT to guarantee that there is enough
|
|
|
|
* disk space for the region, so we also write a byte to each
|
|
|
|
* page. Reading the byte is insufficient as some systems
|
|
|
|
* (e.g., Solaris) do not instantiate disk pages to satisfy
|
|
|
|
* a read, and so we don't know if there is enough disk space
|
|
|
|
* or not.
|
1998-06-09 15:16:55 +00:00
|
|
|
*/
|
|
|
|
if (DB_GLOBAL(db_region_init)) {
|
|
|
|
pages = increment / MEGABYTE;
|
|
|
|
relative = increment % MEGABYTE;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_seek(infop->fd,
|
1998-06-09 15:16:55 +00:00
|
|
|
MEGABYTE, pages, relative, 1, SEEK_END)) != 0)
|
|
|
|
goto err;
|
|
|
|
|
1999-06-13 13:36:34 +00:00
|
|
|
/* Write a byte to each page. */
|
1998-06-09 15:16:55 +00:00
|
|
|
for (i = 0; i < increment; i += DB_VMPAGESIZE) {
|
|
|
|
if ((ret =
|
1999-06-13 13:36:34 +00:00
|
|
|
__os_write(infop->fd, buf, 1, &nr)) != 0)
|
1998-06-09 15:16:55 +00:00
|
|
|
goto err;
|
|
|
|
if (nr != 1)
|
|
|
|
goto eio;
|
1999-06-13 13:36:34 +00:00
|
|
|
if ((ret = __os_seek(infop->fd,
|
1998-06-09 15:16:55 +00:00
|
|
|
0, 0, DB_VMPAGESIZE - 1, 0, SEEK_CUR)) != 0)
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
}
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
eio: ret = EIO;
|
1998-06-09 15:16:55 +00:00
|
|
|
err: __db_err(infop->dbenv, "region grow: %s", strerror(ret));
|
1997-08-27 20:26:10 +00:00
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
1998-06-09 15:16:55 +00:00
|
|
|
* __db_rreattach --
|
|
|
|
* Detach from and reattach to a region.
|
1997-08-27 20:26:10 +00:00
|
|
|
*
|
1998-06-09 15:16:55 +00:00
|
|
|
* PUBLIC: int __db_rreattach __P((REGINFO *, size_t));
|
1997-08-27 20:26:10 +00:00
|
|
|
*/
|
|
|
|
int
|
1998-06-09 15:16:55 +00:00
|
|
|
__db_rreattach(infop, new_size)
|
|
|
|
REGINFO *infop;
|
|
|
|
size_t new_size;
|
1997-08-27 20:26:10 +00:00
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
#ifdef DIAGNOSTIC
|
|
|
|
if (infop->name == NULL) {
|
|
|
|
__db_err(infop->dbenv, "__db_rreattach: name was NULL");
|
|
|
|
return (EINVAL);
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|
1998-06-09 15:16:55 +00:00
|
|
|
#endif
|
|
|
|
/*
|
|
|
|
* If we're growing an already mapped region, we have to unmap it
|
|
|
|
* and get it back. We have it locked, so nobody else can get in,
|
|
|
|
* which makes it fairly straight-forward to do, as everybody else
|
|
|
|
* is going to block while we do the unmap/remap. NB: if we fail
|
|
|
|
* to get it back, the pooch is genuinely screwed, because we can
|
|
|
|
* never release the lock we're holding.
|
|
|
|
*
|
|
|
|
* Detach from the region. We have to do this first so architectures
|
|
|
|
* that don't permit a file to be mapped into different places in the
|
|
|
|
* address space simultaneously, e.g., HP's PaRisc, will work.
|
|
|
|
*/
|
|
|
|
if ((ret = __db_unmapregion(infop)) != 0)
|
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Update the caller's REGINFO size to the new map size. */
|
|
|
|
infop->size = new_size;
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
/* Attach to the region. */
|
|
|
|
ret = __db_mapregion(infop->name, infop);
|
1997-08-27 20:26:10 +00:00
|
|
|
|
1998-06-09 15:16:55 +00:00
|
|
|
return (ret);
|
1997-08-27 20:26:10 +00:00
|
|
|
}
|