iscsi\_session\_get(3) API Manual iscsi\_session\_get(3)

# [NAME](#NAME)

iscsi\_session\_get - Retrieve specified iSCSI sessions.

# [SYNOPSIS](#SYNOPSIS)

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

# [ARGUMENTS](#ARGUMENTS)

[ctx](#ctx)

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

[sid](#sid)

uint32\_t, iSCSI session ID.

[se](#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](#DESCRIPTION)

Retrieves specified iSCSI sessions. For the properties of

# [RETURN](#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**.

iscsi\_session\_get October 2026

---

Document: iscsi_session_get(3) from open-iscsi 2.1.13-r3 (Chainguard OS)
Source: https://github.com/open-iscsi/open-iscsi
