Fix readdir regressions on sparc 32-bit.
[platform/upstream/glibc.git] / hurd / hurd.h
index 212db45..f302e04 100644 (file)
@@ -1,20 +1,19 @@
-/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1993-2013 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 Library General Public License as
-published by the Free Software Foundation; either version 2 of the
-License, or (at your option) any later version.
+   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
-Library General Public License for more details.
+   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 Library General Public
-License along with the GNU C Library; see the file COPYING.LIB.  If
-not, write to the Free Software Foundation, Inc., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #ifndef        _HURD_H
 
@@ -43,7 +42,11 @@ Cambridge, MA 02139, USA.  */
 
 #include <errno.h>
 
-_EXTERN_INLINE int
+#ifndef _HURD_H_EXTERN_INLINE
+#define _HURD_H_EXTERN_INLINE __extern_inline
+#endif
+
+_HURD_H_EXTERN_INLINE int
 __hurd_fail (error_t err)
 {
   switch (err)
@@ -57,13 +60,16 @@ __hurd_fail (error_t err)
     case KERN_NO_SPACE:
       err = ENOMEM;
       break;
+
     case KERN_INVALID_ARGUMENT:
       err = EINVAL;
       break;
 
     case 0:
       return 0;
+
     default:
+      break;
     }
 
   errno = err;
@@ -75,7 +81,7 @@ __hurd_fail (error_t err)
 extern int _hurd_exec_flags;   /* Flags word passed in exec_startup.  */
 extern struct hurd_port *_hurd_ports;
 extern unsigned int _hurd_nports;
-extern volatile mode_t _hurd_umask;
+extern mode_t _hurd_umask;
 extern sigset_t _hurdsig_traced;
 
 /* Shorthand macro for internal library code referencing _hurd_ports (see
@@ -109,11 +115,10 @@ extern pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
 extern int _hurd_orphaned;
 
 /* This variable is incremented every time the process IDs change.  */
-
-unsigned int _hurd_pids_changed_stamp;
+extern unsigned int _hurd_pids_changed_stamp;
 
 /* This condition is broadcast every time the process IDs change.  */
-struct condition _hurd_pids_changed_sync;
+extern struct condition _hurd_pids_changed_sync;
 \f
 /* Unix `data break', for brk and sbrk.
    If brk and sbrk are not used, this info will not be initialized or used.  */
@@ -156,6 +161,22 @@ extern int setcttyid (mach_port_t);
 extern int __setauth (auth_t), setauth (auth_t);
 
 
+/* Modify a port cell by looking up a directory name.
+   This verifies that it is a directory and that we have search permission.  */
+extern int _hurd_change_directory_port_from_name (struct hurd_port *portcell,
+                                                 const char *name);
+/* Same thing, but using an open file descriptor.
+   Also verifies that it is a directory and that we have search permission.  */
+extern int _hurd_change_directory_port_from_fd (struct hurd_port *portcell,
+                                               int fd);
+
+
+
+/* Get and set the effective UID set.  */
+extern int geteuids (int __n, uid_t *__uidset);
+extern int seteuids (int __n, const uid_t *__uidset);
+
+
 /* Split FILE into a directory and a name within the directory.  The
    directory lookup uses the current root and working directory.  If
    successful, stores in *NAME a pointer into FILE where the name
@@ -165,6 +186,12 @@ extern int __setauth (auth_t), setauth (auth_t);
 extern file_t __file_name_split (const char *file, char **name);
 extern file_t file_name_split (const char *file, char **name);
 
+/* Split DIRECTORY into a parent directory and a name within the directory.
+   This is the same as file_name_split, but ignores trailing slashes.  */
+
+extern file_t __directory_name_split (const char *file, char **name);
+extern file_t directory_name_split (const char *file, char **name);
+
 /* Open a port to FILE with the given FLAGS and MODE (see <fcntl.h>).
    The file lookup uses the current root and working directory.
    Returns a port to the file if successful; otherwise sets `errno'
@@ -222,7 +249,7 @@ extern error_t _hurd_exec (task_t task,
                           char *const envp[]);
 
 
-/* Inform the proc server we have exitted with STATUS, and kill the
+/* Inform the proc server we have exited with STATUS, and kill the
    task thoroughly.  This function never returns, no matter what.  */
 
 extern void _hurd_exit (int status) __attribute__ ((noreturn));
@@ -236,9 +263,12 @@ extern void _hurd_init (int flags, char **argv,
                        mach_port_t *portarray, size_t portarraysize,
                        int *intarray, size_t intarraysize);
 
-/* Do startup handshaking with the proc server.  */
+/* Do startup handshaking with the proc server, and initialize library data
+   structures that require proc server interaction.  This includes
+   initializing signals; see _hurdsig_init in <hurd/signal.h>.  */
 
-extern void _hurd_proc_init (char **argv);
+extern void _hurd_proc_init (char **argv,
+                            const int *intarray, size_t intarraysize);
 
 
 /* Return the socket server for sockaddr domain DOMAIN.  If DEAD is
@@ -268,7 +298,9 @@ extern error_t hurd_sig_post (pid_t pid, int sig, mach_port_t refport);
    other than the proc server (such as a bootstrap filesystem) can set
    these variables to install the ports.  */
 
-extern kern_return_t get_privileged_ports (host_priv_t *host_priv_ptr,
+extern kern_return_t __get_privileged_ports (mach_port_t *host_priv_ptr,
+                                            device_t *device_master_ptr);
+extern kern_return_t get_privileged_ports (mach_port_t *host_priv_ptr,
                                           device_t *device_master_ptr);
 extern mach_port_t _hurd_host_priv, _hurd_device_master;
 
@@ -304,4 +336,11 @@ extern int hurd_check_cancel (void);
 extern io_t __getdport (int fd), getdport (int fd);
 
 
+#include <stdarg.h>
+
+/* Write formatted output to PORT, a Mach port supporting the i/o protocol,
+   according to the format string FORMAT, using the argument list in ARG.  */
+int vpprintf (io_t port, const char *format, va_list arg);
+
+
 #endif /* hurd.h */