DOKK / manpages / debian 10 / atfs-dev / atCloseExpand.3.en
atReadExpand(3) AtFS Toolkit Library atReadExpand(3)

atOpenExpand, atReadExpand, atCloseExpand - read version objects with attribute citations expanded
atGetWriteName - get bound version name of a version object opened with atOpenExpand

#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[] ;

atOpenExpand, atReadExpand, and atCloseExpand are designed as a nearly plug-compatible replacement for the system calls open(2), read(2), and close(2) for reading of AtFS version objects with attribute citations expanded.

atOpenExpand opens the file or AtFS version object version for reading with atReadExpand. Version points to the pathname of a file or AtFS version object. If the flag expand_busy is non-zero, attribute citations are expanded in busy versions also. atOpenExpand returns a descriptor that is valid as 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.

atGetWriteName returns a pointer to the bound version name of the version object for which atOpenExpand returned the descriptor desc.

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.

If atOpenExpand returns an error and atBindError has a non-zero value, the string version did not select a version object or not a unique version object. In this case atBindErrorMsg contains an appropriate error message.

Possible Values of errno after a call to atOpenExpand:

Not enough memory could be allocated.
All available descriptors are in use.

All errno values returned by open(2) or read(2).

Possible Values of errno after a call to atReadExpand:

Not enough memory could be allocated.
Invalid descriptor.

Since atOpenExpand reads the complete contents of version into memory, it fails on very large version objects.

intro(2), open(2), read(2), close(2), errno(3), atattribute(3), atbind(3).

Tue Feb 16 20:33:25 1993 AtFStk-1.12