All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Alex Bligh <alex@alex.org.uk>, Xen Devel <xen-devel@lists.xen.org>
Subject: Re: xen 4.3 -> 4.4.0 API change / spurious file handle closure
Date: Mon, 18 Aug 2014 13:46:42 +0100	[thread overview]
Message-ID: <53F1F5B2.8050604@citrix.com> (raw)
In-Reply-To: <B118F1AD-584C-4F1B-B862-F17EB107402E@alex.org.uk>

On 18/08/14 13:28, Alex Bligh wrote:
> I have an application which works when compiled against
> Xen 4.3 but when compiled against Xen 4.4.0 causes a
> spurious file handle closure. Specifically fd 0 is
> closed when it has nothing to do with Xen. This
> happens with a simple call to libxl_ctx_alloc /
> libxl_ctx_free.
>
> This can be seen from the snippet below which
> simply lists the open fds. In the 'before' call,
> the 'ls' command (run from system) opens fd 3
> for the directory. In the 'after' call, the
> alloc/free has closed fd 0, so fd 0 is reused
> for the 'ls' command.
>
> This worked fine under Xen 4.3.
>
> The addition of
>   #define LIBXL_API_VERSION 0x040200
> does not appear to affect things.
>
> Any idea what's up here?
>

Thats antisocial.  I have reproduced the issue.

Stracing it (with some extra debugging)...

write(1, "Freeing libxl ctx", 17Freeing libxl ctx)       = 17
write(1, "\n", 1
)                       = 1
close(5)                                = 0
close(6)                                = 0
close(7)                                = 0
close(3)                                = 0
close(4)                                = 0
close(0)                                = 0
write(1, "Finished freeing", 16Finished freeing)        = 16

Shows that libxl_ctx_free() is closing fd 0.

I suspect it has an fd which is 0 rather than -1.  I will take a look.

~Andrew

      reply	other threads:[~2014-08-18 12:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 12:28 xen 4.3 -> 4.4.0 API change / spurious file handle closure Alex Bligh
2014-08-18 12:46 ` Andrew Cooper [this message]

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=53F1F5B2.8050604@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=alex@alex.org.uk \
    --cc=xen-devel@lists.xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.