Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / dos / createproc.c
blob4f31fc59e42cdb490a102d31f00bf73629d4a5b9
1 /*
2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Create a new process (in an old way).
6 Lang: English
7 */
9 #include "dos_intern.h"
10 #include <dos/dostags.h>
11 #include <proto/exec.h>
13 /*****************************************************************************
15 NAME */
16 #include <proto/dos.h>
18 AROS_LH4(struct MsgPort *, CreateProc,
20 /* SYNOPSIS */
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),
26 /* LOCATION */
27 struct DosLibrary *, DOSBase, 23, Dos)
29 /* FUNCTION
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
35 'stackSize'.
37 You should really use CreateNewProc() rather than this function
38 as it is much more flexible.
40 INPUTS
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.
46 RESULT
47 Pointer to the pr_MsgPort in the Process structure. Will
48 return NULL on failure.
50 NOTES
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:
57 struct Process *pr;
58 struct MsgPort *mp;
60 mp = CreateProc(...);
61 pr = (struct Process *)((struct Task *)mp - 1);
63 // Shouldn't use mp after this point
65 EXAMPLE
67 BUGS
69 SEE ALSO
70 CreateNewProc(), LoadSeg(), UnLoadSeg()
72 INTERNALS
73 Basically passes this call to CreateNewProc().
75 *****************************************************************************/
77 AROS_LIBFUNC_INIT
79 struct Process *pr; /* The process to create */
80 struct Process *parent = (struct Process *)FindTask(NULL);
81 APTR windowPtr = NULL;
83 /* If the caller is a process, inherit its window pointer */
84 if (__is_process(parent))
86 windowPtr = parent->pr_WindowPtr;
90 /* Don't forget to find out some extra defaults here */
91 struct TagItem procTags[] =
93 { NP_Seglist , (IPTR)segList },
94 { NP_FreeSeglist , FALSE },
95 { NP_StackSize , stackSize },
96 { NP_Name , (IPTR)name },
97 { NP_Priority , pri },
98 { NP_WindowPtr , (IPTR)windowPtr },
99 { NP_CurrentDir , 0 },
100 { NP_HomeDir , 0 },
101 { NP_Input , 0 },
102 { NP_Output , 0 },
103 { NP_CloseInput , FALSE },
104 { NP_CloseOutput , FALSE },
105 { TAG_DONE , NULL }
108 if ((pr = CreateNewProc(procTags)))
110 return (struct MsgPort *)&pr->pr_MsgPort;
112 else
114 return NULL;
118 AROS_LIBFUNC_EXIT
119 } /* CreateProc */