From owner-freebsd-current Tue Sep 16 14:12:34 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id OAA20211 for current-outgoing; Tue, 16 Sep 1997 14:12:34 -0700 (PDT) Received: from bmccane.uit.net (bmccane.uit.net [209.83.205.48]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id OAA20200 for ; Tue, 16 Sep 1997 14:12:30 -0700 (PDT) Received: from bmccane.uit.net (localhost.mccane.com [127.0.0.1]) by bmccane.uit.net (8.8.7/8.8.5) with ESMTP id QAA11887; Tue, 16 Sep 1997 16:12:07 -0500 (CDT) Message-Id: <199709162112.QAA11887@bmccane.uit.net> X-Mailer: exmh version 2.0gamma 1/27/96 To: Daniel Ortmann cc: current@FreeBSD.ORG Subject: Re: Does this idea have merit? In-reply-to: Your message of "Sat, 13 Sep 1997 12:39:47 CDT." <199709131739.MAA00426@watcher.isl.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 16 Sep 1997 16:12:06 -0500 From: Wm Brian McCane Sender: owner-freebsd-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > Since 'ps' is often run to find > - all processes belonging to a user, > - or all processes with a particular controlling tty, > - or which instances of a binary are running (i.e. how many instances > of 'spice' circuit simulations are running) > > ... would it make sense to enhance procfs to provide /proc/users/, > /proc/users/binaries/, /proc/ttys/, and /proc/binaries/? Under > these dirs we could perhaps have symlinks to the "real" processes. > > (Part of my motivation is to get the information from a scripting > language such as perl ... without writing extensions.) > > On the other hand, maybe I'm missing something basic. Is there > some other way to find out (without forking a /bin/ps): > - the names and process info of all a user's processes? > - the names and process info of all processes? > - which processes are controlled by a given tty? > - which processes have a given uid? You can get the ownership by doing an `ls -l' in /proc. Or use `readdir' and `stat' in perl to get the owner ID. brian