---
name: "rfiosetopt"
section: "3"
platform: "linux"
package: "libdpm-dev"
version: "1.10.0-2+b3"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/rfiosetopt"
---

# rfiosetopt(3)

set RFIO options

## NAME

rfiosetopt - set RFIO options

## SYNOPSIS

**#include \<sys/types.h\>**\
 **#include "rfio\_api.h"**

**int rfiosetopt (int** *opt***,** **int \****pval***,** **int** *len***)**

**int rfio\_setbufsize (int** *s***,** **int** *bufsize***)**

## DESCRIPTION

**rfiosetopt** sets the RFIO option *opt* to the content of the memory cell pointed by *pval*.

**rfio\_setbufsize** sets the size of the readahead buffer to be used on a particular socket connection.

*opt* can have on of the following values:

- **RFIO\_READOPT**

  The value pointed by pval can be 0, RFIO\_READBUF, RFIO\_READAHEAD or RFIO\_STREAM (V3).

  - If set to zero, a normal read will be used (one request to the server per read).

    If set to RFIO\_READBUF, an internal buffer is allocated in the client API, each call to the server fills this buffer and the user buffer is filled from the internal buffer. There is one server call per buffer fill.

  If set to RFIO\_READAHEAD, an initial call is sent to the server which pushes data to the client buffer until end of file is reached or an error occurs or a new request comes from the client. There is no intermediate buffer unless RFIO\_READBUF\|RFIO\_READAHEAD is specified.

  If RFIO\_STREAM is set, the V3 protocol is enabled. This uses 2 socket connections between the client and the server and the server itself is multi-threaded allowing overlap of disk and network operations. The data is pushed on the data socket until end of file is reached or an error occurs. The transfer can be interrupted by sending a packet on the control socket.\
   Default is RFIO\_READBUF.

  The default internal buffer size is 128kB, but the buffer size can be set with an entry RFIO IOBUFSIZE in **shift.conf** or thru the environment variable RFIO\_IOBUFSIZE.

- **RFIO\_NETOPT**

  The value pointed by pval can be RFIO\_NONET or RFIO\_NET. If set to RFIO\_NONET, the NET entries in **shift.conf** are ignored. Default is RFIO\_NET.

- **RFIO\_NETRETRYOPT**

  The value pointed by pval can be RFIO\_RETRYIT or RFIO\_NOTIME2RETRY.

  If set to RFIO\_RETRYIT, there will be retries on failing connect. The number of retries is given by the environment variable RFIO\_CONRETRY or the RFIO CONRETRY entry in **shift.conf**. The retry interval (in seconds) is given by the environment variable RFIO\_CONRETRYINT or the RFIO CONRETRYINT entry.

  If set to RFIO\_NOTIME2RETRY, there will be no retry on failing connect.\
   Default is RFIO\_RETRYIT.

- **RFIO\_CONNECTOPT**

  The value pointed by pval can be RFIO\_NOLOCAL or RFIO\_FORCELOCAL. If set to RFIO\_FORCELOCAL, no parsing is done on pathname. The file is assumed to be local. Default is RFIO\_NOLOCAL.

The *len* argument is ignored.

*s* is the file descriptor of the receiving socket.

*bufsize* is the size of the readahead buffer to be used.

## RETURN VALUE

**rfiosetopt** returns 0 if the operation was successful or -1 if the operation failed. In the latter case, **serrno** is set appropriately.

## ERRORS

- **ENOMEM**

  buffer could not be allocated.

- **EINVAL**

  *opt* is not a valid option, *bufsize* is negative or the user tries to change the buffer size after the actual I/O has started.

## SEE ALSO

**[rfio\_open(3)](/rfio_open/3.md)**, **[rfioreadopt(3)](/rfioreadopt/3.md)**

## AUTHOR

**LCG Grid Deployment** Team
