linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: linuxppc-embedded@ozlabs.org
Cc: Xupei Liang <tliang@yahoo.com>
Subject: Re: atomic operations in user space
Date: Wed, 23 Aug 2006 00:23:31 +0200	[thread overview]
Message-ID: <200608230023.31402.arnd@arndb.de> (raw)
In-Reply-To: <20060822205024.98433.qmail@web36105.mail.mud.yahoo.com>

Am Tuesday 22 August 2006 22:50 schrieb Xupei Liang:
> #include <asm-ppc/atomic.h>
>
> int main()
> {
> =A0=A0=A0=A0=A0=A0=A0=A0atomic_t atom;
>
> =A0=A0=A0=A0=A0=A0=A0=A0atomic_add(1, &atom);
> =A0=A0=A0=A0=A0=A0=A0=A0return (0);
> }
>
> I am able to compile it and the atomic_add seems to be
> translated into the correct instructions. Can anybody
> please confirm? Thanks.

No, you can't do that, the kernel headers are not generally
working in user space, recent kernel versions protect you
from doing this.

If you don't have a library providing you with atomic operations,
you can copy the inline functions from the kernel, which will
work fine, but require that your app is GPL licensed.

	Arnd <><

  reply	other threads:[~2006-08-22 22:28 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-22 20:50 atomic operations in user space Xupei Liang
2006-08-22 22:23 ` Arnd Bergmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-08-23 19:03 Terry Liang
2006-08-24 10:39 ` Li Yang-r58472
2006-08-24 14:18   ` Brent Cook
2006-08-25  2:33     ` Li Yang-r58472
2006-08-29  0:43 Xupei Liang
2006-08-29  6:43 ` Li Yang-r58472
2006-08-29  8:33   ` Esben Nielsen
2006-08-29  8:54     ` Li Yang-r58472
2006-08-29  9:20       ` Liu Dave-r63238
2006-08-29  9:56         ` Esben Nielsen
2006-08-29 10:05           ` Liu Dave-r63238
2006-08-29 10:52           ` Li Yang-r58472
2006-08-29 11:26             ` Esben Nielsen
2006-08-29 11:30               ` Esben Nielsen
2006-08-29 12:36             ` Brent Cook
2006-08-29 13:37 Li Yang
2006-08-29 16:05 ` Esben Nielsen
2006-08-29 17:00   ` Li Yang
2006-08-30  2:17 Liu Dave-r63238
2006-08-30  2:27 ` Liu Dave-r63238
2006-08-30  2:40   ` Li Yang-r58472

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=200608230023.31402.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linuxppc-embedded@ozlabs.org \
    --cc=tliang@yahoo.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;
as well as URLs for NNTP newsgroup(s).