From ddbf7fef451eeb417ea28ca114f8f12c58dd5ca8 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 29 Jul 1998 18:41:02 +0000 Subject: Update. 1998-07-29 Mark Kettenis * sysdeps/mach/hurd/dl-sysdep.c (__lseek): New function. (__getpid): New function. (abort): New function. * nis/nis_cache2_xdr.c: Removed. --- sysdeps/mach/hurd/dl-sysdep.c | 49 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) (limited to 'sysdeps/mach/hurd/dl-sysdep.c') diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index abaf0b2676..2495af4de9 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -500,6 +500,18 @@ __libc_read (int fd, void *buf, size_t nbytes) return nread; } +off_t weak_function +__lseek (int fd, off_t offset, int whence) +{ + error_t err; + + err = __io_seek ((mach_port_t) fd, offset, whence, &offset); + if (err) + return __hurd_fail (err); + + return offset; +} + __ptr_t weak_function __mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset) { @@ -570,7 +582,6 @@ __fxstat (int vers, int fd, struct stat *buf) return __hurd_fail (err); return 0; - } int weak_function @@ -590,6 +601,19 @@ __xstat (int vers, const char *file, struct stat *buf) return 0; } +pid_t weak_function +__getpid () +{ + pid_t pid, ppid; + int orphaned; + + if (__proc_getpids (_dl_hurd_data->portarray[INIT_PORT_PROC], + &pid, &ppid, &orphaned)) + return -1; + + return pid; +} + void weak_function _exit (int status) { @@ -598,6 +622,29 @@ _exit (int status) while (__task_terminate (__mach_task_self ())) __mach_task_self_ = (__mach_task_self) (); } + +/* Try to get a machine dependent instruction which will make the + program crash. This is used in case everything else fails. */ +#include +#ifndef ABORT_INSTRUCTION +/* No such instruction is available. */ +# define ABORT_INSTRUCTION +#endif + +void weak_function +abort (void) +{ + /* Try to abort using the system specific command. */ + ABORT_INSTRUCTION; + + /* If the abort instruction failed, exit. */ + _exit (127); + + /* If even this fails, make sure we never return. */ + while (1) + /* Try for ever and ever. */ + ABORT_INSTRUCTION; +} /* This function is called by interruptible RPC stubs. For initial dynamic linking, just use the normal mach_msg. Since this defn is -- cgit 1.4.1