IXP9SRV(3)
β¨ NAME β¨
Ixp9Srv, Ixp9Req, ixp_serve9conn β the 9P server squad. This is IXP9SRV(3) from the Library Functions Manual, and bestie, itβs giving βserver-side handler setupβ in the most iconic way. π
π SYNOPSIS π
#include <ixp.h>
typedef struct Ixp9Srv Ixp9Srv;
struct Ixp9Srv {
void* aux;
void (*attach)(Ixp9Req*);
void (*clunk)(Ixp9Req*);
void (*create)(Ixp9Req*);
void (*flush)(Ixp9Req*);
void (*open)(Ixp9Req*);
void (*read)(Ixp9Req*);
void (*remove)(Ixp9Req*);
void (*stat)(Ixp9Req*);
void (*walk)(Ixp9Req*);
void (*write)(Ixp9Req*);
void (*wstat)(Ixp9Req*);
void (*freefid)(IxpFid*);
}
typedef struct Ixp9Req Ixp9Req;
struct Ixp9Req {
Ixp9Srv* srv;
IxpFid* fid; /* Fid structure corresponding to IxpFHdr.fid */
IxpFid* newfid; /* Corresponds to IxpFTWStat.newfid */
Ixp9Req* oldreq; /* For TFlush requests, the original request. */
IxpFcall ifcall; /* The incoming request fcall. */
IxpFcall ofcall; /* The response fcall, to be filled by handler. */
void* aux; /* Arbitrary pointer, to be used by handlers. */
/* Private members */
...
}
void ixp_serve9conn(IxpConn *c);
π DESCRIPTION π
Okay so ixp_serve9conn is the function that handles incoming 9P connections. Normally it gets passed as the read member to ixp_listen(3), with an Ixp9Srv structure passed as the aux member. The handlers defined in the Ixp9Srv structure get called whenever a matching Fcall type is received.
No cap: the handlers are expected to call ixp_respond(3) at some point β whether before they return or at some undefined point in the future. π
Whenever a client disconnects, libixp generates whatever flush and clunk events are required to leave the connection in a clean state, and waits for all responses before freeing the connectionβs associated data structures.
Whenever a file is closed and an IxpFid(3) is about to be freed, the freefid member is called to perform any necessary cleanup and to free any associated resources. π§
π SEE ALSO π
π cute sign-off: this page is from the libixp Manual, dated 2012 Dec. stay iconic, bestie π«Ά
π¦ where this page comes from
- nixos 26.05: libixp 0-unstable-2022-04-04
- nixpkgs unstable: libixp 0-unstable-2022-04-04
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms