Re: Using any network interface whatsoever
Scott Long schrieb: Ceri Davies wrote: On Sat, Apr 08, 2006 at 08:34:30AM -0600, Scott Long wrote: Well, the real question is why we force the details of driver names onto users. Network and storage drivers are especially guilty of this, but tty devices also are annoying. How do you know which manual page to read for driver specifics if they are all named eth0, eth1, ... With the current naming scheme you know when to read the man page for em(4), fxp(4), nve(4), ... I'll say again, how does having em0, em1, em2, and em3 help me know what is going on with each of those interfaces? FreeBSD doesn't support persistent instance numbering, unlike Solaris. If you unplug device em0 in FreeBSD the remaining interfaces get renamed em0, em1, em2 - which is a bad thing. If you unplug e1000g0 in Solaris the remaining interfaces will still be named e1000g1, e1000g2, e1000g3. So I doubt that the overwriting of an Ingres database really happened in Solaris, like some other poster described - unless the administrator fiddled with /etc/path_to_inst by hand (you are free to shoot in your own foot). Daniel ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: Real and Free Memory
Özkan KIRIK schrieb: # cat /var/run/dmesg.boot | grep real real memory = 268435456 (256 MB) # sysctl vm.vmtotal | grep Real Real Memory:(Total: 232792K Active 122448K) Real memory output from dmesg isn't the total amount of memory in the system, but only the highest address where memory was found. Memory holes below may reduce the available memory: real memory = 6442450944 (6144 MB) Physical memory chunk(s): 0x1000 - 0x00090fff, 589824 bytes (144 pages) 0x00985000 - 0x7ff1, 2136584192 bytes (521627 pages) 0x0001 - 0x000174ba, 1958412288 bytes (478128 pages) avail memory = 4085907456 (3896 MB) In above output you can see a very large memory hole of 2GB in total. The machine has 4GB RAM. Between 2GB-4GB has a memory hole to map in the PCI address space. Depending on the BIOS you will likely find a memory hole between 640kB-1/4/16MB in your system. Just boot into verbose mode and read the lines after Physical memory chunk(s): Daniel ___ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Slow User-PPP
Hi, I noticed for some time now a relatively high CPU usage of the user level ppp even on slow links. On my ADSL line (768/128) ppp consumes up to 20% CPU time (AMD K6-2 300MHz). I trussed the process and noticed, that it calls getprotobynumber() for each packet it receives. In most cases, the result from this call isn't used at all - only with debugging enabled or on errors. getprotobynumber() scans /etc/protocols - or even more expensive functions if NSS is involved. Below is a patch which reduces the getprotobynumber() calls, so they only get called if there is log output at all. With this patch, the CPU usage dropped from 20% to under 3% (on my full blown ADSL link) Daniel Index: usr.sbin/ppp/ip.c === RCS file: /export/cvs/src/usr.sbin/ppp/ip.c,v retrieving revision 1.100 diff -u -r1.100 ip.c --- usr.sbin/ppp/ip.c 26 Mar 2003 02:27:32 - 1.100 +++ usr.sbin/ppp/ip.c 11 Dec 2003 22:20:27 - @@ -161,6 +161,18 @@ } } +char *toprototxt(int cproto) +{ + static char prototxt[16]; + struct protoent *pe; + + if ((pe = getprotobynumber(cproto)) == NULL) +snprintf(prototxt, sizeof prototxt, %d, cproto); + else +snprintf(prototxt, sizeof prototxt, %s, pe-p_name); + return prototxt; +} + /* * Check a packet against the given filter * Returns 0 to accept the packet, non-zero to drop the packet. @@ -187,8 +199,7 @@ int match; /* true if condition matched */ int mindata; /* minimum data size or zero */ const struct filterent *fp = filter-rule; - char dbuff[100], dstip[16], prototxt[16]; - struct protoent *pe; + char dbuff[100], dstip[16]; struct ncpaddr srcaddr, dstaddr; const char *payload; /* IP payload */ int datalen; /* IP datagram length */ @@ -239,10 +250,6 @@ cproto = pip-ip_p; } - if ((pe = getprotobynumber(cproto)) == NULL) -snprintf(prototxt, sizeof prototxt, %d, cproto); - else -snprintf(prototxt, sizeof prototxt, %s, pe-p_name); gotinfo = estab = syn = finrst = didname = 0; sport = dport = 0; @@ -356,7 +363,7 @@ if (datalen mindata) { log_Printf(LogFILTER, error: proto %s must be at least -%d octets\n, prototxt, mindata); +%d octets\n, toprototxt(cproto), mindata); return 1; } @@ -367,7 +374,8 @@ , estab = %d, syn = %d, finrst = %d, estab, syn, finrst); } -log_Printf(LogDEBUG, Filter: proto = %s, %s\n, prototxt, dbuff); +log_Printf(LogDEBUG, Filter: proto = %s, %s\n, + toprototxt(cproto), dbuff); } gotinfo = 1; } @@ -424,7 +432,8 @@ if (log_IsKept(LogFILTER)) { snprintf(dstip, sizeof dstip, %s, ncpaddr_ntoa(dstaddr)); log_Printf(LogFILTER, %sbound rule = %d accept %s - src = %s:%d dst = %s:%d\n, filter-name, n, prototxt, + src = %s:%d dst = %s:%d\n, filter-name, n, + toprototxt(cproto), ncpaddr_ntoa(srcaddr), sport, dstip, dport); } } @@ -434,7 +443,7 @@ snprintf(dstip, sizeof dstip, %s, ncpaddr_ntoa(dstaddr)); log_Printf(LogFILTER, %sbound rule = %d deny %s src = %s/%d dst = %s/%d\n, - filter-name, n, prototxt, + filter-name, n, toprototxt(cproto), ncpaddr_ntoa(srcaddr), sport, dstip, dport); } return 1; @@ -450,7 +459,7 @@ snprintf(dstip, sizeof dstip, %s, ncpaddr_ntoa(dstaddr)); log_Printf(LogFILTER, %sbound rule = implicit deny %s src = %s/%d dst = %s/%d\n, - filter-name, prototxt, ncpaddr_ntoa(srcaddr), sport, + filter-name, toprototxt(cproto), ncpaddr_ntoa(srcaddr), sport, dstip, dport); } ___ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: number of processes forked since boot
Hajimu UMEMOTO schrieb: Hi, I wish to obtain number of processes forked since boot from userland. So, I made a patch to intend to commit. Any comment? I have done a similar approach. I was inspired by the "vmstat -s" output of Solaris. Therefor my solution was integrated into the vmmeter structure. Adding sysctl variables would be trivial though. Warning: The diff is from a very old source tree. It may not apply cleanly. But the modifications are trivial and should be easily spotted. -- Daniel Index: sys/kern/kern_exec.c === RCS file: /data/cvs/src/sys/kern/kern_exec.c,v retrieving revision 1.116 diff -u -r1.116 kern_exec.c --- sys/kern/kern_exec.c2000/09/21 09:04:17 1.116 +++ sys/kern/kern_exec.c2000/09/21 17:34:09 @@ -47,6 +47,7 @@ #include sys/shm.h #include sys/sysctl.h #include sys/vnode.h +#include sys/vmmeter.h #include vm/vm.h #include vm/vm_param.h @@ -374,7 +375,10 @@ } if (error == 0) + { + ++cnt.v_exec; return (0); + } exec_fail: if (imgp-vmspace_destroyed) { Index: sys/kern/kern_fork.c === RCS file: /data/cvs/src/sys/kern/kern_fork.c,v retrieving revision 1.82 diff -u -r1.82 kern_fork.c --- sys/kern/kern_fork.c2000/09/14 23:07:39 1.82 +++ sys/kern/kern_fork.c2000/09/15 23:07:29 @@ -55,6 +55,7 @@ #include sys/ktr.h #include sys/ktrace.h #include sys/unistd.h +#include sys/vmmeter.h #include sys/jail.h #include vm/vm.h @@ -105,6 +106,7 @@ if (error == 0) { p-p_retval[0] = p2-p_pid; p-p_retval[1] = 0; + ++cnt.v_fork; } return error; } @@ -122,6 +124,7 @@ if (error == 0) { p-p_retval[0] = p2-p_pid; p-p_retval[1] = 0; + ++cnt.v_vfork; } return error; } Index: sys/sys/vmmeter.h === RCS file: /data/cvs/src/sys/sys/vmmeter.h,v retrieving revision 1.21 diff -u -r1.21 vmmeter.h --- sys/sys/vmmeter.h 1999/12/29 04:24:49 1.21 +++ sys/sys/vmmeter.h 1999/12/31 02:41:29 @@ -92,6 +92,9 @@ u_int v_pageout_free_min; /* min number pages reserved for kernel */ u_int v_interrupt_free_min; /* reserved number of pages for int code */ u_int v_free_severe;/* severe depletion of pages below this pt */ + u_int v_fork; + u_int v_vfork; + u_int v_exec; }; #ifdef _KERNEL Index: usr.bin/vmstat/vmstat.c === RCS file: /data/cvs/src/usr.bin/vmstat/vmstat.c,v retrieving revision 1.39 diff -u -r1.39 vmstat.c --- usr.bin/vmstat/vmstat.c 2000/05/05 16:07:10 1.39 +++ usr.bin/vmstat/vmstat.c 2000/05/07 21:11:18 @@ -599,6 +599,12 @@ (void)printf("%9u cpu context switches\n", sum.v_swtch); (void)printf("%9u device interrupts\n", sum.v_intr); (void)printf("%9u software interrupts\n", sum.v_soft); + (void)printf("%9u forks\n", sum.v_fork); + (void)printf("%9u vforks\n", sum.v_vfork); + (void)printf("%9u execs\n", sum.v_exec); +#ifdef vax + (void)printf("%9u pseudo-dma dz interrupts\n", sum.v_pdma); +#endif (void)printf("%9u traps\n", sum.v_trap); (void)printf("%9u system calls\n", sum.v_syscall); (void)printf("%9u swap pager pageins\n", sum.v_swapin); @@ -731,7 +737,7 @@ errx(1, "malloc"); kread(X_INTRCNT, intrcnt, (size_t)nintr); kread(X_INTRNAMES, intrname, (size_t)inamlen); - (void)printf("interrupt total rate\n"); + (void)printf("interrupttotal rate\n"); inttotal = 0; nintr /= sizeof(long); while (--nintr = 0) {