mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-15 23:50:13 +00:00
04be94a87d
1997-12-01 17:27 Ulrich Drepper <drepper@cygnus.com> * Makefile (subdirs): Add iconvdata and localedata. * iconv/gconv.h: Define UNKNOWN_10646_CHAR as error value. * iconv/gconv_conf.c (read_conf_file): Little optimization. * iconvdata/8bit-gap.c: New file. * iconvdata/8bit-generic.c: Renamed from ... * iconvdata/iso8859-generic.c: ...this. * iconvdata/configure: Removed. * iconvdata/Makefile: Add new modules and better rules. * iconvdata/iso6937.c: Minor bug fixes. * iconvdata/iso8859-1.c: Likewise. * iconvdata/t61.c: Likewise. * iconvdata/iso8859-2.c: Change to use 8bit-generic.c. Minor bug fixes. * iconvdata/iso8859-3.c: Likewise. * iconvdata/iso8859-4.c: Likewise. * iconvdata/iso8859-5.c: Likewise. * iconvdata/iso8859-6.c: Likewise. * iconvdata/iso8859-7.c: Likewise. * iconvdata/iso8859-8.c: Likewise. * iconvdata/iso8859-9.c: Likewise. * iconvdata/iso8859-10.c: Likewise. * iconvdata/ebcdic-at-de-a.c: New file. * iconvdata/ebcdic-at-de.c: New file. * iconvdata/ebcdic-ca-fr.c: New file. * iconvdata/hp-roman8.c: New file. * iconvdata/koi-8.c: New file. * iconvdata/koi8-r.c: New file. * iconvdata/koi8-h.c: New file. * iconvdata/latin-greek-1.c: New file. * iconvdata/latin-greek-1.h: New file. * iconvdata/latin-greek.c: New file. * iconvdata/latin-greek.h: New file. * iconvdata/jis0201.c: New file. * iconvdata/jis0201.h: New file. * iconvdata/jis0208.c: New file. * iconvdata/jis0208.h: New file. * iconvdata/jis0212.c: New file. * iconvdata/jis0212.h: New file. * iconvdata/sjis.c: New file. * iconvdata/gap.pl: New file. Script to generate table header. * iconvdata/gaptab.pl: New file. * iconvdata/gconv-modules: Add info about new modules. * locale/programs/charmap.c: Also examine alias names given in charmap files. * localedata/*: Add to here from add-on. We need the information to generate tables for iconv. Update from db-2.3.14. * db2/Makefile: Updated. * db2/config.h: Likewise. * db2/db.h: Likewise. * db2/db_int.h: Likewise. * db2/btree/bt_cursor.c: Likewise. * db2/btree/bt_delete.c: Likewise. * db2/btree/bt_put.c: Likewise. * db2/btree/bt_search.c: Likewise. * db2/btree/bt_split.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/db/db_auto.c: Likewise. * db2/db/db_dispatch.c: Likewise. * db2/db/db_ret.c: Likewise. * db2/dbm/dbm.c: Likewise. * db2/hash/hash_auto.c: Likewise. * db2/include/btree_ext.h: Likewise. * db2/include/common_ext.h: Likewise. * db2/include/db.h.src: Likewise. * db2/include/db_cxx.h: Likewise. * db2/include/db_ext.h: Likewise. * db2/include/db_int.h.src: Likewise. * db2/include/lock.h: Likewise. * db2/include/log.h: Likewise. * db2/include/mp.h: Likewise. * db2/include/mp_ext.h: Likewise. * db2/include/os_ext.h: Likewise. * db2/include/os_func.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_get.c: Likewise. * db2/log/log_put.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/README: Likewise. * db2/mutex/mutex.c: Likewise. * db2/os/os_open.c: Likewise. * db2/os/os_func.c: Removed. * db2/os/os_config.c: New file. * db2/os/os_spin.c: New file. * db2/txn/txn.c: Likewise. * db2/txn/txn_auto.c: Likewise. 1997-11-30 06:01 Ulrich Drepper <drepper@cygnus.com> * posix/sys/wait.h (__WAIT_INT): Don't use complex version with __typeof for C++ since this fails for class members. Reported by Neal Becker <neal@ctd.comsat.com>. 1997-11-28 11:21 Zack Weinberg <zack@rabi.phys.columbia.edu> * configure.in: Check for a working makeinfo (3.11 or better). * config.make.in: Add MAKEINFO to be substituted. * manual/Makefile: Don't update info if makeinfo is too old. 1997-11-30 05:21 Ulrich Drepper <drepper@cygnus.com> * sysdeps/alpha/setjmp.S: Define _ASM and _SETJMP_H to get definitions. * sysdeps/alpha/__longjmp.S: Likewise. * sysdeps/unix/sysv/linux/alpha/kernel_termios.h: Include <termios.h> not <bits/termios.h>. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Define syscall as __llseek and make llseek and lseek64 weak aliases. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. Patches by a sun <asun@zoology.washington.edu>. 1997-11-29 19:19 Zack Weinberg <zack@rabi.phys.columbia.edu> * misc/sys/syslog.h: Delete KERNEL preprocessor conditional. * sysdeps/unix/sysv/linux/powerpc/bits/termios.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/termios.h: Likewise. * misc/sys/syslog.h: Clean up BSD header. 1997-11-29 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/bits/in.h: Add changes from Linux 2.1.67. * sysdeps/libm-ieee754/s_ctan.c (__ctan): Raise invalid exception for ctan(+-inf,x). * sysdeps/libm-ieee754/s_ctanl.c (__ctanl): Likewise. * sysdeps/libm-ieee754/s_ctanf.c (__ctanf): Likewise. * math/libm-test.c (csqrt_test): Add tests for cabs, carg, ctan, csqrt (-1), ctanh(i*pi/4). 1997-11-26 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/generic/bits/confname.h: Fix comma in enumerator. 1997-11-28 13:28 Philip Blundell <Philip.Blundell@pobox.com> * sysdeps/unix/sysv/linux/net/if_arp.h: Add more ARPHRD_ constants. 1997-11-26 Andreas Jaeger <aj@arthur.rhein-neckar.de> * wcsmbs/wcrtomb.c (__wcrtomb): Remove unused variable fake. 1997-11-26 21:28 Ulrich Drepper <drepper@cygnus.com> * sysdeps/posix/getcwd.c (GETCWD_STORYGE_CLASS): Remove definition and use. Define GETCWD_RETURN_TYPE instead and use it. * sysdeps/unix/sysv/linux/getcwd.c: Define GETCWD_RETURN_TYPE instead of GETCWD_STORYGE_CLASS and put the return type and the `internal_function' in the right order for gcc 2.7.2. 1997-11-26 Andreas Jaeger <aj@arthur.rhein-neckar.de> * sysdeps/unix/sysv/linux/sys/module.h: Remove file. It's incompatible with Linux 2.1.x. Packages using modules (e.g. modutils) should/do provide their own version. Suggested by Richard Henderson. * sysdeps/unix/sysv/linux/Dist: Remove sys/module.h. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers) [$(subdir)=socket]: Remove sys/module.h. * libio/stdio.h: Correct comment of sys_nerr/sys_errlist.
106 lines
5.8 KiB
Plaintext
106 lines
5.8 KiB
Plaintext
# @(#)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.
|