Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
* 'Shared memory' problem
@ 1997-12-30  5:00 kamal
  1997-12-31  5:00 ` Arun Sharma
  0 siblings, 1 reply; 3+ messages in thread
From: kamal @ 1997-12-30  5:00 UTC (permalink / raw)
  To: butenhof, neth, kamal


Hello there,

	I have a problem related to shared memory.
Please see whether you could help me in getting over this.

In my program, shared memory call, shmat, is setting
errno as EINVAL(22), when called as
	shmat(id,NULL,0);

These are some observations I made, while debugging.

* Shared memory with that id exists in the system
  and already three processes are attached to the same.
* This is the 30th shared memory being attached to
  the process. However, system's limit on shared segments per
  process  is set as 64.
* In all, 40 shared segments exists in the whole system and
  about 240 shm attaches( shmat(..) ) are done across all
  processes.
* I am working on Digital Unix 4.0

	Given the above, please suggest me what are other
factors which would cause 'shmat' to set errno as EINVAL.

Thanks in advance,
Kamal.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 'Shared memory' problem
  1997-12-30  5:00 'Shared memory' problem kamal
@ 1997-12-31  5:00 ` Arun Sharma
  1998-01-02  5:00   ` Neal P. Murphy
  0 siblings, 1 reply; 3+ messages in thread
From: Arun Sharma @ 1997-12-31  5:00 UTC (permalink / raw)



kamal@wipsys.stph.net writes:

> Hello there,
> 
> 	I have a problem related to shared memory.
> Please see whether you could help me in getting over this.
> 
> In my program, shared memory call, shmat, is setting
> errno as EINVAL(22), when called as
> 	shmat(id,NULL,0);
> 
> These are some observations I made, while debugging.
> 
> * Shared memory with that id exists in the system
>   and already three processes are attached to the same.

How did you reach the conclusion ? What did ipcs(1) show ?
See if you can get hold of strace or truss (I remember that someone
had ported this to DU) and look for the exact system call being made
and the arguments to see if something went wrong.

> * This is the 30th shared memory being attached to
>   the process. However, system's limit on shared segments per
>   process  is set as 64.

This is unlikely to be the problem - you'll get a EMFILE in that case.

	-Arun



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 'Shared memory' problem
  1997-12-31  5:00 ` Arun Sharma
@ 1998-01-02  5:00   ` Neal P. Murphy
  0 siblings, 0 replies; 3+ messages in thread
From: Neal P. Murphy @ 1998-01-02  5:00 UTC (permalink / raw)



Arun Sharma <asharma@nospam.netscape.com> writes:

>kamal@wipsys.stph.net writes:

>> Hello there,
>> 
>> 	I have a problem related to shared memory.
>> Please see whether you could help me in getting over this.
>> 
>> In my program, shared memory call, shmat, is setting
>> errno as EINVAL(22), when called as
>> 	shmat(id,NULL,0);
>> 
>> These are some observations I made, while debugging.
>> 
>> * Shared memory with that id exists in the system
>>   and already three processes are attached to the same.

>How did you reach the conclusion ? What did ipcs(1) show ?
>See if you can get hold of strace or truss (I remember that someone
>had ported this to DU) and look for the exact system call being made
>and the arguments to see if something went wrong.

>> * This is the 30th shared memory being attached to
>>   the process. However, system's limit on shared segments per
>>   process  is set as 64.

Two things can be wrong:
  - 'id' is not an int or contains an invalid value. Since you've attached
    other segments (likely using this code), 'id' is likely correctly defined.

  - NULL != 0. Again, if you've used this call for the other 30 segments, then
    this should be OK.

Looking at the man pages for SunOS, Solaris, SysV88 and HPUX, the only reasons
EINVAL will appear are:
  - invalid ID
  - invalid ADDR

So something is wrong with either the ID or with the NULL. If those are definitely
both correct, then either the code is being munged, or there's a system problem.

I can't think of any other reasons....

Fest3er
-- 
If you have interesting friends, they're usually broke.

  - Sebastian Junger



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-01-02  5:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-12-30  5:00 'Shared memory' problem kamal
1997-12-31  5:00 ` Arun Sharma
1998-01-02  5:00   ` Neal P. Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox