LC_SYNCFILELOCAL(3)
π LC_SYNCFILELOCAL β the Librecast Programmer's Manual, but make it slay π
okay bestie, sit down, hydrate, and let's talk about lc_syncfilelocal from the Librecast library. this is lc_syncfilelocal(3) and she is literally the file-copying bestie you never knew you needed π«Ά
πΈ NAME πΈ
lc_syncfilelocal β synchronize two local files. yes queen, that's the whole job. two files, one destiny π
π LIBRARY π
Librecast library (liblibrecast, -llibrecast). that's the vibe, that's the link flag, that's the whole library situation β¨
π SYNOPSIS π
#include <librecast/sync.h>
int lc_syncfilelocal(const char *dst, const char *src, q_t *q
lc_stat_t *stats, lc_sync_options_t *opt, int flags);
Compile and link with -llibrecast.
β οΈ bestie look closely at that signature β there's no comma betweenq_t *qandlc_stat_t *statsin the synopsis. that's how it's written in the manual, so that's how it stays. copy-paste responsibly, iykyk π
β¨ DESCRIPTION β¨
so here's the tea. lc_syncfilelocal() takes the file at dst and synchronizes it with the file at src β by overwriting dst with bytes from src. and if dst doesn't exist yet? no worries, she just creates it. main character energy fr fr π
now, the q argument. if q is not NULL, it has to point to a queue q_t structure that was previously initialized with q_init(3). this queue is gonna have jobs enqueued onto it to build the tree π³. this is normally used in conjunction with a threadpool created with q_pool_create(3), where the threads are all calling q_job_seek(3). teamwork makes the dream work, no cap π
if q is NULL, then the creation and destruction of a queue and threadpool gets handled automatically for you. she's independent, she doesn't need you, she's got it π
if stats is not NULL, transfer statistics will be returned in this structure π.
opt is not used at present, and it must be NULL for compatibility with future versions. so like, don't get creative with it, bestie π
the flags argument is the bitwise OR of zero or more of the following flags:
π¦ OPTIONS π¦
MDEX_RECURSEβ recursively index directories. that's it, that's the whole flag list, she's a one-flag wonder and honestly? iconic π
π₯ RETURN VALUE π₯
lc_syncfilelocal() returns zero on success, or -1 if an error occurred. and if there's an error, errno gets set to indicate what went wrong. so always check your return value, bestie, don't just assume it ate π
π ERRORS π
EINVALβ Invalid argument.ENOMEMβ Not enough space/cannot allocate memory (POSIX.1-2001).
and listen: lc_syncfilelocal() can also fail with any of the errors for mmap(2) or chmod(2). so if you get a weird one, check those pages too, she's got range π«Ά
π SEE ALSO π
lc_memsync(3), lc_sync(3), lc_syncfile(3), q_init(3), q_free(3), q_pool_create(3), q_pool_destroy(3), q_job_seek(3), chmod(2), mmap(2)
and that's the whole page, bestie!! π
this little icon was brought to you by LIBRECAST, dated 2023-08-22, and filed under LC_SYNCFILELOCAL(3). go sync some files, you absolute legend πβ¨π¦
π¦ where this page comes from
- debian trixie: liblibrecast-dev 0.9.1-1 Β· GPL-2.0-only OR GPL-3.0-only
- nixos 26.05: librecast 0.11.2
- nixpkgs unstable: librecast 0.11.2
- ubuntu noble: liblibrecast-dev 0.8.0-1.1build1 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu questing: liblibrecast-dev 0.9.1-1
- ubuntu resolute: liblibrecast-dev 0.11.2-2 Β· GPL-2.0-only OR GPL-3.0-only
- ubuntu stonking: liblibrecast-dev 0.11.2-2build1 Β· GPL-2.0-only OR GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms