SAM_D...TSIZE(3)
π SAM_D...TSIZE(3) π
okay so bestie, this is a page from the Corosync Cluster Engine Programmer's Manual β yes the section-3 kind, the "I'm a C function" kind. Buckle up, it's short but it's iconic π
β¨ NAME β¨
sam_data_getsize β bestie, it returns the size of your stored data, in bytes π¦
πΈ SYNOPSIS πΈ
#include <corosync/sam.h>
cs_error_t sam_data_getsize (size_t *size);
like. that's it. that's the whole vibe. one include, one function call, and you're cooking π
π«Ά DESCRIPTION π«Ά
so the sam_data_getsize function is used to return the size of stored data. Size is returned in bytes. β¨
If user data is NULL, zero is returned. no drama, no crash, just a lil zero. π
and here's the part that actually matters, the main character energy of this whole manpage: this function is intended to be used before the sam_data_restore(3) call, so you can properly allocate a buffer for the restored data. like, you gotta know how big the thing is before you make room for the thing, yk? it's giving "measure twice, cut once" fr fr βοΈ
β RETURN VALUE β
This call returns CS_OK if it's successful π β otherwise an error is returned π
π ERRORS π
here's where things go wrong, and ngl you're gonna want to read this part:
CS_ERR_BAD_HANDLEβ the component was not initialized by callingsam_initialize(3), or it was finalized. like bestie, you can't use a thing that was never set up, or a thing you already shut down πCS_ERR_INVALID_PARAMβ thesizeparameter isNULL. yeah. you handed it nothing. it's not doing that. π
π SEE ALSO π
go check out these besties, they're all part of the same friend group:
and here's the whole squad of error codes, in case you were wondering what the rest of them mean π
CS_ERR_TRY_AGAINβ Resource temporarily unavailableCS_ERR_INVALID_PARAMβ Invalid argumentCS_ERR_ACCESSβ Permission deniedCS_ERR_LIBRARYβ The connection failedCS_ERR_INTERRUPTβ System call interrupted by a signalCS_ERR_NOT_SUPPORTEDβ The requested protocol/functionality not supportedCS_ERR_MESSAGE_ERRORβ Incorrect auth message receivedCS_ERR_NO_MEMORYβ Not enough memory to complete the requested task
and that's the whole page, bestie, no notes. this lil gem lives in the corosync Man Page from 04/15/2010, filed under SAM_D...TSIZE(3) π¦β¨ go allocate that buffer correctly, you absolute icon ππ
π¦ where this page comes from
- debian bookworm: libsam-dev 3.1.7-1+deb12u2 Β· BSD-3-Clause
- debian trixie: libsam-dev 3.1.9-2+deb13u1 Β· BSD-3-Clause
- epel 9: corosynclib-devel 3.1.10-0.2.el9.1 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.10-3.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.10-3.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.9-5.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.9-5.fc43 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-4.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-4.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-6.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-6.fc44 Β· BSD-3-Clause
- nixos 26.05: corosync 3.1.9
- nixpkgs unstable: corosync 3.1.9
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- ubuntu jammy: libsam-dev 3.1.6-1ubuntu1 Β· BSD-3-Clause
- ubuntu jammy: libsam-dev 3.1.6-1ubuntu1.2 Β· BSD-3-Clause
- ubuntu noble: libsam-dev 3.1.7-1ubuntu3 Β· BSD-3-Clause
- ubuntu noble: libsam-dev 3.1.7-1ubuntu3.2 Β· BSD-3-Clause
- ubuntu questing: libsam-dev 3.1.9-2ubuntu1
- ubuntu questing: libsam-dev 3.1.9-2ubuntu1.1
- ubuntu resolute: libsam-dev 3.1.9-2ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libsam-dev 3.1.10-3ubuntu1 Β· BSD-3-Clause
- Copyright (c) 2010 Red Hat, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms