beostat_get_avail_nodes_by_id

Name

beostat_get_avail_nodes_by_id – get a list of available nodes for a given identity

Synopsis

#include <sys/beostat.h>
int beostat_get_avail_nodes_by_id (int **node_list, uid_t uid, gid_t *gid_list, int gid_size);

Arguments

node_list

A handle that will have memory allocated and filled with the array of nodes. This memory must be freed by the caller.

uid

The user identifier number

gid_list

A pointer to a list of group identifier numbers

gid_size

The number of elements in the previous arguments array

Description

beostat_get_avail_nodes_by_id executes on the master node and returns a list of nodes that are available to the given user identifier number who also is a member of the group identifier numbers listed. Memory allocated by the function for node_list must be freed by the caller.

Examples

int cnt, *node_list, gid_size, i;
uid_t uid;
gid_t *gid_list;
uid = getuid();
gid_size = getgroups (0, gid_list);
gid_list = malloc (sizeof (gid_t) * gid_size);
getgroups (gid_size, gid_list);
cnt = beostat_get_avail_nodes_by_id (&node_list, uid,
gid_list, gid_size);
printf ("You may run jobs on nodes: ");
for (i = 0; i screen>

Return Value

Returns the number of nodes in node_list. If an error occurs, it will return -1.

Errors

This function relies on the Beostat subsystem, which consists of the proc filesystem on the remote node, the sendstats daemon on the remote node, the recvstats daemon on the master node, and two shared memory files in the directory /var/shm. If any part of the system breaks down, this function could fail.