Re: network crash dumps

2003-08-03 Thread Brian Reichert
On Sat, Aug 02, 2003 at 11:46:56PM +0200, Nicolas Rachinsky wrote:
 Did you really send a SIGABRT to init? This should cause init to exit
 after a while (IIRC 30sec), which should cause a Going nowhere
 without my init panic.

I really did send a SIGABRT to init.  Earlier, I explored a SIGSEGV
with hte same symptoms.

I did this while X was running, and was not at a text console.
Maybe the panic message was hidden from me; I'll re-try to make
sure.

 
 Nicolas
 

-- 
Brian 'you Bastard' Reichert[EMAIL PROTECTED]
37 Crystal Ave. #303Daytime number: (603) 434-6842
Derry NH 03038-1713 USA BSD admin/developer at large
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: messing with CVS_LOCAL_BRANCH_NUM

2003-08-03 Thread Brian Reichert
On Sat, Aug 02, 2003 at 03:22:06PM -0700, John Polstra wrote:
 In article [EMAIL PROTECTED],
 Brian Reichert  [EMAIL PROTECTED] wrote:
  I'm exploring the 'local repository' tactics as described in:
  
http://www.scriptkiddie.org/freebsd/setting_up_local_repo.html
  
  which makes use of the CVS_LOCAL_BRANCH_NUM evironment variable.
 [...]
  Any advice?
 
 Yes: look for a different approach, or at least backup your local
 repository frequently.  There are known bugs in CVSup which can cause
 it to throw away your local branch under certain circumstances.  I
 won't have time to fix those issues any time soon.  So my advice is,
 don't use the CVS_LOCAL_BRANCH_NUM feature.

Darn. :/

I had asked about this topic back in early March, search for message
ID [EMAIL PROTECTED], if you care.  I wanted to
learn about maintaining a private repository, and the above URL was
the sole concrete pointer.

(Well, not true: someone else in that thread responded about a
makefile patch, but no one else had any good ideas.)

So, can the 'certain circumstances' be described, so that I might
avoid them?  Or is that just due to inherent wierdness in the whole
CVSup process?

Thanks for the feedback, in any case...

 
 John
 -- 
   John Polstra
   John D. Polstra  Co., Inc.Seattle, Washington USA
   Two buttocks cannot avoid friction. -- Malawi saying

-- 
Brian 'you Bastard' Reichert[EMAIL PROTECTED]
37 Crystal Ave. #303Daytime number: (603) 434-6842
Derry NH 03038-1713 USA BSD admin/developer at large
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Assembly Syscall Question

2003-08-03 Thread Matthew Dillon
:You need 8K for this, minimally: 4K that's RO user/RW kernel and
:4K that's RW user/RW kernel.  You can use it for things like zero
:system call getpid/getuid/etc..
:
:It's also worth a page doubly mapped, with the second mapping with
:the PG_G bit set on it (to make it RO visible to user space at the
:sampe place in all programs) to hold the timecounter information;
:the current timecounter implementation, with a scad of structures,
:is both wasteful and unnecessary, given that pointer assigns are
:atomic, so you can implement with only two, which only take a small
:part of the page.  Doing this, you can use a pointer reference and
:a structure assign, and a compare-pointer-afterwards to make a zero
:system call gettimeofday() and other calls (consider the benefits
:to Apache, SQID, and other programs that have hard logging with
:timestamp requirements).
:
:I've also been toying with the idea of putting environp ** in a COW
:page, and dealing with changes as a fixup operation in the fault
:handler (really, environp needs to die, to make way for logical name
:tables; it persists because POSIX and SuS demand that it persist).
:
:So, Matt... how does the modified message based system call
:interface fare in a before-and-after with lmbench?  8-) 8-).
:
:-- Terry

In regards to using shared memory to optimize certain things, like
the time functions... I believe it will be possible to do this in a
portable fashion by going through the emulation layer (which is really
misnamed... basically the syscall interface layer which will run in
userspace but whos code will be managed by the kernel).  We don't want
the user program having direct knowledge of memory mapped gizmos, but
it's perfectly acceptable for the emulation layer to have this knowledge,
because the emulation layer will know how to fall back if the gizmo
isn't where it's supposed to be (i.e. you boot an older kernel with a
newer userland).

