mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-21 10:20:06 +00:00
af69217fea
1998-01-26 00:57 Ulrich Drepper <drepper@cygnus.com> * db2/Makefile (routines): Add os_alloc. * db2/db.h: Update from db-2.3.16. * db2/db_185.h: Likewise. * db2/db_int.h: Likewise. * db2/btree/bt_close.c: Likewise. * db2/btree/bt_cursor.c: Likewise. * db2/btree/bt_delete.c: Likewise. * db2/btree/bt_open.c: Likewise. * db2/btree/bt_page.c: Likewise. * db2/btree/bt_put.c: Likewise. * db2/btree/bt_rec.c: Likewise. * db2/btree/bt_recno.c: Likewise. * db2/btree/btree_auto.c: Likewise. * db2/common/db_appinit.c: Likewise. * db2/common/db_apprec.c: Likewise. * db2/common/db_err.c: Likewise. * db2/common/db_region.c: Likewise. * db2/common/db_shash.c: Likewise. * db2/db/db.c: Likewise. * db2/db/db_auto.c: Likewise. * db2/db/db_conv.c: Likewise. * db2/db/db_dispatch.c: Likewise. * db2/db/db_dup.c: Likewise. * db2/db/db_pr.c: Likewise. * db2/db/db_rec.c: Likewise. * db2/db185/db185.c: Likewise. * db2/dbm/dbm.c: Likewise. * db2/hash/hash.c: 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_ext.h: Likewise. * db2/include/clib_ext.h: Likewise. * db2/include/common_ext.h: Likewise. * db2/include/db.h.src: Likewise. * db2/include/db_185.h.src: Likewise. * db2/include/db_am.h: Likewise. * db2/include/db_ext.h: Likewise. * db2/include/db_int.h.src: Likewise. * db2/include/hash_ext.h: Likewise. * db2/include/lock_ext.h: Likewise. * db2/include/log.h: Likewise. * db2/include/log_auto.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_ext.h: Likewise. * db2/lock/lock.c: Likewise. * db2/lock/lock_util.c: Likewise. * db2/log/log.c: Likewise. * db2/log/log.src: Likewise. * db2/log/log_archive.c: Likewise. * db2/log/log_auto.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_pr.c: Likewise. * db2/mp/mp_sync.c: Likewise. * db2/mutex/mutex.c: Likewise. * db2/os/os_alloc.c: Likewise. * db2/os/os_config.c: Likewise. * db2/os/os_stat.c: Likewise. * db2/progs/db_checkpoint/db_checkpoint.c: Likewise. * db2/progs/db_deadlock/db_deadlock.c: Likewise. * db2/progs/db_load/db_load.c: Likewise. * db2/progs/db_printlog/db_printlog.c: Likewise. * db2/progs/db_recover/db_recover.c: Likewise. * db2/progs/db_stat/db_stat.c: Likewise. * db2/txn/txn.c: Likewise. * elf/dl-close.c (_dl_close): Rename inner variable named map to imap. Unmap memory blocks in reverse order of allocation. Call munmap with load address added to offset. Bug reported by Miguel de Icaza. * locale/programs/ld-collate.c (collate_end_weight): Correctly fill up weight array. * localedata/locales/cs_CZ: Update by Michael Mraka <michael@informatics.muni.cz>. * misc/sys/syslog.h: Reformat a bit. Don't declare vsyslog unless __USE_BSD. * nis/nss_compat/compat-grp.c: Correctly handle buffer overflow while reading line with fgets. * nis/nss_compat/compat-pwd.c: Likewise. * nis/nss_compat/compat-spwd.c: Likewise. * nss/nss_files/files-XXX.c: Likewise. * nss/nss_files/files-alias.c: Likewise. * shadow/fgetspent_r.c: Likewise. * string/strerror_r.c: Correct comment. Patch by Andreas Jaeger. * sysdeps/unix/sysv/linux/bits/stat.h: Define _STATBUF_ST_RDEV. * sysdeps/unix/sysv/linux/alpha/bits/stat.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/stat.h: Likewise. * sysdeps/unix/sysv/linux/i386/sys/ucontext.h: Allocate room for FP register content in ucontext_t. 1998-01-22 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/libm-ieee754/s_modfl.c (modf): Correct calculation. Patch by Markus Schoder <Markus.Schoder@dresdner-bank.de>. * math/libm-test.c (modf_test): Add more tests for modf. * sysdeps/unix/sysv/linux/sys/mman.h: Add const to mlock and munlock according to Unix98. 1998-01-25 Andreas Jaeger <aj@arthur.rhein-neckar.de> * nss/nss_files/files-network.c (LINE_PARSER): Set n_addrtype to AF_INET. 1998-01-21 07:22 H.J. Lu <hjl@gnu.org> * sysdeps/posix/ttyname.c: Handle symbolic links. * sysdeps/posix/ttyname_r.c: Ditto. 1998-01-25 19:39 Ulrich Drepper <drepper@cygnus.com> * db2/makedb.c (process_input): Write terminating \0 for value. (print_database): Simply print value string, don't use length. 1998-01-24 Andreas Jaeger <aj@arthur.rhein-neckar.de> * nss/nsswitch.c (__nss_configure_lookup): Correct test for early exit of loop. 1998-01-25 Thorsten Kukuk <kukuk@vt.uni-paderborn.de> * nis/ypclnt.c: Don't set dom_client to NULL, or we will not close all sockets. 1998-01-25 14:54 Ulrich Drepper <drepper@cygnus.com> * signal/Makefile (routines): Add sighold, sigrelse, sigignore, and sigset. * signal/sighold.c: New file. * signal/sigrelse.c: New file. * sysdeps/generic/sigignore.c: New file. * sysdeps/generic/sigset.c: New file. * sysdeps/posix/sigignore.c: New file. * sysdeps/posix/sigset.c: New file. * signal/signal.h: Add prototypes for new functions. * sysdeps/unix/sysv/linux/alpha/bits/signum.h: Define SIG_HOLD. * sysdeps/unix/sysv/linux/bits/signum.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/signum.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/signum.h: Likewise. 1998-01-23 00:16 Tim Waugh <tim@cyberelk.demon.co.uk> * posix/wordexp.c: Added IFS field-splitting in parameter and command substitution. Fixed an IFS-related bug that caused an infinite loop. 1998-01-25 12:38 Ulrich Drepper <drepper@cygnus.com> * stdlib/Makefile (routines): Add getcontext, setcontext, makecontext, and swapcontext. * stdlib/ucontext.h: Correct prototypes. * sysdeps/generic/getcontext.c: New file. * sysdeps/generic/setcontext.c: New file. * sysdeps/generic/makecontext.c: New file. * sysdeps/generic/swapcontext.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: Removed. 1998-01-25 04:07 Ulrich Drepper <drepper@cygnus.com> * resource/sys/resource.h: Remove #include of ulimit.h which is not allowed by SUSv2 and not available on other systems. * sysdeps/unix/sysv/linux/ulimit.c: Include ulimit.h. * streams/Makefile: New file. * streams/stropts.h: New file. * sysdeps/generic/bits/stropts.h: New file. * sysdeps/generic/isastream.c: New file. * sysdeps/generic/getmsg.c: New file. * sysdeps/generic/getpmsg.c: New file. * sysdeps/generic/putmsg.c: New file. * sysdeps/generic/putpmsg.c: New file. * sysdeps/generic/fattach.c: New file. * sysdeps/generic/fdetach.c: New file. * sysdeps/unix/inet/Subdirs: Add streams. * sysdeps/generic/bits/types.h: Add definition of __t_scalar_t and __t_uscalar_t. * sysdeps/unix/sysv/linux/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/types.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/bits/types.h: Likewise. * sysdeps/mach/_strerror.c: Follow changes of generic version to handle small buffers correctly. 1998-01-24 17:31 H.J. Lu <hjl@gnu.org> * sysdeps/alpha/dl-machine.h (ELF_MACHINE_RUNTIME_TRAMPOLINE): Remove the 3rd arg and add declaration for _dl_runtime_resolve and _dl_runtime_profile. 1998-01-25 02:42 Ulrich Drepper <drepper@cygnus.com> * include/cpio.h: New file. Mainly copied from GNU cpio. * posix/Makefile (headers): Add cpio.h. |
||
---|---|---|
.. | ||
68020.gcc | ||
alpha.dec | ||
alpha.gcc | ||
mutex.c | ||
parisc.gcc | ||
parisc.hp | ||
README | ||
sparc.gcc | ||
tsl_parisc.s | ||
uts4.cc.s | ||
x86.gcc |
# @(#)README 10.2 (Sleepycat) 11/25/97 Resource locking routines: lock based on a db_mutex_t. All this gunk (including trying to make assembly code portable), is necessary because System V semaphores require system calls for uncontested locks and we don't want to make two system calls per resource lock. First, this is how it works. The db_mutex_t structure contains a resource test-and-set lock (tsl), a file offset, a pid for debugging and statistics information. If HAVE_SPINLOCKS is defined (i.e. we know how to do test-and-sets for this compiler/architecture combination), we try and lock the resource tsl __db_tsl_spins times. If we can't acquire the lock that way, we use a system call to sleep for 10ms, 20ms, 40ms, etc. (The time is bounded at 1 second, just in case.) Using the timer backoff means that there are two assumptions: that locks are held for brief periods (never over system calls or I/O) and that locks are not hotly contested. If HAVE_SPINLOCKS is not defined, i.e. we can't do test-and-sets, we use a file descriptor to do byte locking on a file at a specified offset. In this case, ALL of the locking is done in the kernel. Because file descriptors are allocated per process, we have to provide the file descriptor as part of the lock/unlock call. We still have to do timer backoff because we need to be able to block ourselves, i.e. the lock manager causes processes to wait by having the process acquire a mutex and then attempting to re-acquire the mutex. There's no way to use kernel locking to block yourself, i.e. if you hold a lock and attempt to re-acquire it, the attempt will succeed. Next, let's talk about why it doesn't work the way a reasonable person would think it should work. Ideally, we'd have the ability to try to lock the resource tsl, and if that fails, increment a counter of waiting processes, then block in the kernel until the tsl is released. The process holding the resource tsl would see the wait counter when it went to release the resource tsl, and would wake any waiting processes up after releasing the lock. This would actually require both another tsl (call it the mutex tsl) and synchronization between the call that blocks in the kernel and the actual resource tsl. The mutex tsl would be used to protect accesses to the db_mutex_t itself. Locking the mutex tsl would be done by a busy loop, which is safe because processes would never block holding that tsl (all they would do is try to obtain the resource tsl and set/check the wait count). The problem in this model is that the blocking call into the kernel requires a blocking semaphore, i.e. one whose normal state is locked. The only portable forms of locking under UNIX are fcntl(2) on a file descriptor/offset, and System V semaphores. Neither of these locking methods are sufficient to solve the problem. The problem with fcntl locking is that only the process that obtained the lock can release it. Remember, we want the normal state of the kernel semaphore to be locked. So, if the creator of the db_mutex_t were to initialize the lock to "locked", then a second process locks the resource tsl, and then a third process needs to block, waiting for the resource tsl, when the second process wants to wake up the third process, it can't because it's not the holder of the lock! For the second process to be the holder of the lock, we would have to make a system call per uncontested lock, which is what we were trying to get away from in the first place. There are some hybrid schemes, such as signaling the holder of the lock, or using a different blocking offset depending on which process is holding the lock, but it gets complicated fairly quickly. I'm open to suggestions, but I'm not holding my breath. Regardless, we use this form of locking when HAVE_SPINLOCKS is not defined, (i.e. we're locking in the kernel) because it doesn't have the limitations found in System V semaphores, and because the normal state of the kernel object in that case is unlocked, so the process releasing the lock is also the holder of the lock. The System V semaphore design has a number of other limitations that make it inappropriate for this task. Namely: First, the semaphore key name space is separate from the file system name space (although there exist methods for using file names to create semaphore keys). If we use a well-known key, there's no reason to believe that any particular key will not already be in use, either by another instance of the DB application or some other application, in which case the DB application will fail. If we create a key, then we have to use a file system name to rendezvous and pass around the key. Second, System V semaphores traditionally have compile-time, system-wide limits on the number of semaphore keys that you can have. Typically, that number is far too low for any practical purpose. Since the semaphores permit more than a single slot per semaphore key, we could try and get around that limit by using multiple slots, but that means that the file that we're using for rendezvous is going to have to contain slot information as well as semaphore key information, and we're going to be reading/writing it on every db_mutex_t init or destroy operation. Anyhow, similar compile-time, system-wide limits on the numbers of slots per semaphore key kick in, and you're right back where you started. My fantasy is that once POSIX.1 standard mutexes are in wide-spread use, we can switch to them. My guess is that it won't happen, because the POSIX semaphores are only required to work for threads within a process, and not independent processes. Note: there are races in the statistics code, but since it's just that, I didn't bother fixing them. (The fix requires a mutex tsl, so, when/if this code is fixed to do rational locking (see above), then change the statistics update code to acquire/release the mutex tsl.