[systemd-commits] 3 commits - TODO src/libsystemd-bus src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Mon Dec 16 08:11:51 PST 2013


 TODO                            |    2 --
 src/libsystemd-bus/bus-socket.c |    8 +++++---
 src/shared/util.c               |   25 ++++++++++++-------------
 3 files changed, 17 insertions(+), 18 deletions(-)

New commits:
commit aec6d91fb76ee55bb1f200cc4489c89072e656d5
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Dec 16 17:05:51 2013 +0100

    bus: increase the bus socket buffer to 8 MB similar, to the log socket buffers

diff --git a/src/libsystemd-bus/bus-socket.c b/src/libsystemd-bus/bus-socket.c
index 1365092..a7eaf50 100644
--- a/src/libsystemd-bus/bus-socket.c
+++ b/src/libsystemd-bus/bus-socket.c
@@ -38,6 +38,8 @@
 #include "bus-internal.h"
 #include "bus-message.h"
 
+#define SNDBUF_SIZE (8*1024*1024)
+
 static void iovec_advance(struct iovec iov[], unsigned *idx, size_t size) {
 
         while (size > 0) {
@@ -614,9 +616,9 @@ int bus_socket_setup(sd_bus *b) {
         enable = !b->bus_client && (b->attach_flags & KDBUS_ATTACH_SECLABEL);
         setsockopt(b->input_fd, SOL_SOCKET, SO_PASSSEC, &enable, sizeof(enable));
 
-        /* Increase the buffers to a MB */
-        fd_inc_rcvbuf(b->input_fd, 1024*1024);
-        fd_inc_sndbuf(b->output_fd, 1024*1024);
+        /* Increase the buffers to 8 MB */
+        fd_inc_rcvbuf(b->input_fd, SNDBUF_SIZE);
+        fd_inc_sndbuf(b->output_fd, SNDBUF_SIZE);
 
         /* Get the peer for socketpair() sockets */
         l = sizeof(b->ucred);

commit 10e4e52be8246fde0835212125ef97fea962df1b
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Dec 16 17:05:42 2013 +0100

    update TODO

diff --git a/TODO b/TODO
index 0b43888..da59f79 100644
--- a/TODO
+++ b/TODO
@@ -67,8 +67,6 @@ Features:
 
 * Automatically configure swap partition to use for hibernation by looking for largest swap partition on the root disk?
 
-* remove NSS usage from PID 1 (notably the specifiers)
-
 * socket-proxyd:Use a nonblocking alternative to getaddrinfo
 
 * rfkill,backlight: we probably should run the load tools inside of the udev rules so that the state is properly initialized by the time other software sees it

commit 92d75ca419994f3924dc14117b71f8706d9e1f57
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Dec 16 17:04:36 2013 +0100

    util: try harder to increase the send/recv buffers of sockets
    
    If we have the priviliges we will try SO_SNDBUFFORCE/SO_RCVBUFFORCE and
    only fall back to SO_SNDBUF/SO_RCVBUF if that fails.

diff --git a/src/shared/util.c b/src/shared/util.c
index 20aec2a..c396fc7 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -4936,15 +4936,15 @@ int fd_inc_sndbuf(int fd, size_t n) {
         socklen_t l = sizeof(value);
 
         r = getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, &l);
-        if (r >= 0 &&
-            l == sizeof(value) &&
-            (size_t) value >= n*2)
+        if (r >= 0 && l == sizeof(value) && (size_t) value >= n*2)
                 return 0;
 
+        /* If we have the privileges we will ignore the kernel limit. */
+
         value = (int) n;
-        r = setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value));
-        if (r < 0)
-                return -errno;
+        if (setsockopt(fd, SOL_SOCKET, SO_SNDBUFFORCE, &value, sizeof(value)) < 0)
+                if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &value, sizeof(value)) < 0)
+                        return -errno;
 
         return 1;
 }
@@ -4954,16 +4954,15 @@ int fd_inc_rcvbuf(int fd, size_t n) {
         socklen_t l = sizeof(value);
 
         r = getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &value, &l);
-        if (r >= 0 &&
-            l == sizeof(value) &&
-            (size_t) value >= n*2)
+        if (r >= 0 && l == sizeof(value) && (size_t) value >= n*2)
                 return 0;
 
-        value = (int) n;
-        r = setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value));
-        if (r < 0)
-                return -errno;
+        /* If we have the privileges we will ignore the kernel limit. */
 
+        value = (int) n;
+        if (setsockopt(fd, SOL_SOCKET, SO_RCVBUFFORCE, &value, sizeof(value)) < 0)
+                if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value)) < 0)
+                        return -errno;
         return 1;
 }
 



More information about the systemd-commits mailing list