The messaging code works fairly well so far performance-wise.   My
original getuid() vs messaging getuid() test on a DELL 2550 (SMP build)
comes out:

getuid() 0.974s 1088300 loops =  0.895uS/loop
getuid() 0.937s 1047500 loops =  0.894uS/loop
getuid() 0.971s 1084700 loops =  0.895uS/loop
getuid_msg() 1.029s 935400 loops =  1.100uS/loop
getuid_msg() 0.970s 881600 loops =  1.100uS/loop
getuid_msg() 0.963s 876600 loops =  1.099uS/loop

About 200ns slower, and I haven't really tried to optimize any of it
yet (and I'm not going to worry about it until a lot more work has
been accomplished anyway).

-Matt
Matthew Dillon 
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


FFS

2003-08-03 Thread david ramblewski
Hello,

1)

I am modifying the mount code and i find this:
malloc(...,M_UFSMNT,...)

In malloc.h:
#define M_UFSMNT 28

There is a lot of define about filesystems in malloc.h and it seems to
represent every types of memories which can be allocated.
I'm searching in the source but i don't know how and why they use it.
Someone knows the solution?

2)

Does someone knows where i can find documentations about filesystems under BSD
(FFS).

thanks.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: messing with CVS_LOCAL_BRANCH_NUM

2003-08-03 Thread John Polstra
In article [EMAIL PROTECTED],
Brian Reichert  [EMAIL PROTECTED] wrote:
 On Sat, Aug 02, 2003 at 03:22:06PM -0700, John Polstra wrote:
  Yes: look for a different approach, or at least backup your local
  repository frequently.  There are known bugs in CVSup which can cause
  it to throw away your local branch under certain circumstances.  I
  won't have time to fix those issues any time soon.  So my advice is,
  don't use the CVS_LOCAL_BRANCH_NUM feature.
 
 Darn. :/
[...]
 So, can the 'certain circumstances' be described, so that I might
 avoid them?  Or is that just due to inherent wierdness in the whole
 CVSup process?

The main situation in which it will occur is when somebody has
directly manipulated or replaced an RCS file in the master CVS
repository.  CVSup notices that the client and server have entirely
different RCS files, so it does a full replace instead of trying to
send just deltas.  Ideally this situation should never arise, but in
the real world it happens all the time.

That's actually the only scenario I know of where the problem should
crop up.  But on the other hand, I've had some suspicious-sounding
reports of CVS_LOCAL_BRANCH_NUM lossage that can't be explained by
this alone.  Bottom line is, if you value your local branch then you
should back it up before every update.

John
-- 
  John Polstra
  John D. Polstra  Co., Inc.Seattle, Washington USA
  Two buttocks cannot avoid friction. -- Malawi saying
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: network crash dumps

2003-08-03 Thread Brian Reichert
On Sun, Aug 03, 2003 at 03:17:42AM -0400, Brian Reichert wrote:
 On Sat, Aug 02, 2003 at 11:46:56PM +0200, Nicolas Rachinsky wrote:
  Did you really send a SIGABRT to init? This should cause init to exit
  after a while (IIRC 30sec), which should cause a Going nowhere
  without my init panic.
 
 I really did send a SIGABRT to init.  Earlier, I explored a SIGSEGV
 with hte same symptoms.
 
 I did this while X was running, and was not at a text console.
 Maybe the panic message was hidden from me; I'll re-try to make
 sure.

OK, for the record:

Sending a SIGABRT to init _does_ induce a panic, but the panic
message only appears on the console.  If X is running, video modes
don't change.  I don't know if that's desirable, but that's not
important right now.

And, also for the record, the netdump utility:

  http://www.cs.duke.edu/~anderson/freebsd/netdump/

Does _not_ work out-of-the box for FreeBSD 4.7-RELEASE.  The kernel
module, though loaded, does not seem to get invoked during a panic.

If I can coax that into working, I'll let people know, but I wanted
to get the current status of my efforts into the archives.

Thanks for your time...

-- 
Brian 'you Bastard' Reichert[EMAIL PROTECTED]
37 Crystal Ave. #303Daytime number: (603) 434-6842
Derry NH 03038-1713 USA BSD admin/developer at large
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


libpcap

2003-08-03 Thread Andrew Konstantinov
Hello,

