Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f11cb4c authored by Gyeongtaek Lee's avatar Gyeongtaek Lee
Browse files

libcutils: use 0 for netlink socket port id



AudioHAL and SoundtriggerHAL is separeted HAL but running in thread with
same process id.
So, if both HAL try to open netlink socket using uevent_open_socket(),
secondly opening socket receives already-in-use error.
To prevent situation, set 0 to socket port id.
By the LINUX man page, "The kernel assigns the process ID to the first
netlink socket the process opens and assigns a unique nl_pid to every
netlink socket that the process subsequently creates."

Bug:163008274
Test: tested by opening netlink socket in AudioHAL and
SoundtriggerHAL both.

Signed-off-by: default avatarGyeongtaek Lee <gt82.lee@samsung.com>
Change-Id: I5f9859e8dac749bf5d0998e825043c9988c202ba
parent 278f11b5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ int uevent_open_socket(int buf_sz, bool passcred) {

    memset(&addr, 0, sizeof(addr));
    addr.nl_family = AF_NETLINK;
    addr.nl_pid = getpid();
    addr.nl_pid = 0;
    addr.nl_groups = 0xffffffff;

    s = socket(PF_NETLINK, SOCK_DGRAM | SOCK_CLOEXEC, NETLINK_KOBJECT_UEVENT);