AUDIT\_GET\_SESSION(3) Linux Audit API AUDIT\_GET\_SESSION(3)

# [NAME](#NAME)

audit\_get\_session - Get a program's login session id value

# [SYNOPSIS](#SYNOPSIS)

```
#include <libaudit.h>
```

```
uint32_t audit_get_session(void);
```

# [DESCRIPTION](#DESCRIPTION)

This function returns the task's session id attribute.

# [RETURN VALUE](#RETURN_VALUE)

This function returns the session id value if it was set. It will return a -1 if the session id is unset. However, since uint32\_t is an unsigned type, you will see the converted value instead of -1.

# [ERRORS](#ERRORS)

This function returns -2 on failure. Additionally, in the event of a real error, errno would be set. The function can set errno based on failures of open, read, or strtoul.

# [SEE ALSO](#SEE_ALSO)

[**audit\_getloginuid**(3)](/man/os/audit/audit_getloginuid.3).

# [AUTHOR](#AUTHOR)

Steve Grubb

Dec 2016 Red Hat

---

Document: audit_get_session(3) from audit 4.2.1-r1 (Chainguard OS)
Source: https://github.com/linux-audit/audit-userspace
