2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 Desc: Find a CLI process by number
9 #include <exec/lists.h>
10 #include <exec/execbase.h>
11 #include <proto/exec.h>
12 #include <dos/dosextens.h>
13 #include "dos_intern.h"
15 /*****************************************************************************
18 #include <proto/dos.h>
20 AROS_LH1(struct Process
*, FindCliProc
,
23 AROS_LHA(ULONG
, num
, D1
),
26 struct DosLibrary
*, DOSBase
, 91, Dos
)
29 Find a CLI process by its task number. The number must be greater
33 num - The task number of the CLI to find.
36 Pointer to the process if found, NULL otherwise.
39 The process calling this function doesn't need to do any locking.
50 *****************************************************************************/
54 struct RootNode
*root
= DOSBase
->dl_Root
;
55 struct Process
*cliProc
= NULL
;
58 ObtainSemaphoreShared(&root
->rn_RootLock
);
60 ForeachNode(&root
->rn_CliList
, node
)
62 if (node
->ci_Process
->pr_TaskNum
== num
)
64 cliProc
= node
->ci_Process
;
69 ReleaseSemaphore(&root
->rn_RootLock
);