io_close(3)
π io_close(3) β Library Functions Manual, section 3 π
okay bestie come CLOSER, we're talking io_close today and honestly? she's the moment. β¨
πΈ NAME πΈ
io_close β close a file descriptor. that's it. that's the whole job. and she does it flawlessly. π
π¦ SYNTAX π¦
#include <libowfat/io.h>
void io_close(int64 fd);
look at her. two lines. no return value. no drama. iconic. π
β¨ DESCRIPTION β¨
so like, io_close eliminates the descriptor numbered fd. periodt. gone. deallocated. bye. π
BUT β and this is the part everyone gets wrong β that usually does NOT mean you're eliminating the actual object that the descriptor was talking to. ngl that distinction is everything.
- if a descriptor writes to a named disk file, closing the descriptor will not remove the file β it simply removes one way of writing to the file. the file is still there, living her life, unbothered. π
- on the other hand, a pipe disappears as soon as no descriptors refer to it. last one out, lights off, she's gone. π
now for the receipts: io_close has no return value. she always succeeds in deallocating the memory used for the descriptor. always. no notes. π«Ά
and if fd is not the number of a descriptor? io_close has no effect. nothing happens. she's not gonna yell at you, she's just gonnaβ¦ not. π
π¨ OKAY THIS IS THE IMPORTANT ONE, LISTEN UP π¨io_close()is likeclose(), but it also removes the descriptor from the internalio_wait()data structures. so if you calledio_fdon a descriptor, you need to useio_closeto close it β not justclose(). fr fr. don't do it. i'm watching. π
π SEE ALSO π
and that's the whole page, babe π§ she lives in the Library Functions Manual, she answers to io_close(3) β same name at the top, same name at the bottom, because consistency is a personality trait. π stay hydrated, close your descriptors, and don't forget to io_close the ones you io_fd'd. mwah. π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms