aboutsummaryrefslogtreecommitdiff
path: root/hurd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
committerJakub Jelinek <jakub@redhat.com>2007-07-12 18:26:36 +0000
commit0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (patch)
tree2ea1f8305970753e4a657acb2ccc15ca3eec8e2c /hurd
parent7d58530341304d403a6626d7f7a1913165fe2f32 (diff)
downloadglibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.tar.xz
glibc-0ecb606cb6cf65de1d9fc8a919bceb4be476c602.zip
2.5-18.1
Diffstat (limited to 'hurd')
-rw-r--r--hurd/Depend9
-rw-r--r--hurd/Makefile6
-rw-r--r--hurd/exc2signal.c71
-rw-r--r--hurd/getdport.c7
-rw-r--r--hurd/hurd/fd.h18
-rw-r--r--hurd/hurd/lookup.h34
-rw-r--r--hurd/hurd/xattr.h35
-rw-r--r--hurd/hurdfault.c5
-rw-r--r--hurd/hurdlookup.c14
-rw-r--r--hurd/hurdmalloc.c58
-rw-r--r--hurd/hurdsig.c6
-rw-r--r--hurd/intr-msg.c22
-rw-r--r--hurd/longjmp-ts.c32
-rw-r--r--hurd/lookup-at.c110
-rw-r--r--hurd/lookup-retry.c4
-rw-r--r--hurd/report-wait.c8
-rw-r--r--hurd/sigunwind.c19
-rw-r--r--hurd/trampoline.c37
-rw-r--r--hurd/xattr.c201
19 files changed, 589 insertions, 107 deletions
diff --git a/hurd/Depend b/hurd/Depend
new file mode 100644
index 0000000000..b108b245b8
--- /dev/null
+++ b/hurd/Depend
@@ -0,0 +1,9 @@
+# This file says that the mach subdirectory should appear before this one.
+# The mach and hurd subdirectories have many generated header files which
+# much of the rest of the library depends on, so it is best to build them
+# first (and mach before hurd, at that). The before-compile additions in
+# sysdeps/{mach,hurd}/Makefile should make it reliably work for these files
+# not to exist when making in other directories, but it will be slower that
+# way with more somewhat expensive `make' invocations.
+
+mach
diff --git a/hurd/Makefile b/hurd/Makefile
index ccf596c918..ab5a8485a2 100644
--- a/hurd/Makefile
+++ b/hurd/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991,92,93,94,95,96,97,98,99,2001,2002
+# Copyright (C) 1991,92,93,94,95,96,97,98,99,2001,2002,2004,2006
# Free Software Foundation, Inc.
# This file is part of the GNU C Library.
@@ -46,7 +46,7 @@ server-interfaces := hurd/msg faultexc
routines = hurdstartup hurdinit \
hurdid hurdpid hurdrlimit hurdprio hurdexec hurdselect \
- hurdlookup lookup-retry \
+ hurdlookup lookup-retry lookup-at \
get-host set-host \
path-lookup \
setauth \
@@ -60,7 +60,7 @@ routines = hurdstartup hurdinit \
vpprintf \
ports-get ports-set hurdports hurdmsg \
errno-loc \
- $(sig) $(dtable) $(inlines) port-cleanup report-wait
+ $(sig) $(dtable) $(inlines) port-cleanup report-wait xattr
sig = hurdsig hurdfault siginfo hurd-raise preempt-sig \
trampoline longjmp-ts catch-exc exc2signal hurdkill sigunwind \
thread-self thread-cancel intr-msg catch-signal
diff --git a/hurd/exc2signal.c b/hurd/exc2signal.c
new file mode 100644
index 0000000000..de044bbcf4
--- /dev/null
+++ b/hurd/exc2signal.c
@@ -0,0 +1,71 @@
+/* Translate Mach exception codes into signal numbers. Stub version.
+ Copyright (C) 1991, 1992, 1994, 1995, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <hurd.h>
+
+/* This file must be modified with machine-dependent details. */
+#error "need to write sysdeps/mach/hurd/MACHINE/exc2signal.c"
+
+/* Translate the Mach exception codes, as received in an `exception_raise' RPC,
+ into a signal number and signal subcode. */
+
+void
+_hurd_exception2signal (int exception, int code, int subcode,
+ int *signo, int *sigcode, int *error)
+{
+ *error = 0;
+
+ switch (exception)
+ {
+ default:
+ *signo = SIGIOT;
+ *sigcode = exception;
+ break;
+
+ case EXC_BAD_ACCESS:
+ if (code == KERN_PROTECTION_FAILURE)
+ *signo = SIGSEGV;
+ else
+ *signo = SIGBUS;
+ *sigcode = subcode;
+ *error = code;
+ break;
+
+ case EXC_BAD_INSTRUCTION:
+ *signo = SIGILL;
+ *sigcode = 0;
+ break;
+
+ case EXC_ARITHMETIC:
+ *signo = SIGFPE;
+ *sigcode = 0;
+ break;
+
+ case EXC_EMULATION:
+ case EXC_SOFTWARE:
+ *signo = SIGEMT;
+ *sigcode = 0;
+ break;
+
+ case EXC_BREAKPOINT:
+ *signo = SIGTRAP;
+ *sigcode = 0;
+ break;
+ }
+}
diff --git a/hurd/getdport.c b/hurd/getdport.c
index eeb5a8689e..41567d5fe1 100644
--- a/hurd/getdport.c
+++ b/hurd/getdport.c
@@ -35,8 +35,11 @@ __getdport (int fd)
so we don't bother allocating a real table. */
if (_hurd_init_dtable == NULL)
- /* Never had a descriptor table. */
- return EBADF;
+ {
+ /* Never had a descriptor table. */
+ errno = EBADF;
+ return MACH_PORT_NULL;
+ }
if (fd < 0 || (unsigned int) fd > _hurd_init_dtablesize ||
_hurd_init_dtable[fd] == MACH_PORT_NULL)
diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
index 198791b807..ad11367f3b 100644
--- a/hurd/hurd/fd.h
+++ b/hurd/hurd/fd.h
@@ -1,5 +1,5 @@
/* File descriptors.
- Copyright (C) 1993,94,95,96,97,98,99,2000,01,02
+ Copyright (C) 1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -240,5 +240,21 @@ extern int _hurd_select (int nfds, struct pollfd *pollfds,
const struct timespec *timeout,
const sigset_t *sigmask);
+/* Variant of file_name_lookup used in *at function implementations.
+ AT_FLAGS should contain only AT_SYMLINK_NOFOLLOW; other bits
+ cause EINVAL. */
+extern file_t __file_name_lookup_at (int fd, int at_flags,
+ const char *file_name,
+ int flags, mode_t mode);
+
+/* Variant of file_name_split used in *at function implementations. */
+extern file_t __file_name_split_at (int fd, const char *file_name,
+ char **name);
+
+/* Variant of directory_name_split used in *at function implementations. */
+extern file_t __directory_name_split_at (int fd, const char *directory_name,
+ char **name);
+
+
#endif /* hurd/fd.h */
diff --git a/hurd/hurd/lookup.h b/hurd/hurd/lookup.h
index faa35e0bf6..1d013d9537 100644
--- a/hurd/hurd/lookup.h
+++ b/hurd/hurd/lookup.h
@@ -1,5 +1,5 @@
/* Declarations of file name translation functions for the GNU Hurd.
- Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1997, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -76,8 +76,8 @@ error_t __hurd_file_name_split (error_t (*use_init_port)
(int which,
error_t (*operate) (mach_port_t)),
file_t (*get_dtable_port) (int fd),
- error_t (*lookup)
- (file_t dir, char *name, int flags, mode_t mode,
+ error_t (*lookup) (file_t dir, char *name,
+ int flags, mode_t mode,
retry_type *do_retry, string_t retry_name,
mach_port_t *result),
const char *file_name,
@@ -86,13 +86,37 @@ error_t hurd_file_name_split (error_t (*use_init_port)
(int which,
error_t (*operate) (mach_port_t)),
file_t (*get_dtable_port) (int fd),
- error_t (*lookup)
- (file_t dir, char *name, int flags, mode_t mode,
+ error_t (*lookup) (file_t dir, char *name,
+ int flags, mode_t mode,
retry_type *do_retry, string_t retry_name,
mach_port_t *result),
const char *file_name,
file_t *dir, char **name);
+/* Split DIRECTORY into a parent directory and a name within the directory.
+ This is the same as hurd_file_name_split, but ignores trailing slashes. */
+
+error_t __hurd_directory_name_split (error_t (*use_init_port)
+ (int which,
+ error_t (*operate) (mach_port_t)),
+ file_t (*get_dtable_port) (int fd),
+ error_t (*lookup) (file_t dir, char *name,
+ int flags, mode_t mode,
+ retry_type *do_retry, string_t retry_name,
+ mach_port_t *result),
+ const char *directory_name,
+ file_t *dir, char **name);
+error_t hurd_directory_name_split (error_t (*use_init_port)
+ (int which,
+ error_t (*operate) (mach_port_t)),
+ file_t (*get_dtable_port) (int fd),
+ error_t (*lookup) (file_t dir, char *name,
+ int flags, mode_t mode,
+ retry_type *do_retry, string_t retry_name,
+ mach_port_t *result),
+ const char *directory_name,
+ file_t *dir, char **name);
+
/* Process the values returned by `dir_lookup' et al, and loop doing
`dir_lookup' calls until one returns FS_RETRY_NONE. The arguments
diff --git a/hurd/hurd/xattr.h b/hurd/hurd/xattr.h
new file mode 100644
index 0000000000..aaa7fd8eaa
--- /dev/null
+++ b/hurd/hurd/xattr.h
@@ -0,0 +1,35 @@
+/* Access to extended attributes on files for GNU/Hurd.
+ Copyright (C) 2005 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _HURD_XATTR_H
+#define _HURD_XATTR_H 1
+
+#include <sys/xattr.h> /* This defines the XATTR_* flags. */
+
+/* These are the internal versions of getxattr/setxattr/listxattr. */
+extern error_t _hurd_xattr_get (io_t port, const char *name,
+ void *value, size_t *size);
+extern error_t _hurd_xattr_set (io_t port, const char *name,
+ const void *value, size_t size, int flags);
+extern error_t _hurd_xattr_remove (io_t port, const char *name);
+extern error_t _hurd_xattr_list (io_t port, void *buffer, size_t *size);
+
+
+
+#endif /* hurd/xattr.h */
diff --git a/hurd/hurdfault.c b/hurd/hurdfault.c
index 6ab5a97876..36653e1488 100644
--- a/hurd/hurdfault.c
+++ b/hurd/hurdfault.c
@@ -1,5 +1,6 @@
/* Handle faults in the signal thread.
- Copyright (C) 1994,95,96,97,2002 Free Software Foundation, Inc.
+ Copyright (C) 1994,1995,1996,1997,2002,2005
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +25,7 @@
#include <string.h>
#include <setjmp.h>
#include <stdio.h>
-#include "thread_state.h"
+#include <thread_state.h>
#include "faultexc_server.h" /* mig-generated header for our exc server. */
#include <assert.h>
diff --git a/hurd/hurdlookup.c b/hurd/hurdlookup.c
index 77de27150a..8270132b90 100644
--- a/hurd/hurdlookup.c
+++ b/hurd/hurdlookup.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992,93,94,95,96,97,99,2001,2004
+/* Copyright (C) 1992,1993,1994,1995,1996,1997,1999,2001,2004,2006
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -184,19 +184,7 @@ __hurd_directory_name_split (error_t (*use_init_port)
--lastslash;
/* Find the last one earlier in the string, before the trailing ones. */
-#if __GLIBC__ > 2 || __GLIBC_MINOR__ >= 2
lastslash = __memrchr (file_name, '/', lastslash - file_name);
-#else
- /* Keep backing up, looking for a slash. */
- do
- if (lastslash == file_name)
- {
- /* Hit the start with no slash. */
- lastslash = NULL;
- break;
- }
- while (*lastslash-- != '/');
-#endif
}
if (lastslash != NULL)
diff --git a/hurd/hurdmalloc.c b/hurd/hurdmalloc.c
index 4839d98535..12da1f2abc 100644
--- a/hurd/hurdmalloc.c
+++ b/hurd/hurdmalloc.c
@@ -33,63 +33,7 @@
* the rights to redistribute these changes.
*/
/*
- * HISTORY
- * $Log$
- * Revision 1.15 2001/09/19 03:04:09 drepper
- * (bcopy): Removed.
- * (realloc): Replace bcopy with memcpy.
- *
- * Revision 1.14 2001/04/01 05:03:14 roland
- * 2001-03-11 Roland McGrath <roland@frob.com>
- *
- * * mach/mach_error.h: Fix ancient #endif syntax.
- * * hurd/hurdmalloc.c: Likewise.
- *
- * Revision 1.13 1996/12/20 01:32:01 drepper
- * Update from main archive 961219
- *
- * Revision 1.12 1996/11/15 19:44:13 thomas
- * Tue Nov 12 16:58:41 1996 Thomas Bushnell, n/BSG <thomas@gnu.ai.mit.edu>
- *
- * * mach/msg-destroy.c (mach_msg_destroy_port,
- * mach_msg_destroy_memory): Use prototype syntax.
- * * hurd/hurdmalloc.c (more_memory, malloc_fork_prepare,
- * malloc_fork_parent, malloc_fork_child): Likewise.
- *
- * Revision 1.11 1996/06/06 15:13:47 miles
- * Changes to bring in line with the hurd libthreads/malloc.c:
- * (more_memory): Use assert_perror instead of MACH_CALL.
- * "cthread_internals.h": Include removed.
- * (realloc): Use LOG2_MIN_SIZE.
- * (LOG2_MIN_SIZE): New macro.
- * (realloc): Don't bother allocating a new block if the
- * new size request fits in the old one and doesn't waste any space.
- * Only free the old block if we successfully got a new one.
- * [MCHECK] (struct header): New type.
- * (union header): Only define if !MCHECK.
- * (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros.
- * [MCHECK] (MIN_SIZE): Add correct definition for this case.
- * (more_memory, malloc, free, realloc): Use above macros, and add
- * appropriate checks & frobs in MCHECK case.
- *
- * Revision 1.6 1996/03/07 21:13:08 miles
- * (realloc):
- * Use LOG2_MIN_SIZE.
- * Don't bother allocating a new block if the new size request fits in the old
- * one and doesn't waste any space.
- * Only free the old block if we successfully got a new one.
- * (LOG2_MIN_SIZE): New macro.
- *
- * Revision 1.5 1996/03/06 23:51:04 miles
- * [MCHECK] (struct header): New type.
- * (union header): Only define if !MCHECK.
- * (HEADER_SIZE, HEADER_NEXT, HEADER_FREE, HEADER_CHECK): New macros.
- * [MCHECK] (MIN_SIZE): Add correct definition for this case.
- * (more_memory, malloc, free, realloc):
- * Use above macros, and add appropriate checks & frobs in MCHECK case.
- *
- * Revision 1.4 1994/05/05 11:21:42 roland
- * entered into RCS
+ * (pre-GNU) HISTORY
*
* Revision 2.7 91/05/14 17:57:34 mrt
* Correcting copyright
diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c
index bbd0c17182..e12d19da12 100644
--- a/hurd/hurdsig.c
+++ b/hurd/hurdsig.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2000,01,2002
+/* Copyright (C) 1991,92,1993,1994,1995,1996,1997,1998,1999,2000,2001,2002,2005
Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -132,7 +132,7 @@ _hurd_thread_sigstate (thread_t thread)
#include <setjmp.h>
#include <fcntl.h>
#include <sys/wait.h>
-#include "thread_state.h"
+#include <thread_state.h>
#include <hurd/msg_server.h>
#include <hurd/msg_reply.h> /* For __msg_sig_post_reply. */
#include <hurd/interrupt.h>
@@ -256,7 +256,7 @@ interrupted_reply_port_location (struct machine_thread_all_state *thread_state,
}
#include <hurd/sigpreempt.h>
-#include "intr-msg.h"
+#include <intr-msg.h>
/* Timeout on interrupt_operation calls. */
mach_msg_timeout_t _hurdsig_interrupt_timeout = 1000;
diff --git a/hurd/intr-msg.c b/hurd/intr-msg.c
index e75fca81fb..0ca6af3580 100644
--- a/hurd/intr-msg.c
+++ b/hurd/intr-msg.c
@@ -1,5 +1,6 @@
/* Replacement for mach_msg used in interruptible Hurd RPCs.
- Copyright (C) 1995,96,97,98,99,2000,01,02 Free Software Foundation, Inc.
+ Copyright (C) 1995,96,97,98,99,2000,2001,2002,2005
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -201,9 +202,10 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
case MACH_MSG_TYPE_MOVE_SEND:
for (i = 0; i < number; i++)
__mach_port_deallocate (__mach_task_self (), *ports++);
- (ty->msgtl_header.msgt_longform
- ? ty->msgtl_name : ty->msgtl_header.msgt_name)
- = MACH_MSG_TYPE_COPY_SEND;
+ if (ty->msgtl_header.msgt_longform)
+ ty->msgtl_name = MACH_MSG_TYPE_COPY_SEND;
+ else
+ ty->msgtl_header.msgt_name = MACH_MSG_TYPE_COPY_SEND;
break;
case MACH_MSG_TYPE_COPY_SEND:
case MACH_MSG_TYPE_MOVE_RECEIVE:
@@ -223,29 +225,29 @@ _hurd_intr_rpc_mach_msg (mach_msg_header_t *msg,
name = ty->msgtl_name;
size = ty->msgtl_size;
number = ty->msgtl_number;
- (char *) ty += sizeof (mach_msg_type_long_t);
+ ty = (void *) ty + sizeof (mach_msg_type_long_t);
}
else
{
name = ty->msgtl_header.msgt_name;
size = ty->msgtl_header.msgt_size;
number = ty->msgtl_header.msgt_number;
- (char *) ty += sizeof (mach_msg_type_t);
+ ty = (void *) ty + sizeof (mach_msg_type_t);
}
if (ty->msgtl_header.msgt_inline)
{
clean_ports ((void *) ty, 0);
/* calculate length of data in bytes, rounding up */
- (char *) ty += (((((number * size) + 7) >> 3)
- + sizeof (mach_msg_type_t) - 1)
- &~ (sizeof (mach_msg_type_t) - 1));
+ ty = (void *) ty + (((((number * size) + 7) >> 3)
+ + sizeof (mach_msg_type_t) - 1)
+ &~ (sizeof (mach_msg_type_t) - 1));
}
else
{
clean_ports (*(void **) ty,
ty->msgtl_header.msgt_deallocate);
- ++(void **) ty;
+ ty = (void *) ty + sizeof (void *);
}
}
#else /* Untyped Mach IPC flavor. */
diff --git a/hurd/longjmp-ts.c b/hurd/longjmp-ts.c
new file mode 100644
index 0000000000..e9c297a20b
--- /dev/null
+++ b/hurd/longjmp-ts.c
@@ -0,0 +1,32 @@
+/* Perform a `longjmp' on a Mach thread_state. Stub version.
+ Copyright (C) 1991, 1994, 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <setjmp.h>
+#include <mach/thread_status.h>
+
+/* Set up STATE to do the equivalent of `longjmp (ENV, VAL);'. */
+
+void
+_hurd_longjmp_thread_state (void *state, jmp_buf env, int val)
+{
+ /* Set all the registers in *STATE to the values described by ENV and
+ RETVAL. After this, setting that thread's state to STATE should be
+ just like calling `longjmp (ENV, RETVAL)'. */
+ #error "Need to write sysdeps/mach/hurd/MACHINE/longjmp-ctx.c"
+}
diff --git a/hurd/lookup-at.c b/hurd/lookup-at.c
new file mode 100644
index 0000000000..a2d50cb192
--- /dev/null
+++ b/hurd/lookup-at.c
@@ -0,0 +1,110 @@
+/* Lookup helper function for Hurd implementation of *at functions.
+