mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 04:50:07 +00:00
Update.
1998-08-25 Ulrich Drepper <drepper@cygnus.com> * sysdeps/generic/dl-cache.c: Move static variable cache and cachesize to toplevel. (_dl_unload_cache): New function. * elf/Versions [libc GLIBC_2.1]: Add _dl_unload_cache. * elf/dl-open.c (_dl_open): Unload map file before freeing the lock. * elf/rtld (dl_main): Unload map file before jumping to user code. * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Define O_DIRECT. Correct comment for O_LARGEFILE. * sysdeps/unix/sysv/linux/bits/fcntl.h: Define O_DIRECT. Change O_LARGEFILE to correct value. 1998-08-25 14:34 Ulrich Drepper <drepper@cygnus.com> * libio/iogetline.c (_IO_getline_info): Don't read anything for N == 0. Patch by HJ Lu.
This commit is contained in:
parent
6dbb7062ff
commit
08cac4ac19
19
ChangeLog
19
ChangeLog
@ -1,3 +1,22 @@
|
||||
1998-08-25 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* sysdeps/generic/dl-cache.c: Move static variable cache and cachesize
|
||||
to toplevel.
|
||||
(_dl_unload_cache): New function.
|
||||
* elf/Versions [libc GLIBC_2.1]: Add _dl_unload_cache.
|
||||
* elf/dl-open.c (_dl_open): Unload map file before freeing the lock.
|
||||
* elf/rtld (dl_main): Unload map file before jumping to user code.
|
||||
|
||||
* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Define O_DIRECT.
|
||||
Correct comment for O_LARGEFILE.
|
||||
* sysdeps/unix/sysv/linux/bits/fcntl.h: Define O_DIRECT.
|
||||
Change O_LARGEFILE to correct value.
|
||||
|
||||
1998-08-25 14:34 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* libio/iogetline.c (_IO_getline_info): Don't read anything for
|
||||
N == 0. Patch by HJ Lu.
|
||||
|
||||
1998-08-25 11:43 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* elf/elf.h: Add syminfo stuff and other DT_* from Solaris' ELF.
|
||||
|
@ -21,7 +21,7 @@ libc {
|
||||
_dl_profile; _dl_profile_map; _dl_profile_output; _dl_start_profile;
|
||||
|
||||
# functions used in other libraries
|
||||
_dl_mcount; _dl_mcount_wrapper; _dl_mcount_wrapper_check;
|
||||
_dl_mcount; _dl_mcount_wrapper; _dl_mcount_wrapper_check; _dl_unload_cache;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/mman.h> /* Check whether MAP_COPY is defined. */
|
||||
#include <bits/libc-lock.h>
|
||||
#include <elf/ldsodefs.h>
|
||||
|
||||
@ -31,6 +32,9 @@ extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
|
||||
ElfW(Addr) *user_entry));
|
||||
weak_extern (_dl_sysdep_start)
|
||||
|
||||
/* This function is used to unload the cache file if necessary. */
|
||||
extern void _dl_unload_cache (void);
|
||||
|
||||
extern int __libc_multiple_libcs; /* Defined in init-first.c. */
|
||||
|
||||
extern int __libc_argc;
|
||||
@ -224,6 +228,11 @@ _dl_open (const char *file, int mode)
|
||||
args.map = NULL;
|
||||
errcode = _dl_catch_error (&errstring, dl_open_worker, &args);
|
||||
|
||||
#ifndef MAP_COPY
|
||||
/* We must munmap() the cache file. */
|
||||
_dl_unload_cache ();
|
||||
#endif
|
||||
|
||||
/* Release the lock. */
|
||||
__libc_lock_unlock (_dl_load_lock);
|
||||
|
||||
|
@ -40,6 +40,9 @@ extern ElfW(Addr) _dl_sysdep_start (void **start_argptr,
|
||||
ElfW(Addr) *user_entry));
|
||||
extern void _dl_sysdep_start_cleanup (void);
|
||||
|
||||
/* This function is used to unload the cache file if necessary. */
|
||||
extern void _dl_unload_cache (void);
|
||||
|
||||
/* System-dependent function to read a file's whole contents
|
||||
in the most convenient manner available. */
|
||||
extern void *_dl_sysdep_read_whole_file (const char *filename,
|
||||
@ -918,6 +921,11 @@ of this helper program; chances are you did not intend to run this program.\n\
|
||||
_dl_debug_state ();
|
||||
}
|
||||
|
||||
#ifndef MAP_COPY
|
||||
/* We must munmap() the cache file. */
|
||||
_dl_unload_cache ();
|
||||
#endif
|
||||
|
||||
/* Now enable profiling if needed. */
|
||||
if (_dl_profile_map != NULL)
|
||||
/* We must prepare the profiling. */
|
||||
|
@ -59,7 +59,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
|
||||
char *ptr = buf;
|
||||
if (eof != NULL)
|
||||
*eof = 0;
|
||||
do
|
||||
while (n != 0);
|
||||
{
|
||||
_IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
|
||||
if (len <= 0)
|
||||
@ -108,7 +108,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
|
||||
ptr += len;
|
||||
n -= len;
|
||||
}
|
||||
} while (n != 0);
|
||||
}
|
||||
return ptr - buf;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,10 @@ struct cache_file
|
||||
} libs[0];
|
||||
};
|
||||
|
||||
/* This is the starting address and the size of the mmap()ed file. */
|
||||
static struct cache_file *cache;
|
||||
static size_t cachesize;
|
||||
|
||||
/* This is the cache ID we expect. Normally it is 3 for glibc linked
|
||||
binaries. */
|
||||
int _dl_correct_cache_id = 3;
|
||||
@ -54,8 +58,6 @@ int _dl_correct_cache_id = 3;
|
||||
const char *
|
||||
_dl_load_cache_lookup (const char *name)
|
||||
{
|
||||
static struct cache_file *cache;
|
||||
static size_t cachesize;
|
||||
unsigned int i;
|
||||
const char *best;
|
||||
|
||||
@ -114,3 +116,19 @@ _dl_load_cache_lookup (const char *name)
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
#ifndef MAP_COPY
|
||||
/* If the system does not support MAP_COPY we cannot leave the file open
|
||||
all the time since this would create problems when the file is replaced.
|
||||
Therefore we provide this function to close the file and open it again
|
||||
once needed. */
|
||||
void
|
||||
_dl_unload_cache (void)
|
||||
{
|
||||
if (cache != NULL && cache != (struct cache_file *) -1)
|
||||
{
|
||||
__munmap (cache, cachesize);
|
||||
cache = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -43,7 +43,11 @@
|
||||
#define O_FSYNC O_SYNC
|
||||
#define O_ASYNC 020000 /* fcntl, for BSD compatibility */
|
||||
|
||||
/* XXX missing */
|
||||
#ifdef __USE_GNU
|
||||
# define O_DIRECT 040000 /* Direct disk access. */
|
||||
#endif
|
||||
|
||||
/* Not necessary, files are always with 64bit off_t. */
|
||||
#define O_LARGEFILE 0
|
||||
|
||||
/* Values for the second argument to `fcntl'. */
|
||||
|
@ -41,6 +41,10 @@
|
||||
#define O_FSYNC O_SYNC
|
||||
#define O_ASYNC 020000
|
||||
|
||||
#ifdef __USE_GNU
|
||||
# define O_DIRECT 040000 /* Direct disk access. */
|
||||
#endif
|
||||
|
||||
/* For now Linux has synchronisity options for data and read operations.
|
||||
We define the symbols here but let them do the same as O_SYNC since
|
||||
this is a superset. */
|
||||
@ -49,9 +53,8 @@
|
||||
# define O_RSYNC O_SYNC /* Synchronize read operations. */
|
||||
#endif
|
||||
|
||||
/* XXX missing */
|
||||
#ifdef __USE_LARGEFILE64
|
||||
# define O_LARGEFILE 0
|
||||
# define O_LARGEFILE 0100000
|
||||
#endif
|
||||
|
||||
/* Values for the second argument to `fcntl'. */
|
||||
|
Loading…
Reference in New Issue
Block a user