Copyright 1989 AT&T Copyright (c) 1997, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
cc [ flag ... ] file ... -lrpcsvc [ library ... ] #include <rpc/rpc.h> #include <rpcsvc/rusers.h> enum clnt_stat rusers(char *host, struct utmpidlearr *up);
int rnusers(char *host);
These routines require that the rpc.rusersd(1M) daemon be configured and available on the remote system indicated by host. The rusers() protocol is used to retrieve information about users logged in on the remote system.
rusers() fills the utmpidlearr structure with data about host, and returns 0 if successful. up must point to an allocated utmpidlearr structure. If rusers() returns successful it will have allocated data structures within the up structure, which should be freed with xdr_free(3NSL) when you no longer need them:
xdr_free(xdr_utimpidlearr, up);
On error, the returned value can be interpreted as an enum clnt_stat and can be displayed with clnt_perror(3NSL) or clnt_sperrno(3NSL).
See the header <rpcsvc/rusers.h> for a definition of struct utmpidlearr.
rnusers() returns the number of users logged on to host (-1 if it cannot determine that number).
The following XDR routines are available in librpcsvc:
xdr_utmpidlearr
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
MT-Level MT-Safe |
rusers(1), rpc.rusersd(1M), rpc_clnt_calls(3NSL), xdr_free(3NSL), attributes(5)