problems with libkvm and sysctl

2001-09-09 Thread chrisw

CONTEXT:

I'm writing a clone of pgrep(1) (part of Solaris) for FreeBSD 
5.0-CURRENT.  Similar to FreeBSD's killall, pgrep matches a pattern 
against either the executable associated with each process or each 
process's command line arguments.  I have tried using both sysctl and 
kvm to do this and have run into problems with each:

The snippet below works, except that for each non-zero kp[n].ki_args I 
find that
ki_args is an invalid pointer and that dereferencing it to access 
arguments to
process n results in a bus error.

   size_t len;
   int mib[3] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL };

   if( sysctl( mib, 3, NULL, len, NULL, 0 )  0 )
 {
   perror( sysctl failed );
   return( -1 );
 }

   assert( kp = malloc( len ) );

   if( sysctl( mib, 3, kp, len, NULL, 0 )  0 )
 {
   perror( sysctl failed );
   return( -1 );
 }

That failing, I fell back on libkvm using this snippet:

   if( ( kern = kvm_open( NULL, NULL, NULL, O_RDONLY,
  kvm_open failed ) ) == NULL )
 {
   exit( 1 );
 }

and found that the resulting executable fails on kvm_open:

$ pgrep foo
kvm_open failed: /dev/mem: Invalid argument

The same open works on 4.1.1-STABLE with the same device file /dev/mem 
present.

Am I doing something obviously wrong, or are these known limitations of 
the proc info interfaces at this time?

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



syslogd: Too many '/' in /dev//console

2001-09-03 Thread chrisw

Between last weekend and this weekend, something changed in syslogd 
seems to have resulted in this boot-time error.  The syslogd.c deltas 
from 1.82 - 1.83 look suspect since the handling of relevant variables 
has changed.

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message