tu/virtio: Use util_get_command_line() helper

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34846>
This commit is contained in:
Rob Clark 2025-05-05 14:03:02 -07:00 committed by Marge Bot
parent 0c45889fa8
commit 1cfe89e3d4

View file

@ -139,24 +139,11 @@ static void
set_debuginfo(struct tu_device *dev)
{
const char *comm = util_get_process_name();
static char cmdline[0x1000+1];
int fd = open("/proc/self/cmdline", O_RDONLY);
if (fd < 0)
static char cmdline[0x1000];
if (!comm || !util_get_command_line(cmdline, sizeof(cmdline)))
return;
int n = read(fd, cmdline, sizeof(cmdline) - 1);
if (n < 0)
return;
/* arguments are separated by NULL, convert to spaces: */
for (int i = 0; i < n; i++) {
if (cmdline[i] == '\0') {
cmdline[i] = ' ';
}
}
cmdline[n] = '\0';
unsigned comm_len = strlen(comm) + 1;
unsigned cmdline_len = strlen(cmdline) + 1;