[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 1

getrpcent, getrpcbyname, getrpcbynumber, setrpcent, or endrpcent Subroutine

Purpose

Accesses the /etc/rpc file.

Library

Standard C Library (libc.a)

Syntax

#include <netdb.h>


struct rpcent *getrpcent ()
struct rpcent *getrpcbyname ( Name)
char *Name;
struct rpcent *getrpcbynumber ( Number)
int Number;
void setrpcent (StayOpen)
int StayOpen
void endrpcent

Description

Attention: Do not use the getrpcent, getrpcbyname, getrpcbynumber, setrpcent, or endrpcent subroutine in a multithreaded environment.
Attention: The information returned by the getrpcbyname, and getrpcbynumber subroutines is stored in a static area and is overwritten on subsequent calls. Copy the information to save it.

The getprcbyname and getrpcbynumber subroutines each return a pointer to an object with the rpcent structure. This structure contains the broken-out fields of a line from the /etc/rpc file. The getprcbyname and getrpcbynumber subroutines searches the rpc file sequentially from the beginning of the file until it finds a matching RPC program name or number, or until it reaches the end of the file. The getrpcent subroutine reads the next line of the file, opening the file if necessary.

The setrpcent subroutine opens and rewinds the /etc/rpc file. If the StayOpen parameter does not equal 0, the rpc file is not closed after a call to the getrpcent subroutine.

The setrpcent subroutine rewinds the rpc file. The endrpcent subroutine closes it.

The rpc file contains information about Remote Procedure Call (RPC) programs. The rpcent structure is in the /usr/include/netdb.h file and contains the following fields:

r_name Contains the name of the server for an RPC program
r_aliases Contains an alternate list of names for RPC programs. This list ends with a 0.
r_number Contains a number associated with an RPC program.

Parameters

Name Specifies the name of a server for rpc program.
Number Specifies the rpc program number for service.
StayOpen Contains a value used to indicate whether to close the rpc file.

Return Values

These subroutines return a null pointer when they encounter the end of a file or an error.

Files

/etc/rpc Contains information about Remote Procedure Call (RPC) programs.

Related Information

Remote Procedure Call (RPC) for Programming in AIX 5L Version 5.2 General Programming Concepts: Writing and Debugging Programs

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]