1 #ifndef ___AROSC_PRIVDATA_H
2 #define ___AROSC_PRIVDATA_H
4 #include <exec/semaphores.h>
5 #include <devices/timer.h>
6 #include <proto/timer.h>
10 #include <sys/arosc.h>
20 /* All stuff visible by the user */
21 struct arosc_userdata acpd_acud
;
23 /* arosc_userdata can grow as much as it wishes,
24 as long as all new fields are added at the end of it.
26 arosc_privdata can also grow at please, but it has no restrictions
27 on the way things are modified in it, as long as arosc_userdata
28 is always kept at its beginning. */
30 /* Keep in here the pointer to the already existing arosc_privdata
33 This is a structure which gets allocated on a per-process basis,
34 however CLI programs are invoked as sort of subroutines of the CLI
35 process, although they must behave as if they were the only ones
36 having possession of their Process structure. Hence, this field
37 is used to save/restore the data of the previous CLI process. */
38 struct arosc_privdata
*acpd_oldprivdata
;
41 APTR acpd_startup_mempool
;
42 struct SignalSemaphore acpd_startup_memsem
;
45 struct __env_item
*acpd_env_list
;
48 struct MinList acpd_stdio_files
;
51 struct DateStamp acpd_startup_datestamp
;
56 struct _fdesc
**acpd_fd_array
;
59 struct MinList acpd_atexit_list
;
65 int acpd_startup_cd_changed
;
66 BPTR acpd_startup_cd_lock
;
69 struct timerequest acpd_timereq
;
70 struct MsgPort acpd_timeport
;
71 struct Device
*acpd_TimerBase
;
74 APTR acpd_process_returnaddr
;
78 char *acpd_apathbuf
; /* Buffer that holds the AROS path converted from the
79 equivalent *nix path. */
80 int acpd_doupath
; /* BOOL - does the conversion need to be done? */
83 char *acpd_joined_args
;
87 char acpd_fault_buf
[100];
90 int acpd_parent_does_upath
;
93 struct MinList acpd_file_locks
;
96 struct vfork_data
*acpd_vfork_data
;
101 /* By default arosc.library keeps the old arosc_privdata if it's opened another
102 time in the same process. Setting this flag forces it to create new
104 #define CREATE_NEW_ACPD 1
106 /* Programs compiled with -nix flag are cloning dos.library environment
107 variables before execution and restoring them during exit. Cloning
108 prevents clobbering the process environment variables by another program
109 ran with RunCommand() or similar means. Setting this flag disables
110 environment cloning. */
111 #define DO_NOT_CLONE_ENV_VARS 2
113 /* This flag is set by vfork() to correctly report child process ID during
114 execution of child code, even though that it's actually executed by parent
115 process until execve() is called. */
116 #define PRETEND_CHILD 4
118 /* By default arosc.library creates new arosc_privdata when opened if
119 pr_ReturnAddr has changed (for example during RunCommand()). Setting
120 this flag prevents creation of new arosc_privdata. */
121 #define KEEP_OLD_ACPD 8
123 /* By default a new process will get new ACPD when it(or any other library
124 it uses) opens arosc.library. This flag prohibits that and forces the
125 child process to share ACPD with parent process */
126 #define SHARE_ACPD_WITH_CHILD 16
130 #define __get_arosc_privdata() ((struct arosc_privdata *)__get_arosc_userdata())
132 #define __oldprivdata (__get_arosc_privdata()->acpd_oldprivdata)
133 #define __env_list (__get_arosc_privdata()->acpd_env_list)
134 #define __stdio_files (__get_arosc_privdata()->acpd_stdio_files)
135 #define __numslots (__get_arosc_privdata()->acpd_numslots)
136 #define __fd_mempool (__get_arosc_privdata()->acpd_fd_mempool)
137 #define __fd_array (__get_arosc_privdata()->acpd_fd_array)
138 #define __startup_memsem (__get_arosc_privdata()->acpd_startup_memsem)
139 #define __startup_mempool (__get_arosc_privdata()->acpd_startup_mempool)
140 #define __startup_datestamp (__get_arosc_privdata()->acpd_startup_datestamp)
141 #define __atexit_list (__get_arosc_privdata()->acpd_atexit_list)
142 #define __umask (__get_arosc_privdata()->acpd_umask)
143 #define __startup_cd_changed (__get_arosc_privdata()->acpd_startup_cd_changed)
144 #define __startup_cd_lock (__get_arosc_privdata()->acpd_startup_cd_lock)
145 #define __timereq (__get_arosc_privdata()->acpd_timereq)
146 #define __timeport (__get_arosc_privdata()->acpd_timeport)
147 #define TimerBase (__get_arosc_privdata()->acpd_TimerBase)
148 #define __apathbuf (__get_arosc_privdata()->acpd_apathbuf)
149 #define __doupath (__get_arosc_privdata()->acpd_doupath)
150 #define __flocks_list (__get_arosc_privdata()->acpd_file_locks)
152 #define __aros_startup ((struct aros_startup *)GetIntETask(FindTask(NULL))->iet_startup)
153 #define __aros_startup_jmp_buf (__aros_startup->as_startup_jmp_buf)
154 #define __aros_startup_error (__aros_startup->as_startup_error)
156 #endif /* !___AROSC_PRIVDATA_H */