(where_is_shmfs): Correct test for filesystem type name of mount points.
[glibc.git] / sysdeps / mach / start.c
blob45d20cccec06b6b64e77256596e0318c1d919071
1 /* Copyright (C) 1992, 1993, 1994, 1995, 1997 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
19 #include <stddef.h>
20 #include <stdlib.h>
21 #include <errno.h>
22 #include <unistd.h>
23 #include <sysdep.h>
25 #ifndef __GNUC__
26 #error This file uses GNU C extensions; you must compile with GCC.
27 #endif
29 /* The first piece of initialized data. */
30 int __data_start = 0;
32 #ifndef _HURD_THREADVAR_H
33 volatile int errno;
34 #endif
36 extern void __mach_init (void);
37 extern void __libc_init (int argc, char **argv, char **envp);
38 extern int main (int argc, char **argv, char **envp);
40 /* These are uninitialized common definitions so they will be zero
41 by default. If the user links in C threads, that will provide initialized
42 definitions that override these. */
43 void *(*_cthread_init_routine) (void); /* Returns new SP to use. */
44 void (*_cthread_exit_routine) (int status);
47 /* These are for communication from _start to start1,
48 where we cannot use the stack for anything. */
49 static int start_argc;
50 static char **start_argv;
52 /* _start calls this on the new stack. */
53 static volatile void
54 start1 (void)
56 __libc_init (start_argc, start_argv, __environ);
58 (_cthread_exit_routine != NULL ? *_cthread_exit_routine : exit)
59 (main (start_argc, start_argv, __environ));
61 /* Should never get here. */
62 LOSE;
65 #ifndef START_ARGS
66 #define START_ARGS void
67 #endif
68 #ifdef START_MACHDEP
69 START_MACHDEP
70 #define _start _start0
71 #endif
73 void
74 _start (START_ARGS)
76 SNARF_ARGS (start_argc, start_argv, __environ);
78 __mach_init ();
80 if (_cthread_init_routine != NULL)
81 CALL_WITH_SP (start1, (*_cthread_init_routine) ());
82 else
83 start1 ();
85 /* Should never get here. */
86 LOSE;