SYNOPSIS
#include <ixp_srvutil.h>
void ixp_pending_write(IxpPending *pending, const char *dat, long ndat);
int ixp_pending_print(IxpPending *pending, const char *fmt, ...);
int ixp_pending_vprint(IxpPending *pending, const char *fmt, va_list ap);
void ixp_pending_pushfid(IxpPending *pending, IxpFid *fid);
bool ixp_pending_clunk(Ixp9Req *req);
void ixp_pending_flush(Ixp9Req *req);
void ixp_pending_respond(Ixp9Req *req);
typedef struct IxpPending IxpPending;
struct IxpPending {
/* Private members */
...
}
DESCRIPTION
These functions aid in writing virtual files used for broadcasting events or writing data when it becomes available. When a file to be used with these functions is opened, ixp_pending_pushfid should be called with its IxpFid(3) as an argument. This sets the IxpFid's pending member to true. Thereafter, for each file with its pending member set, ixp_pending_respond should be called for each TRead request, ixp_pending_clunk for each TClunk request, and ixp_pending_flush for each TFlush request.
ixp_pending_write queues the data in dat of length ndat to be written to each currently pending fid in pending. If there is a read request pending for a given fid, the data is written immediately. Otherwise, it is written the next time ixp_pending_respond is called. Likewise, if there is data queued when ixp_pending_respond is called, it is written immediately, otherwise the request is queued.
ixp_pending_print and ixp_pending_vprint call ixp_pending_write after formatting their arguments with ixp_vsmprint(3).
The IxpPending data structure is opaque and should be initialized zeroed before using these functions for the first time.
RETURN VALUE
ixp_pending_clunk returns true if pending has any more pending IxpFids.