SAM_D...STORE(3)
π SAM_D...STORE(3) β sam_data_restore π
okay bestie, this one lives in the Corosync Cluster Engine Programmer's Manual, section 3 of the manual pages. it's the little sibling of sam_data_store, and it's here to hand your data back to you. let's get into it π«Ά
β¨ NAME β¨
sam_data_restore β bestie, it restores your previously saved user data. that's the whole job. no cap. π
πΈ SYNOPSIS πΈ
#include <corosync/sam.h>
cs_error_t sam_data_restore (void *data, size_t size);
π¦ DESCRIPTION π¦
so the sam_data_restore function is the glow-up reversal of sam_data_store(3) β you use it to restore data that was previously saved by calling sam_data_store(3). and the iconic part? that data survives between instances. it's giving main character energy that outlives the whole process. periodt. π
the data parameter is a pointer to memory that you, the caller, initialized. the stored data gets copied right there into it. which also means β and this is the important bit, don't skip it β the caller is responsible for freeing that memory. you malloc'd it, you free it. it's your child now. π
the size parameter is the length of data. and lowkey this one has rules:
- it must be at least the same length as the previously stored data, otherwise an error gets returned. no sneaky shrinking, bestie. π«
- it can be larger, but then only the stored data size bytes are changed. everything past that just sits there, untouched.
and if you need to know the length of the stored data first (which, honestly, you probably do), use sam_data_getsize(3). it's literally right there for you. π
π RETURN VALUE π
this call returns the CS_OK value if it's successful. if it's not? an error gets returned instead. that's it, that's the vibe check. β¨
π ERRORS π
CS_ERR_BAD_HANDLEβ the component was not initialized by callingsam_initialize(3), or it was already finalized. like, you can't show up to the party after it ended, babe. πCS_ERR_INVALID_PARAMβ thedataparameter isNULL, orsizeis less than the currently stored data length. one of those two, pick your fighter. π
π§ SEE ALSO π§
and also, while you're here, the whole lil squad of CS_ERR codes:
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
π gentle reminder bestie: that data buffer is yours to free. the function copies into it, it does not adopt it. don't leak, okay? i'm watching. π
and that's the whole page, fr fr. this one came straight out of the corosync Man Page, dated 04/15/2010, and it's filed under SAM_D...STORE(3). slay, go restore some data, you absolute legend. π πβ¨
π¦ 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