5 Copyright © 2008-2013, The AROS Development Team. All rights reserved.
9 #include <exec/types.h>
11 #include <exec/exec.h>
13 #include <sys/types.h>
14 #include <aros/startup.h>
22 struct vfork_data
*prev
;
23 jmp_buf vfork_jmp
; /* jmp to place where vfork was called */
26 int *parent_olderrorptr
;
27 jmp_buf parent_oldexitjmp
;
28 jmp_buf parent_newexitjmp
;
31 struct PosixCIntBase
*parent_posixcbase
;
32 struct StdCBase
*parent_stdcbase
;
33 int parent_cd_changed
;
36 struct __env_item
*parent_env_list
;
37 APTR parent_internalpool
;
39 fdesc
**parent_fd_array
;
41 char *parent_upathbuf
;
45 int child_error
, child_errno
;
48 struct PosixCIntBase
*child_posixcbase
;
50 const char *exec_filename
;
51 char *const *exec_argv
;
52 char *const *exec_envp
;
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)
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) \
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) \
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 */