[PATCH] minor change to fcntl(F_GETSIG) interface

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Fri, 11 Dec 1998 16:28:59 +0000


Linus, Alan,

While looking into the behaviour of completion ports, I found
that fcntl(fd, F_GETSIG) returns 0 initially, and the value
set by fcntl(fd, F_SETSIG, signr) if it is changed.

That would be fine, but after using F_SETSIG, there is no way to restore
the default behaviour because F_SETSIG does not allow a value of zero.

The code in send_sigio() behaves differently depending on whether the
value is zero or a signal number. Even SIGIO behaves differently from
the default setting. The end result is the same for zero or SIGIO, but
goes through a different path in the signal code, and will have a
different effect in due course.

For consistency therefore, the enclosed patch.

-- Jamie

--- linux/fs/fcntl.c.devel Fri Nov 20 14:21:28 1998
+++ linux/fs/fcntl.c Fri Dec 11 16:26:26 1998
@@ -162,7 +162,9 @@
err = filp->f_owner.signum;
break;
case F_SETSIG:
- if (arg <= 0 || arg > _NSIG) {
+ /* arg == 0 restores default behaviour (single
+ SIGIO without any siginfo). */
+ if (arg < 0 || arg > _NSIG) {
err = -EINVAL;
break;
}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/