From: Andre Noll Date: Sun, 6 Nov 2011 11:06:25 +0000 (+0100) Subject: Merge branch 't/t0004' X-Git-Tag: v0.4.9~12 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=e1f3c04146bff24c242101bb446a2528ee45214a;hp=a7a72ca4acf7f44abca866d410e2bc80590e7fab Merge branch 't/t0004' --- diff --git a/NEWS b/NEWS index 6db72253..f50ffa3b 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ - Shared memory areas are no longer restricted to 64K. We now detect the maximal size of a shared memory area at runtime. - cleanup of the internal uptime API. + - para_server prefaults the mmapped audio file to avoid + delays on slow media. + - A new test for the test-suite that exercises the + communication between para_server and para_audiod. -------------------------------------- 0.4.8 (2011-08-19) "nested assignment" diff --git a/net.h b/net.h index 80f57944..79c5994c 100644 --- a/net.h +++ b/net.h @@ -8,13 +8,15 @@ /** \file net.h exported symbols from net.c */ /** - * the buffer size of the sun_path component of struct sockaddr_un + * The buffer size of the sun_path component of struct sockaddr_un. * - * While glibc doesn't define \p UNIX_PATH_MAX, it - * documents it has being limited to 108 bytes. + * While glibc doesn't define \p UNIX_PATH_MAX, it documents it has being + * limited to 108 bytes. On NetBSD it is only 104 bytes though. We trust \p + * UNIX_PATH_MAX if it is defined and use the size of the ->sun_path member + * otherwise. This should be safe everywhere. */ #ifndef UNIX_PATH_MAX -#define UNIX_PATH_MAX 108 +#define UNIX_PATH_MAX (sizeof(((struct sockaddr_un *)0)->sun_path)) #endif /* Userland defines for Linux DCCP support. */ diff --git a/server.c b/server.c index 1e45eb36..0cfac607 100644 --- a/server.c +++ b/server.c @@ -434,7 +434,7 @@ err: exit(EXIT_FAILURE); } -static int init_afs(void) +static int init_afs(int argc, char **argv) { int ret, afs_server_socket[2]; pid_t afs_pid; @@ -448,6 +448,10 @@ static int init_afs(void) if (afs_pid < 0) exit(EXIT_FAILURE); if (afs_pid == 0) { /* child (afs) */ + int i; + for (i = argc - 1; i >= 0; i--) + memset(argv[i], 0, strlen(argv[i])); + sprintf(argv[0], "para_server (afs)"); close(afs_server_socket[0]); afs_init(afs_socket_cookie, afs_server_socket[1]); } @@ -510,7 +514,7 @@ static void server_init(int argc, char **argv) */ para_block_signal(SIGCHLD); PARA_NOTICE_LOG("initializing the audio file selector\n"); - afs_socket = init_afs(); + afs_socket = init_afs(argc, argv); init_signal_task(); para_unblock_signal(SIGCHLD); PARA_NOTICE_LOG("initializing virtual streaming system\n"); diff --git a/vss.c b/vss.c index f6da52dd..e336a9e7 100644 --- a/vss.c +++ b/vss.c @@ -953,6 +953,10 @@ static int recv_afs_msg(int afs_socket, int *fd, uint32_t *code, uint32_t *data) return 1; } +#ifndef MAP_POPULATE +#define MAP_POPULATE 0 +#endif + static void recv_afs_result(struct vss_task *vsst, fd_set *rfds) { int ret, passed_fd, shmid; @@ -987,8 +991,8 @@ static void recv_afs_result(struct vss_task *vsst, fd_set *rfds) } mmd->size = statbuf.st_size; mmd->mtime = statbuf.st_mtime; - ret = para_mmap(mmd->size, PROT_READ, MAP_PRIVATE, passed_fd, - 0, &vsst->map); + ret = para_mmap(mmd->size, PROT_READ, MAP_PRIVATE | MAP_POPULATE, + passed_fd, 0, &vsst->map); if (ret < 0) goto err; close(passed_fd); @@ -1077,6 +1081,23 @@ static void vss_send(struct vss_task *vsst) } mmd->chunks_sent++; mmd->current_chunk++; + /* + * Prefault next chunk(s) + * + * If the backing device of the memory-mapped audio file is + * slow and read-ahead is turned off or prevented for some + * reason, e.g. due to memory pressure, it may take much longer + * than the chunk interval to get the next chunk on the wire, + * causing buffer underruns on the client side. Mapping the + * file with MAP_POPULATE seems to help a bit, but it does not + * eliminate the delays completely. Moreover, it is supported + * only on Linux. So we do our own read-ahead here. + */ + buf += len; + for (i = 0; i < 5 && buf < vsst->map + mmd->size; i++) { + __a_unused volatile char x = *buf; + buf += 4096; + } } } diff --git a/web/download.in.html b/web/download.in.html index d735d5e8..1da6c363 100644 --- a/web/download.in.html +++ b/web/download.in.html @@ -1,25 +1,13 @@

Download


-

Download the latest version from the +

Clone the git repository by executing

-download directory +

git clone git://paraslash.systemlinux.org/git paraslash

-or grab a - -tarball - -of the current master branch. This version is expected to be more -stable than any of the released versions. - -All regular releases are cryptographically signed. - -Anonymous (read-only) - -git - -access is also available. Check out a copy with

- -

-git clone git://paraslash.systemlinux.org/git paraslash -

+

Or grab the tarball +of the current master branch, or download the latest version from the +download directory. All regular releases are +cryptographically signed. Since development +takes place in separate topic branches the master branch is expected +to be more stable than any of the released versions.