finish migrating from arosmesa to mesa3dgl
[AROS.git] / rom / dos / maxcli.c
blob340096e8e2df33c586b01fed695001712dc03e79
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
8 #include <exec/execbase.h>
9 #include <proto/exec.h>
10 #include <dos/dosextens.h>
12 /*****************************************************************************
14 NAME */
15 #include <proto/dos.h>
17 AROS_LH0(ULONG, MaxCli,
19 /* SYNOPSIS */
21 /* LOCATION */
22 struct DosLibrary *, DOSBase, 92, Dos)
24 /* FUNCTION
25 Returns the highest Cli number currently in use. Since processes
26 may be added and removed at any time the returned value may already
27 be wrong.
29 INPUTS
31 RESULT
32 Maximum Cli number (_not_ the number of Clis).
34 NOTES
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 *****************************************************************************/
46 AROS_LIBFUNC_INIT
48 IPTR *taskarray = BADDR(DOSBase->dl_Root->rn_TaskArray);
49 /*
50 The first IPTR in the taskarray contains the size of the
51 taskarray = the max. number of processes the taskarray
52 can currently hold.
54 IPTR retval = taskarray[0];
56 /*
57 Not all of the fields in the array may contain a valid
58 pointer to a process and they might be NULL instead. So
59 I search that array backwards until I find a valid entry.
61 while (retval && (IPTR)NULL != taskarray[retval])
62 retval--;
64 return retval;
65 AROS_LIBFUNC_EXIT
66 } /* MaxCli */