Sun Microsystems, Inc.
spacer | | |  
black dot
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
Networking Services Library Functionsnis_server(3NSL)


 nis_server, nis_mkdir, nis_rmdir, nis_servstate, nis_stats, nis_getservlist, nis_freeservlist, nis_freetags - miscellaneous NIS+ functions


cc [ flag ... ] file ... -lnsl [ library ... ]
#include <rpcsvc/nis.h>
nis_error nis_mkdir(nis_name dirname, nis_server *machine);
 nis_error nis_rmdir(nis_name dirname, nis_server *machine);
 nis_error nis_servstate(nis_server *machine, nis_tag *tags, int numtags, nis_tag **result);
 nis_error nis_stats(nis_server *machine, nis_tag *tags, int numtags, nis_tag **result);
 void nis_freetags(nis_tag *tags, int numtags);
 nis_server **nis_getservlist(nis_name dirname);
 void nis_freeservlist(nis_server **machines);



These functions provide a variety of services for NIS+ applications.

nis_mkdir() is used to create the necessary databases to support NIS+ service for a directory, dirname, on a server, machine. If this operation is successful, it means that the directory object describing dirname has been updated to reflect that server machine is serving the named directory. For a description of the nis_server structure, refer to nis_objects(3NSL).

Per-server and per-directory access restrictions may apply to nis_mkdir(). See nisopaccess(1).

nis_rmdir() is used to delete the directory, dirname, from the specified server machine. The machine parameter cannot be NULL. Note that nis_rmdir() does not remove the directory dirname from the namespace or remove a server from the server list in the directory object. To remove a directory from the namespace you must call nis_remove() to remove the directory dirname from the namespace and call nis_rmdir() for each server in the server list to remove the directory from the server. To remove a replica from the server list, you need to first call nis_modify() to remove the server from the directory object and then call nis_rmdir() to remove the replica.

Per-server and per-directory access restrictions may apply to nis_rmdir(). See nisopaccess(1).

For a description of the nis_server structure, refer to nis_objects(3NSL).

nis_servstate() is used to set and read the various state variables of the NIS+ servers. In particular the internal debugging state of the servers may be set and queried.

The nis_stats() function is used to retrieve statistics about how the server is operating. Tracking these statistics can help administrators determine when they need to add additional replicas or to break up a domain into two or more subdomains. For more information on reading statistics, see nisstat(1M).

nis_servstate() and nis_stats() use the tag list. This tag list is a variable length array of nis_tag structures whose length is passed to the function in the numtags parameter. The set of legal tags are defined in the file <rpcsvc/nis_tags.h> which is included in <rpcsvc/nis.h>. Because these tags can and do vary between implementations of the NIS+ service, it is best to consult this file for the supported list. Passing unrecognized tags to a server will result in their tag_value member being set to the string ``unknown.'' Both of these functions return their results in malloced tag structure, *result. If there is an error, *result is set to NULL. The tag_value pointers points to allocated string memory which contains the results. Use nis_freetags() to free the tag structure.

Per-server and per-directory access restrictions may apply to the NIS_SERVSTATE or NIS_STATUS (nis_stats()) operations and their sub-operations (tags). See nisopaccess(1).

nis_getservlist() returns a null terminated list of nis_server structures that represent the list of servers that serve the domain named dirname. Servers from this list can be used when calling functions that require the name of a NIS+ server. For a description of the nis_server refer to nis_objects(3NSL). nis_freeservlist() frees the list of servers list of servers returned by nis_getservlist(). Note that this is the only legal way to free that list.



See attributes(5) for descriptions of the following attributes:




nisopaccess(1), nisstat(1M), nis_names(3NSL), nis_objects(3NSL), nis_subr(3NSL), attributes(5)



NIS+ might not be supported in future releases of the Solaris Operating Environment. Tools to aid the migration from NIS+ to LDAP are available in the Solaris 9 operating environment. For more information, visit

SunOS 5.9Go To TopLast Changed 18 Dec 2001

Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.