af_attrs(3)
π af_attrs(3) β the AtFS attribute handling girlies π
okay so this page lives in the Attribute Filesystem (AtFS) manual, section 3, and it's literally all about handling attributes. it's giving "everything you ever wanted to know about ASO attributes" and honestly? we ate. π
β¨ NAME β¨
af_retattr, af_retnumattr, af_retuserattr, af_rettimeattr, af_setattr, af_allattrs, af_isstdval, af_freeattr, af_freeattrbuf β AtFS attribute handling, bestie. that's the whole squad. π«Ά
π¦ SYNOPSIS π¦
#include <atfs.h>
char *af_retattr (Af_key *aso, char *attrName)
int af_retnumattr (Af_key *aso, char *attrName)
Af_useraf_retuserattr (Af_key *aso, char *attrName)
time_taf_rettimeattr (Af_key *aso, char *attrName)
int af_setattr (Af_key *aso, int mode, char *attrName)
int af_allattrs (Af_key *aso, Af_attrs *attrBuf)
void af_freeattr (char *attrValue);
void af_freeattrbuf (Af_attrs *attrBuf);
int af_isstdval (char *attrValue);
presenting these exactly as written, character for character, no notes π
πΈ DESCRIPTION πΈ
af_retattr hands you back the value of any ASO attribute as a string. the attrName argument is either a standard attribute (peep the list below, it's iconic) or a user defined one. standard attributes get converted into a meaningful string representation if they need it, no biggie. β¨
if the attribute name you pass to af_retattr has an equal sign in it (which can totally happen with user defined attributes), only the part before the equal sign gets interpreted as the name. the rest? not the name's business.
if the named attribute is a user defined one carrying multiple values, they all come back in one single string, with the values separated by newline ('\n') characters. multi-value queen. π
if the named attribute doesn't exist, af_retattr returns a null pointer. and if the value is empty, you get an empty string. different things, bestie, don't mix them up.
β οΈ note: the result string ofaf_retattrmay live in static memory which gets overwritten on subsequent calls ofaf_retattr. so don't get attached, it's not yours forever. π
af_retnumattr, af_retuserattr, and af_rettimeattr return the value of the named attribute as an integer, a user structure, or a time value respectively. heads up tho β these functions only apply to standard attributes with a matching type. no freeloaders. π«
af_setattr sets, modifies, or deletes user defined attributes of the ASO identified by aso. the attr parameter is a string shaped like this:
name=value
the name can be made of any characters (even non-printable ones, go off) but it may not contain Ctrl-A (\001) characters. periodt. the first equal sign that shows up in the string is the delimiter between name and value. if there's no equal sign at all, the whole string is interpreted as just an attribute name with no value. simple as.
the mode parameter is one of the following:
AF_ADDβ attach the given attribute to the identified ASO. if an attribute with that name already exists, it just adds the value to the existing attribute. subsequent calls ofaf_setattrwith the same attribute name construct attributes with multiple (any number) values. stacking values like it's a collection, we love to see it. β¨AF_REMOVEβ remove the named attribute. this mode needs only the attribute name given as theattrparameter. removing single values? not supported, sorry babe. πAF_REPLACEβ replace an existing user defined attribute. this one fails if no attribute with the given name exists. you can't replace a vibe that was never there. π
af_allattrs returns the complete attribute buffer (attrBuf) of the ASO identified by aso, including standard and user defined attributes. the af_retrieve(3) manual page shows the structure of the attribute buffer β go check it, iykyk. π
af_freeattr and af_freeattrbuf release memory that eventually got allocated during an af_retattr or af_allattrs call.
π¨ because the result ofaf_retattrmay reside in either static or dynamic (malloc(3)) memory, you should not usefree(3)for releasing attribute value memory. use the provided free-ers, bestie, they know what they're doing. π
af_isstdval returns TRUE if the given attrValue string is the return value of an af_retattr call where the result was written to static rather than allocated memory. otherwise it returns FALSE. vibe check for your strings. β
π AtFS STANDARD ATTRIBUTES π
here's an alphabetically ordered list of all known standard attributes. the AF_ATT... ones are string constants that you can use as the attrName argument for any of the function calls described on this page. in parentheses behind each symbolic constant is the type of the attribute. slay, let's go down the list. π
AF_ATTAUTHOR(user) β the version's author. the main character who wrote it. βοΈAF_ATTATIME(time) β the date of last access (read or write) to the version contents.AF_ATTBOUND(string) β the version name in bound version notation (e.g.foo.c[1.2]).AF_ATTBOUNDPATH(string) β absolute pathname of the version in bound version notation (e.g./usr/andy/foo.c[1.2]).AF_ATTCTIME(time) β the date of last status change. updated when an attribute's value is changed. it's giving "noticed you edited". πAF_ATTDSIZE(numeric) β the size of the delta if there is any. if the version is not stored as delta,-1is returned.AF_ATTGEN(numeric) β the generation number.AF_ATTHOST(string) β the host from where the version was accessed. (the manual itself says this attribute is quite useless, as this is always the current host. not me reading the manpage being shady π)AF_ATTLOCKER(user) β the user who has set a lock on the version (if any).AF_ATTLTIME(time) β the date of last lock change. this is empty when there was never a lock set.AF_ATTMODE(numeric) β the version file type and protection. same asst_modeinstruct stat(seestat(2)).AF_ATTMTIME(time) β the date of the last contents modification.AF_ATTNAME(string) β the AtFS name of the version. this has the filename extension, if there is any, stripped off. naked filename energy. π«£AF_ATTOWNER(user) β the version's owner.AF_ATTREV(numeric) β the revision number.AF_ATTSIZE(numeric) β the file size. this may be independent of the real storage size, as most saved versions are stored as deltas (see alsoAF_ATTDSIZE).AF_ATTSPATH(string) β the UNIX pathname leading to the version. this may be different when accessing the version from different hosts.AF_ATTSTATE(numeric) β the version state. states are numbered0through5from busy to frozen. range queen. βοΈAF_ATTSTIME(time) β the save date. this date is not set for busy versions.AF_ATTTYPE(string) β the filename extension (the string behind the rightmost period in the version's full name). seeaf_misc(3)for details.AF_ATTUNIXNAME(string) β the full UNIX name (without path).AF_ATTUNIXPATH(string) β the full UNIX path.AF_ATTVERSION(string) β the complete version numbergeneration.revision.
π SEE ALSO π
stat(2), free(3), af_misc(3), af_retrieve(3)
go read those too, they're part of the lore. π
π DIAGNOSTICS π
upon error, -1 or a nil pointer (depending on the return type, obvi) is returned, and af_errno is set to the corresponding error number. so if something's wrong, check af_errno, it's the group chat telling you what happened. π¨
π« LIMITS π«
although AtFS promises the storage of an arbitrary number of user defined attributes, the current implementation limits their number to 255. af_setattr sets the corresponding error condition if the limit is reached. so like, theoretically infinite, practically 255. the math is not mathing but that's what it says. π
that's the whole page, bestie, you're officially an AtFS attribute expert now, no cap. this was AtFS-1.71, dated Fri Jun 25 14:33:00 1993 β iconic vintage behavior, honestly. go forth and handle those attributes. π¦β¨π
π¦ 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