View previous topic :: View next topic |
Author |
Message |
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5910
|
Posted: Sat May 06, 2023 9:04 pm Post subject: getting the seat where a process is running |
|
|
Greetings,
given a process P with pid i, I want to know which seat is running it, is there a way to use ps + pids to findout which seat is connected to the terminal running it?
Thanks. _________________ Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3882
|
Posted: Sat May 06, 2023 9:34 pm Post subject: |
|
|
Are you running systemd?
Maybe
see
Quote: |
seat SEAT displays the identifier associated with all hardware devices assigned to a specific workplace, if systemd support has been included.
|
_________________
|
|
Back to top |
|
|
DaggyStyle Watchman
Joined: 22 Mar 2006 Posts: 5910
|
Posted: Sun May 07, 2023 4:23 pm Post subject: |
|
|
nope but today you either require to have systemd or elogind if you don't want to work overtime onyour setup
so I use elogind.
as for the suggestion, looks interesting, I'll try it out.
Thanks _________________ Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein |
|
Back to top |
|
|
GDH-gentoo Veteran
Joined: 20 Jul 2019 Posts: 1569 Location: South America
|
Posted: Sun May 07, 2023 11:24 pm Post subject: |
|
|
Do you want the seat, or the session? Your computer probably has a single seat named seat0, and that's it:
Code: | $ loginctl list-seats
SEAT
seat0
1 seats listed. |
If you want the session a process is assigned to, it can be found by looking at cgroup membership:
Code: | $ ps
PID TTY TIME CMD
687 pts/0 00:00:00 bash
...
$ loginctl list-sessions
SESSION UID USER SEAT TTY
c2 1000 <my_username> seat0
c3 1000 <my_username> seat0 tty1
2 sessions listed.
$ cat /proc/687/cgroup
1:name=openrc:/c2 |
_________________
NeddySeagoon wrote: | I'm not a witch, I'm a retired electronics engineer |
Ionen wrote: | As a packager I just don't want things to get messier with weird build systems and multiple toolchains requirements though |
|
|
Back to top |
|
|
|