~ubuntu-branches/ubuntu/utopic/eglibc/utopic

« back to all changes in this revision

Viewing changes to .pc/hurd-i386/submitted-exec_filename.diff/hurd/hurd.h

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2012-10-26 05:14:58 UTC
  • mfrom: (1.5.1) (4.4.22 experimental)
  • Revision ID: package-import@ubuntu.com-20121026051458-oryotr4i03ob5pab
Tags: 2.16-0ubuntu1
* Merge with unreleased 2.16 in Debian experimental, remaining changes:
  - Drop the Breaks line from libc6, which refers to a Debian transition
  - Remove the libc6 recommends on libc6-i686, which we don't build
  - Enable libc6{,-dev}-armel on armhf and libc6{-dev}-armhf on armel
  - Ship update-locale and validlocale in /usr/sbin in libc-bin
  - Don't build locales or locales-all in Ubuntu, we rely on langpacks
  - Heavily mangle the way we do service restarting on major upgrades
  - Use different MIN_KERNEL_SUPPORTED versions than Debian, due to
    buildd needs.  This should be universally bumped to 3.2.0 once all
    our buildds (including the PPA guests) are running precise kernels
  - Build i386 variants as -march=i686, build amd64 with -O3, and build
    ppc64 variants (both 64-bit and 32-bit) with -O3 -fno-tree-vectorize
  - Re-enable unsubmitted-ldconfig-cache-abi.diff and rebuild the cache
    on upgrades from previous versions that used a different constant
  - debian/patches/any/local-CVE-2012-3406.diff: switch to malloc when
    array grows too large to handle via alloca extension (CVE-2012-3406)
  - Build generic i386/i686 flavour with -mno-tls-direct-seg-refs
* Changes added/dropped with this merge while reducing our delta:
  - Stop building glibc docs from the eglibc source, and instead make
    the glibc-docs stub have a hard dependency on glibc-doc-reference
  - Remove outdated conflicts against ancient versions of ia32-libs
  - Drop the tzdata dependency from libc6, it's in required and minimal
  - Use gcc-4.7/g++-4.7 by default on all our supported architectures
  - Save our historical changelog as changelog.ubuntu in the source
  - Drop nscd's libaudit build-dep for now, as libaudit is in universe
  - Drop the unnecessary Breaks from libc6 to locales and locales-all
  - Ship xen's ld.so.conf.d snippet as /etc/ld.so.conf.d/libc6-xen.conf
* Disable hard failures on the test suite for the first upload to raring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 1993,94,95,96,97,98,99,2001,2002,2007
 
2
   Free Software Foundation, Inc.
 
3
   This file is part of the GNU C Library.
 
4
 
 
5
   The GNU C Library is free software; you can redistribute it and/or
 
6
   modify it under the terms of the GNU Lesser General Public
 
7
   License as published by the Free Software Foundation; either
 
8
   version 2.1 of the License, or (at your option) any later version.
 
9
 
 
10
   The GNU C Library is distributed in the hope that it will be useful,
 
11
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
   Lesser General Public License for more details.
 
14
 
 
15
   You should have received a copy of the GNU Lesser General Public
 
16
   License along with the GNU C Library; if not, see
 
17
   <http://www.gnu.org/licenses/>.  */
 
18
 
 
19
#ifndef _HURD_H
 
20
 
 
21
#define _HURD_H 1
 
22
#include <features.h>
 
23
 
 
24
 
 
25
/* Get types, macros, constants and function declarations
 
26
   for all Mach microkernel interaction.  */
 
27
#include <mach.h>
 
28
#include <mach/mig_errors.h>
 
29
 
 
30
/* Get types and constants necessary for Hurd interfaces.  */
 
31
#include <hurd/hurd_types.h>
 
32
 
 
33
/* Get MiG stub declarations for commonly used Hurd interfaces.  */
 
34
#include <hurd/auth.h>
 
35
#include <hurd/process.h>
 
36
#include <hurd/fs.h>
 
37
#include <hurd/io.h>
 
38
 
 
39
/* Get `struct hurd_port' and related definitions implementing lightweight
 
40
   user references for ports.  These are used pervasively throughout the C
 
41
   library; this is here to avoid putting it in nearly every source file.  */
 
42
#include <hurd/port.h>
 
43
 
 
44
#include <errno.h>
 
45
 
 
46
#ifndef _HURD_H_EXTERN_INLINE
 
47
#define _HURD_H_EXTERN_INLINE __extern_inline
 
48
#endif
 
49
 
 
50
int __hurd_fail (error_t err);
 
51
 
 
52
#ifdef __USE_EXTERN_INLINES
 
53
_HURD_H_EXTERN_INLINE int
 
54
__hurd_fail (error_t err)
 
