io_close(3)

πŸ“¦
version 0.34 Β· 2 versions
  • 0.34 Β· alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 0.30 Β· fedora 43, fedora 44, ubuntu jammy
, in alpine 3.24, debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– 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 like close(), but it also removes the descriptor from the internal io_wait() data structures. so if you called io_fd on a descriptor, you need to use io_close to close it β€” not just close(). 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. πŸ“