[pulseaudio-commits] r1867 - in /branches/lennart/src: daemon/ modules/ modules/rtp/ pulse/ pulsecore/

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Tue Sep 18 17:12:02 PDT 2007


Author: lennart
Date: Wed Sep 19 02:12:01 2007
New Revision: 1867

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1867&root=pulseaudio&view=rev
Log:
make O_CLOEXEC, O_NONBLOCK and socket low latency fd ops more uniform: always return void, name them similarly, only pass a single fd

Modified:
    branches/lennart/src/daemon/cpulimit.c
    branches/lennart/src/modules/module-pipe-sink.c
    branches/lennart/src/modules/module-pipe-source.c
    branches/lennart/src/modules/oss-util.c
    branches/lennart/src/modules/rtp/module-rtp-send.c
    branches/lennart/src/pulse/context.c
    branches/lennart/src/pulse/mainloop-signal.c
    branches/lennart/src/pulse/mainloop.c
    branches/lennart/src/pulsecore/core-util.c
    branches/lennart/src/pulsecore/core-util.h
    branches/lennart/src/pulsecore/fdsem.c
    branches/lennart/src/pulsecore/iochannel.c
    branches/lennart/src/pulsecore/socket-client.c
    branches/lennart/src/pulsecore/socket-server.c
    branches/lennart/src/pulsecore/socket-util.c
    branches/lennart/src/pulsecore/socket-util.h

Modified: branches/lennart/src/daemon/cpulimit.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/daemon/cpulimit.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/daemon/cpulimit.c (original)
+++ branches/lennart/src/daemon/cpulimit.c Wed Sep 19 02:12:01 2007
@@ -184,10 +184,10 @@
         return -1;
     }
 
-    pa_make_nonblock_fd(the_pipe[0]);
-    pa_make_nonblock_fd(the_pipe[1]);
-    pa_fd_set_cloexec(the_pipe[0], 1);
-    pa_fd_set_cloexec(the_pipe[1], 1);
+    pa_make_fd_nonblock(the_pipe[0]);
+    pa_make_fd_nonblock(the_pipe[1]);
+    pa_make_fd_cloexec(the_pipe[0]);
+    pa_make_fd_cloexec(the_pipe[1]);
 
     api = m;
     io_event = api->io_new(m, the_pipe[0], PA_IO_EVENT_INPUT, callback, NULL);

Modified: branches/lennart/src/modules/module-pipe-sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-pipe-sink.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/modules/module-pipe-sink.c (original)
+++ branches/lennart/src/modules/module-pipe-sink.c Wed Sep 19 02:12:01 2007
@@ -236,8 +236,8 @@
         goto fail;
     }
 
-    pa_fd_set_cloexec(u->fd, 1);
-    pa_make_nonblock_fd(u->fd);
+    pa_make_fd_cloexec(u->fd);
+    pa_make_fd_nonblock(u->fd);
 
     if (fstat(u->fd, &st) < 0) {
         pa_log("fstat('%s'): %s", u->filename, pa_cstrerror(errno));

Modified: branches/lennart/src/modules/module-pipe-source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/module-pipe-source.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/modules/module-pipe-source.c (original)
+++ branches/lennart/src/modules/module-pipe-source.c Wed Sep 19 02:12:01 2007
@@ -214,8 +214,8 @@
         goto fail;
     }
 
-    pa_fd_set_cloexec(u->fd, 1);
-    pa_make_nonblock_fd(u->fd);
+    pa_make_fd_cloexec(u->fd);
+    pa_make_fd_nonblock(u->fd);
 
     if (fstat(u->fd, &st) < 0) {
         pa_log("fstat('%s'): %s",u->filename, pa_cstrerror(errno));

Modified: branches/lennart/src/modules/oss-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/oss-util.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/modules/oss-util.c (original)
+++ branches/lennart/src/modules/oss-util.c Wed Sep 19 02:12:01 2007
@@ -141,7 +141,7 @@
 #endif
                  *pcaps & DSP_CAP_TRIGGER ? " TRIGGER" : "");
 
-    pa_fd_set_cloexec(fd, 1);
+    pa_make_fd_cloexec(fd);
 
     return fd;
 

Modified: branches/lennart/src/modules/rtp/module-rtp-send.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/modules/rtp/module-rtp-send.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/modules/rtp/module-rtp-send.c (original)
+++ branches/lennart/src/modules/rtp/module-rtp-send.c Wed Sep 19 02:12:01 2007
@@ -280,8 +280,10 @@
     }
 
     /* If the socket queue is full, let's drop packets */