55
{
 
56
  switch (err)
 
57
    {
 
58
    case EMACH_SEND_INVALID_DEST:
 
59
    case EMIG_SERVER_DIED:
 
60
      /* The server has disappeared!  */
 
61
      err = EIEIO;
 
62
      break;
 
63
 
 
64
    case KERN_NO_SPACE:
 
65
      err = ENOMEM;
 
66
      break;
 
67
 
 
68
    case KERN_INVALID_ARGUMENT:
 
69
      err = EINVAL;
 
70
      break;
 
71
 
 
72
    case 0:
 
73
      return 0;
 
74
 
 
75
    default:
 
76
      break;
 
77
    }
 
78
 
 
79
  errno = err;
 
80
  return -1;
 
81
}
 
82
#endif
 
83
 
 
84
/* Basic ports and info, initialized by startup.  */
 
85
 
 
86
extern int _hurd_exec_flags;    /* Flags word passed in exec_startup.  */
 
87
extern struct hurd_port *_hurd_ports;
 
88
extern unsigned int _hurd_nports;
 
89
extern mode_t _hurd_umask;
 
90
extern sigset_t _hurdsig_traced;
 
91
 
 
92
/* Shorthand macro for internal library code referencing _hurd_ports (see
 
93
   <hurd/port.h>).  */
 
94
 
 
95
#define __USEPORT(which, expr) \
 
