mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu
To: vamsi krishna <vamsi.krishnak@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Quick close of all the open files.
Date: Tue, 06 Jun 2006 17:56:32 -0400	[thread overview]
Message-ID: <200606062156.k56LuWFD001871@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Wed, 07 Jun 2006 03:15:43 +0530." <3faf05680606061445r7da489d9tc265018bc7960779@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

On Wed, 07 Jun 2006 03:15:43 +0530, vamsi krishna said:
> Hello,
> 
> I found that the following code is closing all the open files by the
> program, do you think its a bug in kernel code?
> 
> ------------
> fp = tmpfile();
> fp->_chain = stderr;
> fpclose(fp);
> fp = NULL;

strace that, and see how many times close() gets called.  If it gets
called once, it's a kernel bug.  If it gets called once for each open
file, it's a userspace bug.

For bonus points, how did you verify that all the open files were closed?

(Hint - what does that fp->_chain = stderr *really* do? ;)

[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]

  reply	other threads:[~2006-06-06 21:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-06 21:45 vamsi krishna
2006-06-06 21:56 ` Valdis.Kletnieks [this message]
2006-06-06 22:02   ` vamsi krishna
2006-06-06 22:39     ` Måns Rullgård
2006-06-07  0:33     ` Valdis.Kletnieks
2006-06-07  1:22       ` vamsi krishna
2006-06-07  7:57         ` Måns Rullgård
2006-06-07  8:50         ` Bernd Petrovitsch
2006-06-07  7:56       ` Måns Rullgård
2006-06-06 22:03   ` Måns Rullgård
2006-06-07 11:12 ` linux-os (Dick Johnson)

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=200606062156.k56LuWFD001871@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vamsi.krishnak@gmail.com \
    /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®