base: Fix off-by-one in abstract unix socket names The code in UnixSocket was appending an extra \0 to the socket name. So PERFETTO_CONSUMER_SOCK_NAME=@foo ended up with a socket named "foo\0". This worked fine because both client and server were affected consistently by the same bug. However, this breaks interoperatbility with other tools, most notably UI integration with adb, which doesn't support ADB forwarding of non-ASCII abstract socket names. Filesystem linked sockets are not affected by the bug, as man 7 unix explicily says they must be null-terminated. Note: this change is technically breaking the ABI of the socket. We just think that the risk of anybody overriding the socket with PERFETTO_CONSUMER_SOCK_NAME=@xxx is extremely low given that abstract sockets are mostly used in testing purposes. An internal code search and PSA on the mailing list returned no potential breakages. Bug: 239725760 Test: perfetto_unittests --gtest_filter=UnixSocketTest.Sockaddr* Test: manual: start traced; socat 'UNIX-CONNECT:/tmp/perfetto-producer' /dev/stdout Test: manual: start PERFETTO_CONSUMER_SOCK_NAME=@foo traced; socat 'ABSTRACT-CONNECT:foo' /dev/stdout Change-Id: I478e5ff09aa78dc417c372c8906f241cb2cf0046
Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.
See https://perfetto.dev/docs or the /docs/ directory for documentation.