I am writing a program which takes advantage of libpcap but I've run into several 
problems with it:
1) Is there any way how I can specify in the filter description that it should match 
only incoming packets on some interface? inbound/outbound keywords work only for 
'slip' (according to tcpdump man page). I could do that with 'not src host' and then 
put the local hostname after that, but is there a more general solution, without the 
need for local hostname or ip address?
2) I can't figure out how to setup a filter so it could match several ports at once. 
For example, I want the filter to only match 21-25 and 113 ports for incoming traffic. 
How do I do that? Right know I can see only two solutions. I could simply sniff all 
the traffic, and then filter out the interesting ports by myself, or I could setup 
several filters each of which would be responsible for a specific port. But both 
solutions seem to be inefficient. Is there a better way to accomplish this?
Any help will be greatly appriciated.

Thanks in advance.
Andrew


pgp0.pgp
Description: PGP signature


Tuning HZ for semi-realtime applications

2003-08-03 Thread Sean Hamilton
Greetings,

I have an application which has some task it must execute at some interval
(approximately 1000 times per second.) This application calls select(2) in a
loop, and uses its timeout parameter to try to keep the timing consistent.

At the end of a cycle, it sends out a large amount of network traffic.
During the select loop, it expects to receive replies to all this traffic.

Should I set HZ to 1000 (the frequency of my application) or should I set it
to a much higher value? The CPU is running at around 2 GHz, and I set it as
high as 50,000 with no problems. However, the granularity of my timeout
appears to be restricted to 1/1000th of a second.

I would like to use poll(2) instead of select, but it appears to take its
timeout parameter in milliseconds, which aren't precise enough to keep my
timing reasonable, especially if I ever need to increase my frequency.

Another option would be calling poll/select with no timeout, in a loop.
However, this seems like a waste of CPU time.

Also, as I am doing large amounts of network traffic, which NIC (preferably
gigabit) should I be using, to cause the least interference with my timing?

I do not require realtime performance. I am just looking to have this run as
smoothly as possible.

sh

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


getting from bio to buf in dastrategy()

2003-08-03 Thread Eno Thereska
Hi all,

I am hacking into the FreeBSD 5.0 code.
I jumped from using 4.4 to 5.0 and a couple of things
have changed. Here is my question:
in /sys/cam/scsi/scsi_da.c the dastrategy()
function takes as an argument struct bio* bp
Now I need to get to the struct *buf that bp
belongs to. In /sys/sys/buf.h I see that
struct buf has as the first member b_io which is
of type struct bio. I also see the BIOTOBUF
#define which is supposed to take a bio and
return the buf it belongs to.
Now in dastrategy() if I use the BIOTOBUF function
and try to access members of the struct buf
I get junk, which means that the bio passed to the
is not directly related to a buf. Am I missing something
here? How do I know to which buf (if any) the bio belongs
to?
Also it seems to me that the new way of
splitting the old struct buf into a
struct bio and having a bunch of #defines inside
the struct buf is kind of hacky. What was the
rationale behind doing that (rather than
just leaving it the way it was in 4.4)?
Thanks
Eno
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: [patch] Re: getfsent(3) and spaces in fstab

2003-08-03 Thread Simon Barner
Hi Terry,

 You need to add '\\' to the list of characters that can be escaped,
 or you've just traded the inability to specify '\t' or ' ' for an
 inability to speciy '\\'.

Oh yes, I have overlook this special case. I revised my patch in order
to get this right.

Simon
--- fstab.c.origFri Aug  1 17:18:00 2003
+++ fstab.c Mon Aug  4 01:46:55 2003
@@ -49,6 +49,7 @@
 #include errno.h
 #include fstab.h
 #include paths.h
+#include stdbool.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -84,6 +85,140 @@
_fs_fstab.fs_spec = buf;
 }
 
