build fd files in the directory specified in the config.
[AROS.git] / compiler / posixc / __vfork.h
blobef7fd17c5e5851c8f12b5dc861d4cdd36a18e599
1 #ifndef __VFORK_H
2 #define __VFORK_H
4 /*
5 Copyright © 2008-2013, The AROS Development Team. All rights reserved.
6 $Id$
7 */
9 #include <exec/types.h>
10 #include <dos/bptr.h>
11 #include <exec/exec.h>
12 #include <setjmp.h>
13 #include <sys/types.h>
14 #include <aros/startup.h>
16 #include "__fdesc.h"
18 struct PosixCIntBase;
20 struct vfork_data
22 struct vfork_data *prev;
23 jmp_buf vfork_jmp; /* jmp to place where vfork was called */
25 struct Task *parent;
26 int *parent_olderrorptr;
27 jmp_buf parent_oldexitjmp;
28 jmp_buf parent_newexitjmp;
29 BYTE parent_signal;
30 BYTE parent_state;
31 struct PosixCIntBase *parent_posixcbase;
32 struct StdCBase *parent_stdcbase;
33 int parent_cd_changed;
34 BPTR parent_cd_lock;
35 BPTR parent_curdir;
36 struct __env_item *parent_env_list;
37 APTR parent_internalpool;
38 int parent_numslots;
39 fdesc **parent_fd_array;
40 int parent_flags;
41 char *parent_upathbuf;
43 struct Task *child;
44 int child_executed;
45 int child_error, child_errno;
46 BYTE child_signal;
47 BYTE child_state;
48 struct PosixCIntBase *child_posixcbase;
50 const char *exec_filename;
51 char *const *exec_argv;
52 char *const *exec_envp;
53 APTR exec_id;
56 pid_t __vfork(jmp_buf env);
57 void vfork_longjmp (jmp_buf env, int val);
59 #define PARENT_STATE_EXIT_CALLED (1L << 0)
60 #define PARENT_STATE_EXEC_CALLED (1L << 1)
61 #define PARENT_STATE_EXEC_DO_FINISHED (1L << 2)
62 #define PARENT_STATE_STOPPED_PRETENDING (1L << 3)
64 #define CHILD_STATE_SETUP_FAILED (1L << 0)
65 #define CHILD_STATE_SETUP_FINISHED (1L << 1)
66 #define CHILD_STATE_EXEC_PREPARE_FINISHED (1L << 2)
67 #define CHILD_STATE_UDATA_NOT_USED (1L << 3)
69 #define DSTATE(x) //x
71 #define PRINTSTATE \
72 DSTATE(bug("[PrintState]: Parent = %d, Child = %d, Line %d\n", udata->parent_state, udata->child_state, __LINE__));
74 #define SETPARENTSTATE(a) \
75 udata->parent_state = a
77 #define ASSERTPARENTSTATE(a) \
78 DSTATE({ \
79 if (!(udata->parent_state & (a))) \
80 bug("Parent state assertion failed, was %d, expected %d\n", udata->parent_state, (a));\
83 #define SETCHILDSTATE(a) \
84 udata->child_state = a
86 #define ASSERTCHILDSTATE(a) \
87 DSTATE({ \
88 if (!(udata->child_state & (a))) \
89 bug("Child state assertion failed, was %d, expected %d\n", udata->parent_state, (a));\
92 #endif /* __VFORK_H */