Peek into system buffers?
john richardson
jrich at devnet4.hac.com
Fri Mar 3 01:20:42 AEST 1989
We run SunOS, so have the use of select(2).
I would like to "peek" into system buffers so I may
then construct a read(2) system call to read just
until the next newline (or whatever message delimiter I choose),
leaving the remainder of the pending data in the system buffers,
to trigger a subsequent select.
If I read one character at a time, I pay a noticeable performance
penalty on sockets.
If I use stdio or build my own buffering,
data beyond the newline is removed from the system buffers,
and consequently, from select's scope.
This requires a special programming interface calling
a special select-like routine to check my internal buffers,
and then call select(2).
We have done this but it is awkward, confusing,
and has limits that are now beginning to confine us somewhat.
What I would like is to have a peek system call
that would act just like a read, but not
change the pointers into the systems buffers.
Or possibly an fcntl/ioctl call to be used with FIONREAD ioctls
that would actually allow access to the pending data.
I would like it to work for at least sockets
and ttys. Disk files would probably be trivial too.
These all appear to have some sort of buffering
associated with them making this conceivable.
I have not found anything like this in the documentation,
but feel it could be useful enough that it might exist somewhere.
Does such a mechanism exist?
Is it reasonable?
If not, what would it require?
Just a subroutine to access existing system calls?
A new routine in the kernel that is able to
access generic system buffers to perform this function?
A new routine in the kernel that uses existing
entry points in the device drivers?
New entry points on device drivers to handle
the specific buffering mechanisms for each device?
I ask this despite the fact that
we don't have source and my knowledge of Unix internals
is limited to what I observe from the outside.
Beyond our need, I am also curious.
Thanks in advance.
John Richardson jrich at devnet4.hac.com
Hughes Aircraft Company, Fullerton, Ca. (714) 732-5588
Subject to the usual disclaimers as well as
all failings normally associated with the efforts of man.
More information about the Comp.unix.questions
mailing list