public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Dike <jdike@addtoit.com>
To: Eduard-Gabriel Munteanu <maxdamage@aladin.ro>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] UML: fix missing non-blocking I/O, now DEBUG_SHIRQ works
Date: Mon, 11 Jun 2007 17:16:04 -0400	[thread overview]
Message-ID: <20070611211604.GA8859@c2.user-mode-linux.org> (raw)
In-Reply-To: <466DA50C.5050301@aladin.ro>

On Mon, Jun 11, 2007 at 10:39:56PM +0300, Eduard-Gabriel Munteanu wrote:
> No offense, but this is an ugly hack. 

I'm not going to defend it too much, but the alternatives don't seem any
better to me.

> What if sizeof(int) !=  sizeof(long)?

Doesn't matter - the casting will preserve the value.  Of greater
concern is the relationship between sizeof(void *) and sizeof(long).
That's not guaranteed by the standard, but is by gcc.

> You're calling glibc functions
> with that fd as a parameter. On some arches, compiling will issue
> warnings or simply fail. 

Which ones?

> An alternative would be to use kmalloc instead of a global static 
> variable. Do you like this one more?

No, that trades the global variable for a new point of failure.

The main reason I like the current casting better than your global
(not by a lot) is that globals have to be audited for SMP safety.  So,
I don't want any globals which don't need to be.  This implies a
local, and to minimize the machinery associated with that (kmalloc, or
passing a pointer and synchronizing to avoid returning too soon), just
passing the descriptor in the pointer and accepting the casting needed
to get it through the compiler.

				Jeff

-- 
Work email - jdike at linux dot intel dot com

  reply	other threads:[~2007-06-11 21:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-10 22:01 [PATCH 1/1] UML: fix missing non-blocking I/O, now DEBUG_SHIRQ works Eduard-Gabriel Munteanu
2007-06-11 17:31 ` Jeff Dike
2007-06-11 19:39   ` Eduard-Gabriel Munteanu
2007-06-11 21:16     ` Jeff Dike [this message]
2007-06-11 22:39       ` Eduard-Gabriel Munteanu
2007-06-12  0:48         ` Jeff Dike
2007-06-12  5:44           ` Eduard-Gabriel Munteanu
2007-06-12 13:26             ` Jeff Dike
  -- strict thread matches above, loose matches on Subject: below --
2007-06-10 22:20 Eduard-Gabriel Munteanu
2007-06-11 10:26 ` Eduard-Gabriel Munteanu

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=20070611211604.GA8859@c2.user-mode-linux.org \
    --to=jdike@addtoit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxdamage@aladin.ro \
    /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