lkml.org 
[lkml]   [1999]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: USB script
Date
Dominik Kubla writes:
> On Wed, Apr 28, 1999 at 10:29:59PM -0400, Albert D. Cahalan wrote:

>> The file linux/drivers/usb/restart contains this line:
>> UPID=`ps aux | grep uhci-control | grep -v grep | awk '{print $2}'`
>>
>> That isn't such a great way to do it. I suggest this for now:
>> UPID=`ps auxc | grep '^root .* uhci-control$' | awk '{print $2}'`
>
> Even better:
>
> UPID=`ps -C uhci-control -o pid --no-headers`

That is almost what I initially thought:
UPID=`ps -C uhci-control -o pid=`
(if all column heads are empty, no header line is printed)

It isn't perfect though. There is currently no way to exclude
processes that non-root users are running.

> Of course that will only work with ps >=2.0.0. So we would have to
> require people to upgrade to at least this version...

http://www.cs.uml.edu/~acahalan/linux/procps-990320.tar.gz
http://www.cs.uml.edu/~acahalan/linux/procps-990417.tar.gz

SPARC and i386 users should get the newer code. Other users should
use the old code or make sure their libc does sysconf(_SC_NPROCESSORS_CONF)
correctly. (It may NOT return 0. It could return -1, but only a poor
implementation would ever do so.)

BTW, see common.h if output looks terrible with glibc 2.1.

Getting back to the kernel... we seem to lack proper sysconf() support.
The i386 libc does slow and nasty things with /proc/cpuinfo.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:51    [W:0.073 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site