+/*
+ * Get next token from string *stringp, where tokens are possibly-empty
+ * strings separated by characters from delim.
+ *
+ * Writes NULs into the string at *stringp to end tokens.
+ * delim need not remain constant from call to call.
+ * On return, *stringp points past the last NUL written (if there might
+ * be further tokens), or is NULL (if there are definitely no more tokens).
+ *
+ * If *stringp is NULL, es_strsep returns NULL.
+ *
+ * In contrast to strsep(3), es_strsep will allow escaped delimiters
+ * within a token. These escaped characters as well as the special case
+ * '\\' will be converted appropriately ('\delim' - 'delim, '\\' - '\'
+ *
+ */
+char *
+es_strsep(char **stringp, const char *delim)
+{
+   boolescaped=false;
+   char*s, *t, *u;
+   int i;
+
+
+   if (*stringp == '\0')   /* empty string */
+   return NULL;
+   s = *stringp;
+   s += strspn (s, delim); /* skip delimiters */
+
+   if (*s == '\0') /* string consists only of delimiters */
+   return NULL;
+   
+   /*
+* skip a string consisting of non-delimiters,
+* escapted delimiters or '\\'
+   */
+   for (t = s; *t != '\0'; ++t) {
+   if (*t == '\\') {
+   if (escaped) {  /* convert \\ to \ */
+   --t;
+   u = t;
+   escaped = false;
+   while (u[0] != '\0') {
+   u[0] = u[1];
+   ++u;
+   }
+   } else  /* start \-Sequence */
+   escaped = true;
+   continue;
+   }
+   
+   /* search for delimiter */
+   for (i=0; delim[i] != '\0'; ++i) {
+   if (*t == delim[i])
+   break;
+   }
+   
+   /* un-escaped delimiter found = end of token */
+   if (!escaped  delim[i] != '\0')
+   break;
+   
+   /* escaped delimiter found = remove / */
+   if (escaped) {
+   --t;
+   u = t;
+escaped = false;
+   while (u[0] != '\0') {
+   u[0] = u[1];
+   ++u;
+   }
+   }
+   }
+
+   if (*t != '\0') {
+   *t = '\0';  /* end current token */
+   *stringp = t+1; /* *t != '\0' = *(t+1) is valid */
+   } else
+   *stringp = 0;   /* end of string reached */ 
+   
+   return s;   /* return current token */
+}
+
+/*
+ * This function converts escaped characters:
+ * '\delim' - 'delim', '\\' - '\'
+ * 
+ * If there are unescaped delimiters, 'false' will be return to indicate
+ * an error, otherwise remove_escape returns 'true'.
+ */
+bool remove_escapes (char **s, const char* delim) {
+   boolescaped=false;
+   char*t, *u;
+   int i;
+   
+   for (t = *s; *t != '\0'; ++t) {
+   if (*t == '\\') {
+   if (escaped) {  /* convert \\ to \ */
+   --t;
+   u = t;
+   escaped = false;
+   while (u[0] != '\0') {
+   u[0] = u[1];
+   ++u;
+   }
+   } else  /* start \-Sequence */
+   escaped = true;
+   continue;
+   }
+   
+   /* search for delimiter */
+   for (i=0; delim[i] != '\0'; ++i) {
+   if (*t == delim[i])
+   break;
+   }
+   
+   /* un-escaped delimiter found = error */
+   if (!escaped  delim[i] != '\0')
+   return false;
+
+   /* escaped delimiter found = remove / */
+   if (escaped) {
+   --t;
+   u = t;
+escaped = false;
+   while (u[0] != '\0') {
+   u[0] = u[1];
+   ++u;
+   }
+   }
+   }
+   
+   return true;
+}
+
 static int
 

Re: libpcap

2003-08-03 Thread Lev Walkin
Andrew Konstantinov wrote:
Hello,

I am writing a program which takes advantage of libpcap but I've run into
several problems with it: 1) Is there any way how I can specify in the
filter description that it should match only incoming packets on some
interface? inbound/outbound keywords work only for 'slip' (according to
tcpdump man page). I could do that with 'not src host' and then put the
local hostname after that, but is there a more general solution, without
the need for local hostname or ip address?
No, there isn't. Please study the bpf manual page to find out what
capabilities libpcap could export to its user, because libpcap uses
bpf device on FreeBSD.
2) I can't figure out how to
setup a filter so it could match several ports at once. For example, I
want the filter to only match 21-25 and 113 ports for incoming traffic.
How do I do that? Right know I can see only two solutions. I could simply
sniff all the traffic, and then filter out the interesting ports by
myself, or I could setup several filters each of which would be
responsible for a specific port. But both solutions seem to be
inefficient. Is there a better way to accomplish this? Any help will be
greatly appriciated.
port 21 or ... or port 25 or port 113

--
Lev Walkin
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]