[vorbis-dev] ogg123 doesn't destroy shm segment
Kenneth Arnold
ken at arnoldnet.net
Sat Mar 17 08:40:23 PST 2001
On Sat, Mar 17, 2001 at 02:49:15PM +0000, Christian Weisgerber wrote:
> Every time ogg123 -bXXX is run, it creates another shared memory
> segment but fails to destroy it on exit. Thus an increasing number
> of shm segments keeps piling up and eat all the (often rather
> limited amount of) available shared memory.
>
> The patch below corrects this and also fixes the bizarre abuse of
> stat() permission bits for shmget().
I stole some of that shm code from buffer(1). I need to go back and
steal some more :) Well okay I didn't "steal" it per se, just used it
as an example of how to use the Unix shm functions.
> On systems that support it, I'd very much like to get rid of using
> SYSVSHM altogether and instead use a shared memory mapping of
> /dev/zero. The code is very simple and I have it running on BSD,
> but I still need to steal an autoconf fragment to test for availability
> of this feature in a portable manner. More on this later.
I was aware of this solution, and indeed it does seem cleaner. However
I still do not know how portable this method is. Anyone?
> - IPC_CREAT|S_IREAD|S_IWRITE);
> + IPC_CREAT|SHM_R|SHM_W);
duh. Those weren't in my manpage, though, IIRC.
> + /* Remove segment after last process detaches it or terminates. */
> + shmctl(shmid, IPC_RMID, 0);
> +
ure. But wait a second -- a shared memory segment stays around even
after the last process using it dies? Sounds like Win32...
Patch will be applied as soon as I copy it over from my server,
test-compile and commit. Oops, gotta switch out my mobo now...
--
Kenneth Arnold <ken at arnoldnet.net> / kcarnold / Linux user #180115
http://arnoldnet.net/~kcarnold/
<HR NOSHADE>
<UL>
<LI>application/pgp-signature attachment: stored
</UL>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: part
Type: application/octet-stream
Size: 233 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/vorbis-dev/attachments/20010317/929c53e4/part-0001.obj
More information about the Vorbis-dev
mailing list