diff options
-rw-r--r-- | libexec/ld.so/alpha/syscall.h | 14 | ||||
-rw-r--r-- | libexec/ld.so/dir.c | 6 | ||||
-rw-r--r-- | libexec/ld.so/library.c | 18 | ||||
-rw-r--r-- | libexec/ld.so/loader.c | 8 | ||||
-rw-r--r-- | libexec/ld.so/mips/syscall.h | 27 | ||||
-rw-r--r-- | libexec/ld.so/powerpc/syscall.h | 31 | ||||
-rw-r--r-- | libexec/ld.so/resolve.h | 8 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/archdep.h | 6 | ||||
-rw-r--r-- | libexec/ld.so/sparc64/syscall.h | 14 | ||||
-rw-r--r-- | libexec/ld.so/util.c | 4 | ||||
-rw-r--r-- | libexec/ld.so/util.h | 17 |
11 files changed, 78 insertions, 75 deletions
diff --git a/libexec/ld.so/alpha/syscall.h b/libexec/ld.so/alpha/syscall.h index fca8a65c397..91c5dc51d6b 100644 --- a/libexec/ld.so/alpha/syscall.h +++ b/libexec/ld.so/alpha/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.7 2002/07/23 23:56:31 mickey Exp $ */ +/* $OpenBSD: syscall.h,v 1.8 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 2001 Niklas Hallqvist @@ -46,13 +46,13 @@ int _dl_close(int); int _dl_exit(int); int _dl_issetugid(void); -void * _dl_mmap(void *, size_t, int, int, int, off_t); -int _dl_mprotect(const void *, size_t, int); -int _dl_munmap(const void*, size_t); -int _dl_open(const char*, int); -ssize_t _dl_read(int, const char*, size_t); +long _dl_mmap(void *, unsigned int, unsigned int, unsigned int, int, off_t); +int _dl_mprotect(const void *, int, int); +int _dl_munmap(const void*, unsigned int); +int _dl_open(const char*, unsigned int); +int _dl_read(int, const char*, int); int _dl_stat(const char *, struct stat *); -ssize_t _dl_write(int, const char*, size_t); +int _dl_write(int, const char*, int); int _dl_fstat(int, struct stat *); int _dl_fcntl(int, int, ...); int _dl_getdirentries(int, char*, int, long *); diff --git a/libexec/ld.so/dir.c b/libexec/ld.so/dir.c index ce0a3ab5506..f70292ecd3b 100644 --- a/libexec/ld.so/dir.c +++ b/libexec/ld.so/dir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dir.c,v 1.2 2002/07/24 01:05:11 deraadt Exp $ */ +/* $OpenBSD: dir.c,v 1.3 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -83,7 +83,7 @@ _dl_opendir(name) * If the machine's page size is an exact multiple of DIRBLKSIZ, * use a buffer that is cluster boundary aligned. * Hopefully this can be a big win someday by allowing page trades - * to user space to be done by getdirentries() + * to user space to be done by getdirentries() * - not done in ld.so. */ incr = DIRBLKSIZ; @@ -190,7 +190,7 @@ static char rcsid[] = "$ telldir.c,v 1.2 1996/08/19 08:26:35 tholo Exp $"; /* * One of these structures is malloced to describe the current directory - * position each time telldir is called. It records the current magic + * position each time telldir is called. It records the current magic * cookie returned by getdirentries and the offset within the buffer * associated with that return value. */ diff --git a/libexec/ld.so/library.c b/libexec/ld.so/library.c index d6e37e2e80b..f4cda333b8c 100644 --- a/libexec/ld.so/library.c +++ b/libexec/ld.so/library.c @@ -1,4 +1,4 @@ -/* $OpenBSD: library.c,v 1.19 2002/07/24 01:05:11 deraadt Exp $ */ +/* $OpenBSD: library.c,v 1.20 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 2002 Dale Rahn @@ -64,7 +64,7 @@ static elf_object_t *_dl_tryload_shlib(const char *libname, int type); * This fucntion determines if a given name matches what is specified * in a struct sod. The major must match exactly, and the minor must * be same or larger. - * + * * sodp is updated with the minor if this matches. */ @@ -98,7 +98,7 @@ _dl_match_file(struct sod *sodp, char *name, int namelen) match = 1; /* return version matched */ - sodp->sod_minor = lsod.sod_minor; + sodp->sod_minor = lsod.sod_minor; } _dl_free((char *)lsod.sod_name); @@ -119,7 +119,7 @@ _dl_find_shlib(struct sod *sodp, const char *searchpath, int nohints) struct dirent *dp; int match; - /* if we are to search default directories, and hints + /* if we are to search default directories, and hints * are not to be used, search the standard path from ldconfig * (_dl_hint_search_path) or use the default path */ @@ -134,7 +134,7 @@ _dl_find_shlib(struct sod *sodp, const char *searchpath, int nohints) return hint; } else { /* search hints requesting matches for only - * the searchpath directories, + * the searchpath directories, */ pp = searchpath; while (pp) { @@ -164,7 +164,7 @@ nohints: if (searchpath == NULL) { if (_dl_hint_search_path != NULL) searchpath = _dl_hint_search_path; - else + else searchpath = DEFAULT_PATH; } pp = searchpath; @@ -426,7 +426,7 @@ _dl_tryload_shlib(const char *libname, int type) if (phdp->p_type == PT_LOAD) { char *start = (char *)(phdp->p_vaddr & ~align) + loff; int size = (phdp->p_vaddr & align) + phdp->p_filesz; - void *res; + int res; res = _dl_mmap(start, size, PFLAGS(phdp->p_flags), MAP_FIXED|MAP_PRIVATE, libfile, @@ -437,7 +437,7 @@ _dl_tryload_shlib(const char *libname, int type) next_load->start = start; next_load->size = size; next_load->prot = PFLAGS(phdp->p_flags); - if (_dl_check_error((long)res)) { + if (_dl_check_error(res)) { _dl_printf("%s: rtld mmap failed mapping %s.\n", _dl_progname, libname); _dl_close(libfile); @@ -456,7 +456,7 @@ _dl_tryload_shlib(const char *libname, int type) res = _dl_mmap(start, size, PFLAGS(phdp->p_flags), MAP_FIXED|MAP_PRIVATE|MAP_ANON, -1, 0); - if (_dl_check_error((long)res)) { + if (_dl_check_error(res)) { _dl_printf("%s: rtld mmap failed mapping %s.\n", _dl_progname, libname); _dl_close(libfile); diff --git a/libexec/ld.so/loader.c b/libexec/ld.so/loader.c index 44d3e605691..4cb7fd49778 100644 --- a/libexec/ld.so/loader.c +++ b/libexec/ld.so/loader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: loader.c,v 1.39 2002/07/24 01:05:11 deraadt Exp $ */ +/* $OpenBSD: loader.c,v 1.40 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -73,7 +73,7 @@ _dl_debug_state(void) } /* - * Routine to walk through all of the objects except the first + * Routine to walk through all of the objects except the first * (main executable). */ void @@ -192,7 +192,7 @@ _dl_boot(const char **argv, char **envp, const long loff, phdp++; } - if (_dl_preload != NULL) + if (_dl_preload != NULL) _dl_dopreload(_dl_preload); /* @@ -232,7 +232,7 @@ _dl_boot(const char **argv, char **envp, const long loff, * Everything should be in place now for doing the relocation * and binding. Call _dl_rtld to do the job. Fingers crossed. */ - if (_dl_traceld == NULL) + if (_dl_traceld == NULL) _dl_rtld(_dl_objects); /* diff --git a/libexec/ld.so/mips/syscall.h b/libexec/ld.so/mips/syscall.h index 0437d269c34..0e33a3a6d2d 100644 --- a/libexec/ld.so/mips/syscall.h +++ b/libexec/ld.so/mips/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.7 2002/07/23 23:56:31 mickey Exp $ */ +/* $OpenBSD: syscall.h,v 1.8 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -65,7 +65,7 @@ _dl_exit (int status) } extern inline int -_dl_open (const char* addr, int flags) +_dl_open (const char* addr, unsigned int flags) { register int status __asm__ ("$2"); @@ -99,10 +99,10 @@ _dl_close (int fd) return status; } -extern inline ssize_t -_dl_write (int fd, const char* buf, size_t len) +extern inline int +_dl_write (int fd, const char* buf, int len) { - register ssize_t status __asm__ ("$2"); + register int status __asm__ ("$2"); __asm__ volatile ("move $4,%2\n\t" "move $5,%3\n\t" @@ -118,10 +118,10 @@ _dl_write (int fd, const char* buf, size_t len) return status; } -extern inline ssize_t -_dl_read (int fd, const char* buf, size_t len) +extern inline int +_dl_read (int fd, const char* buf, int len) { - register ssize_t status __asm__ ("$2"); + register int status __asm__ ("$2"); __asm__ volatile ("move $4,%2\n\t" "move $5,%3\n\t" @@ -137,10 +137,11 @@ _dl_read (int fd, const char* buf, size_t len) return status; } -extern inline void * -_dl_mmap (void *addr, size_t size, int prot, int flags, int fd, off_t f_offset) +extern inline int +_dl_mmap (void *addr, unsigned int size, unsigned int prot, + unsigned int flags, int fd, unsigned int f_offset) { - register void * malloc_buffer __asm__ ("$2"); + register int malloc_buffer __asm__ ("$2"); __asm__ volatile ("addiu $29,-40\n\t" "move $6,%2\n\t" @@ -174,7 +175,7 @@ _dl_mmap (void *addr, size_t size, int prot, int flags, int fd, off_t f_offset) } extern inline int -_dl_munmap (const void* addr, size_t len) +_dl_munmap (const void* addr, unsigned int len) { register int status __asm__ ("$2"); @@ -192,7 +193,7 @@ _dl_munmap (const void* addr, size_t len) } extern inline int -_dl_mprotect (const void *addr, size_t size, int prot) +_dl_mprotect (const void *addr, int size, int prot) { register int status __asm__ ("$2"); diff --git a/libexec/ld.so/powerpc/syscall.h b/libexec/ld.so/powerpc/syscall.h index ff413c6c8ca..0ed17c6e198 100644 --- a/libexec/ld.so/powerpc/syscall.h +++ b/libexec/ld.so/powerpc/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.11 2002/07/24 01:05:11 deraadt Exp $ */ +/* $OpenBSD: syscall.h,v 1.12 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -68,7 +68,7 @@ _dl_exit (int status) } static inline int -_dl_open (const char* addr, int flags) +_dl_open (const char* addr, unsigned int flags) { register int status __asm__ ("3"); @@ -104,10 +104,10 @@ _dl_close (int fd) return status; } -static inline ssize_t -_dl_write (int fd, const char* buf, size_t len) +static inline int +_dl_write (int fd, const char* buf, int len) { - register ssize_t status __asm__ ("3"); + register int status __asm__ ("3"); __asm__ volatile ("mr 0,%1\n\t" "mr 3,%2\n\t" @@ -124,10 +124,10 @@ _dl_write (int fd, const char* buf, size_t len) return status; } -static inline ssize_t -_dl_read (int fd, const char* buf, size_t len) +static inline int +_dl_read (int fd, const char* buf, int len) { - register ssize_t status __asm__ ("3"); + register int status __asm__ ("3"); __asm__ volatile ("mr 0,%1\n\t" "mr 3,%2\n\t" @@ -158,15 +158,16 @@ __asm__(".align 2\n\t" "1:\n\t" "blr"); -static inline void * -_dl_mmap (void *addr, size_t len, int prot, int flags, int fd, off_t offset) +static inline int +_dl_mmap (void *addr, unsigned int len, unsigned int prot, + unsigned int flags, int fd, off_t offset) { - return((void *)_dl__syscall((quad_t)SYS_mmap, addr, len, prot, + return((int)_dl__syscall((quad_t)SYS_mmap, addr, len, prot, flags, fd, 0, offset)); } static inline int -_dl_munmap (const void* addr, size_t len) +_dl_munmap (const void* addr, unsigned int len) { register int status __asm__ ("3"); @@ -185,7 +186,7 @@ _dl_munmap (const void* addr, size_t len) } static inline int -_dl_mprotect (const void *addr, size_t size, int prot) +_dl_mprotect (const void *addr, int size, int prot) { register int status __asm__ ("3"); @@ -279,7 +280,7 @@ _dl_getdirentries(int fd, char *buf, int nbytes, long *basep) "1:" : "=r" (status) : "r" (SYS_getdirentries), "r" (fd), "r" (buf), "r"(nbytes), - "r" (basep) + "r" (basep) : "0", "3", "4", "5", "6"); return status; } @@ -304,6 +305,6 @@ _dl_issetugid() static inline off_t _dl_lseek(int fildes, off_t offset, int whence) { - return _dl__syscall((quad_t)SYS_lseek, fildes, 0, offset, whence); + return _dl__syscall((quad_t)SYS_lseek, fildes, 0, offset, whence); } #endif /*__DL_SYSCALL_H__*/ diff --git a/libexec/ld.so/resolve.h b/libexec/ld.so/resolve.h index cb67d39c363..705c889a7d7 100644 --- a/libexec/ld.so/resolve.h +++ b/libexec/ld.so/resolve.h @@ -1,4 +1,4 @@ -/* $OpenBSD: resolve.h,v 1.13 2002/07/24 00:13:55 deraadt Exp $ */ +/* $OpenBSD: resolve.h,v 1.14 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -122,8 +122,8 @@ typedef struct elf_object { extern void _dl_rt_resolve(void); extern elf_object_t *_dl_add_object(const char *objname, Elf_Dyn *dynp, - const u_long *, const int objtype, - const long laddr, const long loff); + const u_long *, const int objtype, + const long laddr, const long loff); extern void _dl_remove_object(elf_object_t *object); extern elf_object_t *_dl_lookup_object(const char *objname); @@ -134,7 +134,7 @@ extern int _dl_md_reloc(elf_object_t *object, int rel, int relsz); extern void _dl_md_reloc_got(elf_object_t *object, int lazy); Elf_Addr _dl_find_symbol(const char *name, elf_object_t *startlook, - const Elf_Sym **ref, int myself, int warnnotfound); + const Elf_Sym **ref, int myself, int warnnotfound); void _dl_rtld(elf_object_t *object); void _dl_call_init(elf_object_t *object); diff --git a/libexec/ld.so/sparc64/archdep.h b/libexec/ld.so/sparc64/archdep.h index 8e3c1b19d36..3f3257fa865 100644 --- a/libexec/ld.so/sparc64/archdep.h +++ b/libexec/ld.so/sparc64/archdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: archdep.h,v 1.10 2002/07/24 00:12:47 deraadt Exp $ */ +/* $OpenBSD: archdep.h,v 1.11 2002/07/24 04:00:45 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -49,11 +49,11 @@ #include "syscall.h" #include "util.h" -static inline void * +static inline long _dl_mmap(void *addr, unsigned int len, unsigned int prot, unsigned int flags, int fd, off_t offset) { - return((void *)_dl__syscall((quad_t)SYS_mmap, addr, len, prot, + return(_dl__syscall((quad_t)SYS_mmap, addr, len, prot, flags, fd, 0, offset)); } diff --git a/libexec/ld.so/sparc64/syscall.h b/libexec/ld.so/sparc64/syscall.h index 1be4c3faf1c..83d6f9d2536 100644 --- a/libexec/ld.so/sparc64/syscall.h +++ b/libexec/ld.so/sparc64/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.8 2002/07/24 01:05:11 deraadt Exp $ */ +/* $OpenBSD: syscall.h,v 1.9 2002/07/24 04:00:45 deraadt Exp $ */ /* * Copyright (c) 2001 Niklas Hallqvist @@ -48,12 +48,12 @@ int _dl_close(int); int _dl_exit(int); int _dl_issetugid(void); long _dl__syscall(quad_t, ...); -int _dl_mprotect(const void *, size_t, int); -int _dl_munmap(const void*, size_t); -int _dl_open(const char*, int); -ssize_t _dl_read(int, const char*, size_t); +int _dl_mprotect(const void *, int, int); +int _dl_munmap(const void*, unsigned int); +int _dl_open(const char*, unsigned int); +int _dl_read(int, const char*, int); int _dl_stat(const char *, struct stat *); -ssize_t _dl_write(int, const char*, size_t); +int _dl_write(int, const char*, int); int _dl_fstat(int, struct stat *); int _dl_fcntl(int, int, ...); int _dl_getdirentries(int, char*, int, long *); @@ -61,7 +61,7 @@ int _dl_getdirentries(int, char*, int, long *); static inline off_t _dl_lseek(int fildes, off_t offset, int whence) { - return _dl__syscall((quad_t)SYS_lseek, fildes, 0, offset, whence); + return _dl__syscall((quad_t)SYS_lseek, fildes, 0, offset, whence); } #endif /*__DL_SYSCALL_H__*/ diff --git a/libexec/ld.so/util.c b/libexec/ld.so/util.c index 8acf9bfc2cf..3324cc72a54 100644 --- a/libexec/ld.so/util.c +++ b/libexec/ld.so/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.7 2002/07/24 00:13:55 deraadt Exp $ */ +/* $OpenBSD: util.c,v 1.8 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 1998 Per Fogelstrom, Opsycon AB @@ -66,7 +66,7 @@ _dl_strdup(const char *orig) */ void * -_dl_malloc(size_t size) +_dl_malloc(int size) { long *p, *t, *n; diff --git a/libexec/ld.so/util.h b/libexec/ld.so/util.h index 4a204b3e9df..53118a25238 100644 --- a/libexec/ld.so/util.h +++ b/libexec/ld.so/util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: util.h,v 1.8 2002/07/24 00:13:55 deraadt Exp $ */ +/* $OpenBSD: util.h,v 1.9 2002/07/24 04:00:44 deraadt Exp $ */ /* * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> @@ -36,7 +36,8 @@ #ifndef __DL_UTIL_H__ #define __DL_UTIL_H__ -void *_dl_malloc(const size_t size); +int _dl_write(int, const char *, int); +void *_dl_malloc(const int size); void _dl_free(void *); char *_dl_strdup(const char *); void _dl_printf(const char *fmt, ...); @@ -56,12 +57,12 @@ _dl_wrstderr(const char *s) } static inline void * -_dl_memset(void *p, const int v, size_t c) +_dl_memset(void *p, const char v, size_t c) { char *ip = p; while (c--) - *ip++ = (char)v; + *ip++ = v; return(p); } @@ -76,7 +77,7 @@ _dl_strlen(const char *p) } static inline size_t -_dl_strlcpy(char *dst, const char *src, size_t siz) +_dl_strlcpy(char *dst, const char *src, int siz) { char *d = dst; const char *s = src; @@ -102,13 +103,13 @@ _dl_strlcpy(char *dst, const char *src, size_t siz) } static inline int -_dl_strncmp(const char *d, const char *s, size_t len) +_dl_strncmp(const char *d, const char *s, int c) { - while (len-- && *d && *d == *s) { + while (c-- && *d && *d == *s) { d++; s++; } - if (len < 0) + if (c < 0) return(0); return(*d - *s); } |