qlibs:(fd)

πŸ“¦
version 31 Β· 2 versions
, in alpine 3.24

πŸ’… qlibs:(fd) β€” the fd page, but make it bestie-coded πŸ’…

okay so this is the qlibs:(fd) manual, page 3 energy, and we’re talking about file-descriptor glow-ups: duplicating, moving, and closing. no cap, every detail is staying. 🫢

🌸 NAME 🌸

fd β€” duplicate, move or close a file descriptor.

✨ SYNTAX ✨

#include "fd.h"

int fd_copy(int to,int from);
int fd_move(int to,int from);
int fd_coe(int fd);

πŸ¦‹ DESCRIPTION πŸ¦‹

  • fd_copy β€” copies descriptor from to descriptor to. If to was already open, fd_copy closes it. fd_copy always leaves from intact; if to and from are the same number, fd_copy does nothing.
🚨 caveat, bestie: fd_copy does not guarantee that to will remain open, if it was open, in case of error.
  • fd_move β€” moves descriptor from to descriptor to. If to was already open, fd_move closes it. If the move is successful, fd_move closes from. Exception: if to and from are the same number, fd_move does nothing.
  • fd_coe β€” closes fd.

πŸ’€ RETURN CODES πŸ’€

fd_copy, fd_move, and fd_coe return 0 on success, and -1 on error. that’s it, that’s the whole vibe check. ✨

πŸ‘‘ SEE ALSO πŸ‘‘


made with πŸ’– from qlibs:(fd) Β· page 3 Β· date: not listed in the footer of this copy, bestie β€” so we’re reporting exactly what’s there. πŸŽ€

πŸ“¦ where this page comes from