---
name: "io_uring_register_files"
section: "3"
platform: "linux"
package: "liburing"
version: "2.15-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/io_uring_register_files"
---

# io\_uring\_register\_files(3)

register file descriptors

## NAME

io\_uring\_register\_files - register file descriptors

## SYNOPSIS

```
#include <liburing.h>
```

**int io\_uring\_register\_files(struct io\_uring \****ring***,**                             **const int \****files***,**                             **unsigned** *nr\_files***);**

**int io\_uring\_register\_files\_tags(struct io\_uring \****ring***,**                                  **const int \****files***,**                                  **const \_\_u64 \****tags***,**                                  **unsigned** *nr***);**

**int io\_uring\_register\_files\_sparse(struct io\_uring \****ring***,**                                    **unsigned** *nr\_files***);**

**int io\_uring\_register\_files\_update(struct io\_uring \****ring***,**                                    **unsigned** *off***,**                                    **const int \****files***,**                                    **unsigned** *nr\_files***);**

**int io\_uring\_register\_files\_update\_tag(struct io\_uring \****ring***,**                                    **unsigned** *off***,**                                    **const int \****files***,**                                    **const \_\_u64 \****tags***,**                                    **unsigned** *nr\_files***);**

## DESCRIPTION

The [**io\_uring\_register\_files**(3)](/io_uring_register_files/3.md) function registers *nr\_files* number of file descriptors defined by the array *files* belonging to the *ring* for subsequent operations.

The [**io\_uring\_register\_files\_tags**(3)](/io_uring_register_files_tags/3.md) function behaves the same as [**io\_uring\_register\_files**(3)](/io_uring_register_files/3.md) function but additionally takes *tags* parameter. See **IORING\_REGISTER\_BUFFERS2** for the resource tagging description.

The [**io\_uring\_register\_files\_sparse**(3)](/io_uring_register_files_sparse/3.md) function registers an empty file table of *nr\_files* number of file descriptors. These files must be updated before use, using eg [**io\_uring\_register\_files\_update\_tag**(3)](/io_uring_register_files_update_tag/3.md). Note that if the size of the sparse table exceeds what **RLIMIT\_NOFILE** allows, then [**io\_uring\_register\_files\_sparse**(3)](/io_uring_register_files_sparse/3.md) will attempt to raise the limit using **setrlimit (2)** and retry the operation. If the registration fails after doing that, then an error will be returned. The sparse variant is available in kernels 5.19 and later.

Registering a file table is a prerequisite for using any request that uses direct descriptors.

Registered files have less overhead per operation than normal files. This is due to the kernel grabbing a reference count on a file when an operation begins, and dropping it when it's done. When the process file table is shared, for example if the process has ever created any threads, then this cost goes up even more. Using registered files reduces the overhead of file reference management across requests that operate on a file.

The [**io\_uring\_register\_files\_update**(3)](/io_uring_register_files_update/3.md) function updates existing registered files. The *off* is offset on which to start the update *nr\_files* number of files defined by the array *files* belonging to the *ring*.

The [**io\_uring\_register\_files\_update\_tag**(3)](/io_uring_register_files_update_tag/3.md) function behaves the same as [**io\_uring\_register\_files\_update**(3)](/io_uring_register_files_update/3.md) function but additionally takes *tags* parameter. See **IORING\_REGISTER\_BUFFERS2** for the resource tagging description.

## RETURN VALUE

On success [**io\_uring\_register\_files**(3)](/io_uring_register_files/3.md), [**io\_uring\_register\_files\_tags**(3)](/io_uring_register_files_tags/3.md) and [**io\_uring\_register\_files\_sparse**(3)](/io_uring_register_files_sparse/3.md) return 0. [**io\_uring\_register\_files\_update**(3)](/io_uring_register_files_update/3.md) and [**io\_uring\_register\_files\_update\_tag**(3)](/io_uring_register_files_update_tag/3.md) return number of files updated. On failure they return **-errno**.

## SEE ALSO

[**io\_uring\_register**(2)](/io_uring_register/2.md), [**io\_uring\_get\_sqe**(3)](/io_uring_get_sqe/3.md), [**io\_uring\_unregister\_files**(3)](/io_uring_unregister_files/3.md)