-    pa_make_nonblock_fd(fd);
-    pa_socket_udp_low_delay(fd);
+    pa_make_fd_nonblock(fd);
+    pa_make_udp_socket_low_delay(fd);
+    pa_make_fd_cloexec(fd);
+    pa_make_fd_cloexec(sap_fd);
 
     pa_source_output_new_data_init(&data);
     data.name = "RTP Monitor Stream";

Modified: branches/lennart/src/pulse/context.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulse/context.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulse/context.c (original)
+++ branches/lennart/src/pulse/context.c Wed Sep 19 02:12:01 2007
@@ -498,10 +498,10 @@
         goto fail;
     }
 
-    pa_fd_set_cloexec(fds[0], 1);
-
-    pa_socket_low_delay(fds[0]);
-    pa_socket_low_delay(fds[1]);
+    pa_make_fd_cloexec(fds[0]);
+
+    pa_make_socket_low_delay(fds[0]);
+    pa_make_socket_low_delay(fds[1]);
 
     if (c->spawn_api.prefork)
         c->spawn_api.prefork();

Modified: branches/lennart/src/pulse/mainloop-signal.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulse/mainloop-signal.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulse/mainloop-signal.c (original)
+++ branches/lennart/src/pulse/mainloop-signal.c Wed Sep 19 02:12:01 2007
@@ -123,10 +123,10 @@
         return -1;
     }
 
-    pa_make_nonblock_fd(signal_pipe[0]);
-    pa_make_nonblock_fd(signal_pipe[1]);
-    pa_assert_se(pa_fd_set_cloexec(signal_pipe[0], 1) == 0);
-    pa_assert_se(pa_fd_set_cloexec(signal_pipe[1], 1) == 0);
+    pa_make_fd_nonblock(signal_pipe[0]);
+    pa_make_fd_nonblock(signal_pipe[1]);
+    pa_make_fd_cloexec(signal_pipe[0]);
+    pa_make_fd_cloexec(signal_pipe[1]);
 
     api = a;
 

Modified: branches/lennart/src/pulse/mainloop.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulse/mainloop.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulse/mainloop.c (original)
+++ branches/lennart/src/pulse/mainloop.c Wed Sep 19 02:12:01 2007
@@ -457,10 +457,10 @@
         return NULL;
     }
 
-    pa_make_nonblock_fd(m->wakeup_pipe[0]);
-    pa_make_nonblock_fd(m->wakeup_pipe[1]);
-    pa_fd_set_cloexec(m->wakeup_pipe[0], 1);
-    pa_fd_set_cloexec(m->wakeup_pipe[1], 1);
+    pa_make_fd_nonblock(m->wakeup_pipe[0]);
+    pa_make_fd_nonblock(m->wakeup_pipe[1]);
+    pa_make_fd_cloexec(m->wakeup_pipe[0]);
+    pa_make_fd_cloexec(m->wakeup_pipe[1]);
     m->wakeup_requested = 0;
 
     PA_LLIST_HEAD_INIT(pa_io_event, m->io_events);

Modified: branches/lennart/src/pulsecore/core-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/core-util.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/core-util.c (original)
+++ branches/lennart/src/pulsecore/core-util.c Wed Sep 19 02:12:01 2007
@@ -134,23 +134,42 @@
 #endif
 
 /** Make a file descriptor nonblock. Doesn't do any error checking */
-void pa_make_nonblock_fd(int fd) {
+void pa_make_fd_nonblock(int fd) {
+
 #ifdef O_NONBLOCK
     int v;
     pa_assert(fd >= 0);
 
-    if ((v = fcntl(fd, F_GETFL)) >= 0)
-        if (!(v & O_NONBLOCK))
-            fcntl(fd, F_SETFL, v|O_NONBLOCK);
+    pa_assert_se((v = fcntl(fd, F_GETFL)) >= 0);
+
+    if (!(v & O_NONBLOCK))
+        pa_assert_se(fcntl(fd, F_SETFL, v|O_NONBLOCK) >= 0);
+    
 #elif defined(OS_IS_WIN32)
     u_long arg = 1;
     if (ioctlsocket(fd, FIONBIO, &arg) < 0) {
-        if (WSAGetLastError() == WSAENOTSOCK)
-            pa_log_warn("Only sockets can be made non-blocking!");
+        pa_assert_se(WSAGetLastError() == WSAENOTSOCK);
+        pa_log_warn("Only sockets can be made non-blocking!");
     }
 #else
     pa_log_warn("Non-blocking I/O not supported.!");
 #endif
+
+}
+
+/* Set the FD_CLOEXEC flag for a fd */
+void pa_make_fd_cloexec(int fd) {
+
+#ifdef FD_CLOEXEC
+    int v;
+    pa_assert(fd >= 0);
+
+    pa_assert_se((v = fcntl(fd, F_GETFD, 0)) >= 0);
+
+    if (!(v & FD_CLOEXEC))
+        pa_assert_se(fcntl(fd, F_SETFD, v|FD_CLOEXEC) >= 0);
+#endif
+
 }
 
 /** Creates a directory securely */
@@ -552,25 +571,6 @@
 #endif
 }
 
