Please roll your eyeballs over the following -- idea is to have open(blah,
O_ASYNC) work as expected (device permitting), and not to leave the caller
with an fd with a frustrated flag.
Successfully applied against 2.4.14. Simple test case (for ttys) attached.
Previous post [1] has more about motivation and scope (incl. FIFOs) of this
somewhat obscure concern.
=============================
--- linux/fs/open.c.orig Wed Nov 14 09:53:36 2001
+++ linux/fs/open.c Wed Nov 14 15:34:33 2001
@@ -789,6 +789,15 @@
error = PTR_ERR(f);
if (IS_ERR(f))
goto out_error;
+ /* handle open(foo, O_ASYNC|...) */
+ if ((f->f_flags & FASYNC) &&
+ f->f_op && f->f_op->fasync) {
+ error = f->f_op->fasync(fd, f, 1);
+ if (error < 0) {
+ filp_close(f, NULL);
+ goto out_error;
+ }
+ }
fd_install(fd, f);
}
out:
=============================
Notes:
[1] "open(O_ASYNC) sets futile flag"
http://www.uwsg.indiana.edu/hypermail/linux/kernel/0111.1/1401.html
Regards,
Mike
-- MJ Pomraning mjp@pilcrow.madison.wi.us
This archive was generated by hypermail 2b29 : Thu Nov 15 2001 - 21:00:41 EST