---
name: "iscsi_sessions_get"
section: "3"
platform: "linux"
package: "open-iscsi"
version: "2.1.13-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/iscsi_sessions_get"
---

# iscsi\_sessions\_get(3)

Retrieve all iSCSI sessions.

## NAME

iscsi\_sessions\_get - Retrieve all iSCSI sessions.

## SYNOPSIS

**int iscsi\_sessions\_get** **(struct iscsi\_context \****ctx***,** **struct iscsi\_session \*\*\****ses***,** **uint32\_t \****se\_count***);**

## ARGUMENTS

- ctx

  Pointer of 'struct iscsi\_context'. If this pointer is NULL, your program will be terminated by assert.

- ses

  Output pointer of 'struct iscsi\_session' pointer array. Its memory should be freed by **iscsi\_sessions\_free**. If this pointer is NULL, your program will be terminated by assert.

- se\_count

  Output pointer of uint32\_t. Will store the size of

## DESCRIPTION

Retrieves all iSCSI sessions. For the properties of 'struct iscsi\_session', please refer to the functions defined in 'libopeniscsiusr\_session.h' file.

## RETURN

int. Valid error codes are:

\* LIBISCSI\_OK

\* LIBISCSI\_ERR\_BUG

\* LIBISCSI\_ERR\_NOMEM

\* LIBISCSI\_ERR\_ACCESS

\* LIBISCSI\_ERR\_SYSFS\_LOOKUP

Error number could be converted to string by **iscsi\_strerror**.