-/* Set the FD_CLOEXEC flag for a fd */
-int pa_fd_set_cloexec(int fd, int b) {
-
-#ifdef FD_CLOEXEC
-    int v;
-    pa_assert(fd >= 0);
-
-    if ((v = fcntl(fd, F_GETFD, 0)) < 0)
-        return -1;
-
-    v = (v & ~FD_CLOEXEC) | (b ? FD_CLOEXEC : 0);
-
-    if (fcntl(fd, F_SETFD, v) < 0)
-        return -1;
-#endif
-
-    return 0;
-}
-
 /* Try to parse a boolean string value.*/
 int pa_parse_boolean(const char *v) {
 
@@ -629,12 +629,12 @@
 
     if (sig <= 0)
         goto fail;
-
+ 
 #ifdef NSIG
-	if (sig >= NSIG)
-		goto fail;
-#endif
-
+    if (sig >= NSIG)
+        goto fail;
+#endif
+        
 #ifdef HAVE_SIG2STR
     {
         char buf[SIG2STR_MAX];

Modified: branches/lennart/src/pulsecore/core-util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/core-util.h?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/core-util.h (original)
+++ branches/lennart/src/pulsecore/core-util.h Wed Sep 19 02:12:01 2007
@@ -34,7 +34,8 @@
 
 struct timeval;
 
-void pa_make_nonblock_fd(int fd);
+void pa_make_fd_nonblock(int fd);
+void pa_make_fd_cloexec(int fd);
 
 int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid);
 int pa_make_secure_parent_dir(const char *fn, mode_t, uid_t uid, gid_t gid);
@@ -58,8 +59,6 @@
 void pa_make_realtime(void);
 void pa_raise_priority(void);
 void pa_reset_priority(void);
-
-int pa_fd_set_cloexec(int fd, int b);
 
 int pa_parse_boolean(const char *s) PA_GCC_PURE;
 

Modified: branches/lennart/src/pulsecore/fdsem.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/fdsem.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/fdsem.c (original)
+++ branches/lennart/src/pulsecore/fdsem.c Wed Sep 19 02:12:01 2007
@@ -54,8 +54,8 @@
         return NULL;
     }
 
-    pa_fd_set_cloexec(f->fds[0], 1);
-    pa_fd_set_cloexec(f->fds[1], 1);
+    pa_make_fd_cloexec(f->fds[0]);
+    pa_make_fd_cloexec(f->fds[1]);
 
     pa_atomic_store(&f->waiting, 0);
     pa_atomic_store(&f->signalled, 0);

Modified: branches/lennart/src/pulsecore/iochannel.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/iochannel.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/iochannel.c (original)
+++ branches/lennart/src/pulsecore/iochannel.c Wed Sep 19 02:12:01 2007
@@ -145,17 +145,17 @@
 
     if (ifd == ofd) {
         pa_assert(ifd >= 0);
-        pa_make_nonblock_fd(io->ifd);
+        pa_make_fd_nonblock(io->ifd);
         io->input_event = io->output_event = m->io_new(m, ifd, PA_IO_EVENT_INPUT|PA_IO_EVENT_OUTPUT, callback, io);
     } else {
 
         if (ifd >= 0) {
-            pa_make_nonblock_fd(io->ifd);
+            pa_make_fd_nonblock(io->ifd);
             io->input_event = m->io_new(m, ifd, PA_IO_EVENT_INPUT, callback, io);
         }
 
         if (ofd >= 0) {
-            pa_make_nonblock_fd(io->ofd);
+            pa_make_fd_nonblock(io->ofd);
             io->output_event = m->io_new(m, ofd, PA_IO_EVENT_OUTPUT, callback, io);
         }
     }

