LIBGENDERS(3)
π LIBGENDERS π
okay bestie, so you know that manual page LIBGENDERS(3)? yeah, that one. it's the libgenders one, section 3, and it's genuinely so useful. this is a library of functions to parse and retrieve genders data. slay. let's get into it π«Ά
β¨ NAME β¨
libgenders β a library of functions to parse and retrieve genders data
πΈ SYNOPSIS πΈ
#include <genders.h>
genders_t genders_handle_create(void);
int genders_handle_destroy(genders_t handle);
int genders_load_data(genders_t handle, const char *filename);
int genders_errnum(genders_t handle);
char *genders_strerror(int errnum);
char *genders_errormsg(genders_t handle);
void genders_perror(genders_t handle, const char *msg);
int genders_getnumnodes(genders_t handle);
int genders_getnumattrs(genders_t handle);
int genders_getmaxattrs(genders_t handle);
int genders_getmaxnodelen(genders_t handle);
int genders_getmaxattrlen(genders_t handle);
int genders_getmaxvallen(genders_t handle);
int genders_nodelist_create(genders_t handle, char ***nodelist);
int genders_nodelist_clear(genders_t handle, char **nodelist);
int genders_nodelist_destroy(genders_t handle, char **nodelist);
int genders_attrlist_create(genders_t handle, char ***attrlist);
int genders_attrlist_clear(genders_t handle, char **attrlist);
int genders_attrlist_destroy(genders_t handle, char **attrlist);
int genders_vallist_create(genders_t handle, char ***vallist);
int genders_vallist_clear(genders_t handle, char **vallist);
int genders_vallist_destroy(genders_t handle, char **vallist);
int genders_getnodename(genders_t handle, char *node, int len);
int genders_getnodes(genders_t handle, char *nodes[], int len, const char *attr, const char *val);
int genders_getattr(genders_t handle, char *attrs[], char *vals[], int len, const char *node);
int genders_getattr_all(genders_t handle, char *attrs[], int len);
int genders_testattr(genders_t handle, const char *node, const char *attr, char *val, int len);
int genders_testattrval(genders_t handle, const char *node, const char *attr, const char *val);
int genders_isnode(genders_t handle, const char *node);
int genders_isattr(genders_t handle, const char *attr);
int genders_isattrval(genders_t handle, const char *attr, const char *val);
int genders_index_attrvals(genders_t handle, const char *attr);
int genders_query(genders_t handle, char *nodes[], int len, const char *query);
int genders_testquery(genders_t handle, const char *node, const char *query);
int genders_parse(genders_t handle, const char *filename, FILE *stream);
like, that's a LOT of functions, and every single one of them is in the list. no skips, no shortcuts, we respect the whole API in this house π
π DESCRIPTION π
so basically, the genders library functions are a set of functions used to parse and retrieve data from a genders file. that's the vibe. π¦
for the actual API deets, bestie, pls go read the individual manpages for each of the functions listed above β or honestly? just read the comments written in /usr/include/genders.h. the source of truth is right there. iykyk.
π GENDERS FILE FORMAT π
every line of the genders file is one of these formats, no cap. (and for the host range stuff, the HOST RANGES section below has you covered.)
nodename attr[=value],attr[=value],...
nodename1,nodename2,... attr[=value],attr[=value],...
nodenames[A-B] attr[=value],attr[=value],...
okay so breaking it down:
- the nodename(s) are the shortened hostnames of a node.
- then you got any number of spaces or tabs, literally whatever, followed by the comma-separated list of attributes, and each attribute can optionally have a value. optional! it's giving flexible.
- the substitution string
"%n"can be used in an attribute value to represent the nodename. cute right? - nodenames can be listed on multiple lines, so a node's attributes can be specified on multiple lines. multiple lines, multiple moments, we love that for you.
- however, no single node may have duplicate attributes. that's the line. don't cross it. π
there must be no spaces embedded in the attribute list, and there is no provision for continuation lines. like, none. zero. don't try it.
also important: commas and equal characters are special and cannot appear in attribute names or their values. periodt.
comments are prefixed with the hash character (#) and can appear anywhere in the file. and the active genders file is typically found at /etc/genders or /admin/etc/genders.
here's an example genders file from a small 16-node linux cluster, for the visual learners:
# slc cluster genders file
slci,slcj,slc[0-15] eth2=e%n,cluster=slc,all
slci passwdhost
slci,slcj management
slc[1-15] compute
π HOST RANGES π
so as noted in the sections above, the genders database accepts ranges of nodenames in the general form:
prefix[n-m,l-k,...]
where n < m and l < k, etc., as an alternative to explicit lists of nodenames. it's the same info, just... cuter. β¨
this range syntax is meant only as a convenience on clusters with a prefixNN naming convention, and specification of ranges should not be considered necessary β the list foo1,foo9 could be specified as such, or by the range foo[1,9]. both valid, both iconic, do what feels right π
some examples of range usage follow:
foo01,foo02,foo03,foo04,foo05βfoo[01-05]foo3,foo7,foo9,foo11βfoo[3,7,9-11]fooi,fooj,foo0,foo1,foo2βfooi,fooj,foo[0-2]
π FILES π
/usr/include/genders.h/etc/genders
π SEE ALSO π
go read these too, bestie, they're all linked up and ready:
Libgenders(3), Genders(3), genders_handle_create(3), genders_handle_destroy(3), genders_load_data(3), genders_errnum(3), genders_strerror(3), genders_errormsg(3), genders_perror(3), genders_getnumnodes(3), genders_getnumattrs(3), genders_getmaxattrs(3), genders_getmaxnodelen(3), genders_getmaxattrlen(3), genders_getmaxvallen(3), genders_nodelist_create(3), genders_nodelist_clear(3), genders_nodelist_destroy(3), genders_attrlist_create(3), genders_attrlist_clear(3), genders_attrlist_destroy(3), genders_vallist_create(3), genders_vallist_clear(3), genders_vallist_destroy(3), genders_getnodename(3), genders_getnodes(3), genders_getattr(3), genders_getattr_all(3), genders_testattr(3), genders_testattrval(3), genders_testnode(3), genders_index_nodes(3), genders_index_attrs(3), genders_index_attrvals(3), genders_query(3), genders_testquery(3), genders_parse(3)
and that's the whole page, no crumbs left πΈ this lil masterpiece came from LLNL and it's dated August 2003 β yes, 2003, it's vintage, it's archival, it's a whole elder statesman of a manual page, and it still ate. π«Ά
LIBGENDERS(3) β that's a wrap, bestie πβ¨
π¦ where this page comes from
- epel 10: libgenders 1.28.1~^20231119git27b915d-5.el10_2 Β· GPL-2.0-only
- fedora 43: libgenders 1.28.1~^20231119git27b915d-5.fc43 Β· GPL-2.0-only
- fedora 43: libgenders 1.28.1~^20231119git27b915d-5.fc43 Β· GPL-2.0-only
- fedora 44: libgenders 1.28.1~^20231119git27b915d-6.fc44 Β· GPL-2.0-only
- fedora 44: libgenders 1.28.1~^20231119git27b915d-6.fc44 Β· GPL-2.0-only
- Copyright (C) 2007-2019 Lawrence Livermore National Security, LLC
- Copyright (C) 2001-2007 The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms