Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
getting the seat where a process is running
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5910

PostPosted: Sat May 06, 2023 9:04 pm    Post subject: getting the seat where a process is running Reply with quote

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
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3882

PostPosted: Sat May 06, 2023 9:34 pm    Post subject: Reply with quote

Are you running systemd?
Maybe
Code:

ps seat

see
Code:

man ps

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
View user's profile Send private message
DaggyStyle
Watchman
Watchman


Joined: 22 Mar 2006
Posts: 5910

PostPosted: Sun May 07, 2023 4:23 pm    Post subject: Reply with quote

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
View user's profile Send private message
GDH-gentoo
Veteran
Veteran


Joined: 20 Jul 2019
Posts: 1569
Location: South America

PostPosted: Sun May 07, 2023 11:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum