---
name: "getrpcbynumber_r"
section: "3"
platform: "linux"
package: "man-pages"
version: "6.19-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/getrpcent_r"
---

# getrpcbynumber\_r(3)

get RPC entry (reentrant)

Part of [getrpcent\_r(3)](/getrpcent_r/3.md).

## NAME

getrpcent\_r, getrpcbyname\_r, getrpcbynumber\_r - get RPC entry (reentrant)

## LIBRARY

Standard C library (*libc*, *-lc*)

## SYNOPSIS

```
#include <netdb.h>
```

**int getrpcent\_r(**size\_t size;                 **struct rpcent \****result\_buf***, char** *buf***\[***size***\],**                 **size\_t** *size***, struct rpcent \*\****result***);** **int getrpcbyname\_r(**size\_t size;                 **const char \****name***,**                 **struct rpcent \****result\_buf***, char** *buf***\[***size***\],**                 **size\_t** *size***, struct rpcent \*\****result***);** **int getrpcbynumber\_r(**size\_t size;                 **int** *number***,**                 **struct rpcent \****result\_buf***, char** *buf***\[***size***\],**                 **size\_t** *size***, struct rpcent \*\****result***);**

Feature Test Macro Requirements for glibc (see [**feature\_test\_macros**(7)](/feature_test_macros/7.md)):

**getrpcent\_r**(), **getrpcbyname\_r**(), **getrpcbynumber\_r**():

```
    Since glibc 2.19:
        _DEFAULT_SOURCE
    glibc 2.19 and earlier:
        _BSD_SOURCE || _SVID_SOURCE
```

## DESCRIPTION

The **getrpcent\_r**(), **getrpcbyname\_r**(), and **getrpcbynumber\_r**() functions are the reentrant equivalents of, respectively, [**getrpcent**(3)](/getrpcent/3.md), [**getrpcbyname**(3)](/getrpcbyname/3.md), and [**getrpcbynumber**(3)](/getrpcbynumber/3.md). They differ in the way that the *rpcent* structure is returned, and in the function calling signature and return value. This manual page describes just the differences from the nonreentrant functions.

Instead of returning a pointer to a statically allocated *rpcent* structure as the function result, these functions copy the structure into the location pointed to by *result\_buf*.

The *buf* array is used to store the string fields pointed to by the returned *rpcent* structure. (The nonreentrant functions allocate these strings in static storage.) The size of this array is specified in *size*. If *buf* is too small, the call fails with the error **ERANGE**, and the caller must try again with a larger buffer. (A buffer of size 1024 bytes should be sufficient for most applications.)

If the function call successfully obtains an RPC record, then *\*result* is set pointing to *result\_buf*; otherwise, *\*result* is set to NULL.

## RETURN VALUE

On success, these functions return 0. On error, they return one of the positive error numbers listed in ERRORS.

On error, record not found (**getrpcbyname\_r**(), **getrpcbynumber\_r**()), or end of input (**getrpcent\_r**()) *\*result* is set to NULL.

## ERRORS

- **ENOENT**

  (**getrpcent\_r**()) No more records in database.

- **ERANGE**

  *buf* is too small. Try again with a larger buffer (and increased *size*).

## ATTRIBUTES

For an explanation of the terms used in this section, see [**attributes**(7)](/attributes/7.md).

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **getrpcent\_r**(), **getrpcbyname\_r**(), **getrpcbynumber\_r**() | Thread safety | MT-Safe locale |

## VERSIONS

Functions with similar names exist on some other systems, though typically with different calling signatures.

## STANDARDS

GNU.

## SEE ALSO

[**getrpcent**(3)](/getrpcent/3.md), [**rpc**(5)](/rpc/5.md)
