PS2SDK
PS2 Homebrew Libraries
init.c
Go to the documentation of this file.
1 /*
2 # _____ ___ ____ ___ ____
3 # ____| | ____| | | |____|
4 # | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
5 #-----------------------------------------------------------------------
6 # Copyright 2001-2004, ps2dev - http://www.ps2dev.org
7 # Licenced under Academic Free License version 2.0
8 # Review ps2sdk README & LICENSE files for further details.
9 */
10 
16 void __init_cwd(int argc, char ** argv);
17 void _libcglue_timezone_update();
18 void _libcglue_rtc_update();
19 void __fdman_init();
20 void pthread_init();
21 void pthread_terminate();
22 void __fdman_deinit();
23 void __locks_init();
24 void __locks_deinit();
25 
26 int chdir(const char *path);
27 
28 #ifdef F___gprof_init
29 /* Note: This function is being called from _init and it is overrided when compiling with -pg */
30 __attribute__((weak))
31 void __gprof_init() {}
32 #else
33 void __gprof_init();
34 #endif
35 
36 #ifdef F___gprof_cleanup
37 /* Note: This function is being called from _exit and it is overrided when compiling with -pg */
38 __attribute__((weak))
39 void __gprof_cleanup() {}
40 #else
41 void __gprof_cleanup();
42 #endif
43 
44 #ifdef F___libpthreadglue_init
45 /* Note: This function is being called from __libcglue_init.
46 * It is a weak function because can be override by user program
47 */
48 __attribute__((weak))
49 void __libpthreadglue_init()
50 {
51  pthread_init();
52 }
53 #else
54 void __libpthreadglue_init();
55 #endif
56 
57 #ifdef F___libpthreadglue_deinit
58 /* Note: This function is being called from __libcglue_deinit.
59 * It is a weak function because can be override by user program
60 */
61 __attribute__((weak))
62 void __libpthreadglue_deinit()
63 {
64  pthread_terminate();
65 }
66 #else
67 void __libpthreadglue_deinit();
68 #endif
69 
70 #ifdef F__libcglue_init
71 __attribute__((weak))
72 void _libcglue_init()
73 {
74  /* Initialize lock API */
75  __locks_init();
76 
77  /* Initialize filedescriptor management */
78  __fdman_init();
79 
80  /* Initialize pthread library */
81  __libpthreadglue_init();
82 
83  _libcglue_timezone_update();
84  _libcglue_rtc_update();
85 
86  __gprof_init();
87 }
88 #endif
89 
90 #ifdef F__libcglue_deinit
91 __attribute__((weak))
92 void _libcglue_deinit()
93 {
94  __gprof_cleanup();
95  __libpthreadglue_deinit();
96  __fdman_deinit();
97  __locks_deinit();
98 }
99 #endif
100 
101 #ifdef F__libcglue_args_parse
102 __attribute__((weak))
103 void _libcglue_args_parse(int argc, char ** argv)
104 {
105  /* Initialize cwd from this program's path */
106  __init_cwd(argc, argv);
107 }
108 #endif
109 
__attribute__
typedef __attribute__
Definition: tlbfunc.c:60