System-wide totals via sysctl (struct vmtotal)

2002-12-08 Thread Hiten Pandya
Hello Gang!

Currently, people, the vm.vmmeter sysctl is bogus and misleading.  It
refers to struct vmtotal, which gives us the system wide totals, and
does not relate/refer to struct vmmeter in _any_ way.

It is silently skipped by sysctl -a listing, because there is no handler
for it:

   # sysctl vm.vmmeter  # nothing returned...
   # sysctl -ao vm.vmmeter
   vm.vmmeter: Format:S,vmtotal Length:48 Dump: 

It has been this from the days of 3.0-CURRENT, and earlier, I think. PR
kern/5689 addressed this problem.  Johan Karlsson assigned this PR to
phk@ in 2000 (submitted: 1998), but no action was taken by anyone anyway, 
and eventually, patch was left to rot.

Well, I have updated the patch for 3.0-CURRENT, for our latest -current,
and also made one more change vmmeter-vmtotal, as requested in the PR.
The patches are attached with this mail.  I would be very grateful is
someone can commit (and review) them for me.

Cheers.

P.S. http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/5689

-- 
Hiten Pandya ([EMAIL PROTECTED], [EMAIL PROTECTED])
http://www.unixdaemons.com/~hiten/

Index: sbin/sysctl/sysctl.c
===
RCS file: /home/ncvs/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.48
diff -u -r1.48 sysctl.c
--- sbin/sysctl/sysctl.c2002/11/12 21:18:21 1.48
+++ sbin/sysctl/sysctl.c2002/12/08 14:58:56
@@ -54,6 +54,7 @@
 #include sys/resource.h
 #include sys/stat.h
 #include sys/sysctl.h
+#include sys/vmmeter.h
 
 #include ctype.h
 #include err.h
@@ -323,6 +324,29 @@
 }
 
 static int
+S_vmtotal(int l2, void *p)
+{
+   struct vmtotal *v = (struct vmtotal *)p;
+
+   if (l2 != sizeof(*v)) {
+   warnx(S_vmtotal %d != %d, l2, sizeof(*v));
+   return (0);
+   }
+
+   printf(\nSystem wide totals computed every five seconds:\n);
+   printf(===\n);
+   printf(Processes: (RUNQ:\t %hu Disk Wait: %hu Page Wait: %hu Sleep: %hu)\n,
+   v-t_rq, v-t_dw, v-t_pw, v-t_sl);
+   printf(Virtual Memory:\t\t (Total: %hu Active %hu)\n, v-t_vm, v-t_avm);
+   printf(Real Memory:\t\t (Total: %hu Active %hu)\n, v-t_rm, v-t_arm);
+   printf(Shared Virtual Memory:\t (Total: %hu Active: %hu)\n, v-t_vmshr, 
+v-t_avmshr);
+   printf(Shared Real Memory:\t (Total: %hu Active: %hu)\n, v-t_rmshr, 
+v-t_armshr);
+   printf(Free Memory Pages:\t %hu\n, v-t_free);
+   
+   return (0);
+}
+
+static int
 T_dev_t(int l2, void *p)
 {
dev_t *d = (dev_t *)p;
@@ -587,6 +611,8 @@
func = S_timeval;
else if (strcmp(fmt, S,loadavg) == 0)
func = S_loadavg;
+   else if (strcmp(fmt, S,vmtotal) == 0)
+   func = S_vmtotal;
else if (strcmp(fmt, T,dev_t) == 0)
func = T_dev_t;
else
Index: sys/vm/vm_meter.c
===
RCS file: /home/ncvs/src/sys/vm/vm_meter.c,v
retrieving revision 1.66
diff -u -r1.66 vm_meter.c
--- sys/vm/vm_meter.c   2002/10/02 20:31:47 1.66
+++ sys/vm/vm_meter.c   2002/12/08 14:59:01
@@ -222,7 +222,7 @@
return(error);
 }
 
