search for: chunk_t

Displaying 3 results from an estimated 3 matches for "chunk_t".

Did you mean: chunk_s
2001 Mar 17
1
ogg123: shared memory by mmap()
...uot;buffer.h" @@ -72,6 +72,22 @@ int childpid; buf_t *buf; +#if HAVE_SMMAP + int fd; + + if ((fd = open("/dev/zero", O_RDWR)) < 0) + { + perror ("cannot open /dev/zero"); + exit (1); + } + if ((buf = (buf_t *) mmap (0, sizeof(buf_t) + sizeof (chunk_t) * (size - 1), + PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) < 0) + { + perror("mmap"); + exit(1); + } + close(fd); +#else /* Get the shared memory segment. */ int shmid = shmget (IPC_PRIVATE, sizeof(buf_t) + s...
2001 Feb 27
1
Ogg123 buffering
I tried to use ogg123 -b to play from a slow HTTP server, and I realized that ogg123 starts to play immediately even if the buffer isn't full, so if it can't read the ogg fast enough it skips, even with a huge buffer. Is this the way it's supposed to work? It seems to me like the buffer shouldn't start playing until it's full. Am I misunderstanding the purpose of having a
2001 Mar 17
1
ogg123 doesn't destroy shm segment
...de <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); +...