Modified: branches/lennart/src/pulsecore/socket-client.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/socket-client.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/socket-client.c (original)
+++ branches/lennart/src/pulsecore/socket-client.c Wed Sep 19 02:12:01 2007
@@ -208,7 +208,7 @@
     pa_assert(sa);
     pa_assert(len > 0);
 
-    pa_make_nonblock_fd(c->fd);
+    pa_make_fd_nonblock(c->fd);
 
     if ((r = connect(c->fd, sa, len)) < 0) {
 #ifdef OS_IS_WIN32
@@ -293,11 +293,11 @@
         return -1;
     }
 
-    pa_fd_set_cloexec(c->fd, 1);
+    pa_make_fd_cloexec(c->fd);
     if (sa->sa_family == AF_INET || sa->sa_family == AF_INET6)
-        pa_socket_tcp_low_delay(c->fd);
+        pa_make_tcp_socket_low_delay(c->fd);
     else
-        pa_socket_low_delay(c->fd);
+        pa_make_socket_low_delay(c->fd);
 
     if (do_connect(c, sa, salen) < 0)
         return -1;

Modified: branches/lennart/src/pulsecore/socket-server.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/socket-server.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/socket-server.c (original)
+++ branches/lennart/src/pulsecore/socket-server.c Wed Sep 19 02:12:01 2007
@@ -111,7 +111,7 @@
         goto finish;
     }
 
-    pa_fd_set_cloexec(nfd, 1);
+    pa_make_fd_cloexec(nfd);
 
     if (!s->on_connection) {
         pa_close(nfd);
@@ -137,9 +137,9 @@
 
     /* There should be a check for socket type here */
     if (s->type == SOCKET_SERVER_IPV4)
-        pa_socket_tcp_low_delay(fd);
+        pa_make_tcp_socket_low_delay(fd);
     else
-        pa_socket_low_delay(fd);
+        pa_make_socket_low_delay(fd);
 
     pa_assert_se(io = pa_iochannel_new(s->mainloop, nfd, nfd));
     s->on_connection(s, io, s->userdata);
@@ -193,13 +193,13 @@
         goto fail;
     }
 
-    pa_fd_set_cloexec(fd, 1);
+    pa_make_fd_cloexec(fd);
 
     sa.sun_family = AF_UNIX;
     strncpy(sa.sun_path, filename, sizeof(sa.sun_path)-1);
     sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
 
-    pa_socket_low_delay(fd);
+    pa_make_socket_low_delay(fd);
 
     if (bind(fd, (struct sockaddr*) &sa, SUN_LEN(&sa)) < 0) {
         pa_log("bind(): %s", pa_cstrerror(errno));
@@ -253,14 +253,14 @@
         goto fail;
     }
 
-    pa_fd_set_cloexec(fd, 1);
+    pa_make_fd_cloexec(fd);
 
 #ifdef SO_REUSEADDR
     if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)) < 0)
         pa_log("setsockopt(): %s", pa_cstrerror(errno));
 #endif
 
-    pa_socket_tcp_low_delay(fd);
+    pa_make_tcp_socket_low_delay(fd);
 
     memset(&sa, 0, sizeof(sa));
     sa.sin_family = AF_INET;
@@ -305,7 +305,7 @@
         goto fail;
     }
 
-    pa_fd_set_cloexec(fd, 1);
+    pa_make_fd_cloexec(fd);
 
 #ifdef IPV6_V6ONLY
     if (setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) < 0)
@@ -317,7 +317,7 @@
         pa_log("setsockopt(SOL_SOCKET, SO_REUSEADDR, 1): %s", pa_cstrerror(errno));
 #endif
 
-    pa_socket_tcp_low_delay(fd);
+    pa_make_tcp_socket_low_delay(fd);
 
     memset(&sa, 0, sizeof(sa));
     sa.sin6_family = AF_INET6;

Modified: branches/lennart/src/pulsecore/socket-util.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/socket-util.c?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/socket-util.c (original)
+++ branches/lennart/src/pulsecore/socket-util.c Wed Sep 19 02:12:01 2007
@@ -143,83 +143,64 @@
     pa_snprintf(c, l, "Unknown client");
 }
 
