[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <200906092338.42368.luke@dashjr.org>
Date: Tue, 9 Jun 2009 23:38:31 -0500
From: "Luke-Jr" <luke@...hjr.org>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: pty tcdrain() bug in 2.6.27 to 2.6.30/current
tcdrain blocks on ptys since 2.6.27; at least 2.6.26 returns in a timely
manner. The following test case reproduces the bug, and hangs only on affected
kernels. Examination of 2.6.26 and 2.6.27 suggests the ioctl used by tcdrain
underwent a rewrite for 2.6.27, and thus fixing this bug is beyond my
capabilities at this time.
-------
#define _POSIX_C_SOURCE 200112L
#define _XOPEN_SOURCE
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
int
main() {
int masterfd, slavefd;
char test[] = "test";
masterfd = posix_openpt(O_RDWR | O_NOCTTY);
assert(masterfd != -1);
grantpt(masterfd);
unlockpt(masterfd);
slavefd = open(ptsname(masterfd), O_NOCTTY | O_RDWR);
assert(slavefd != -1);
assert(sizeof(test) == write(slavefd, test, sizeof(test)));
assert(!tcdrain(slavefd));
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists