LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Denis Vlasenko <vda.linux@googlemail.com>
To: linux-kernel@vger.kernel.org
Subject: O_NONBLOCK setting "leak" outside of a process??
Date: Sat, 27 Jan 2007 21:52:11 +0100	[thread overview]
Message-ID: <200701272152.11087.vda.linux@googlemail.com> (raw)

Hi,

I am currently on Linux 2.6.18, x86_64.
I came across strange behavior while working on one
of busybox applets. I narrowed it down to these two
trivial testcases:

#include <unistd.h>
#include <fcntl.h>
int main() {
        fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) | O_NONBLOCK);
        return 0;
}

#include <unistd.h>
#include <fcntl.h>
int main() {
        fcntl(0, F_SETFL, fcntl(0, F_GETFL, 0) & ~O_NONBLOCK);
        return 0;
}

If I run "nonblock" in Midnight Commander in KDE's Konsole,
screen redraw starts to work ~5 times slower. For example,
Ctrl-O ("show/hide panels" in MC) takes ~0.5 sec to redraw.
This persists after the program exist (which it
does immediately as you see).
Running "block" reverts things to normal.

I mean: how can O_NONBLOCK _issued in a process which
already exited_ have any effect whatsoever on MC or Konsole?
They can't even know that it did it, right?

Either I do not know something subtle about Unix or some sort
of bug is at work.

Any advice?
--
vda

             reply	other threads:[~2007-01-27 20:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-27 20:52 Denis Vlasenko [this message]
2007-01-30  3:40 ` Philippe Troin
2007-02-01 23:00   ` Denis Vlasenko
2007-02-01 23:15     ` Philippe Troin
2007-02-02 12:10       ` Roland Kuhn
2007-02-02 13:48         ` Guillaume Chazarain
2007-02-02 15:04           ` Roland Kuhn
2007-02-02 18:59             ` Philippe Troin
2007-02-05 10:49               ` bert hubert
2007-02-04  0:55         ` David Schwartz
2007-02-04  1:22           ` Denis Vlasenko
2007-02-04  7:56             ` David Schwartz
2007-02-04 20:11               ` Michael Tokarev
2007-02-04 21:08                 ` David Schwartz

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=200701272152.11087.vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: O_NONBLOCK setting "leak" outside of a process??' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).