Re: [linux-audio-dev] shared memory problems

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] shared memory problems
From: Richard Guenther (rguenth_AT_tat.physik.uni-tuebingen.de)
Date: Sun Nov 11 2001 - 15:10:04 EET


On Sat, 10 Nov 2001, Paul Davis wrote:

> i figured out what was wrong.
>
> if you call shmat(2) or mmap(2) with a specific address, the kernel
> assumes that you know what you're doing and unmaps anything thats
> already mapped there.

No it doesnt.

> i was trying to force the same address for a given segment in two
> different processes, and in one of them, we several libraries mapped
> at that location.

Whee - you're not trying to use pointers stored within a shared memory
segment, no? Thats obviously broken and _will_ fail badly sooner than
you think of it. Use offsets to the shared memory segment instead.

> if shmat (id, 0, 0) did what the man page suggests, which is to find a
> space working backwards from the top of a 1.5GB address range, this
> would be (nearly always) OK. but the kernel just calls
> get_unmapped_area(), which finds the first hole it can (this is in the
> JACK server). when that address is used in a JACK client with a GUI or
> other libs linked in, its likely to be right in the middle of the
> library mappings.

See above - you shalt not depend on being able to attach a shared memory
segment to the same address in different processes.

Richard.

--
Richard Guenther <richard.guenther_AT_student.uni-tuebingen.de>
PGP: 2E829319 - 2F 83 FC 93 E9 E4 19 E2 93 7A 32 42 45 37 23 57
WWW: http://www.anatom.uni-tuebingen.de/~richi/


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sun Nov 11 2001 - 15:07:58 EET