[xiph-cvs] cvs commit: vorbis-tools/ogg123 buffer.c
Kenneth C. Arnold
kcarnold at xiph.org
Wed Mar 21 21:43:49 PST 2001
kcarnold 01/03/21 21:43:48
Modified: ogg123 buffer.c
Log:
Patch from Christian Weisgerber to make buffering code free the shm
segment (duh...) Also fix a little naming quirk (blasted manpages...)
Revision Changes Path
1.4 +5 -3 vorbis-tools/ogg123/buffer.c
Index: buffer.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/ogg123/buffer.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- buffer.c 2001/01/30 10:42:48 1.3
+++ buffer.c 2001/03/22 05:43:48 1.4
@@ -8,7 +8,6 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
-#include <sys/stat.h>
#include <sys/time.h>
#include <unistd.h> /* for fork and pipe*/
#include <fcntl.h>
@@ -76,7 +75,7 @@
/* Get the shared memory segment. */
int shmid = shmget (IPC_PRIVATE,
sizeof(buf_t) + sizeof (chunk_t) * (size - 1),
- IPC_CREAT|S_IREAD|S_IWRITE);
+ IPC_CREAT|SHM_R|SHM_W);
if (shmid == -1)
{
@@ -92,7 +91,10 @@
perror ("shmat");
exit (1);
}
-
+
+ /* Remove segment after last process detaches it or terminates. */
+ shmctl(shmid, IPC_RMID, 0);
+
buffer_init (buf, size);
/* Create a pipe for communication between the two processes. Unlike
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list