ilbmtoicon: Refuse to generate icons with differently sized select and normal images
[AROS.git] / rom / dos / createproc.c
blobddb1ed075b579991310ce7689a52b0e0403fd544
1 /*
2 Copyright © 1995-2011, 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 /* These arguments are necessary, for
100 * AOS 3.x compatability. Specifically,
101 * CreateProc() must *not* break Forbid()
102 * locking.
104 { NP_CurrentDir , 0 },
105 { NP_HomeDir , 0 },
106 { NP_Input , 0 },
107 { NP_Output , 0 },
108 { NP_CloseInput , FALSE },
109 { NP_CloseOutput , FALSE },
110 { TAG_DONE , 0 }
113 if ((pr = CreateNewProc(procTags)))
115 return (struct MsgPort *)&pr->pr_MsgPort;
117 else
119 return NULL;
123 AROS_LIBFUNC_EXIT
124 } /* CreateProc */