From: "Luke-Jr" <luke@dashjr.org>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: pty tcdrain() bug in 2.6.27 to 2.6.30/current
Date: Tue, 9 Jun 2009 23:38:31 -0500 [thread overview]
Message-ID: <200906092338.42368.luke@dashjr.org> (raw)
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));
}
next reply other threads:[~2009-06-10 4:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-10 4:38 Luke-Jr [this message]
[not found] ` <1244615954.19735.42.camel@marge.simson.net>
2009-06-10 6:53 ` Luke-Jr
2009-06-10 9:51 ` Alan Cox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200906092338.42368.luke@dashjr.org \
--to=luke@dashjr.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®