Project Database Access Library Functions projectwalk(3PROJECT)
NAME
projectwalk - visit active project IDs on current system
SYNOPSIS
cc [ flag ... ] file... -lproject [ library ... ]
#include
int projectwalk(int (*callback)(const projidt project,
void *walkdata), void *initdata);
DESCRIPTION
The projectwalk() function provides a mechanism for the
application author to examine all active projects on the
current system. The callback function provided by the
application is given the ID of an active project at each
invocation and can use the walkdata to record its own
state. The callback function should return non-zero if it
encounters an error condition or attempts to terminate the
walk prematurely; otherwise the callback function should
return 0.
RETURN VALUES
Upon successful completion, projectwalk() returns 0. It
returns -1 if the callback function returned a non-zero
value or if the walk encountered an error, in which case
errno is set to indicate the error.
ERORS
The projectwalk() function will fail if:
ENOMEM There is insufficient memory available to set up
the initial data for the walk.
Other returned error values are presumably caused by the
callback function.
EXAMPLES
Example 1 Count the number of projects available on the sys-
tem.
The following example counts the number of projects avail-
able on the system.
#include
#include
#include
SunOS 5.11 Last change: 7 Oct 2003 1
Project Database Access Library Functions projectwalk(3PROJECT)
typedef struct wdata {
uintt count;
} wdatat;
wdatat totalcount;
int
simplecallback(const projidt p, void *pvt)
{
wdatat *w = (wdatat *)pvt;
w->count];
return (0);
}
...
totalcount.count = 0;
errno = 0;
if ((n = projectwalk(simplecallback, &totalcount)) >= 0)
(void) printf("count = %u\n", totalcount.count);
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Evolving
MT-Level MT-Safe
SEE ALSO
getprojid(2), libproject(3LIB), settaskid(2), attributes(5)
SunOS 5.11 Last change: 7 Oct 2003 2
|