-SYSCTL_PROC(_vm, VM_METER, vmmeter, CTLTYPE_OPAQUE|CTLFLAG_RD,
+SYSCTL_PROC(_vm, VM_TOTAL, vmtotal, CTLTYPE_OPAQUE|CTLFLAG_RD,
 0, sizeof(struct vmtotal), vmtotal, S,vmtotal, 
 System virtual memory statistics);
 SYSCTL_NODE(_vm, OID_AUTO, stats, CTLFLAG_RW, 0, VM meter stats);
Index: sys/vm/vm_param.h
===
RCS file: /home/ncvs/src/sys/vm/vm_param.h,v
retrieving revision 1.15
diff -u -r1.15 vm_param.h
--- sys/vm/vm_param.h   2001/10/10 23:06:54 1.15
+++ sys/vm/vm_param.h   2002/12/08 14:59:02
@@ -76,7 +76,7 @@
 /*
  * CTL_VM identifiers
  */
-#defineVM_METER1   /* struct vmmeter */
+#defineVM_TOTAL1   /* struct vmtotal */
 #defineVM_LOADAVG  2   /* struct loadavg */
 #define VM_V_FREE_MIN  3   /* cnt.v_free_min */
 #define VM_V_FREE_TARGET   4   /* cnt.v_free_target */
@@ -91,7 +91,7 @@
 
 #define CTL_VM_NAMES { \
{ 0, 0 }, \
-   { vmmeter, CTLTYPE_STRUCT }, \
+   { vmtotal, CTLTYPE_STRUCT }, \
{ loadavg, CTLTYPE_STRUCT }, \
{ v_free_min, CTLTYPE_INT }, \
{ v_free_target, CTLTYPE_INT }, \
Index: usr.bin/systat/vmstat.c
===
RCS file: /home/ncvs/src/usr.bin/systat/vmstat.c,v
retrieving revision 1.52
diff -u -r1.52 vmstat.c
--- usr.bin/systat/vmstat.c 2002/06/06 23:01:50 1.52
+++ usr.bin/systat/vmstat.c 2002/12/08 14:59:05
@@ -784,7 +784,7 @@
 
size = sizeof(ls-Total);
mib[0] = CTL_VM;
-   mib[1] = VM_METER;
+   mib[1] = VM_TOTAL;
if (sysctl(mib, 2, ls-Total, size, NULL, 0)  0) {
  

CVS_LOCAL_BRANCH_NUM?

2002-12-08 Thread Lamont Granquist

I've been struggling all weekend to setup a local CVS repo mirror, and I
guess I've done that successfully, but I can't figure out what is going on
with CVS_LOCAL_BRANCH_NUM.  My understanding is that if I set it to a
large number 63000 that it should tag branches that I make with values
roughly that large.  You can see from below that what I'm getting though
is low-numbered branches.  I'm confused.  This is what I did on both
-current and 4.6-release:

setenv CVS_LOCAL_BRANCH_NUM 63000
cvs rtag -b -r RELENG_4_7 RELENG_4_LCG src

And this is what I get -- shouldn't that be something like 1.229.63000?

cvs status UPDATING
===
File: UPDATING  Status: Up-to-date

   Working revision:1.229
   Repository revision: 1.229   /cvs/src/UPDATING,v
   Sticky Tag:  RELENG_4_LCG (branch: 1.229.4)
   Sticky Date: (none)
   Sticky Options:  (none)




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



help compiling propolice gcc

2002-12-08 Thread Lamont Granquist

I'm trying to follow these instructions to build 4.7 with the propolice
modifications to the gcc compiler:

http://www.trl.ibm.com/projects/security/ssp/buildfreebsd.html

I'm starting with an absolutely fresh cvs checkout and i've nuked my
/usr/obj tree.  What I'm getting is in this step:


 cd /usr/src/gnu/usr.bin/cc
 make depend  make all install

I'm getting this error in the build:

--

cc -O -pipe  -DIN_GCC -DHAVE_CONFIG_H -DPREFIX=\/usr\
-I/usr/src/gnu/usr.bin/cc/cc1/../cc_tools
-I/usr/src/gnu/usr.bin/cc/cc1/../cc_tools
-I/usr/src/gnu/usr.bin/cc/cc1/../../../../contrib/gcc
-I/usr/src/gnu/usr.bin/cc/cc1/../../../../contrib/gcc/config -I.
-static -o cc1 c-parse.o c-lang.o c-decl.o c-lex.o
/usr/src/gnu/usr.bin/cc/cc1/../cc_int/libcc_int.a
cc: /usr/src/gnu/usr.bin/cc/cc1/../cc_int/libcc_int.a: No such file or
directory
*** Error code 1

Stop in /usr/src/gnu/usr.bin/cc/cc1.
*** Error code 1

Stop in /usr/src/gnu/usr.bin/cc.



And if I try to go into /usr/src/gnu/usr.bin/cc/cc_int and do a make I get
only this:

Warning: Object directory not changed from original
/usr/src/gnu/usr.bin/cc/cc_int

Can anyone suggest how to build gcc standalone like this?  Or if that
shouldn't be supported is there a better build procedure that you should
follow to upgrade to the propolice compiler?  I know I could build+install
the world and then do it again to recompile with propolice, but a shortcut
in that process would be a good thing.



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



Re: help compiling propolice gcc

2002-12-08 Thread Kris Kennaway
On Sun, Dec 08, 2002 at 05:22:24PM -0800, Lamont Granquist wrote:

 And if I try to go into /usr/src/gnu/usr.bin/cc/cc_int and do a make I get
 only this:
 
 Warning: Object directory not changed from original
 /usr/src/gnu/usr.bin/cc/cc_int

This indicates you probably have stale cruft in your source tree.  Do
the following:

cd /usr/src
make cleandir  make cleandir

and try again.

Kris



msg38565/pgp0.pgp
Description: PGP signature


Re: help compiling propolice gcc

2002-12-08 Thread Lamont Granquist


On Sun, 8 Dec 2002, Kris Kennaway wrote:
 On Sun, Dec 08, 2002 at 05:22:24PM -0800, Lamont Granquist wrote:

  And if I try to go into /usr/src/gnu/usr.bin/cc/cc_int and do a make I get
  only this:
 
  Warning: Object directory not changed from original
  /usr/src/gnu/usr.bin/cc/cc_int

 This indicates you probably have stale cruft in your source tree.  Do
 the following:

 cd /usr/src
 make cleandir  make cleandir

 and try again.

nope, it was *clean*, i did an rm -rf /usr/src /usr/obj and then a fresh
checkout into /usr/src.

i made it work using something like:

  cd /usr/src/gnu/usr.bin/cc
  make depend
  cd /usr/src/gnu/usr.bin/cc/cc_int
  make libcc_int.a
  cd /usr/src/gnu/usr.bin/cc/cc_fbsd
  make libcc_fbsd.a
  cd /usr/src/gnu/usr.bin/cc
  make all install

(if anyone else is interested in propolice i had to add protector.c to
 the cc_int/Makefile, my initial test program seems to be succesful -- if
 i get a succesful world out of it, i'll post instructions and fresh
 diff against 4.7)


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



Re: help compiling propolice gcc

2002-12-08 Thread Lamont Granquist


On Sun, 8 Dec 2002, Garance A Drosihn wrote:
 If you're going to jump into the middle of /usr/src to make something,
 then you should probably do:
 cd /usr/src/gnu/usr.bin/cc
 make obj
 make depend
 ...etc

Thanks, that seems to have worked.

I couldn't get libc to compile though.  What does the build process use
the system libc for?  Are the static binaries compiled against that?


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



tail -f file on webpage

2002-12-08 Thread nbari
Hi all

How can i make a tail -f file and show the results in a web page with
out having to reload the page every N seconds

i am using PHP in a script like:

?php
$error_log = '/var/log/apache/log';
passthru (tail -f  $error_log);
?

but i have to relaod the page to view new results.

any ideas ?


thanks.






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



Spoofing Another Host Packet From User Land

2002-12-08 Thread soheil soheil
Dear All
I want to know if i can use SOCK_RAW to create and send another Host ( with 
another IP) Packet from my box. Sayin' in another way , i want to know if 
the kernel fill the ip:ip_src field of the packet throw out by SOCK_RAW ?
if i can not do this by raw socket how can i do that ?
THANX
S,H,Y

_
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. 
http://join.msn.com/?page=features/virus


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


Re: tail -f file on webpage

2002-12-08 Thread David Syphers
On Sunday 08 December 2002 10:55 pm, [EMAIL PROTECTED] wrote:
 Hi all
 
 How can i make a tail -f file and show the results in a web page with
 out having to reload the page every N seconds
 
 i am using PHP in a script like:
 
 ?php
 $error_log = '/var/log/apache/log';
 passthru (tail -f  $error_log);
 ?
 
 but i have to relaod the page to view new results.

First of all, this is off-topic for any FreeBSD list. They're cc'd only to let 
them know someone has told you this. I would suggest trying a PHP list, 
but...

... you can't do this with PHP. You're viewing a (pure HTML) page generated by 
PHP, and for anything to change on it, the page needs to be regenerated, e.g. 
reloaded.

-David

-- 
On the whole I am against mass murder. I rarely commit it myself, and
often find myself quite out of sympathy with those who make a habit of it.
-Bernard Levin

Astronomy and Astrophysics Center
The University of Chicago

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



Re: tail -f file on webpage

2002-12-08 Thread Dan Nelson
In the last episode (Dec 08), [EMAIL PROTECTED] said:
 Hi all
 
 How can i make a tail -f file and show the results in a web page with
 out having to reload the page every N seconds
 
 i am using PHP in a script like:
 
 ?php
 $error_log = '/var/log/apache/log';
 passthru (tail -f  $error_log);
 ?

The following 3-line CGI works fine:

#! /bin/sh
printf Content-type: text/plain\r\n\r\n
tail -f /var/log/messages

If you want a PHP solution, try a php mailinglist.

-- 
Dan Nelson
[EMAIL PROTECTED]

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