mirror of
https://git.freebsd.org/src.git
synced 2026-01-16 23:02:24 +00:00
Doing some debugging I noticed that applications using rpc(3) would often
make lseek(2) on a totally bogus file descriptor, that looks more like a
pointer. So, what happens here is that xdrrec type xdr doesn't keep a
track of how many bytes were sent/received on the stream and tries to
obtain this number via lseek(2). Then it adds/subtracts the offset in the
internal buffer from the obtained number. This code originates from the
original Sun RPC import in 1994. However, it was not a working code even
if Solaris would support lseek(2) on a socket, because it was passing not
the file descriptor, but a pointer to opaque data from upper RPC layer.
It could be that previously (before import to FreeBSD) code was correct,
but the Solaris 8 documentation says that lseek(2) on socket isn't
supported [1]. Maybe supported on older Solaris?
Anyway, this lseek(2) never worked and xdr_getpos() would always fail on
xdrrec object, until
|
||
|---|---|---|
| .. | ||
| Makefile.inc | ||
| Symbol.map | ||
| xdr.3 | ||
| xdr.c | ||
| xdr_array.c | ||
| xdr_float.c | ||
| xdr_mem.c | ||
| xdr_rec.c | ||
| xdr_reference.c | ||
| xdr_sizeof.c | ||
| xdr_stdio.c | ||