---
name: "sam_data_getsize"
section: "3"
platform: "linux"
package: "libsam-dev"
version: "3.1.9-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/sam_data_getsize"
---

# sam\_data\_getsize(3)

Return size of stored data in bytes

## NAME

sam\_data\_getsize - Return size of stored data in bytes

## SYNOPSIS

**#include \<corosync/sam.h\>**

**cs\_error\_t sam\_data\_getsize (size\_t \****size***);**

## DESCRIPTION

The **sam\_data\_getsize** function is used to return size of stored data. Size is returned in bytes. If user data is NULL, zero is returned. Function is intended to be used before **[sam\_data\_restore(3)](/sam_data_restore/3.md)** call to properly allocate buffer for restored data.

## RETURN VALUE

This call return CS\_OK value if successful, otherwise and error is returned.

## ERRORS

- CS\_ERR\_BAD\_HANDLE

  component was not initialized by calling **[sam\_initialize(3)](/sam_initialize/3.md)** or it was finalized.

- CS\_ERR\_INVALID\_PARAM

  size parameter is NULL

## SEE ALSO

[**sam\_data\_store**(3)](/sam_data_store/3.md), [**sam\_data\_restore**(3)](/sam_data_restore/3.md)

**CS\_ERR\_TRY\_AGAIN** Resource temporarily unavailable

**CS\_ERR\_INVALID\_PARAM** Invalid argument

**CS\_ERR\_ACCESS** Permission denied

**CS\_ERR\_LIBRARY** The connection failed

**CS\_ERR\_INTERRUPT** System call interrupted by a signal

**CS\_ERR\_NOT\_SUPPORTED** The requested protocol/functionality not supported

**CS\_ERR\_MESSAGE\_ERROR** Incorrect auth message received

**CS\_ERR\_NO\_MEMORY** Not enough memory to complete the requested task
