From: Doug McNaught <doug@mcnaught.org>
To: "Dirk Bull" <dirkbull102@hotmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: shmat problem
Date: 06 Jan 2003 10:32:50 -0500 [thread overview]
Message-ID: <m31y3qi999.fsf@varsoon.wireboard.com> (raw)
In-Reply-To: "Dirk Bull"'s message of "Mon, 06 Jan 2003 14:53:41 +0000"
"Dirk Bull" <dirkbull102@hotmail.com> writes:
> Doug, thanks for the reply. I've set SHM_RND in the call and used
> "__attribute__ ((aligned(4096)))" during the the declaration of
> variable global01_
> (as shown below) such that it is aligned on a page boundary. I'm
> porting code that was
> written for a Unix system to Linux and the example shown below is how
> the code is
> implemented on Unix.
Hmmm, I may be ignorant, but I don't see how the below could work.
You're asking for the kernel to map your shared memory in the middle
of an already-mapped area (the bss segment). I'm actually surprised
it works on any Unix.
If you can point out a clear violation of the POSIX spec, someone may
be willing to change it, but it's not clear to me that you're
guaranteed to be able to map a shared memory area inside your existing
data segment.
> union {
> long IN[2048];
> } global01_ __attribute__ ((aligned(4096)));
[...]
> if ( (shmptr = shmat(shmid, &global01_, SHM_RND)) == (void *) -1)
> printf("shmat error: %d %s\n",errno, strerror(errno));
> else
> printf("shared memory attached from %x to %x\n",
> shmptr, shmptr+sizeof(global01_));
-Doug
next prev parent reply other threads:[~2003-01-06 15:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-01-06 14:53 Dirk Bull
2003-01-06 15:32 ` Doug McNaught [this message]
2003-01-06 15:50 ` Richard B. Johnson
-- strict thread matches above, loose matches on Subject: below --
2003-01-07 8:14 Dirk Bull
2003-01-07 18:41 ` Alex Riesen
2003-01-06 16:22 Alex Riesen
2003-01-06 16:36 ` Doug McNaught
2003-01-06 16:43 ` Alex Riesen
2003-01-06 16:50 ` Doug McNaught
2003-01-06 17:01 ` Alex Riesen
2003-01-06 9:05 Dirk Bull
2003-01-06 14:17 ` Doug McNaught
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=m31y3qi999.fsf@varsoon.wireboard.com \
--to=doug@mcnaught.org \
--cc=dirkbull102@hotmail.com \
--cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome