freedreno/virtio: Use util_get_command_line() helper
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

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:24 -07:00 committed by Marge Bot
parent 1cfe89e3d4
commit 25752d9ac1

View file

@ -54,24 +54,11 @@ static void
set_debuginfo(struct fd_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;