2 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
5 Desc: Create a new process (in an old way).
9 #include "dos_intern.h"
10 #include <dos/dostags.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
16 #include <proto/dos.h>
18 AROS_LH4(struct MsgPort
*, CreateProc
,
21 AROS_LHA(CONST_STRPTR
, name
, D1
),
22 AROS_LHA(LONG
, pri
, D2
),
23 AROS_LHA(BPTR
, segList
, D3
),
24 AROS_LHA(LONG
, stackSize
, D4
),
27 struct DosLibrary
*, DOSBase
, 23, Dos
)
30 CreateProc() will create a new process (a process is a superset
31 of an exec Task), with the name 'name' and the priority 'pri'.
33 You should pass a segList as returned by LoadSeg() (or similar)
34 in the 'segList' parameter, and specify the stack size in
37 You should really use CreateNewProc() rather than this function
38 as it is much more flexible.
41 name - Name of the new process.
42 pri - Starting priority.
43 segList - BCPL pointer to a seglist.
44 stackSize - The size of the initial process stack.
47 Pointer to the pr_MsgPort in the Process structure. Will
48 return NULL on failure.
51 This will not free the seglist when the process finishes.
53 This does not return a pointer to the Process structure, but
54 rather the MsgPort structure contained within it. You can
55 get the real Process structure by:
61 pr = (struct Process *)((struct Task *)mp - 1);
63 // Shouldn't use mp after this point
70 CreateNewProc(), LoadSeg(), UnLoadSeg()
73 Basically passes this call to CreateNewProc().
75 *****************************************************************************/
79 struct Process
*pr
; /* The process to create */
82 /* Don't forget to find out some extra defaults here */
83 struct TagItem procTags
[] =
85 { NP_Seglist
, (IPTR
)segList
},
86 { NP_FreeSeglist
, FALSE
},
87 { NP_StackSize
, stackSize
},
88 { NP_Name
, (IPTR
)name
},
89 { NP_Priority
, pri
},
90 /* These arguments are necessary, for
91 * AOS 3.x compatability. Specifically,
92 * CreateProc() must *not* break Forbid()
95 { NP_CurrentDir
, 0 },
99 { NP_CloseInput
, FALSE
},
100 { NP_CloseOutput
, FALSE
},
104 if ((pr
= CreateNewProc(procTags
)))
106 return (struct MsgPort
*)&pr
->pr_MsgPort
;