atReadExpand(3)
π atReadExpand(3) β bestie edition π
okay so this is the AtFS Toolkit Library page for atReadExpand(3) and its little friend group, and honestly? they ate. β¨
πΈ NAME πΈ
atOpenExpand,atReadExpand,atCloseExpandβ read version objects with attribute citations expanded π¦atGetWriteNameβ get the bound version name of a version object that got opened withatOpenExpandπ
β¨ SYNOPSIS β¨
#include <atfs.h>
#include <atfstk.h>
int atOpenExpand(char *version, int expand_busy) ;
int atReadExpand(int desc, char *bufp, int nbytes) ;
void atCloseExpand(int desc) ;
char *atGetWriteName(int desc) ;
extern int atBindError ;
extern char atBindErrorMsg[] ;
π DESCRIPTION π
so atOpenExpand, atReadExpand, and atCloseExpand are literally designed as a nearly plug-compatible replacement for the system calls open(2), read(2), and close(2) β but for reading AtFS version objects with attribute citations expanded. it's giving "same energy, extra sparkle." π
atOpenExpand opens the file or AtFS version object version for reading with atReadExpand. version points to the pathname of a file or an AtFS version object. if the flag expand_busy is non-zero, attribute citations get expanded in busy versions also π. atOpenExpand returns a descriptor that is valid as an argument to successive calls to atReadExpand and atCloseExpand.
atReadExpand attempts to read nbytes of data from the object referenced by the descriptor desc into the buffer pointed to by bufp. if desc is zero, atReadExpand reads from the standard input π₯. atReadExpand returns the number of bytes actually read.
atCloseExpand frees the resources associated with the descriptor desc. bye bestie, clean up after yourself π«Ά
atGetWriteName returns a pointer to the bound version name of the version object for which atOpenExpand returned the descriptor desc. iconic behavior tbh.
π₯ DIAGNOSTICS π₯
on error, atOpenExpand and atReadExpand return -1 and set errno appropriately. if one of these returns an error and errno is set to ENOMEM, the application may retry the operation, possibly after freeing some memory. so like, breathe, free some stuff, try again π
if atOpenExpand returns an error and atBindError has a non-zero value, the string version did not select a version object, or did not select a unique version object. in that case atBindErrorMsg contains an appropriate error message π’.
possible values oferrnoafter a call toatOpenExpand:
ENOMEMβ not enough memory could be allocated πEMFILEβ all available descriptors are in use π- all
errnovalues returned byopen(2)orread(2)β yes, the whole set, no crumbs left
possible values oferrnoafter a call toatReadExpand:
ENOMEMβ not enough memory could be allocated πEBADFβ invalid descriptor π«
π BUGS π
since atOpenExpand reads the complete contents of version into memory, it fails on very large version objects. so likeβ¦ big files? not her moment. no cap. π
π SEE ALSO π
intro(2), open(2), read(2), close(2), errno(3), atattribute(3), atbind(3).
this has been AtFStk-1.12, dated Tue Feb 16 20:33:25 1993 β yes bestie, 1993, she's vintage and she's still serving πβ¨π
π¦ where this page comes from
- debian bookworm: atfs-dev 1.4pl6-15+b1
- ubuntu jammy: atfs-dev 1.4pl6-15
- ubuntu noble: atfs-dev 1.4pl6-16.1build1
- ubuntu resolute: atfs-dev 1.4pl6-17
- ubuntu stonking: atfs-dev 1.4pl6-17
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms