- Define structure pointer to NULL to make the compiler happy
[AROS.git] / rom / dos / createproc.c
blob1f813d867b41e9b0aeaaec44f3370d4d959a64f2
1 /*
2 Copyright © 1995-2017, 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 */
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()
93 * locking.
95 { NP_CurrentDir , 0 },
96 { NP_HomeDir , 0 },
97 { NP_Input , 0 },
98 { NP_Output , 0 },
99 { NP_CloseInput , FALSE },
100 { NP_CloseOutput , FALSE },
101 { TAG_DONE , 0 }
104 if ((pr = CreateNewProc(procTags)))
106 return (struct MsgPort *)&pr->pr_MsgPort;
108 else
110 return NULL;
114 AROS_LIBFUNC_EXIT
115 } /* CreateProc */