ZIP_REGISTER_CANCEL_CALLBACK_WITH_STATE(3)
β¨ NAME β¨
zip_register_cancel_callback_with_state β bestie, this is the one that lets you cancel stuff while zip_close is doing its thing π
π LIBRARY
libzip β link it with -lzip π
π¦ SYNOPSIS π¦
#include <zip.h>
typedef int (*zip_cancel_callback)(zip_t *, void *);
void
zip_register_cancel_callback_with_state(zip_t *archive,
zip_cancel_callback callback, void (*ud_free)(void *), void *ud);
π DESCRIPTION π
okay so, real talk: this function is your little emergency brake π. You use it to cancel writing of a zip archive while zip_close(3) is mid-grind.
The zip_register_cancel_callback_with_state() function registers a callback function, callback, for the zip archive archive. And the ud_free function? That one gets called during cleanup, for deleting the userdata you supplied in ud. So likeβ¦ it handles the β¨aftercareβ¨. No leaks, no mess, iconic behavior honestly π«Ά
Now the callback function itself gets called during zip_close(3) in regular intervals β specifically after every zip archive entry that's completely written to disk, and while writing data for entries β and it gets handed the zip archive archive and the user-provided user-data ud as arguments. The way that it works is: when the callback function returns a non-zero value, writing is cancelled and zip_close(3) returns an error. Periodt. π
β οΈ Heads up bestie: the callback function should be fast, since it will be called often. Like, it's giving "quick vibe check," not "write me a whole novel." Don't be doing heavy stuff in there, fr fr π
π SEE ALSO π
π HISTORY π
zip_register_cancel_callback_with_state() was added in libzip 1.6.0 β so it's a relatively fresh baddie, not an ancient relic π
π AUTHORS π
The masterminds behind this whole thing:
- Dieter Baron
<dillo@nih.at> - Thomas Klausner
<wiz@gatalith.at>
and that's the whole page, bestie π this one came from the Debian crew, dated June, and it's the ZIP_REGISTER_CANCEL_CALLBACK_WITH_STATE(3) page β go forth and cancel responsibly πβ¨
π¦ where this page comes from
- arch rolling: libzip 1.11.4-1 Β· BSD
- debian trixie: libzip-dev 1.11.3-2 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 43: libzip-devel 1.11.4-2.fc43 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- fedora 44: libzip-devel 1.11.4-3.fc44 Β· BSD-3-Clause
- nixpkgs unstable: libzip 1.11.4
- ubuntu questing: libzip-dev 1.11.3-2
- ubuntu resolute: libzip-dev 1.11.4-2 Β· BSD-3-Clause
- ubuntu stonking: libzip-dev 1.11.4-2build1 Β· BSD-3-Clause
- Copyright (C) 2021-2022 Dieter Baron and Thomas Klausner
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms