---
name: "ixp_srv_readbuf"
section: "3"
platform: "linux"
package: "libixp-dev"
version: "0.6~20121202+hg148-5"
release: "Debian 11 (Bullseye)"
platforms: ["linux"]
url: "https://new.carta.tech/ixp_srv_readbuf"
---

# ixp\_srv\_readbuf(3)

## NAME

ixp\_srv\_readbuf, ixp\_srv\_writebuf

## SYNOPSIS

```
#include <ixp_srvutil.h>
void ixp_srv_readbuf(Ixp9Req *req, char *buf, uint len);
void ixp_srv_writebuf(Ixp9Req *req, char **buf, uint *len, uint max);
```

## DESCRIPTION

Utility functions for handling TRead and TWrite requests for files backed by in-memory buffers. For both functions, *buf* points to a buffer and *len* specifies the length of the buffer. In the case of ixp\_srv\_writebuf, these values add a level of pointer indirection, and updates the values if they change.

If *max* has a value other than 0, ixp\_srv\_writebuf will truncate any writes to that point in the buffer. Otherwise, *\*buf* is assumed to be [malloc(3)](/malloc/3.md) allocated, and is reallocated to fit the new data as necessary. The buffer is is always left nul-terminated.

## BUGS

ixp\_srv\_writebuf always truncates its buffer to the end of the most recent write.