-int pa_socket_low_delay(int fd) {
+void pa_make_socket_low_delay(int fd) {
     
 #ifdef SO_PRIORITY
     int priority;
     pa_assert(fd >= 0);
 
     priority = 6;
-    if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, (void*)&priority, sizeof(priority)) < 0) {
+    if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, (void*)&priority, sizeof(priority)) < 0)
         pa_log_warn("SO_PRIORITY failed: %s", pa_cstrerror(errno));
-        return -1;
-    }
-#endif
-
-    return 0;
-}
-
-int pa_socket_tcp_low_delay(int fd) {
-    int ret, tos, on;
-
-    pa_assert(fd >= 0);
-
-    ret = pa_socket_low_delay(fd);
-
-    on = 1;
-    tos = 0;
+#endif
+}
+
+void pa_make_tcp_socket_low_delay(int fd) {
+    pa_assert(fd >= 0);
+    
+    pa_make_socket_low_delay(fd);
 
 #if defined(SOL_TCP) || defined(IPPROTO_TCP)
+    {
+        int on = 1;
 #if defined(SOL_TCP)
-    if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (void*)&on, sizeof(on)) < 0)
+        if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (void*)&on, sizeof(on)) < 0)
 #else
-    if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&on, sizeof(on)) < 0)
-#endif
+        if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (void*)&on, sizeof(on)) < 0)
+#endif
+            pa_log_warn("TCP_NODELAY failed: %s", pa_cstrerror(errno));
+    }
+#endif
+        
+#if defined(IPTOS_LOWDELAY) && defined(IP_TOS) && (defined(SOL_IP) || defined(IPPROTO_IP))
     {
-        pa_log_warn("TCP_NODELAY failed: %s", pa_cstrerror(errno));
-        ret = -1;
-    }
-#endif
-
+        int tos = IPTOS_LOWDELAY;
+#ifdef SOL_IP
+        if (setsockopt(fd, SOL_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+#else
+        if (setsockopt(fd, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+#endif
+            pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno));
+    }
+#endif
+}
+
+void pa_make_udp_socket_low_delay(int fd) {
+    pa_assert(fd >= 0);
+    
+    pa_make_socket_low_delay(fd);
+    
 #if defined(IPTOS_LOWDELAY) && defined(IP_TOS) && (defined(SOL_IP) || defined(IPPROTO_IP))
-    tos = IPTOS_LOWDELAY;
+    {
+        int tos = IPTOS_LOWDELAY;
 #ifdef SOL_IP
-    if (setsockopt(fd, SOL_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+        if (setsockopt(fd, SOL_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
 #else
-    if (setsockopt(fd, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
-#endif
-    {
-        pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno));
-        ret = -1;
-    }
-#endif
-
-    return ret;
-}
-
-int pa_socket_udp_low_delay(int fd) {
-    int ret, tos;
-
-    pa_assert(fd >= 0);
-
-    ret = pa_socket_low_delay(fd);
-
-    tos = 0;
-
-#if defined(IPTOS_LOWDELAY) && defined(IP_TOS) && (defined(SOL_IP) || defined(IPPROTO_IP))
-    tos = IPTOS_LOWDELAY;
-#ifdef SOL_IP
-    if (setsockopt(fd, SOL_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
-#else
-    if (setsockopt(fd, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
-#endif
-    {
-        ret = -1;
-        pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno));
-    }
-#endif
-
-    return ret;
+        if (setsockopt(fd, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) < 0)
+#endif
+            pa_log_warn("IP_TOS failed: %s", pa_cstrerror(errno));
+    }
+#endif
 }
 
 int pa_socket_set_rcvbuf(int fd, size_t l) {

Modified: branches/lennart/src/pulsecore/socket-util.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/socket-util.h?rev=1867&root=pulseaudio&r1=1866&r2=1867&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/socket-util.h (original)
+++ branches/lennart/src/pulsecore/socket-util.h Wed Sep 19 02:12:01 2007
@@ -29,9 +29,9 @@
 
 void pa_socket_peer_to_string(int fd, char *c, size_t l);
 
-int pa_socket_low_delay(int fd);
-int pa_socket_tcp_low_delay(int fd);
-int pa_socket_udp_low_delay(int fd);
+void pa_make_socket_low_delay(int fd);
+void pa_make_tcp_socket_low_delay(int fd);
+void pa_make_udp_socket_low_delay(int fd);
 
 int pa_socket_set_sndbuf(int fd, size_t l);
 int pa_socket_set_rcvbuf(int fd, size_t l);




More information about the pulseaudio-commits mailing list