96
  HURD_PORT_USE (&_hurd_ports[INIT_PORT_##which], (expr))
 
97
 
 
98
/* Function version of __USEPORT: calls OPERATE with a send right.  */
 
99
 
 
100
extern error_t _hurd_ports_use (int which, error_t (*operate) (mach_port_t));
 
101
 
 
102
 
 
103
/* Base address and size of the initial stack set up by the exec server.
 
104
   If using cthreads, this stack is deallocated in startup.
 
105
   Not locked.  */
 
106
 
 
107
extern vm_address_t _hurd_stack_base;
 
108
extern vm_size_t _hurd_stack_size;
 
109
 
 
110
/* Initial file descriptor table we were passed at startup.  If we are
 
111
   using a real dtable, these are turned into that and then cleared at
 
112
   startup.  If not, these are never changed after startup.  Not locked.  */
 
113
 
 
114
extern mach_port_t *_hurd_init_dtable;
 
115
extern mach_msg_type_number_t _hurd_init_dtablesize;
 
116
 
 
117
/* Current process IDs.  */
 
118
 
 
119
extern pid_t _hurd_pid, _hurd_ppid, _hurd_pgrp;
 
120
extern int _hurd_orphaned;
 
121
 
 
122
/* This variable is incremented every time the process IDs change.  */
 
123
extern unsigned int _hurd_pids_changed_stamp;
 
124
 
 
125
/* This condition is broadcast every time the process IDs change.  */
 
126
extern struct condition _hurd_pids_changed_sync;
 
127
 
 
128
/* Unix `data break', for brk and sbrk.
 
129
   If brk and sbrk are not used, this info will not be initialized or used.  */
 
130
 
 
131
 
 
132
/* Data break.  This is what `sbrk (0)' returns.  */
 
133
 
 
134
extern vm_address_t _hurd_brk;
 
135
 
 
136
/* End of allocated space.  This is generally `round_page (_hurd_brk)'.  */
 
137
 
 
138
extern vm_address_t _hurd_data_end;
 
139
 
 
140
/* This mutex locks _hurd_brk and _hurd_data_end.  */
 
141
 
 
142
extern struct mutex _hurd_brk_lock;
 
143
 
 
144
/* Set the data break to NEWBRK; _hurd_brk_lock must
 
145
   be held, and is released on return.  */
 
146
 
 
147
extern int _hurd_set_brk (vm_address_t newbrk);
 
148
 
 
149
#define __need_FILE
 
150
#include <stdio.h>
 
151
 
 
152
/* Calls to get and set basic ports.  */
 
153
 
 
154
extern error_t _hurd_ports_get (unsigned int which, mach_port_t *result);
 
155
extern error_t _hurd_ports_set (unsigned int which, mach_port_t newport);
 
156
 
 
157
extern process_t getproc (void);
 
158
extern file_t getcwdir (void), getcrdir (void);
 
159
extern auth_t getauth (void);
 
160
extern mach_port_t getcttyid (void);
 
161
extern int setproc (process_t);
 
162
extern int setcwdir (file_t), setcrdir (file_t);
 
163
extern int setcttyid (mach_port_t);
 
164
 
 
165
/* Does reauth with the proc server and fd io servers.  */
 
166
extern int __setauth (auth_t), setauth (auth_t);
 
167
 
 
168
 
 
169
/* Modify a port cell by looking up a directory name.
 
170
   This verifies that it is a directory and that we have search permission.  */
 
171
extern int _hurd_change_directory_port_from_name (struct hurd_port *portcell,
 
172
                                                  const char *name);
 
173
/* Same thing, but using an open file descriptor.
 
174
   Also verifies that it is a directory and that we have search permission.  */
 
175
extern int _hurd_change_directory_port_from_fd (struct hurd_port *portcell,
 
176
                                                int fd);
 
177
 
 
178
 
 
179
 
 
180
/* Get and set the effective UID set.  */
 
181
extern int geteuids (int __n, uid_t *__uidset);
 
182
extern int seteuids (int __n, const uid_t *__uidset);
 
183
 
 
184
 
 
185
/* Split FILE into a directory and a name within the directory.  The
 
186
   directory lookup uses the current root and working directory.  If
 
187
   successful, stores in *NAME a pointer into FILE where the name
 
188
   within directory begins and returns a port to the directory;
 
189
   otherwise sets `errno' and returns MACH_PORT_NULL.  */
 
190
 
 
191
extern file_t __file_name_split (const char *file, char **name);
 
192
extern file_t file_name_split (const char *file, char **name);
 
193
 
 
194
/* Split DIRECTORY into a parent directory and a name within the directory.
 
195
   This is the same as file_name_split, but ignores trailing slashes.  */
 
196
 
 
197
extern file_t __directory_name_split (const char *file, char **name);
 
198
extern file_t directory_name_split (const char *file, char **name);
 
199
 
 
200
/* Open a port to FILE with the given FLAGS and MODE (see <fcntl.h>).
 
201
   The file lookup uses the current root and working directory.
 
202
   Returns a port to the file if successful; otherwise sets `errno'
 
203
   and returns MACH_PORT_NULL.  */
 
204
 
 
205
extern file_t __file_name_lookup (const char *file, int flags, mode_t mode);
 
206
extern file_t file_name_lookup (const char *file, int flags, mode_t mode);
 
207
 
 
208
/* Open a port to FILE with the given FLAGS and MODE (see <fcntl.h>).  The
 
209
   file lookup uses the current root directory, but uses STARTDIR as the
 
210
   "working directory" for file relative names.  Returns a port to the file
 
211
   if successful; otherwise sets `errno' and returns MACH_PORT_NULL.  */
 
212
 
 
213
extern file_t __file_name_lookup_under (file_t startdir, const char *file,
 
214
                                        int flags, mode_t mode);
 
215
extern file_t file_name_lookup_under (file_t startdir, const char *file,
 
216
                                      int flags, mode_t mode);
 
217
 
 
218
 
 
219
/* Lookup FILE_NAME and return the node opened with FLAGS & MODE
 
220
   (see hurd_file_name_lookup for details), but a simple file name (without
 
221
   any directory prefixes) will be consecutively prefixed with the pathnames
 
222
   in the `:' separated list PATH until one succeeds in a successful lookup.
 
223
   If none succeed, then the first error that wasn't ENOENT is returned, or
 
224
   ENOENT if no other errors were returned.  If PREFIXED_NAME is non-NULL,
 
225
   then if the result is looked up directly, *PREFIXED_NAME is set to NULL, and
 
226
   if it is looked up using a prefix from PATH, *PREFIXED_NAME is set to
 
227
   malloc'd storage containing the prefixed name.  */
 
228
extern file_t file_name_path_lookup (const char *file_name, const char *path,
 
229
                                     int flags, mode_t mode,
 
230
                                     char **prefixed_name);
 
231
 
 
232
 
 
233
 
 
234
/* Open a file descriptor on a port.  FLAGS are as for `open'; flags
 
235
   affected by io_set_openmodes are not changed by this.  If successful,
 
236
   this consumes a user reference for PORT (which will be deallocated on
 
237
   close).  */
 
238
 
 
239
extern int openport (io_t port, int flags);
 
240
 
 
241
/* Open a stream on a port.  MODE is as for `fopen'.
 
242
   If successful, this consumes a user reference for PORT
 
243
   (which will be deallocated on fclose).  */
 
244
 
 
245
extern FILE *fopenport (io_t port, const char *mode);
 
246
extern FILE *__fopenport (io_t port, const char *mode);
 
247
 
 
248
 
 
249
/* Execute a file, replacing TASK's current program image.  */
 
250
 
 
251
extern error_t _hurd_exec (task_t task,
 
252
                           file_t file,
 
253
                           char *const argv[],
 
254
                           char *const envp[]);
 
255
 
 
256
 
 
257
/* Inform the proc server we have exited with STATUS, and kill the
 
258
   task thoroughly.  This function never returns, no matter what.  */
 
259
 
 
260
extern void _hurd_exit (int status) __attribute__ ((noreturn));
 
261
 
 
262
 
 
263
/* Initialize the library data structures from the
 
264
   ints and ports passed to us by the exec server.
 
265
   Then vm_deallocate PORTARRAY and INTARRAY.  */
 
266
 
 
267
extern void _hurd_init (int flags, char **argv,
 
268
                        mach_port_t *portarray, size_t portarraysize,
 
269
                        int *intarray, size_t intarraysize);
 
270
 
 
271
/* Do startup handshaking with the proc server, and initialize library data
 
272
   structures that require proc server interaction.  This includes
 
273
   initializing signals; see _hurdsig_init in <hurd/signal.h>.  */
 
274
 
 
275
extern void _hurd_proc_init (char **argv,
 
276
                             const int *intarray, size_t intarraysize);
 
277
 
 
278
 
 
279
/* Return the socket server for sockaddr domain DOMAIN.  If DEAD is
 
280
   nonzero, remove the old cached port and always do a fresh lookup.
 
281
 
 
282
   It is assumed that a socket server will stay alive during a complex socket
 
283
   operation involving several RPCs.  But a socket server may die during
 
284
   long idle periods between socket operations.  Callers should first pass
 
285
   zero for DEAD; if the first socket RPC tried on the returned port fails
 
286
   with MACH_SEND_INVALID_DEST or MIG_SERVER_DIED (indicating the server
 
287
   went away), the caller should call _hurd_socket_server again with DEAD
 
288
   nonzero and retry the RPC on the new socket server port.  */
 
289
 
 
290
extern socket_t _hurd_socket_server (int domain, int dead);
 
291
 
 
292
/* Send a `sig_post' RPC to process number PID.  If PID is zero,
 
293
   send the message to all processes in the current process's process group.
 
294
   If PID is < -1, send SIG to all processes in process group - PID.
 
295
   SIG and REFPORT are passed along in the request message.  */
 
296
 
 
297
extern error_t _hurd_sig_post (pid_t pid, int sig, mach_port_t refport);
 
298
extern error_t hurd_sig_post (pid_t pid, int sig, mach_port_t refport);
 
299
 
 
300
/* Fetch the host privileged port and device master port from the proc
 
301
   server.  They are fetched only once and then cached in the
 
302
   variables below.  A special program that gets them from somewhere
 
303
   other than the proc server (such as a bootstrap filesystem) can set
 
304
   these variables to install the ports.  */
 
305
 
 
306
extern kern_return_t __get_privileged_ports (mach_port_t *host_priv_ptr,
 
307
                                             device_t *device_master_ptr);
 
308
extern kern_return_t get_privileged_ports (mach_port_t *host_priv_ptr,
 
309
                                           device_t *device_master_ptr);
 
310
extern mach_port_t _hurd_host_priv, _hurd_device_master;
 
311
 
 
312
/* Return the PID of the task whose control port is TASK.
 
313
   On error, sets `errno' and returns -1.  */
 
314
 
 
315
extern pid_t __task2pid (task_t task), task2pid (task_t task);
 
316
 
 
317
/* Return the task control port of process PID.
 
318
   On error, sets `errno' and returns MACH_PORT_NULL.  */
 
319
 
 
320
extern task_t __pid2task (pid_t pid), pid2task (pid_t pid);
 
321
 
 
322
/* Return the current thread's thread port.  This is a cheap operation (no
 
323
   system call), but it relies on Hurd signal state being set up.  */
 
324
extern thread_t hurd_thread_self (void);
 
325
 
 
326
 
 
327
/* Cancel pending operations on THREAD.  If it is doing an interruptible RPC,
 
328
   that RPC will now return EINTR; otherwise, the "cancelled" flag will be
 
329
   set, causing the next `hurd_check_cancel' call to return nonzero or the
 
330
   next interruptible RPC to return EINTR (whichever is called first).  */
 
331
extern error_t hurd_thread_cancel (thread_t thread);
 
332
 
 
333
/* Test and clear the calling thread's "cancelled" flag.  */
 
334
extern int hurd_check_cancel (void);
 
335
 
 
336
 
 
337
/* Return the io server port for file descriptor FD.
 
338
   This adds a Mach user reference to the returned port.
 
339
   On error, sets `errno' and returns MACH_PORT_NULL.  */
 
340
 
 
341
extern io_t __getdport (int fd), getdport (int fd);
 
342
 
 
343
 
 
344
#include <stdarg.h>
 
345
 
 
346
/* Write formatted output to PORT, a Mach port supporting the i/o protocol,
 
347
   according to the format string FORMAT, using the argument list in ARG.  */
 
348
int vpprintf (io_t port, const char *format, va_list arg);
 
349
 
 
350
 
 
351
#endif  /* hurd.h */