From: Anthony Liguori <aliguori@us.ibm.com>
To: Ian Pratt <m+Ian.Pratt@cl.cam.ac.uk>
Cc: Christian.Limpach@cl.cam.ac.uk, xen-devel@lists.sourceforge.net,
ian.pratt@cl.cam.ac.uk
Subject: Re: [PATCH] libxen-3.0 (libxc rewrite)
Date: Tue, 22 Mar 2005 10:13:59 -0600 [thread overview]
Message-ID: <42404447.9070507@us.ibm.com> (raw)
In-Reply-To: <A95E2296287EAD4EB592B5DEEFCE0E9D1E37E3@liverpoolst.ad.cl.cam.ac.uk>
Ian Pratt wrote:
>Personally, I think the best approach is to stick with the existing C
>convention that everyone is already well familiar with, and have a
>separate errno variable. This means we can then have functions return
>pointers etc rather than having to pass them by reference, which is
>undeniably ugly.
>
>
There's only one problem with this: thread-safety. I believe errno is
commonly implemented in thread-local storage. We'd have to jump through
major hoops to get our own proper errno.
Returning the error as part of the interface makes life a lot easier for
threading. However, it sounds like a lot of people don't like this.
The best alternative would be to have a context for the library (not
just a simple file descriptor, but an actual struct that contained the
file descriptors and the current error condition). I really was hoping
to avoid requiring a context (it simplifies application programming
tremendously).
Does anyone have an idea for making a libxen errno thread safe that
wouldn't require a context?
>I notice that you store the fd of the priv_cmd in a static variable. I
>guess this is OK, but I think I still prefer a way of explicit way of
>closing the fd. You'd also have to be a little bit careful about someone
>
>
Ok. Not a problem.
>forking then two guys trying to open the fd at the same time.
>
>
Yes, I was actually considering the case of two threads when I wrote the
library. That's why I exposed hcall_init() as part of the public
interface. It allows a threaded app (or a forking() app) to ensure that
the library is only initialized once.
Regards,
Anthony Liguori
>Ian
>
>
>
>
-------------------------------------------------------
This SF.net email is sponsored by: 2005 Windows Mobile Application Contest
Submit applications for Windows Mobile(tm)-based Pocket PCs or Smartphones
for the chance to win $25,000 and application distribution. Enter today at
http://ads.osdn.com/?ad_id=6882&alloc_id=15148&op=click
next prev parent reply other threads:[~2005-03-22 16:13 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-22 16:00 [PATCH] libxen-3.0 (libxc rewrite) Ian Pratt
2005-03-22 16:13 ` Anthony Liguori [this message]
2005-03-22 16:29 ` Nivedita Singhvi
2005-03-22 16:34 ` Anthony Liguori
2005-03-22 16:39 ` Steven Hand
-- strict thread matches above, loose matches on Subject: below --
2005-03-22 17:21 Ian Pratt
2005-03-22 17:31 ` Anthony Liguori
2005-03-22 16:25 Ian Pratt
2005-03-22 15:13 Ian Pratt
2005-03-22 9:01 Ian Pratt
2005-03-22 15:03 ` Anthony Liguori
[not found] ` <1111504492.20157.26.camel@bree.local.net>
2005-03-22 15:18 ` Anthony Liguori
2005-03-22 15:31 ` Jeremy Katz
2005-03-22 15:55 ` Anthony Liguori
2005-03-22 16:25 ` Jeremy Katz
2005-03-22 21:58 ` Jeremy Katz
2005-03-22 22:18 ` Anthony Liguori
2005-03-21 21:25 Anthony Liguori
2005-03-22 3:33 ` Jacob Gorm Hansen
2005-03-22 4:24 ` Anthony Liguori
2005-03-22 19:28 ` Adam Heath
2005-03-22 20:12 ` Jacob Gorm Hansen
2005-03-22 11:02 ` Christian Limpach
2005-03-22 15:04 ` Anthony Liguori
2005-03-22 16:01 ` Christian Limpach
2005-03-22 16:06 ` Anthony Liguori
2005-03-22 16:13 ` Christian Limpach
2005-03-22 16:21 ` Anthony Liguori
2005-03-22 16:41 ` Christian Limpach
2005-03-22 17:05 ` Anthony Liguori
2005-03-22 17:28 ` Keir Fraser
2005-03-22 17:32 ` Ronald G. Minnich
2005-03-22 17:47 ` Christian Limpach
2005-03-22 17:53 ` Anthony Liguori
2005-03-22 13:50 ` Keir Fraser
2005-03-22 15:16 ` Anthony Liguori
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=42404447.9070507@us.ibm.com \
--to=aliguori@us.ibm.com \
--cc=Christian.Limpach@cl.cam.ac.uk \
--cc=ian.pratt@cl.cam.ac.uk \
--cc=m+Ian.Pratt@cl.cam.ac.uk \
--cc=xen-devel@lists.sourceforge.net \
/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.