Updated PCI IDs to latest snapshot.
[tangerine.git] / rom / dos / findcliproc.c
blob6cac474fbb5f6c007b24d9fd35b0798f9f8350ce
1 /*
2 Copyright © 1995-2007, 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
40 The process calling this function doesn't need to do any locking.
42 EXAMPLE
44 BUGS
46 SEE ALSO
47 Cli(), MaxCli()
49 INTERNALS
51 *****************************************************************************/
53 AROS_LIBFUNC_INIT
55 struct RootNode *root = DOSBase->dl_Root;
56 struct Process *cliProc = NULL;
57 struct CLIInfo *node;
59 ObtainSemaphoreShared(&root->rn_RootLock);
61 ForeachNode(&root->rn_CliList, node)
63 if (node->ci_Process->pr_TaskNum == num)
65 cliProc = node->ci_Process;
66 break;
70 ReleaseSemaphore(&root->rn_RootLock);
71 return cliProc;
73 AROS_LIBFUNC_EXIT
74 } /* FindCliProc */