From: Andi Shyti <andi.shyti@linux.intel.com>
To: Mauro Carvalho Chehab <mauro.chehab@linux.intel.com>
Cc: igt-dev@lists.freedesktop.org,
Ch Sai Gowtham <sai.gowtham.ch@intel.com>,
Petri Latvala <petri.latvala@intel.com>,
Andrzej Hajda <andrzej.hajda@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t v4 8/9] lib/igt_kmod: properly handle pipewire-pulse
Date: Tue, 17 May 2022 12:34:50 +0200 [thread overview]
Message-ID: <YoN6StkBiQcqIyGr@intel.intel> (raw)
In-Reply-To: <20220517072803.186989-9-mauro.chehab@linux.intel.com>
Hi Mauro,
> +static void pipewire_reserve_wait(int pipewire_pulse_pid)
> +{
> + char xdg_dir[PATH_MAX];
> + const char *homedir;
> + struct passwd *pw;
> + proc_t *proc_info;
> + PROCTAB *proc;
> +
> + igt_fork(child, 1) {
> + igt_info("Preventing pipewire-pulse to use the audio drivers\n");
> +
> + proc = openproc(PROC_FILLCOM | PROC_FILLSTAT | PROC_FILLARG);
> + igt_assert(proc != NULL);
> +
> + while ((proc_info = readproc(proc, NULL))) {
> + if (pipewire_pulse_pid == proc_info->tid)
> + break;
> + freeproc(proc_info);
> + }
> + closeproc(proc);
> +
> + /* Sanity check: if it can't find the process, it means it has gone */
> + if (pipewire_pulse_pid != proc_info->tid)
> + exit(0);
> +
> + pw = getpwuid(proc_info->euid);
> + homedir = pw->pw_dir;
> + snprintf(xdg_dir, sizeof(xdg_dir), "/run/user/%d", proc_info->euid);
> + setgid(proc_info->egid);
> + setuid(proc_info->euid);
> + clearenv();
> + setenv("HOME", homedir, 1);
> + setenv("XDG_RUNTIME_DIR",xdg_dir, 1);
> + freeproc(proc_info);
> +
> + /*
> + * pw-reserve will run in background. It will only exit when
> + * igt_kill_children() is called later on. So, it shouldn't
> + * call igt_waitchildren(). Instead, just exit with the return
> + * code from pw-reserve.
> + */
> + exit(system("pw-reserve -n Audio0 -r"));
Thanks for the comment! And I also think think it's safe!
igt_fork() calls exit() anyway but you call it earlier, so that
the former will not have time to be called.
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Thanks,
Andi
next prev parent reply other threads:[~2022-05-17 10:34 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 7:27 [igt-dev] [PATCH i-g-t v4 0/9] Improve logic to work with audio dependency on DRM driver Mauro Carvalho Chehab
2022-05-17 7:27 ` [igt-dev] [PATCH i-g-t v4 1/9] tests/core_hotunplug: properly finish processes using audio devices Mauro Carvalho Chehab
2022-05-17 7:27 ` [igt-dev] [PATCH i-g-t v4 2/9] lib/igt_kmod: always fill who when unloading audio driver Mauro Carvalho Chehab
2022-05-17 7:27 ` [igt-dev] [PATCH i-g-t v4 3/9] lib/igt_kmod: improve audio unbind logic Mauro Carvalho Chehab
2022-05-17 7:27 ` [igt-dev] [PATCH i-g-t v4 4/9] lib/igt_kmod: don't leak who from module unload routines Mauro Carvalho Chehab
2022-05-17 10:24 ` Andi Shyti
2022-05-17 11:04 ` Mauro Carvalho Chehab
2022-05-17 11:25 ` Petri Latvala
2022-05-17 7:27 ` [igt-dev] [PATCH i-g-t v4 5/9] core_hotunplug: fix audio unbind logic Mauro Carvalho Chehab
2022-05-17 7:28 ` [igt-dev] [PATCH i-g-t v4 6/9] lib/igt_kmod: make it less pedantic with audio driver removal Mauro Carvalho Chehab
2022-05-17 10:28 ` Andi Shyti
2022-05-17 7:28 ` [igt-dev] [PATCH i-g-t v4 7/9] lib/igt_core: export kill_children() function Mauro Carvalho Chehab
2022-05-17 10:26 ` Andi Shyti
2022-05-17 7:28 ` [igt-dev] [PATCH i-g-t v4 8/9] lib/igt_kmod: properly handle pipewire-pulse Mauro Carvalho Chehab
2022-05-17 10:34 ` Andi Shyti [this message]
2022-05-17 7:28 ` [igt-dev] [PATCH i-g-t v4 9/9] lib/igt_aux: get rid of passing pipewire-pulse pid on functions Mauro Carvalho Chehab
2022-05-17 10:53 ` Andi Shyti
2022-05-17 8:10 ` [igt-dev] ✓ Fi.CI.BAT: success for Improve logic to work with audio dependency on DRM driver Patchwork
2022-05-17 9:38 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YoN6StkBiQcqIyGr@intel.intel \
--to=andi.shyti@linux.intel.com \
--cc=andrzej.hajda@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=mauro.chehab@linux.intel.com \
--cc=petri.latvala@intel.com \
--cc=sai.gowtham.ch@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.