Hi,
Entschuldigung für kaputte References:/In-Reply-To:-Header.
In article <8nau76$2cnh$1(at)atlantis.rz.tu-clausthal.de> you wrote:
> vielleicht habe ich ja fundamental etwas nicht begriffen.
> irgendjemand im kernel muß ja mal entscheiden, daß EWOULDBLOCK
> zurückgegeben wird, wenn keine daten zum lesen da sind bzw.
> die sende/schreibpuffer voll sind.
Ich fange gerade erst an, mich da einzuarbeiten, aber vielleicht
stimmts ja...
struct foo_softc {
...
int foo_nonblock;
}
int
foo_open(dev_t dev, int flags, int otyp, struct proc *procp) {
...
currentdev->foo_nonblock = flags & O_NONBLOCK;
...
}
/* foo_ioctl() analog zu foo_open() */
int
foo_read(dev_t dev, struct uio *uio, int flag) {
...
while (no data available) {
if (currentdev->foo_nonblock) {
return (EWOULDBLOCK);
} else {
/* wait for data, e.g. with tsleep() */
}
}
/* process and return data */
}
Ich verspreche nicht, daß das tut :-). Ich habe das so kompakt nirgends
gesehen, aber Bsp. in dieser Richtung wären z.B. bktr_core: vbi_read()
(da wird auch der parameter flag benutzt - keine Ahnung, welche
Funktion der hat) oder ppi.c: ppiopen() und ppb_conf.c: ppb_request_bus().
Tschüß, Philipp
-- http://www.uni-karlsruhe.de/~un1i/ (,.) \\\00 ) \= ) cc_|\_,^ To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org with "unsubscribe de-bsd-questions" in the body of the messageReceived on Tue 15 Aug 2000 - 17:29:38 CEST