Fixed a typo.
[AROS.git] / rom / dos / findcliproc.c
blobc8e448c656985e485787b6ea9f2247930ae9abbb
1 /*
2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: Find a CLI process by number
6 Lang: English
7 */
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 /*****************************************************************************
17 NAME */
18 #include <proto/dos.h>
20 AROS_LH1(struct Process *, FindCliProc,
22 /* SYNOPSIS */
23 AROS_LHA(ULONG, num, D1),
25 /* LOCATION */
26 struct DosLibrary *, DOSBase, 91, Dos)
28 /* FUNCTION
29 Find a CLI process by its task number. The number must be greater
30 than 0.
32 INPUTS
33 num - The task number of the CLI to find.
35 RESULT
36 Pointer to the process if found, NULL otherwise.
38 NOTES
39 The process calling this function doesn't need to do any locking.
41 EXAMPLE
43 BUGS
45 SEE ALSO
46 Cli(), MaxCli()
48 INTERNALS
50 *****************************************************************************/
52 AROS_LIBFUNC_INIT
54 struct RootNode *root = DOSBase->dl_Root;
55 struct Process *cliProc = NULL;
56 struct CLIInfo *node;
58 ObtainSemaphoreShared(&root->rn_RootLock);
60 ForeachNode(&root->rn_CliList, node)
62 if (node->ci_Process->pr_TaskNum == num)
64 cliProc = node->ci_Process;
65 break;
69 ReleaseSemaphore(&root->rn_RootLock);
70 return cliProc;
72 AROS_LIBFUNC_EXIT
73 } /* FindCliProc */