diff options
author | Tom Cherry <tomcherry@google.com> | 2018-12-06 13:29:30 -0800 |
---|---|---|
committer | Tom Cherry <tomcherry@google.com> | 2018-12-06 13:35:52 -0800 |
commit | e29101077c9fae5dbb9563d046ea37272e7f0b8f (patch) | |
tree | 1196e955a767980cc0fc45f420a807dd134fd65b /init/ueventd_parser_test.cpp | |
parent | 215d1d510ea1d1f076716ab9303f87cbcd8bcacc (diff) | |
download | system_core-e29101077c9fae5dbb9563d046ea37272e7f0b8f.tar.gz system_core-e29101077c9fae5dbb9563d046ea37272e7f0b8f.tar.bz2 system_core-e29101077c9fae5dbb9563d046ea37272e7f0b8f.zip |
ueventd: allow configuring SO_RCVBUF(FORCE) for the ueventd socket
Some configurations won't allow ueventd to have CAP_NET_ADMIN, so the
new default size of 16M is not possible for those. Those
configurations also won't need such a large buffer size, so this
change allows devices to customize the SO_RCVBUF(FORCE) size for the
uevent socket.
This is done by adding the line 'uevent_socket_rcvbuf_size <size>' to
your device's ueventd.rc file. <size> is specified as a byte count,
for example '16M' is 16MiB.
The last parsed uevent_socket_rcvbuf_size line is the one that is
used.
Bug: 120485624
Test: boot sailfish
Test: ueventd unit tests
Change-Id: If8123b92ca8a9b089ad50318caada2f21bc94707
Diffstat (limited to 'init/ueventd_parser_test.cpp')
-rw-r--r-- | init/ueventd_parser_test.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/init/ueventd_parser_test.cpp b/init/ueventd_parser_test.cpp index c3af341c6..9c1cedf8b 100644 --- a/init/ueventd_parser_test.cpp +++ b/init/ueventd_parser_test.cpp @@ -138,6 +138,15 @@ firmware_directories /more TestUeventdFile(ueventd_file, {{}, {}, {}, firmware_directories}); } +TEST(ueventd_parser, UeventSocketRcvbufSize) { + auto ueventd_file = R"( +uevent_socket_rcvbuf_size 8k +uevent_socket_rcvbuf_size 8M +)"; + + TestUeventdFile(ueventd_file, {{}, {}, {}, {}, false, 8 * 1024 * 1024}); +} + TEST(ueventd_parser, AllTogether) { auto ueventd_file = R"( @@ -169,6 +178,8 @@ subsystem test_devpath_dirname /sys/devices/virtual/*/input poll_delay 0660 root input firmware_directories /more +uevent_socket_rcvbuf_size 6M + #ending comment )"; @@ -197,8 +208,10 @@ firmware_directories /more "/more", }; - TestUeventdFile(ueventd_file, - {subsystems, sysfs_permissions, permissions, firmware_directories}); + size_t uevent_socket_rcvbuf_size = 6 * 1024 * 1024; + + TestUeventdFile(ueventd_file, {subsystems, sysfs_permissions, permissions, firmware_directories, + false, uevent_socket_rcvbuf_size}); } // All of these lines are ill-formed, so test that there is 0 output. @@ -213,6 +226,8 @@ firmware_directories #no directory listed /sys/devices/platform/trusty.* trusty_version 0440 baduidbad log /sys/devices/platform/trusty.* trusty_version 0440 root baduidbad +uevent_socket_rcvbuf_size blah + subsystem #no name )"; |