Re: Argument shmaddr in shmat()
- From: Don Morris <dgmorris@xxxxxxxxxxxxx>
- Date: Sun, 23 Dec 2007 04:48:03 -0800
Alex Vinokur wrote:
From man shmat
HP-UX 11i Version 2; August 2003
---------------------
void *shmat(int shmid, void *shmaddr, int shmflg);
int shmdt(void *shmaddr);
[snip]
If the shared memory segment has never been attached to by any
process prior to the current shmat() call, shmaddr must be specified
as zero and the segment is attached at a location selected by the
operating system.
[snip]
---------------------
Does it mean that if the only process works with the shared memory
segment, then shmaddr must be set 0 in shmat(), i.e.
shmat (shmat, 0, shmflg) ?
Well, you don't really say what you mean by "the only process works".
And I certainly hope you aren't using "int shmat;" as your shmid field
either...
Assuming what you mean is if this holds if only a single process creates
and attaches a shared memory segment -- yes, that single process still
passes 0 on the first attach [because the OS has already chosen a
shared virtual range for the object]. It is permitted if the process
does shmdt() and then shmat() again later for the process to pass 0
or the address previously given via the first shmat().
The big exception (since you cited the 11iv2 man page) is if this is
11iv2 on IPF -- there you can be running a process in MPAS layout.
MPAS processes may pass in any virtual address they want to shmat()
[if they want to put the segment somewhere in particular].
Don
.
- Follow-Ups:
- Re: Argument shmaddr in shmat()
- From: Sela Lerer
- Re: Argument shmaddr in shmat()
- References:
- Argument shmaddr in shmat()
- From: Alex Vinokur
- Argument shmaddr in shmat()
- Prev by Date: Argument shmaddr in shmat()
- Next by Date: Re: Argument shmaddr in shmat()
- Previous by thread: Argument shmaddr in shmat()
- Next by thread: Re: Argument shmaddr in shmat()
- Index(es):
Relevant Pages
|
|