---
name: "iscsi_session_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_session_get"
---

# iscsi\_session\_get(3)

Retrieve specified iSCSI sessions.

## NAME

iscsi\_session\_get - Retrieve specified iSCSI sessions.

## SYNOPSIS

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

## ARGUMENTS

- ctx

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

- sid

  uint32\_t, iSCSI session ID.

- se

  Output pointer of 'struct iscsi\_session' pointer. Its memory should be freed by **iscsi\_session\_free**. If this pointer is NULL, your program will be terminated by assert. If specified iSCSI session does not exist, this pointer will be set to NULL with LIBISCSI\_OK returned.

## DESCRIPTION

Retrieves specified iSCSI sessions. For the properties of

## RETURN

int. Valid error codes are:

\* LIBISCSI\_OK

\* LIBISCSI\_ERR\_BUG

\* LIBISCSI\_ERR\_NOMEM

\* LIBISCSI\_ERR\_ACCESS

\* LIBISCSI\_ERR\_SYSFS\_LOOKUP

\* LIBISCSI\_ERR\_SESS\_NOT\_FOUND

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