From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 09:03:13 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A886537B401 for ; Sun, 6 Jul 2003 09:03:13 -0700 (PDT) Received: from bluejay.mail.pas.earthlink.net (bluejay.mail.pas.earthlink.net [207.217.120.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 26ACC44020 for ; Sun, 6 Jul 2003 09:03:13 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfmrb.dialup.mindspring.com ([165.247.219.107] helo=mindspring.com) by bluejay.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZByf-0000Xu-00; Sun, 06 Jul 2003 09:03:02 -0700 Message-ID: <3F0847F2.8A985E5@mindspring.com> Date: Sun, 06 Jul 2003 09:01:54 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: zhuyi References: <20030704171430.68CE.ZHUYI@jstvu.edu.cn> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4cd6f194732abf36809acc0be4ecdd4b8350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org Subject: Re: how to call a syscall in a kernel module? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 16:03:14 -0000 zhuyi wrote: > Dear all: > How to call a syscall in a kernel module? In Linux, you can add two > line into your source code. > > #define __KERNEL_SYSCALLS__ > #include Most system calls call "copyin" or "copyinstr" or "uiomove", which assumes that the data is in the user process that is active at the time of the system call. This basically boils down to UIO_SYSSPACE vs. UIO_USERSPACE. Because of this, it's generally not possible to call system calls from within the kernel. It's probably reasonable to turn all the system calls into wrappers; there would be an additional function call worth of overhead for all system calls, but the benefit would be to enable calling of all calls from kernel space. The overhead is probably worth it (AIX works this way, and it doesn't seem to hurt them at all). -- Terry From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 09:07:32 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A774637B401 for ; Sun, 6 Jul 2003 09:07:26 -0700 (PDT) Received: from bluejay.mail.pas.earthlink.net (bluejay.mail.pas.earthlink.net [207.217.120.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 33C0A43FD7 for ; Sun, 6 Jul 2003 09:07:26 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfmrb.dialup.mindspring.com ([165.247.219.107] helo=mindspring.com) by bluejay.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZC2v-00015w-00; Sun, 06 Jul 2003 09:07:25 -0700 Message-ID: <3F0848FF.A386477C@mindspring.com> Date: Sun, 06 Jul 2003 09:06:23 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Josh Brooks References: <20030704015704.Y57224-100000@mail.econolodgetulsa.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4cd6f194732abf3687cdd8ac3363233e8350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org Subject: Re: recovering data from a truncated vn-file possible? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 16:07:33 -0000 Josh Brooks wrote: > Long story short, I have a 4gig vn-backed filesystem. The file backing it > is now missing the last 750megs ... I can vnconfig it, but when I fsck it > I see: Probably the first thing you'll want to do is write a small program to open the file and write a zero at the offset of the 750M to make the "device" the right size. Most of the recovery tools, including fsck, go into convulsions if the device size shrinks on them. So the first thing you want to do is change the size back to what it should be. -- Terry From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 09:14:48 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D213837B404 for ; Sun, 6 Jul 2003 09:14:46 -0700 (PDT) Received: from adsl-64-161-78-226.dsl.lsan03.pacbell.net (adsl-64-161-78-226.dsl.lsan03.pacbell.net [64.161.78.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 7633843FBF for ; Sun, 6 Jul 2003 09:14:45 -0700 (PDT) (envelope-from oremanj@adsl-64-161-78-226.dsl.lsan03.pacbell.net) Received: (qmail 30812 invoked by uid 1001); 6 Jul 2003 16:17:54 -0000 Date: Sun, 6 Jul 2003 09:17:54 -0700 From: Joshua Oreman To: Terry Lambert Message-ID: <20030706161754.GA30740@webserver.get-linux.org> References: <20030704015704.Y57224-100000@mail.econolodgetulsa.com> <3F0848FF.A386477C@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F0848FF.A386477C@mindspring.com> User-Agent: Mutt/1.4.1i cc: hackers@freebsd.org Subject: Re: recovering data from a truncated vn-file possible? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 16:14:49 -0000 On Sun, Jul 06, 2003 at 09:06:23AM -0700 or thereabouts, Terry Lambert wrote: > Josh Brooks wrote: > > Long story short, I have a 4gig vn-backed filesystem. The file backing it > > is now missing the last 750megs ... I can vnconfig it, but when I fsck it > > I see: > > Probably the first thing you'll want to do is write a small program > to open the file and write a zero at the offset of the 750M to make > the "device" the right size. Most of the recovery tools, including > fsck, go into convulsions if the device size shrinks on them. So the > first thing you want to do is change the size back to what it should > be. He said it used to be 4gigs, so one would have to write a zero at 4gigs. Or do this (slower, but it works): $ dd if=/dev/zero bs=1m count=750 >> myfile -- Josh > > -- Terry > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 09:18:13 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7C62537B401 for ; Sun, 6 Jul 2003 09:18:13 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id E752544005 for ; Sun, 6 Jul 2003 09:18:12 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfmrb.dialup.mindspring.com ([165.247.219.107] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZCDL-0000Jw-00; Sun, 06 Jul 2003 09:18:11 -0700 Message-ID: <3F084B85.5CF7F6B0@mindspring.com> Date: Sun, 06 Jul 2003 09:17:09 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Matthew Emmerton References: <001901c34256$95e4db10$1200a8c0@gsicomp.on.ca> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a473f9b5eb7b0e8053be1cc9a79031bf33350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org Subject: Re: RFC: Change to sys_errlist X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 16:18:14 -0000 Matthew Emmerton wrote: > This is a RFC on a change to sys_errlist for errno = 0. > > On Linux, if perror() or strerror() is called with errno = 0, the resulting > string is "Success". > On FreeBSD, the resulting string is "Unknown error: 0". > > I think that FreeBSD's output is unintentionally confusing, as errno = 0 > implies success. > > The following patch will change the output to the Linux behaviour. > > I appreciate any comments. Actually, I ran into a situation on MacOS X the other day that had a system call with a -1 return code with an errno == 0. I would personally like to distinguish this case, if only for the purpose of catching kernel errors. Saying "Success" when in fact the system call is returning -1 is a bogus thing to do. -- Terry From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 09:25:05 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6C8E937B401 for ; Sun, 6 Jul 2003 09:25:04 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id CE0F543FDF for ; Sun, 6 Jul 2003 09:25:03 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfmrb.dialup.mindspring.com ([165.247.219.107] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZCJw-0001RK-00; Sun, 06 Jul 2003 09:25:01 -0700 Message-ID: <3F084D1E.9C15E181@mindspring.com> Date: Sun, 06 Jul 2003 09:23:58 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: John-Mark Gurney References: <001901c34256$95e4db10$1200a8c0@gsicomp.on.ca> <20030704185032.GB605@funkthat.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a473f9b5eb7b0e80534c864752b41471ea350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org Subject: Re: RFC: Change to sys_errlist X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 16:25:05 -0000 John-Mark Gurney wrote: > Matthew Emmerton wrote this message on Fri, Jul 04, 2003 at 14:03 -0400: > > This is a RFC on a change to sys_errlist for errno = 0. [ ... ] > This is not good. This will just encourge more programers to not properly > test return values. Read man 2 errno says: "Successful calls never set > errno;", so this depends upon the programmer initalizing errno to 0 > before they make their call. If they are already so poor as to be > calling perror, etc with errno 0, then I doubt that we can depend upon > them initalizing errno to 0 and giving consistant results. I was tempted to say something similar, but tried to take the high road, instead, so that it didn't look like a gratuitous "different than Linux" comment. There are a lot of good reasons to *not* want to change the error message to "Success" without playing the "be like Linux" card. The one you cite here is just another one. In case it's not obvious... I'm agreeing with you. 8-). -- Terry From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 09:30:46 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DBD8237B401 for ; Sun, 6 Jul 2003 09:30:46 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5CD4244005 for ; Sun, 6 Jul 2003 09:30:46 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfmrb.dialup.mindspring.com ([165.247.219.107] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZCPT-0002M5-00; Sun, 06 Jul 2003 09:30:44 -0700 Message-ID: <3F084E75.1CC3058@mindspring.com> Date: Sun, 06 Jul 2003 09:29:41 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Vivek Khera References: <16133.55711.263062.288990@yertle.int.kciLink.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a403615f51df4b911179d401bec010f1d4350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: hackers@freebsd.org Subject: Re: process sizes X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 16:30:47 -0000 Vivek Khera wrote: > Now, currently, the BSD code from SizeLimit reads like this: > > sub bsd_size_check { > return (&BSD::Resource::getrusage())[2,3]; > } > > This routine is intended to return the current process size and shared > memory size. However, the getrusage() above is not really doing what > is intended. The shared pages value returned is way wrong (only text > pages are given by getrusage) and the current process size is not the > MAX RSS, which is returned above. > > I'm at a loss as to what to use to measure the current process size > and also to measure the amount of virtual memory in use by that > process that is in shared pages. > If anyone has good code to get this information on FreeBSD (and other > BSD's in general) please let me know. If additional libraries are > needed, that's ok. If we have to poke around /proc, that's ok to. > > I'd appreciate direct replies since I'm away at OSCON next week and > don't want to miss anything. Thanks. You are aware that POSIX only requires that the struct rusage have system and user timeval members, right? http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/resource.h.html -- Terry From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 10:17:30 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4DAF337B401 for ; Sun, 6 Jul 2003 10:17:30 -0700 (PDT) Received: from phuket.psconsult.nl (ps226.psconsult.nl [213.222.19.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id D0D0A43FF2 for ; Sun, 6 Jul 2003 10:17:28 -0700 (PDT) (envelope-from paul@phuket.psconsult.nl) Received: from phuket.psconsult.nl (localhost [127.0.0.1]) by phuket.psconsult.nl (8.12.6p2/8.12.6) with ESMTP id h66HHRSP066740 for ; Sun, 6 Jul 2003 19:17:27 +0200 (CEST) (envelope-from paul@phuket.psconsult.nl) Received: (from paul@localhost) by phuket.psconsult.nl (8.12.6p2/8.12.6/Submit) id h66HHRdh066739 for hackers@freebsd.org; Sun, 6 Jul 2003 19:17:27 +0200 (CEST) Date: Sun, 6 Jul 2003 19:17:26 +0200 From: Paul Schenkeveld To: hackers@freebsd.org Message-ID: <20030706171726.GA66532@psconsult.nl> Mail-Followup-To: hackers@freebsd.org References: <20030704015704.Y57224-100000@mail.econolodgetulsa.com> <3F0848FF.A386477C@mindspring.com> <20030706161754.GA30740@webserver.get-linux.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030706161754.GA30740@webserver.get-linux.org> User-Agent: Mutt/1.5.4i Subject: Re: recovering data from a truncated vn-file possible? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 17:17:30 -0000 On Sun, Jul 06, 2003 at 09:17:54AM -0700, Joshua Oreman wrote: > On Sun, Jul 06, 2003 at 09:06:23AM -0700 or thereabouts, Terry Lambert wrote: > > Josh Brooks wrote: > > > Long story short, I have a 4gig vn-backed filesystem. The file backing it > > > is now missing the last 750megs ... I can vnconfig it, but when I fsck it > > > I see: > > > > Probably the first thing you'll want to do is write a small program > > to open the file and write a zero at the offset of the 750M to make > > the "device" the right size. Most of the recovery tools, including > > fsck, go into convulsions if the device size shrinks on them. So the > > first thing you want to do is change the size back to what it should > > be. > > He said it used to be 4gigs, so one would have to write a zero at 4gigs. > Or do this (slower, but it works): > $ dd if=/dev/zero bs=1m count=750 >> myfile $ truncate -s > -- Josh > > > > > -- Terry Paul Schenkeveld, Consultant PSconsult ICT Services BV From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 10:23:50 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 596D937B401 for ; Sun, 6 Jul 2003 10:23:50 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id C5D9243FBD for ; Sun, 6 Jul 2003 10:23:49 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-2ivfmrb.dialup.mindspring.com ([165.247.219.107] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZDEo-0003al-00; Sun, 06 Jul 2003 10:23:46 -0700 Message-ID: <3F085AE1.EE105C0C@mindspring.com> Date: Sun, 06 Jul 2003 10:22:41 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Paul Schenkeveld References: <20030704015704.Y57224-100000@mail.econolodgetulsa.com> <3F0848FF.A386477C@mindspring.com> <20030706171726.GA66532@psconsult.nl> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a467c53f4ccd078a8aaa4b4d769f006b79666fa475841a1c7a350badd9bab72f9c350badd9bab72f9c cc: hackers@freebsd.org Subject: Re: recovering data from a truncated vn-file possible? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 17:23:50 -0000 Paul Schenkeveld wrote: > $ truncate -s Bah! Why use a utility, when you can write a program? -- Terry From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 10:25:53 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 208E637B401 for ; Sun, 6 Jul 2003 10:25:53 -0700 (PDT) Received: from phuket.psconsult.nl (ps226.psconsult.nl [213.222.19.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id DE95043FF3 for ; Sun, 6 Jul 2003 10:25:51 -0700 (PDT) (envelope-from paul@phuket.psconsult.nl) Received: from phuket.psconsult.nl (localhost [127.0.0.1]) by phuket.psconsult.nl (8.12.6p2/8.12.6) with ESMTP id h66HPoSP066911 for ; Sun, 6 Jul 2003 19:25:50 +0200 (CEST) (envelope-from paul@phuket.psconsult.nl) Received: (from paul@localhost) by phuket.psconsult.nl (8.12.6p2/8.12.6/Submit) id h66HPo1l066910 for hackers@freebsd.org; Sun, 6 Jul 2003 19:25:50 +0200 (CEST) Date: Sun, 6 Jul 2003 19:25:50 +0200 From: Paul Schenkeveld To: hackers@freebsd.org Message-ID: <20030706172550.GA66820@psconsult.nl> Mail-Followup-To: Paul Schenkeveld , hackers@freebsd.org References: <20030704015704.Y57224-100000@mail.econolodgetulsa.com> <3F0848FF.A386477C@mindspring.com> <20030706161754.GA30740@webserver.get-linux.org> <20030706171726.GA66532@psconsult.nl> <3F085AE1.EE105C0C@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F085AE1.EE105C0C@mindspring.com> User-Agent: Mutt/1.5.4i Subject: Re: recovering data from a truncated vn-file possible? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 17:25:53 -0000 On Sun, Jul 06, 2003 at 10:22:41AM -0700, Terry Lambert wrote: > Paul Schenkeveld wrote: > > $ truncate -s > > Bah! Why use a utility, when you can write a program? Cause I find it hard to choose between C, Cobol and PL/1 when I decide to write such a program :-) > -- Terry -- Paul Schenkeveld From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 12:46:10 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 401C837B401 for ; Sun, 6 Jul 2003 12:46:10 -0700 (PDT) Received: from freebie.xs4all.nl (freebie.xs4all.nl [213.84.32.253]) by mx1.FreeBSD.org (Postfix) with ESMTP id 865F544033 for ; Sun, 6 Jul 2003 12:46:01 -0700 (PDT) (envelope-from wkb@freebie.xs4all.nl) Received: from freebie.xs4all.nl (localhost [127.0.0.1]) by freebie.xs4all.nl (8.12.9/8.12.9) with ESMTP id h66JjmNj000988 for ; Sun, 6 Jul 2003 21:45:48 +0200 (CEST) (envelope-from wkb@freebie.xs4all.nl) Received: (from wkb@localhost) by freebie.xs4all.nl (8.12.9/8.12.9/Submit) id h66JjmUE000987 for FreeBSD-hackers@freebsd.org; Sun, 6 Jul 2003 21:45:48 +0200 (CEST) Date: Sun, 6 Jul 2003 21:45:48 +0200 From: Wilko Bulte To: FreeBSD hackers list Message-ID: <20030706194548.GA966@freebie.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-OS: FreeBSD 4.8-STABLE X-PGP: finger wilko@freebsd.org Subject: advise for new mainboard X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 19:46:10 -0000 Folks, I'm shopping for a P4 mainboard. Currently I'm considering a Asus P4P800 (I don't need the RAID from the Deluxe version) or the Asus P4PE. The latter one has a Broadcom gigE NIC, whereas the P4P800 has a 3COM chip which I think is not currently supported? Advise welcome on whether this is a good idea or not. Wilko -- | / o / /_ _ wilko@FreeBSD.org |/|/ / / /( (_) Bulte From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 13:18:46 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 393B237B401 for ; Sun, 6 Jul 2003 13:18:46 -0700 (PDT) Received: from cus.org.uk (host213-106-240-81.no-dns-yet.ntli.net [213.106.240.81]) by mx1.FreeBSD.org (Postfix) with ESMTP id 43E3843FDF for ; Sun, 6 Jul 2003 13:18:45 -0700 (PDT) (envelope-from dom@cus.org.uk) Received: from cus.org.uk (localhost.cus.org.uk [127.0.0.1]) by cus.org.uk (8.12.6/8.12.6) with ESMTP id h66KIh5h011460; Sun, 6 Jul 2003 21:18:43 +0100 (BST) (envelope-from dom@cus.org.uk) Received: (from dom@localhost) by cus.org.uk (8.12.6/8.12.6/Submit) id h66KIh9v011459; Sun, 6 Jul 2003 21:18:43 +0100 (BST) Date: Sun, 6 Jul 2003 21:18:43 +0100 From: Dominic Marks To: Wilko Bulte Message-ID: <20030706201843.GA8596@cus.org.uk> References: <20030706194548.GA966@freebie.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030706194548.GA966@freebie.xs4all.nl> User-Agent: Mutt/1.4i cc: FreeBSD hackers list Subject: Re: advise for new mainboard X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 20:18:46 -0000 On 06/07/2003 21:45, Wilko Bulte wrote: > Folks, > > I'm shopping for a P4 mainboard. > > Currently I'm considering a Asus P4P800 (I don't need the RAID from the > Deluxe version) or the Asus P4PE. > > The latter one has a Broadcom gigE NIC, whereas the P4P800 has a 3COM > chip which I think is not currently supported? > > Advise welcome on whether this is a good idea or not. > > Wilko > -- > | / o / /_ _ wilko@FreeBSD.org > |/|/ / / /( (_) Bulte > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" I can't offer any review of the hardware you are looking at, but I can say what experience I have had of an Intel 875P based mainboard which is in a Dell Dimension I've just bought. Specification: http://www.intel.com/design/chipsets/875P/ Everything seems to work with recent -CURRENT with the exception of the integrated sound which works with a patch available in Gnats. The performance is excellent, I have a 2.6GHz P4 with HT in this machine and it certainly flies. Hope this is useful, -- Dominic From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 13:30:47 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B7AB737B401 for ; Sun, 6 Jul 2003 13:30:47 -0700 (PDT) Received: from priv-edtnes46.telusplanet.net (defout.telus.net [199.185.220.240]) by mx1.FreeBSD.org (Postfix) with ESMTP id DDCDD43F3F for ; Sun, 6 Jul 2003 13:30:45 -0700 (PDT) (envelope-from pfak@telus.net) Received: from starfly ([209.121.12.209]) by priv-edtnes46.telusplanet.net (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with SMTP id <20030706203045.NNFS5265.priv-edtnes46.telusplanet.net@starfly>; Sun, 6 Jul 2003 14:30:45 -0600 Message-ID: <001601c343fd$79df2580$c601a8c0@starfly> From: "Peter" To: "Wilko Bulte" References: <20030706194548.GA966@freebie.xs4all.nl> Date: Sun, 6 Jul 2003 13:30:44 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1193 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1193 cc: FreeBSD-hackers@freebsd.org Subject: Re: advise for new mainboard X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 20:30:48 -0000 I just (yesterday) bought a Asus P4SDX (w/Sound NIC USB 2.0 ATA-133). Work's very nicely on FreeBSD 5.1-RELEASE, but refuses to work on 4.8-STABLE/RELEASE. Very nice board, fast performance and good bang-for-your buck. --Peter ----- Original Message ----- From: "Wilko Bulte" To: "FreeBSD hackers list" Sent: Sunday, July 06, 2003 12:45 PM Subject: advise for new mainboard > Folks, > > I'm shopping for a P4 mainboard. > > Currently I'm considering a Asus P4P800 (I don't need the RAID from the > Deluxe version) or the Asus P4PE. > > The latter one has a Broadcom gigE NIC, whereas the P4P800 has a 3COM > chip which I think is not currently supported? > > Advise welcome on whether this is a good idea or not. > > Wilko > -- > | / o / /_ _ wilko@FreeBSD.org > |/|/ / / /( (_) Bulte > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 16:13:49 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E750D37B401 for ; Sun, 6 Jul 2003 16:13:49 -0700 (PDT) Received: from cicero0.cybercity.dk (cicero0.cybercity.dk [212.242.40.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0984B43FF5 for ; Sun, 6 Jul 2003 16:13:49 -0700 (PDT) (envelope-from db@traceroute.dk) Received: from user4.cybercity.dk (fxp0.user4.ip.cybercity.dk [212.242.41.50]) by cicero0.cybercity.dk (Postfix) with ESMTP id 63A5928BE7 for ; Mon, 7 Jul 2003 01:13:47 +0200 (CEST) Received: from main (port132.ds1-arsy.adsl.cybercity.dk [212.242.239.73]) by user4.cybercity.dk (Postfix) with SMTP id 8F9AB1278AB for ; Mon, 7 Jul 2003 01:13:46 +0200 (CEST) Date: Mon, 7 Jul 2003 01:22:05 +0200 From: Socketd To: hackers@freebsd.org Message-Id: <20030707012205.3103dfc8.db@traceroute.dk> X-Mailer: Sylpheed version 0.8.10claws (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jul 2003 23:13:50 -0000 Hi all 1. Reading "man blackhole" I found that net.inet.udp.blackhole=1 will prevent traceroute. Is this only if the host is the end target? or will it simply disable sending an ICMP packet when it get's a packet with ttl=1? 2. Does net.inet.icmp.drop_redirect drop all redirects? Redirect datagrams for the Network. Redirect datagrams for the Host. Redirect datagrams for the Type of Service and Network. Redirect datagrams for the Type of Service and Host. 3. What is the difference between net.inet.ip.redirect and the above? 4. There is a net.inet.icmp.maskrepl, but can you also disable timestamp, echo request and information request messages the same way or do I need a firewall for that? 5. In order to drop SYN-FIN packets, do I need to compile the kernel with "options TCP_DROP_SYNFIN" or can I just use "tcp_drop_synfin="YES"" in /etc/rc.conf? Is there a net.inet.tcp.?? I can use instead of the above suggestions? br socketd From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 21:36:55 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 618) id 71E6537B422; Sun, 6 Jul 2003 21:36:55 -0700 (PDT) To: hackers@freebsd.org, mobile@freebsd.org Date: Sun, 6 Jul 2003 21:36:55 -0700 (PDT) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20030707043655.71E6537B422@hub.freebsd.org> From: wpaul@FreeBSD.ORG (Bill Paul) Subject: MCT USB<->RS232 driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 04:36:56 -0000 While wandering around CompUSA today, I came upon what I consider to be an incredibly useful little device: the Targus USB mobile port replicator with ethernet. This device is basically a multi-port USB hub with a bunch of peripherals attached, including: - PS/2 keyboard port - PS/2 mouse port - parallel printer port - RS-232 serial port - 10/100 ethernet port - Two USB 1.1 ports for any other USB devices you care to use For someone like me, who owns a 'legacy free' laptop that has no parallel or serial ports, or external keyboard/mouse ports, this struck me as a pretty clever idea. When I got it home, I found that almost everything is supported in FreeBSD 5.x, except for one thing: the serial port. The chip is a MCT USB-232 device, which is supported in NetBSD, but not FreeBSD. Not to be denied, I grabbed the umct(4) driver from NetBSD and got it working well enough that I can run userland PPP over it with my US Robotics external 56K modem. (If fact, I'm composing this e-mail over it right now.) It's not perfect. One major problem is that unlike all the other USB serial devices, this one provides incoming data via the interrupt endpoint instead of the bulk IN endpoint. Somehow in NetBSD, both the ucom(4) support module and the driver itself are able to read from the interrupt endpoint, but this trick doesn't work in FreeBSD. Consequently, I had to kludge things up to stuff data into the terminal device from the umct(4) driver's interrupt pipe handler. This is messy, but it works. It anyone else wants to use this driver, you can download it from: http://www.freebsd.org/~wpaul/MCT/mct.tar.gz To use it, download the tarball, then do the following: # cd /sys # cat /path/to/mct.tar.gz | gzip -d | tar -xvf - # cd modules/umct # make; make install; make load You need the ucom(4) module loaded as well. I'm not going to commit this yet because there's one thing I haven't been able to test, which is that I'm not sure how this device is supposed to signal changes in the modem status register. It's supposed to signal changes via the interrupt pipe, but I don't see how that can work if the interrupt pipe is also being used for incoming data. There's no easy way for me to figure it out either since I have no datasheet for this chip. In the meantime, I consider this useful enough that I should make it available for others who might have a USB<->RS232 adapter with the same chip. Share and enjoy! -Bill -- ============================================================================= -Bill Paul (510) 749-2329 | Senior Engineer, Master of Unix-Fu wpaul@windriver.com | Wind River Systems ============================================================================= "If stupidity were a handicap, you'd have the best parking spot." ============================================================================= From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 22:45:26 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A5A7537B401 for ; Sun, 6 Jul 2003 22:45:26 -0700 (PDT) Received: from cfcl.com (cpe-24-221-172-174.ca.sprintbbd.net [24.221.172.174]) by mx1.FreeBSD.org (Postfix) with ESMTP id 01CBD43FB1 for ; Sun, 6 Jul 2003 22:45:26 -0700 (PDT) (envelope-from rdm@cfcl.com) Received: from [192.168.254.205] ([192.168.254.205]) by cfcl.com (8.12.6/8.11.1) with ESMTP id h675lKj4068994 for ; Sun, 6 Jul 2003 22:47:21 -0700 (PDT) (envelope-from rdm@cfcl.com) Mime-Version: 1.0 Message-Id: X-Mailer: Eudora for Macintosh! Date: Sun, 6 Jul 2003 22:45:18 -0700 To: hackers@freebsd.org From: Rich Morin Content-Type: text/plain; charset="us-ascii" ; format="flowed" Subject: Adding second-level resolution to cron(8). X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 05:45:26 -0000 I have a project for which I need a generalized time-based scheduling daemon. cron(8) is almost ideal, but it only has minute-level resolution. So, I'm thinking about modifying cron to add second-level resolution. Before I start, I thought I'd ask a few questions: * Has someone already done this? * Is it a Really Bad Idea for some reason? * Would anyone else be interested in having these modifications? The crontab(5) syntax is pretty well set in stone, but I think I see a way to extend it without causing any breakage. Specifically, I'd extend the format of the "minute" field, as: 1 minute 1 1,5 minutes 1 and 5 * any minute */5 any minute that is divisible by 5 1:2 second 2 of minute 1 1:2,5:10 second 2 of minute 1 and second 10 of minute 5 *:3 second 3 of any minute *:*/5 any second that is divisible by 5 Comments and suggestions (sans flamage) are solicited. -r -- email: rdm@cfcl.com; phone: +1 650-873-7841 http://www.cfcl.com/rdm - my home page, resume, etc. http://www.cfcl.com/Meta - The FreeBSD Browser, Meta Project, etc. http://www.ptf.com/dossier - Prime Time Freeware's DOSSIER series From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 23:18:57 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8A23337B401; Sun, 6 Jul 2003 23:18:57 -0700 (PDT) Received: from mail.cyberonic.com (mail.cyberonic.com [4.17.179.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 33E4F43FBD; Sun, 6 Jul 2003 23:18:56 -0700 (PDT) (envelope-from jmg@hydrogen.funkthat.com) Received: from hydrogen.funkthat.com (node-40244c0a.sfo.onnet.us.uu.net [64.36.76.10]) by mail.cyberonic.com (8.12.8/8.12.5) with ESMTP id h676hbMa026083; Mon, 7 Jul 2003 02:43:38 -0400 Received: (from jmg@localhost) by hydrogen.funkthat.com (8.12.9/8.11.6) id h676JCka061832; Sun, 6 Jul 2003 23:19:12 -0700 (PDT) (envelope-from jmg) Date: Sun, 6 Jul 2003 23:19:12 -0700 From: John-Mark Gurney To: Bill Paul Message-ID: <20030707061912.GB44762@funkthat.com> Mail-Followup-To: Bill Paul , hackers@freebsd.org, mobile@freebsd.org References: <20030707043655.71E6537B422@hub.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030707043655.71E6537B422@hub.freebsd.org> User-Agent: Mutt/1.4.1i X-Operating-System: FreeBSD 4.2-RELEASE i386 X-PGP-Fingerprint: B7 EC EF F8 AE ED A7 31 96 7A 22 B3 D8 56 36 F4 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html cc: hackers@freebsd.org cc: mobile@freebsd.org Subject: Re: MCT USB<->RS232 driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: John-Mark Gurney List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 06:18:57 -0000 Bill Paul wrote this message on Sun, Jul 06, 2003 at 21:36 -0700: > When I got it home, I found that almost everything is supported in > FreeBSD 5.x, except for one thing: the serial port. The chip is a > MCT USB-232 device, which is supported in NetBSD, but not FreeBSD. > > Not to be denied, I grabbed the umct(4) driver from NetBSD and got > it working well enough that I can run userland PPP over it with my Anything wrong with umct in -current? (scottl commited it just 9 days ago.) Or is this a different driver that is not compatible? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 6 23:55:57 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 618) id 7FDAB37B401; Sun, 6 Jul 2003 23:55:57 -0700 (PDT) In-Reply-To: <20030707061912.GB44762@funkthat.com> from John-Mark Gurney at "Jul 6, 2003 11:19:12 pm" To: gurney_j@efn.org (John-Mark Gurney) Date: Sun, 6 Jul 2003 23:55:57 -0700 (PDT) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20030707065557.7FDAB37B401@hub.freebsd.org> From: wpaul@FreeBSD.ORG (Bill Paul) cc: hackers@freebsd.org cc: mobile@freebsd.org Subject: Re: MCT USB<->RS232 driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 06:55:57 -0000 > Bill Paul wrote this message on Sun, Jul 06, 2003 at 21:36 -0700: > > When I got it home, I found that almost everything is supported in > > FreeBSD 5.x, except for one thing: the serial port. The chip is a > > MCT USB-232 device, which is supported in NetBSD, but not FreeBSD. > > > > Not to be denied, I grabbed the umct(4) driver from NetBSD and got > > it working well enough that I can run userland PPP over it with my > > Anything wrong with umct in -current? (scottl commited it just 9 days > ago.) Or is this a different driver that is not compatible? Argh. Yes, this is the same device. And yes, Scott's driver is much nicer than the monstrosity I created. I need to update my local copy of the -current USB code more often. :/ Ah well. At least now this port expander is fully supported. -Bill From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 00:46:27 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 022F837B401 for ; Mon, 7 Jul 2003 00:46:27 -0700 (PDT) Received: from xorpc.icir.org (xorpc.icir.org [192.150.187.68]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9AC0543FCB for ; Mon, 7 Jul 2003 00:46:26 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: from xorpc.icir.org (localhost [127.0.0.1]) by xorpc.icir.org (8.12.8p1/8.12.3) with ESMTP id h677kQkN062744; Mon, 7 Jul 2003 00:46:26 -0700 (PDT) (envelope-from rizzo@xorpc.icir.org) Received: (from rizzo@localhost) by xorpc.icir.org (8.12.8p1/8.12.3/Submit) id h677kQGe062743; Mon, 7 Jul 2003 00:46:26 -0700 (PDT) (envelope-from rizzo) Date: Mon, 7 Jul 2003 00:46:26 -0700 From: Luigi Rizzo To: hackers@freebsd.org Message-ID: <20030707004626.B56037@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Subject: hints on shell string expansion ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 07:46:27 -0000 Hi, i need a bit of help from creative /bin/sh users... I am writing a script to generate ipfw test cases, and as part of the script i need to generate 'actions' which can be either one or more, e.g. a1="allow" a2="deny log" a3="pipe 10" Now, this works: for act in "$a1" "$a2" "$a3"; do echo "add $act ip from 1.2.3.4 to 5.6.7.8" done but i because the string of actions is used in several places, I would love to find a way to group actions into a single variable and then write something like this actions="allow 'deny log' 'pipe 10'" for act in $actions ; do echo "add $act ip from 1.2.3.4 to 5.6.7.8" done I have tried to play tricks with quotes and backquotes, backslashes, eval, etc. but no methods helped. Any ideas ? cheers luigi From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 00:46:40 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6B24B37B401; Mon, 7 Jul 2003 00:46:40 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7DE5343F75; Mon, 7 Jul 2003 00:46:39 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h677kcdP022373; Mon, 7 Jul 2003 01:46:38 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Mon, 07 Jul 2003 01:46:28 -0600 (MDT) Message-Id: <20030707.014628.18704844.imp@bsdimp.com> To: wpaul@freebsd.org From: "M. Warner Losh" In-Reply-To: <20030707043655.71E6537B422@hub.freebsd.org> References: <20030707043655.71E6537B422@hub.freebsd.org> X-Mailer: Mew version 2.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit cc: hackers@freebsd.org cc: mobile@freebsd.org Subject: Re: MCT USB<->RS232 driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 07:46:40 -0000 In message: <20030707043655.71E6537B422@hub.freebsd.org> wpaul@freebsd.org (Bill Paul) writes: : When I got it home, I found that almost everything is supported in : FreeBSD 5.x, except for one thing: the serial port. The chip is a : MCT USB-232 device, which is supported in NetBSD, but not FreeBSD. But Scott Long already committed his umct driver a few days ago... :-) Warner From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 00:56:41 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BBF2337B401 for ; Mon, 7 Jul 2003 00:56:41 -0700 (PDT) Received: from pc5.i.0x5.de (reverse-213-146-113-119.dialin.kamp-dsl.de [213.146.113.119]) by mx1.FreeBSD.org (Postfix) with ESMTP id 559BE43FDD for ; Mon, 7 Jul 2003 00:56:39 -0700 (PDT) (envelope-from nicolas@dauerreden.de) Received: from pc5.i.0x5.de (localhost [127.0.0.1]) by pc5.i.0x5.de (8.12.8p1/8.12.8) with ESMTP id h677ublr005119 for ; Mon, 7 Jul 2003 09:56:37 +0200 (CEST) (envelope-from nicolas@pc5.i.0x5.de) Received: (from root@localhost) by pc5.i.0x5.de (8.12.8p1/8.12.8/Submit) id h677ubvo005118 for hackers@freebsd.org.magicnowbp; Mon, 7 Jul 2003 09:56:37 +0200 (CEST) Received: from pc5.i.0x5.de (localhost [127.0.0.1]) by pc5.i.0x5.de (8.12.8p1/8.12.8) with ESMTP id h677ualr005114 for ; Mon, 7 Jul 2003 09:56:36 +0200 (CEST) (envelope-from nicolas@pc5.i.0x5.de) Received: (from nicolas@localhost) by pc5.i.0x5.de (8.12.8p1/8.12.8/Submit) id h677ua89005113 for hackers@freebsd.org; Mon, 7 Jul 2003 09:56:36 +0200 (CEST) Date: Mon, 7 Jul 2003 09:56:36 +0200 From: Nicolas Rachinsky To: hackers@freebsd.org Message-ID: <20030707075636.GA4724@pc5.i.0x5.de> Mail-Followup-To: hackers@freebsd.org References: <20030707004626.B56037@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030707004626.B56037@xorpc.icir.org> X-Powered-by: FreeBSD X-Homepage: http://www.rachinsky.de X-PGP-Keyid: C11ABC0E X-PGP-Fingerprint: 19DB 8392 8FE0 814A 7362 EEBD A53B 526A C11A BC0E X-PGP-Key: http://www.rachinsky.de/nicolas/nicolas_rachinsky.asc X-SECURITY: Never trust a running system User-Agent: Mutt/1.5.4i Subject: Re: hints on shell string expansion ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 07:56:42 -0000 * Luigi Rizzo [2003-07-07 00:46 -0700]: > but i because the string of actions is used in several places, > I would love to find a way to group actions into a single > variable and then write something like this > > actions="allow 'deny log' 'pipe 10'" > for act in $actions ; do > echo "add $act ip from 1.2.3.4 to 5.6.7.8" > done actions="allow 'deny log' 'pipe 10'" eval "for act in $actions ; do"' echo "add $act ip from 1.2.3.4 to 5.6.7.8" done' But I'm shure there are better ways. Nicolas From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 01:32:00 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1894737B401 for ; Mon, 7 Jul 2003 01:32:00 -0700 (PDT) Received: from prioris.mini.pw.edu.pl (prioris.mini.pw.edu.pl [194.29.178.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A5B943FAF for ; Mon, 7 Jul 2003 01:31:59 -0700 (PDT) (envelope-from P.Dawidek@prioris.mini.pw.edu.pl) Received: from localhost (localhost.mini.pw.edu.pl [127.0.0.1]) by prioris.mini.pw.edu.pl (Postfix) with ESMTP id 5D58924396; Mon, 7 Jul 2003 10:31:55 +0200 (CEST) Received: by prioris.mini.pw.edu.pl (Postfix, from userid 1091) id AC74F2438D; Mon, 7 Jul 2003 10:31:49 +0200 (CEST) Date: Mon, 7 Jul 2003 10:31:49 +0200 From: Pawel Jakub Dawidek To: Luigi Rizzo Message-ID: <20030707083149.GC2199@prioris.mini.pw.edu.pl> References: <20030707004626.B56037@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline In-Reply-To: <20030707004626.B56037@xorpc.icir.org> User-Agent: Mutt/1.4.1i X-PGP-Key-URL: http://garage.freebsd.pl/jules.pgp X-OS: FreeBSD 4.8-STABLE i386 X-Virus-Scanned: by AMaViS (prioris) cc: hackers@freebsd.org Subject: Re: hints on shell string expansion ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 08:32:00 -0000 On Mon, Jul 07, 2003 at 12:46:26AM -0700, Luigi Rizzo wrote: +> I am writing a script to generate ipfw test cases, and as +> part of the script i need to generate 'actions' which can be either +> one or more, e.g. [...] +> actions="allow 'deny log' 'pipe 10'" +> for act in $actions ; do +> echo "add $act ip from 1.2.3.4 to 5.6.7.8" +> done +> +> I have tried to play tricks with quotes and backquotes, backslashes, +> eval, etc. but no methods helped. Any ideas ? Maybe just: IFS='#' actions="allow#deny log#pipe 10" for act in $actions; do echo "add $act ip from 1.2.3.4 to 5.6.7.8" done -- Pawel Jakub Dawidek pawel@dawidek.net UNIX Systems Programmer/Administrator http://garage.freebsd.pl Am I Evil? Yes, I Am! http://cerber.sourceforge.net From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 01:34:26 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5CCA637B413 for ; Mon, 7 Jul 2003 01:34:21 -0700 (PDT) Received: from HAL9000.homeunix.com (ip114.bella-vista.sfo.interquest.net [66.199.86.114]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6363B43FA3 for ; Mon, 7 Jul 2003 01:34:20 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: from HAL9000.homeunix.com (localhost [127.0.0.1]) by HAL9000.homeunix.com (8.12.9/8.12.9) with ESMTP id h678YGK5090757; Mon, 7 Jul 2003 01:34:16 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Received: (from das@localhost) by HAL9000.homeunix.com (8.12.9/8.12.9/Submit) id h678YF39090756; Mon, 7 Jul 2003 01:34:15 -0700 (PDT) (envelope-from das@FreeBSD.ORG) Date: Mon, 7 Jul 2003 01:34:15 -0700 From: David Schultz To: Luigi Rizzo Message-ID: <20030707083415.GB90638@HAL9000.homeunix.com> Mail-Followup-To: Luigi Rizzo , hackers@freebsd.org References: <20030707004626.B56037@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030707004626.B56037@xorpc.icir.org> cc: hackers@FreeBSD.ORG Subject: Re: hints on shell string expansion ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 08:34:26 -0000 On Mon, Jul 07, 2003, Luigi Rizzo wrote: > but i because the string of actions is used in several places, > I would love to find a way to group actions into a single > variable and then write something like this > > actions="allow 'deny log' 'pipe 10'" > for act in $actions ; do > echo "add $act ip from 1.2.3.4 to 5.6.7.8" > done I've used a trick with 'set' for something similar, so perhaps this will work for you: set -- allow 'deny log' 'pipe 10' while [ $# -gt 0 ]; do act=$1 # do stuff here shift done You can also use 'eval', but that makes escaping nasty. It may be possible to change the IFS to something other than space, but I've never messed around with that particular black magic. From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 02:37:21 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D384D37B401; Mon, 7 Jul 2003 02:37:21 -0700 (PDT) Received: from prioris.mini.pw.edu.pl (prioris.mini.pw.edu.pl [194.29.178.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C38A43F93; Mon, 7 Jul 2003 02:37:20 -0700 (PDT) (envelope-from P.Dawidek@prioris.mini.pw.edu.pl) Received: from localhost (localhost.mini.pw.edu.pl [127.0.0.1]) by prioris.mini.pw.edu.pl (Postfix) with ESMTP id 38EF9243C7; Mon, 7 Jul 2003 11:37:19 +0200 (CEST) Received: by prioris.mini.pw.edu.pl (Postfix, from userid 1091) id 40EAC243C6; Mon, 7 Jul 2003 11:37:13 +0200 (CEST) Date: Mon, 7 Jul 2003 11:37:12 +0200 From: Pawel Jakub Dawidek To: phk@freebsd.org Message-ID: <20030707093712.GD2199@prioris.mini.pw.edu.pl> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="5/uDoXvLw7AC5HRs" Content-Disposition: inline User-Agent: Mutt/1.4.1i X-PGP-Key-URL: http://garage.freebsd.pl/jules.pgp X-OS: FreeBSD 4.8-STABLE i386 X-Virus-Scanned: by AMaViS (prioris) cc: freebsd-hackers@freebsd.org Subject: setattr() system call (task from phk TODO list). X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 09:37:22 -0000 --5/uDoXvLw7AC5HRs Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Hello. I think I got patch for setattr() syscall (attached as setattr.patch) and it works fine, but there is a problem in ufs_setattr(). It looks like ufs_setattr() will don't handle property changes of many file attibutes, because there is many places where it can modify some attributes, but return with error, because next change will fail. For now there is also no chance to change flags to '[su]chg'/'[su]appnd' and other attributes in one call of ufs_setattr(), because flags are changed first and other modifications aren't permitted because of that. If we put flags changing code at the end, there will be no chance to change other attributes when flags are '[su]chg' or '[su]appnd'. So I'm sending also patch for UFS that allow other attributes changes when before or after setattr() there is/will be no [su](chg|appnd) flags (patch attached: ufs_setattr.patch). It isn't the best way. The best why will be made a copy of inode struct go through changes and copy it back only if everything succeeded. This cost performance of course, so... PS. This syscall will be quite usefull in tar(1) I think. -- Pawel Jakub Dawidek pawel@dawidek.net UNIX Systems Programmer/Administrator http://garage.freebsd.pl Am I Evil? Yes, I Am! http://cerber.sourceforge.net --5/uDoXvLw7AC5HRs Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="setattr.patch" diff -ur /usr/src/sys/kern/syscalls.master src/sys/kern/syscalls.master --- /usr/src/sys/kern/syscalls.master Sat Jul 5 16:54:11 2003 +++ src/sys/kern/syscalls.master Sat Jul 5 16:54:05 2003 @@ -637,6 +637,9 @@ int attrnamespace, void *data, size_t nbytes); } 439 STD BSD { ssize_t extattr_list_link(const char *path, \ int attrnamespace, void *data, size_t nbytes); } +440 STD BSD { int setattr(char *path, struct stat *sb, int op); } +441 STD BSD { int lsetattr(char *path, struct stat *sb, int op); } +442 STD BSD { int fsetattr(int fd, struct stat *sb, int op); } ; Please copy any additions and changes to the following compatability tables: ; sys/ia64/ia32/syscalls.master (take a best guess) diff -ur /usr/src/sys/kern/vfs_syscalls.c src/sys/kern/vfs_syscalls.c --- /usr/src/sys/kern/vfs_syscalls.c Tue Jul 1 11:29:38 2003 +++ src/sys/kern/vfs_syscalls.c Sat Jul 5 21:12:23 2003 @@ -1940,48 +1940,254 @@ return (error); } -/* - * Common implementation code for chflags() and fchflags(). - */ static int -setfflags(td, vp, flags) - struct thread *td; - struct vnode *vp; - int flags; +setfattr(struct thread *td, struct vnode *vp, struct stat *sb, u_int op, + int locked) { - int error; struct mount *mp; struct vattr vattr; + int error; - /* - * Prevent non-root users from setting flags on devices. When - * a device is reused, users can retain ownership of the device - * if they are allowed to set flags and programs assume that - * chown can't fail when done as root. - */ - if (vp->v_type == VCHR || vp->v_type == VBLK) { - error = suser_cred(td->td_ucred, PRISON_ROOT); - if (error) + if ((op & SA_OP_ALL) == 0) + return (0); + + if ((op & SA_OP_FLAGS) != 0) { + /* + * Prevent non-root users from setting flags on devices. When + * a device is reused, users can retain ownership of the device + * if they are allowed to set flags and programs assume that + * chown can't fail when done as root. + */ + if (vp->v_type == VCHR || vp->v_type == VBLK) { + error = suser_cred(td->td_ucred, PRISON_ROOT); + if (error) + return (error); + } + } + + if (!locked) { + if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) return (error); + VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); } - if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - return (error); - VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); VATTR_NULL(&vattr); - vattr.va_flags = flags; + + if ((op & SA_OP_FLAGS) != 0) { + vattr.va_flags = sb->st_flags; #ifdef MAC - error = mac_check_vnode_setflags(td->td_ucred, vp, vattr.va_flags); - if (error == 0) + error = mac_check_vnode_setflags(td->td_ucred, vp, + vattr.va_flags); + if (error != 0) + goto fail; #endif - error = VOP_SETATTR(vp, &vattr, td->td_ucred, td); - VOP_UNLOCK(vp, 0, td); - vn_finished_write(mp); + } + if ((op & SA_OP_MODE) != 0) { + vattr.va_mode = sb->st_mode & ALLPERMS; +#ifdef MAC + error = mac_check_vnode_setmode(td->td_ucred, vp, + vattr.va_mode); + if (error != 0) + goto fail; +#endif + } + if ((op & SA_OP_OWNER) != 0) { + vattr.va_uid = sb->st_uid; + vattr.va_gid = sb->st_gid; +#ifdef MAC + error = mac_check_vnode_setowner(td->td_ucred, vp, vattr.va_uid, + vattr.va_gid); + if (error != 0) + goto fail; +#endif + } + if ((op & SA_OP_UTIMES) != 0) { + if ((op & SA_OP_ATIME) != 0) + vattr.va_atime = sb->st_atimespec; + if ((op & SA_OP_MTIME) != 0) + vattr.va_mtime = sb->st_mtimespec; + if ((op & SA_OP_BIRTHTIME) != 0) + vattr.va_birthtime = sb->st_birthtimespec; +#ifdef MAC + error = mac_check_vnode_setutimes(td->td_ucred, vp, + vattr.va_atime, vattr.va_mtime); + if (error != 0) + goto fail; +#endif + if ((op & SA_OP_UTIMES_NULL) != 0) + vattr.va_vaflags |= VA_UTIMES_NULL; + } + + error = VOP_SETATTR(vp, &vattr, td->td_ucred, td); +fail: + if (!locked) { + VOP_UNLOCK(vp, 0, td); + vn_finished_write(mp); + } + + return (error); +} + +/* + * Change attributes of a file given path name. + */ +#ifndef _SYS_SYSPROTO_H_ +struct setattr_args { + char *path; + struct stat *sb; + u_int op; +}; +#endif +/* ARGSUSED */ +int +setattr(td, uap) + struct thread *td; + register struct setattr_args /* { + char *path; + struct stat *sb; + u_int op; + } */ *uap; +{ + + return (kern_setattr(td, uap->path, UIO_USERSPACE, uap->sb, + UIO_USERSPACE, uap->op)); +} + +int +kern_setattr(struct thread *td, char *path, enum uio_seg pathseg, + struct stat *sb, enum uio_seg sbseg, u_int op) +{ + int error; + struct nameidata nd; + struct stat stb; + + if (sbseg == UIO_USERSPACE) { + if ((error = copyin(sb, &stb, sizeof(stb))) != 0) + return (error); + } else { + stb = *sb; + } + NDINIT(&nd, LOOKUP, FOLLOW, pathseg, path, td); + if ((error = namei(&nd)) != 0) + return (error); + NDFREE(&nd, NDF_ONLY_PNBUF); + error = setfattr(td, nd.ni_vp, &stb, op, 0); + vrele(nd.ni_vp); + return error; +} + +/* + * Change attributes of a file given path name (don't follow links.) + */ +#ifndef _SYS_SYSPROTO_H_ +struct lsetattr_args { + char *path; + struct stat *sb; + u_int op; +}; +#endif +/* ARGSUSED */ +int +lsetattr(td, uap) + struct thread *td; + register struct lsetattr_args /* { + char *path; + struct stat *sb; + u_int op; + } */ *uap; +{ + + return (kern_lsetattr(td, uap->path, UIO_USERSPACE, uap->sb, + UIO_USERSPACE, uap->op)); +} + +int +kern_lsetattr(struct thread *td, char *path, enum uio_seg pathseg, + struct stat *sb, enum uio_seg sbseg, u_int op) +{ + int error; + struct nameidata nd; + struct stat stb; + + if (sbseg == UIO_USERSPACE) { + if ((error = copyin(sb, &stb, sizeof(stb))) != 0) + return (error); + } else { + stb = *sb; + } + NDINIT(&nd, LOOKUP, NOFOLLOW, pathseg, path, td); + if ((error = namei(&nd)) != 0) + return (error); + NDFREE(&nd, NDF_ONLY_PNBUF); + error = setfattr(td, nd.ni_vp, &stb, op, 0); + vrele(nd.ni_vp); + return error; +} + +/* + * Change attributes of a file given a file descriptor. + */ +#ifndef _SYS_SYSPROTO_H_ +struct fsetattr_args { + int fd; + struct stat *sb; + u_int op; +}; +#endif +/* ARGSUSED */ +int +fsetattr(td, uap) + struct thread *td; + register struct fsetattr_args /* { + int fd; + struct stat *sb; + u_int op; + } */ *uap; +{ + + return (kern_fsetattr(td, uap->fd, uap->sb, UIO_USERSPACE, uap->op)); +} + +int +kern_fsetattr(struct thread *td, int fd, struct stat *sb, enum uio_seg sbseg, + u_int op) +{ + int error; + struct file *fp; + struct stat stb; + + if (sbseg == UIO_USERSPACE) { + if ((error = copyin(sb, &stb, sizeof(stb))) != 0) + return (error); + } else { + stb = *sb; + } + if ((error = getvnode(td->td_proc->p_fd, fd, &fp)) != 0) + return (error); + error = setfattr(td, fp->f_vnode, &stb, op, 0); + fdrop(fp, td); + return (error); } /* + * Common implementation code for chflags() and fchflags(). + */ +static int __inline +setfflags(td, vp, flags) + struct thread *td; + struct vnode *vp; + int flags; +{ + struct stat sb; + + sb.st_flags = flags; + + return (setfattr(td, vp, &sb, SA_OP_FLAGS, 0)); +} + +/* * Change flags of a file given a path name. */ #ifndef _SYS_SYSPROTO_H_ @@ -2065,30 +2271,17 @@ /* * Common implementation code for chmod(), lchmod() and fchmod(). */ -static int +static int __inline setfmode(td, vp, mode) struct thread *td; struct vnode *vp; int mode; { - int error; - struct mount *mp; - struct vattr vattr; + struct stat sb; - if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - return (error); - VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); - VATTR_NULL(&vattr); - vattr.va_mode = mode & ALLPERMS; -#ifdef MAC - error = mac_check_vnode_setmode(td->td_ucred, vp, vattr.va_mode); - if (error == 0) -#endif - error = VOP_SETATTR(vp, &vattr, td->td_ucred, td); - VOP_UNLOCK(vp, 0, td); - vn_finished_write(mp); - return error; + sb.st_mode = mode; + + return (setfattr(td, vp, &sb, SA_OP_MODE, 0)); } /* @@ -2189,33 +2382,19 @@ /* * Common implementation for chown(), lchown(), and fchown() */ -static int +static int __inline setfown(td, vp, uid, gid) struct thread *td; struct vnode *vp; uid_t uid; gid_t gid; { - int error; - struct mount *mp; - struct vattr vattr; + struct stat sb; - if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) - return (error); - VOP_LEASE(vp, td, td->td_ucred, LEASE_WRITE); - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); - VATTR_NULL(&vattr); - vattr.va_uid = uid; - vattr.va_gid = gid; -#ifdef MAC - error = mac_check_vnode_setowner(td->td_ucred, vp, vattr.va_uid, - vattr.va_gid); - if (error == 0) -#endif - error = VOP_SETATTR(vp, &vattr, td->td_ucred, td); - VOP_UNLOCK(vp, 0, td); - vn_finished_write(mp); - return error; + sb.st_uid = uid; + sb.st_gid = gid; + + return (setfattr(td, vp, &sb, SA_OP_OWNER, 0)); } /* @@ -2363,7 +2542,7 @@ /* * Common implementation code for utimes(), lutimes(), and futimes(). */ -static int +static int __inline setutimes(td, vp, ts, numtimes, nullflag) struct thread *td; struct vnode *vp; @@ -2374,6 +2553,8 @@ int error, setbirthtime; struct mount *mp; struct vattr vattr; + struct stat sb; + u_int op; if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0) return (error); @@ -2383,24 +2564,26 @@ if (numtimes < 3 && VOP_GETATTR(vp, &vattr, td->td_ucred, td) == 0 && timespeccmp(&ts[1], &vattr.va_birthtime, < )) setbirthtime = 1; - VATTR_NULL(&vattr); - vattr.va_atime = ts[0]; - vattr.va_mtime = ts[1]; - if (setbirthtime) - vattr.va_birthtime = ts[1]; - if (numtimes > 2) - vattr.va_birthtime = ts[2]; + sb.st_atimespec = ts[0]; + sb.st_mtimespec = ts[1]; + op = SA_OP_ATIME | SA_OP_MTIME; + if (setbirthtime) { + sb.st_birthtimespec = ts[1]; + op |= SA_OP_BIRTHTIME; + } + if (numtimes > 2) { + sb.st_birthtimespec = ts[2]; + op |= SA_OP_BIRTHTIME; + } if (nullflag) - vattr.va_vaflags |= VA_UTIMES_NULL; -#ifdef MAC - error = mac_check_vnode_setutimes(td->td_ucred, vp, vattr.va_atime, - vattr.va_mtime); -#endif - if (error == 0) - error = VOP_SETATTR(vp, &vattr, td->td_ucred, td); + op |= SA_OP_UTIMES_NULL; + + error = setfattr(td, vp, &sb, op, 1); + VOP_UNLOCK(vp, 0, td); vn_finished_write(mp); - return error; + + return (error); } /* diff -ur /usr/src/sys/sys/stat.h src/sys/sys/stat.h --- /usr/src/sys/sys/stat.h Thu May 22 19:07:57 2003 +++ src/sys/sys/stat.h Mon Jul 7 11:34:36 2003 @@ -288,6 +288,22 @@ #define SF_NOUNLINK 0x00100000 /* file may not be removed or renamed */ #define SF_SNAPSHOT 0x00200000 /* snapshot inode */ +#if __BSD_VISIBLE +/* + * Avaliable options for setattr() syscall. + */ +#define SA_OP_FLAGS 0x01 +#define SA_OP_MODE 0x02 +#define SA_OP_OWNER 0x04 +#define SA_OP_ATIME 0x08 +#define SA_OP_MTIME 0x10 +#define SA_OP_BIRTHTIME 0x20 +#define SA_OP_UTIMES (SA_OP_ATIME | SA_OP_MTIME | SA_OP_BIRTHTIME) +#define SA_OP_ALL (SA_OP_FLAGS | SA_OP_MODE | SA_OP_OWNER | SA_OP_UTIMES) +/* Additional options: */ +#define SA_OP_UTIMES_NULL 0x0100 +#endif + #ifdef _KERNEL /* * Shorthand abbreviations of above. @@ -303,6 +319,9 @@ #ifndef _KERNEL __BEGIN_DECLS #if __BSD_VISIBLE +int setattr(const char *, struct stat *, unsigned op); +int lsetattr(const char *, struct stat *, unsigned op); +int fsetattr(int, struct stat *, unsigned op); int chflags(const char *, unsigned long); #endif int chmod(const char *, mode_t); diff -ur /usr/src/sys/sys/syscall.h src/sys/sys/syscall.h --- /usr/src/sys/sys/syscall.h Tue Jul 1 11:30:18 2003 +++ src/sys/sys/syscall.h Sat Jul 5 21:06:39 2003 @@ -2,8 +2,8 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD: src/sys/sys/syscall.h,v 1.138 2003/06/28 08:29:04 davidxu Exp $ - * created from FreeBSD: src/sys/kern/syscalls.master,v 1.150 2003/06/04 03:49:31 rwatson Exp + * $FreeBSD$ + * created from FreeBSD: src/sys/kern/syscalls.master,v 1.151 2003/06/28 08:29:05 davidxu Exp */ #define SYS_syscall 0 @@ -347,4 +347,7 @@ #define SYS_extattr_list_fd 437 #define SYS_extattr_list_file 438 #define SYS_extattr_list_link 439 -#define SYS_MAXSYSCALL 440 +#define SYS_setattr 440 +#define SYS_lsetattr 441 +#define SYS_fsetattr 442 +#define SYS_MAXSYSCALL 443 diff -ur /usr/src/sys/sys/syscall.mk src/sys/sys/syscall.mk --- /usr/src/sys/sys/syscall.mk Tue Jul 1 11:30:18 2003 +++ src/sys/sys/syscall.mk Sat Jul 5 21:06:39 2003 @@ -1,7 +1,7 @@ # FreeBSD system call names. # DO NOT EDIT-- this file is automatically generated. -# $FreeBSD: src/sys/sys/syscall.mk,v 1.93 2003/06/28 08:29:04 davidxu Exp $ -# created from FreeBSD: src/sys/kern/syscalls.master,v 1.150 2003/06/04 03:49:31 rwatson Exp +# $FreeBSD$ +# created from FreeBSD: src/sys/kern/syscalls.master,v 1.151 2003/06/28 08:29:05 davidxu Exp MIASM = \ syscall.o \ exit.o \ @@ -292,4 +292,7 @@ jail_attach.o \ extattr_list_fd.o \ extattr_list_file.o \ - extattr_list_link.o + extattr_list_link.o \ + setattr.o \ + lsetattr.o \ + fsetattr.o diff -ur /usr/src/sys/sys/syscallsubr.h src/sys/sys/syscallsubr.h --- /usr/src/sys/sys/syscallsubr.h Sat Jul 5 17:01:40 2003 +++ src/sys/sys/syscallsubr.h Sat Jul 5 19:58:10 2003 @@ -30,6 +30,7 @@ #include #include +#include struct sockaddr; struct msghdr; @@ -41,6 +42,12 @@ int flags); int kern_bind(struct thread *td, int fd, struct sockaddr *sa); int kern_chdir(struct thread *td, char *path, enum uio_seg pathseg); +int kern_setattr(struct thread *td, char *path, enum uio_seg pathseg, + struct stat *sb, enum uio_seg sbseg, u_int op); +int kern_lsetattr(struct thread *td, char *path, enum uio_seg pathseg, + struct stat *sb, enum uio_seg sbseg, u_int op); +int kern_fsetattr(struct thread *td, int fd, struct stat *sb, + enum uio_seg sbseg, u_int op); int kern_chmod(struct thread *td, char *path, enum uio_seg pathseg, int mode); int kern_chown(struct thread *td, char *path, enum uio_seg pathseg, int uid, --5/uDoXvLw7AC5HRs Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: attachment; filename="ufs_setattr.patch" diff -ur /usr/src/sys/ufs/ufs/ufs_vnops.c src/sys/ufs/ufs/ufs_vnops.c --- /usr/src/sys/ufs/ufs/ufs_vnops.c Tue Jul 1 11:30:20 2003 +++ src/sys/ufs/ufs/ufs_vnops.c Sun Jul 6 11:27:12 2003 @@ -87,6 +87,7 @@ static int ufs_access(struct vop_access_args *); static int ufs_advlock(struct vop_advlock_args *); +static int ufs_chflags(struct vnode *, u_int32_t, struct ucred *, struct thread *); static int ufs_chmod(struct vnode *, int, struct ucred *, struct thread *); static int ufs_chown(struct vnode *, uid_t, gid_t, struct ucred *, struct thread *); static int ufs_close(struct vop_close_args *); @@ -487,51 +488,28 @@ return (EINVAL); } if (vap->va_flags != VNOVAL) { - if (vp->v_mount->mnt_flag & MNT_RDONLY) - return (EROFS); /* - * Callers may only modify the file flags on objects they - * have VADMIN rights for. + * If we have for example 'schg' flag on file and we're + * trying to remove it, but set 'sappnd' flag no other + * modifications are permitted. */ - if ((error = VOP_ACCESS(vp, VADMIN, cred, td))) + if ((vap->va_flags & (IMMUTABLE | APPEND)) && + (ip->i_flags & (IMMUTABLE | APPEND)) && + (vap->va_uid != (uid_t)VNOVAL || + vap->va_gid != (gid_t)VNOVAL || + vap->va_size != VNOVAL || + vap->va_atime.tv_sec != VNOVAL || + vap->va_mtime.tv_sec != VNOVAL || + vap->va_birthtime.tv_sec != VNOVAL || + vap->va_mode != (mode_t)VNOVAL)) { + return (EPERM); + } + error = ufs_chflags(vp, (u_int32_t)vap->va_flags, cred, td); + if (error != 0) return (error); - /* - * Unprivileged processes and privileged processes in - * jail() are not permitted to unset system flags, or - * modify flags if any system flags are set. - * Privileged non-jail processes may not modify system flags - * if securelevel > 0 and any existing system flags are set. - */ - if (!suser_cred(cred, PRISON_ROOT)) { - if (ip->i_flags - & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { - error = securelevel_gt(cred, 0); - if (error) - return (error); - } - /* Snapshot flag cannot be set or cleared */ - if (((vap->va_flags & SF_SNAPSHOT) != 0 && - (ip->i_flags & SF_SNAPSHOT) == 0) || - ((vap->va_flags & SF_SNAPSHOT) == 0 && - (ip->i_flags & SF_SNAPSHOT) != 0)) - return (EPERM); - ip->i_flags = vap->va_flags; - DIP(ip, i_flags) = vap->va_flags; - } else { - if (ip->i_flags - & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || - (vap->va_flags & UF_SETTABLE) != vap->va_flags) - return (EPERM); - ip->i_flags &= SF_SETTABLE; - ip->i_flags |= (vap->va_flags & UF_SETTABLE); - DIP(ip, i_flags) = ip->i_flags; - } - ip->i_flag |= IN_CHANGE; - if (vap->va_flags & (IMMUTABLE | APPEND)) - return (0); - } - if (ip->i_flags & (IMMUTABLE | APPEND)) + } else if (ip->i_flags & (IMMUTABLE | APPEND)) { return (EPERM); + } /* * Go through the fields and update iff not VNOVAL. */ @@ -618,8 +596,63 @@ return (EPERM); error = ufs_chmod(vp, (int)vap->va_mode, cred, td); } + if (error == 0 && vap->va_flags != VNOVAL && !chflags) + error = ufs_chflags(vp, (u_int32_t)vap->va_flags, cred, td); VN_KNOTE(vp, NOTE_ATTRIB); return (error); +} + +/* + * Perform chflags operation on inode ip; + * inode must be locked prior to call. + */ +static int +ufs_chflags(struct vnode *vp, u_int32_t flags, struct ucred *cred, + struct thread *td) +{ + struct inode *ip = VTOI(vp); + int error; + + if (vp->v_mount->mnt_flag & MNT_RDONLY) + return (EROFS); + /* + * Callers may only modify the file flags on objects they + * have VADMIN rights for. + */ + if ((error = VOP_ACCESS(vp, VADMIN, cred, td))) + return (error); + /* + * Unprivileged processes and privileged processes in + * jail() are not permitted to unset system flags, or + * modify flags if any system flags are set. + * Privileged non-jail processes may not modify system flags + * if securelevel > 0 and any existing system flags are set. + */ + if (!suser_cred(cred, PRISON_ROOT)) { + if (ip->i_flags & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND)) { + error = securelevel_gt(cred, 0); + if (error) + return (error); + } + /* Snapshot flag cannot be set or cleared */ + if (((flags & SF_SNAPSHOT) != 0 && + (ip->i_flags & SF_SNAPSHOT) == 0) || + ((flags & SF_SNAPSHOT) == 0 && + (ip->i_flags & SF_SNAPSHOT) != 0)) + return (EPERM); + ip->i_flags = flags; + DIP(ip, i_flags) = flags; + } else { + if (ip->i_flags & (SF_NOUNLINK | SF_IMMUTABLE | SF_APPEND) || + (flags & UF_SETTABLE) != flags) + return (EPERM); + ip->i_flags &= SF_SETTABLE; + ip->i_flags |= (flags & UF_SETTABLE); + DIP(ip, i_flags) = ip->i_flags; + } + ip->i_flag |= IN_CHANGE; + + return (0); } /* --5/uDoXvLw7AC5HRs-- From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 02:43:02 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E0A5337B401 for ; Mon, 7 Jul 2003 02:43:02 -0700 (PDT) Received: from grummit.biaix.org (86.Red-213-97-212.pooles.rima-tde.net [213.97.212.86]) by mx1.FreeBSD.org (Postfix) with SMTP id 7C35F43F75 for ; Mon, 7 Jul 2003 02:43:01 -0700 (PDT) (envelope-from joan@grummit.biaix.org) Received: (qmail 44898 invoked by uid 1000); 7 Jul 2003 09:39:19 -0000 Date: Mon, 7 Jul 2003 11:39:19 +0200 From: Joan Picanyol To: hackers@freebsd.org Message-ID: <20030707093919.GA44679@grummit.biaix.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Subject: Re: Adding second-level resolution to cron(8). X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 09:43:03 -0000 * Rich Morin [20030707 07:42]: > * Has someone already done this? I know two replacements of cron with second resolution: http://multivac.cwru.edu./runwhen/ http://www.ohse.de/uwe/uschedule.html qvb -- pica From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 05:09:31 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A878937B401 for ; Mon, 7 Jul 2003 05:09:31 -0700 (PDT) Received: from mail.rdslink.ro (mail.rdslink.ro [193.231.236.20]) by mx1.FreeBSD.org (Postfix) with SMTP id D97A443FB1 for ; Mon, 7 Jul 2003 05:09:29 -0700 (PDT) (envelope-from enache@rdslink.ro) Received: (qmail 12845 invoked from network); 7 Jul 2003 12:03:27 -0000 Received: from unknown (HELO ratsnest.hole) (10.100.0.70) by mail.rdslink.ro with SMTP; 7 Jul 2003 12:03:27 -0000 Date: Mon, 7 Jul 2003 15:14:00 +0300 From: Enache Adrian To: Luigi Rizzo Message-ID: <20030707121400.GA1262@ratsnest.hole> References: <20030707004626.B56037@xorpc.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030707004626.B56037@xorpc.icir.org> User-Agent: Mutt/1.4i cc: hackers@freebsd.org Subject: Re: hints on shell string expansion ? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 12:09:31 -0000 On Mon, Jul 07, 2003 at 12:46:26AM -0700, Luigi Rizzo wrote: > Hi, > i need a bit of help from creative /bin/sh users... > > I am writing a script to generate ipfw test cases, and as > part of the script i need to generate 'actions' which can be either > one or more, e.g. > > a1="allow" > a2="deny log" > a3="pipe 10" > > Now, this works: > > for act in "$a1" "$a2" "$a3"; do > echo "add $act ip from 1.2.3.4 to 5.6.7.8" > done > > but i because the string of actions is used in several places, > I would love to find a way to group actions into a single > variable and then write something like this > > actions="allow 'deny log' 'pipe 10'" > for act in $actions ; do > echo "add $act ip from 1.2.3.4 to 5.6.7.8" > done Isn't this what you want ? $ set allow "deny log" "pipe 10" $ for act in "$@"; do echo "<$act>"; done Regards, Adi From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 06:40:08 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D0D0D37B401 for ; Mon, 7 Jul 2003 06:40:08 -0700 (PDT) Received: from mail.rdstm.ro (mail.rdstm.ro [193.231.233.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 972CA43F85 for ; Mon, 7 Jul 2003 06:40:07 -0700 (PDT) (envelope-from aanton@reversedhell.net) Received: from reversedhell.net (casa_auto [81.196.32.25]) by mail.rdstm.ro (8.12.9/8.12.1) with ESMTP id h67De2FT014613 for ; Mon, 7 Jul 2003 16:40:04 +0300 Message-ID: <3F077EEF.7000704@reversedhell.net> Date: Sun, 06 Jul 2003 04:44:15 +0300 From: Alin-Adrian Anton User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030606 X-Accept-Language: en-us, en, ro MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 13:40:09 -0000 Hey folks, I am playing with raw sockets on a FreeBSD 4.8 STABLE. This is the include section from my file: #include #include #include #include #include #include #include #include #include When i try to compile the code, this is what I get: %cc -o raw raw.c In file included from raw.c:7: /usr/include/netinet/ip.h:156: syntax error before `n_long' /usr/include/netinet/ip.h:159: syntax error before `n_long' % Errors like that were many more, but I rearranged the included files in this particular order, and the huge number of errors was reduced to what I pasted. Before, there were errors in tcp.h and etc. I would really appreciate an advice of what else to include/not to include in order to get things right. Thanks in advance! Yours Sincerely, Alin. From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 06:50:28 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7635637B401 for ; Mon, 7 Jul 2003 06:50:28 -0700 (PDT) Received: from twix.hotpop.com (twix.hotpop.com [204.57.55.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id B234B43FCB for ; Mon, 7 Jul 2003 06:50:27 -0700 (PDT) (envelope-from xtomservox@hotpop.com) Received: from hotpop.com (kubrick.hotpop.com [204.57.55.16]) by twix.hotpop.com (Postfix) with SMTP id 6F2A145FFB4 for ; Mon, 7 Jul 2003 13:50:15 +0000 (UTC) Received: from esmith (dca-29-c-210.dca.dsl.cerfnet.com [63.242.170.210]) by smtp-2.hotpop.com (Postfix) with ESMTP id EDFCA1800C4; Mon, 7 Jul 2003 13:50:21 +0000 (UTC) From: "Tom Servo" To: "'Alin-Adrian Anton'" , Date: Mon, 7 Jul 2003 09:50:19 -0400 Message-ID: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 Importance: Normal In-Reply-To: <3F077EEF.7000704@reversedhell.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-HotPOP: ----------------------------------------------- Sent By HotPOP.com FREE Email Get your FREE POP email at www.HotPOP.com ----------------------------------------------- Subject: RE: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 13:50:28 -0000 Off the top of my head this appears to be an include sequencing/circular include problem. Check the type that 'n_long' is being defined as and make sure that the proper includes that define the type are defined before the variable is defined and make sure that it is not getting run over. Is that the only files that you are including? -ts >Hey folks, > >I am playing with raw sockets on a FreeBSD 4.8 STABLE. This is the >include section from my file: > >#include >#include >#include >#include >#include >#include >#include >#include >#include > >When i try to compile the code, this is what I get: >%cc -o raw raw.c >In file included from raw.c:7: >/usr/include/netinet/ip.h:156: syntax error before `n_long' >/usr/include/netinet/ip.h:159: syntax error before `n_long' >% > >Errors like that were many more, but I rearranged the included files in >this particular order, and the huge number of errors was reduced to what >I pasted. Before, there were errors in tcp.h and etc. > >I would really appreciate an advice of what else to include/not to >include in order to get things right. > >Thanks in advance! > >Yours Sincerely, >Alin. _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:10:29 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8614837B401 for ; Mon, 7 Jul 2003 07:10:29 -0700 (PDT) Received: from mail.rdstm.ro (mail.rdstm.ro [193.231.233.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7B39C43FA3 for ; Mon, 7 Jul 2003 07:10:27 -0700 (PDT) (envelope-from aanton@reversedhell.net) Received: from reversedhell.net (casa_auto [81.196.32.25]) by mail.rdstm.ro (8.12.9/8.12.1) with ESMTP id h67EAPFT016533; Mon, 7 Jul 2003 17:10:25 +0300 Message-ID: <3F07860E.9060702@reversedhell.net> Date: Sun, 06 Jul 2003 05:14:38 +0300 From: Alin-Adrian Anton User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030606 X-Accept-Language: en-us, en, ro MIME-Version: 1.0 To: Tom Servo References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> In-Reply-To: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:10:29 -0000 Tom Servo wrote: >Off the top of my head this appears to be an include sequencing/circular >include problem. Check the type that 'n_long' is being defined as and make >sure that the proper includes that define the type are defined before the >variable is defined and make sure that it is not getting run over. Is that >the only files that you are including? >-ts > > > >>Hey folks, >> >>I am playing with raw sockets on a FreeBSD 4.8 STABLE. This is the >>include section from my file: >> >>#include >>#include >>#include >>#include >>#include >>#include >>#include >>#include >>#include >> >>When i try to compile the code, this is what I get: >>%cc -o raw raw.c >>In file included from raw.c:7: >>/usr/include/netinet/ip.h:156: syntax error before `n_long' >>/usr/include/netinet/ip.h:159: syntax error before `n_long' >>% >> >>Errors like that were many more, but I rearranged the included files in >>this particular order, and the huge number of errors was reduced to what >>I pasted. Before, there were errors in tcp.h and etc. >> >>I would really appreciate an advice of what else to include/not to >>include in order to get things right. >> >>Thanks in advance! >> >>Yours Sincerely, >>Alin. >> >> > > > > > > > Well, I don't wanna be idiot, perhaps I am too tired, but n_long appears in ip.h defined as : beast# grep ipt_time /usr/include/netinet/ip.h union ipt_timestamp { n_long ipt_time[1]; n_long ipt_time; } ipt_timestamp; beast# grep ipt_time /usr/include/netinet/* /usr/include/netinet/ip.h: union ipt_timestamp { /usr/include/netinet/ip.h: n_long ipt_time[1]; /usr/include/netinet/ip.h: n_long ipt_time; /usr/include/netinet/ip.h: } ipt_timestamp; beast# And, I simply don't find where ipt_time is defined ! I suppose it is structure, perhaps it is of type ipt_timestamp, *g*. And yes, those are all the files I include, nothing more, nothing less. Alin. From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:23:20 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0749F37B401 for ; Mon, 7 Jul 2003 07:23:20 -0700 (PDT) Received: from sccmmhc02.asp.att.net (sccmmhc02.asp.att.net [204.127.203.184]) by mx1.FreeBSD.org (Postfix) with ESMTP id 418F143F85 for ; Mon, 7 Jul 2003 07:23:19 -0700 (PDT) (envelope-from stephen@math.missouri.edu) Received: from math.missouri.edu (12-216-242-20.client.mchsi.com[12.216.242.20]) by sccmmhc02.asp.att.net (sccmmhc02) with SMTP id <20030707142318mm200nfvc2e>; Mon, 7 Jul 2003 14:23:18 +0000 Message-ID: <3F098255.9040906@math.missouri.edu> Date: Mon, 07 Jul 2003 09:23:17 -0500 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20030701 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alin-Adrian Anton References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> In-Reply-To: <3F07860E.9060702@reversedhell.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: Tom Servo cc: freebsd-hackers@freebsd.org Subject: Re: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:23:20 -0000 Alin-Adrian Anton wrote: > Well, I don't wanna be idiot, perhaps I am too tired, but n_long appears > in ip.h defined as : > > beast# grep ipt_time /usr/include/netinet/ip.h > union ipt_timestamp { > n_long ipt_time[1]; > n_long ipt_time; > } ipt_timestamp; > beast# grep ipt_time /usr/include/netinet/* > /usr/include/netinet/ip.h: union ipt_timestamp { > /usr/include/netinet/ip.h: n_long ipt_time[1]; > /usr/include/netinet/ip.h: n_long ipt_time; > /usr/include/netinet/ip.h: } ipt_timestamp; > beast# > > And, I simply don't find where ipt_time is defined ! I suppose it is > structure, perhaps it is of type ipt_timestamp, *g*. > And yes, those are all the files I include, nothing more, nothing less. > > Alin. > I did grep -R ipt_time /usr/include and got exactly the same output as you have above. It looks like ipt_time is not defined anywhere. It looks to me like netinet/ip.h is broken. What is it that you need netinet/ip.h for? Maybe there are some other include files that would work just as well. -- Stephen Montgomery-Smith stephen@math.missouri.edu http://www.math.missouri.edu/~stephen From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:30:09 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 47CE037B401 for ; Mon, 7 Jul 2003 07:30:09 -0700 (PDT) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id E760143FA3 for ; Mon, 7 Jul 2003 07:30:07 -0700 (PDT) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])h67EU2Q27339; Mon, 7 Jul 2003 16:30:02 +0200 (MEST) Date: Mon, 7 Jul 2003 16:30:02 +0200 (CEST) From: Harti Brandt To: Alin-Adrian Anton In-Reply-To: <3F07860E.9060702@reversedhell.net> Message-ID: <20030707162900.B49607@beagle.fokus.fraunhofer.de> References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Tom Servo cc: freebsd-hackers@freebsd.org Subject: Re: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:30:09 -0000 On Sun, 6 Jul 2003, Alin-Adrian Anton wrote: AA>>>In file included from raw.c:7: AA>>>/usr/include/netinet/ip.h:156: syntax error before `n_long' AA>>>/usr/include/netinet/ip.h:159: syntax error before `n_long' You may want to include harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:30:43 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 45FDA37B401 for ; Mon, 7 Jul 2003 07:30:43 -0700 (PDT) Received: from sccimhc02.asp.att.net (sccimhc02.asp.att.net [63.240.76.164]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A83443FAF for ; Mon, 7 Jul 2003 07:30:42 -0700 (PDT) (envelope-from stephen@math.missouri.edu) Received: from math.missouri.edu (12-216-242-20.client.mchsi.com[12.216.242.20]) by sccimhc02.asp.att.net (sccimhc02) with SMTP id <20030707143041im20002b8le>; Mon, 7 Jul 2003 14:30:41 +0000 Message-ID: <3F098410.8050001@math.missouri.edu> Date: Mon, 07 Jul 2003 09:30:40 -0500 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20030701 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Stephen Montgomery-Smith References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> <3F098255.9040906@math.missouri.edu> In-Reply-To: <3F098255.9040906@math.missouri.edu> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: Tom Servo cc: Alin-Adrian Anton cc: freebsd-hackers@freebsd.org Subject: Re: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:30:44 -0000 > > I did > > grep -R ipt_time /usr/include > > and got exactly the same output as you have above. It looks like > ipt_time is not defined anywhere. It looks to me like netinet/ip.h is > broken. > > What is it that you need netinet/ip.h for? Maybe there are some other > include files that would work just as well. > Sorry - it is I who is the complete idiot. Please totalyl ignore my last post. -- Stephen Montgomery-Smith stephen@math.missouri.edu http://www.math.missouri.edu/~stephen From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:30:45 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0AD3937B401 for ; Mon, 7 Jul 2003 07:30:45 -0700 (PDT) Received: from ultra02.rbg.informatik.tu-darmstadt.de (ultra02.rbg.informatik.tu-darmstadt.de [130.83.9.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6EF8243F3F for ; Mon, 7 Jul 2003 07:30:43 -0700 (PDT) (envelope-from viktor@rbg.informatik.tu-darmstadt.de) Received: from ABC216.ram1st.wh.tu-darmstadt.de (ultra19.rbg.informatik.tu-darmstadt.de [130.83.129.6]) SMTP id h67EUaj03937; Mon, 7 Jul 2003 16:30:36 +0200 (MEST) Received: by ABC216.ram1st.wh.tu-darmstadt.de (sSMTP sendmail emulation); Mon, 7 Jul 2003 16:30:26 +0200 Date: Mon, 7 Jul 2003 16:30:26 +0200 From: Viktor Vasilev To: Alin-Adrian Anton Message-ID: <20030707143026.GA6927@rbg.informatik.tu-darmstadt.de> Mail-Followup-To: Alin-Adrian Anton , freebsd-hackers@freebsd.org References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F07860E.9060702@reversedhell.net> User-Agent: Mutt/1.4i X-Operating-System: FreeBSD 5.0-RELEASE i386 cc: freebsd-hackers@freebsd.org Subject: Re: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:30:45 -0000 Hi, On Sun, Jul 06, 2003 at 05:14:38AM +0300, Alin-Adrian Anton wrote: > Well, I don't wanna be idiot, perhaps I am too tired, but n_long appears > in ip.h defined as : > > beast# grep ipt_time /usr/include/netinet/ip.h > union ipt_timestamp { > n_long ipt_time[1]; > n_long ipt_time; > } ipt_timestamp; > beast# grep ipt_time /usr/include/netinet/* > /usr/include/netinet/ip.h: union ipt_timestamp { > /usr/include/netinet/ip.h: n_long ipt_time[1]; > /usr/include/netinet/ip.h: n_long ipt_time; > /usr/include/netinet/ip.h: } ipt_timestamp; > beast# Actually it's defined in: /usr/include/netinet/in_systm.h:typedef u_int32_t n_long; /* long as received from the net */ What the problem might be, is that in_systm.h isn't included anywhere: cd /usr/include; grep in_systm.h `find . -type f` ./netinet/in_systm.h: * @(#)in_systm.h 8.1 (Berkeley) 6/10/93 ./netinet/in_systm.h: * $FreeBSD: src/sys/netinet/in_systm.h,v 1.10 2002/03/19 21:25:46 alfred Exp $ Hope this helps. Regards, Viktor -- He who asks is a fool for five minutes, but he who does not ask reamins a fool forever. Old Chinese saying From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:43:05 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E4A3137B401 for ; Mon, 7 Jul 2003 07:43:05 -0700 (PDT) Received: from vivaldi.meteo.fr (vivaldi.meteo.fr [137.129.28.17]) by mx1.FreeBSD.org (Postfix) with ESMTP id 485D243FCB for ; Mon, 7 Jul 2003 07:43:03 -0700 (PDT) (envelope-from igor.pokrovsky@cnrm.meteo.fr) Received: from cti825.cnrm.meteo.fr (localhost.meteo.fr [127.0.0.1]) OAA12441 for ; Mon, 7 Jul 2003 14:42:55 GMT Received: from xdata.cnrm.meteo.fr (xdata.cnrm.meteo.fr [137.129.150.2]) QAA18307 for ; Mon, 7 Jul 2003 16:42:48 +0200 (METDST) Received: from exmatis1.cnrm.meteo.fr (exmatis1.cnrm.meteo.fr [137.129.157.46]) by xdata.cnrm.meteo.fr with ESMTP (8.9.3 (PHNE_24419)/8.7.1) id QAA21943 for ; Mon, 7 Jul 2003 16:43:00 +0200 (METDST) Received: from exmatis1.cnrm.meteo.fr (localhost [127.0.0.1]) h67EeFls000703 for ; Mon, 7 Jul 2003 16:40:15 +0200 (CEST) (envelope-from pokrovsi@exmatis1.cnrm.meteo.fr) Received: (from pokrovsi@localhost) by exmatis1.cnrm.meteo.fr (8.12.9/8.12.9/Submit) id h67EeEcm000702 for freebsd-hackers@freebsd.org; Mon, 7 Jul 2003 16:40:14 +0200 (CEST) Date: Mon, 7 Jul 2003 16:40:13 +0200 From: Igor Pokrovsky To: freebsd-hackers@freebsd.org Message-ID: <20030707144013.GA664@exmatis1.cnrm.meteo.fr> Mail-Followup-To: Igor Pokrovsky , freebsd-hackers@freebsd.org References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> <20030707143026.GA6927@rbg.informatik.tu-darmstadt.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030707143026.GA6927@rbg.informatik.tu-darmstadt.de> User-Agent: Mutt/1.4.1i X-Accept-Language: ru X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (cti825/CNRM) Organization: METEO FRANCE(CNRM) Subject: Re: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Igor Pokrovsky List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:43:06 -0000 On Sun, Jul 06, 2003 at 05:14:38AM +0300, Alin-Adrian Anton wrote: > Well, I don't wanna be idiot, perhaps I am too tired, but n_long appears > in ip.h defined as : > > beast# grep ipt_time /usr/include/netinet/ip.h > union ipt_timestamp { > n_long ipt_time[1]; > n_long ipt_time; > } ipt_timestamp; > beast# grep ipt_time /usr/include/netinet/* > /usr/include/netinet/ip.h: union ipt_timestamp { > /usr/include/netinet/ip.h: n_long ipt_time[1]; > /usr/include/netinet/ip.h: n_long ipt_time; > /usr/include/netinet/ip.h: } ipt_timestamp; Try to #include before #include . -- Igor From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:43:27 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8BBD337B401 for ; Mon, 7 Jul 2003 07:43:27 -0700 (PDT) Received: from mail.rdstm.ro (mail.rdstm.ro [193.231.233.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7007843F75 for ; Mon, 7 Jul 2003 07:43:26 -0700 (PDT) (envelope-from aanton@reversedhell.net) Received: from reversedhell.net (casa_auto [81.196.32.25]) by mail.rdstm.ro (8.12.9/8.12.1) with ESMTP id h67EhOFT018211 for ; Mon, 7 Jul 2003 17:43:24 +0300 Message-ID: <3F078DC9.3080708@reversedhell.net> Date: Sun, 06 Jul 2003 05:47:37 +0300 From: Alin-Adrian Anton User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030606 X-Accept-Language: en-us, en, ro MIME-Version: 1.0 Cc: freebsd-hackers@freebsd.org References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> <20030707162900.B49607@beagle.fokus.fraunhofer.de> In-Reply-To: <20030707162900.B49607@beagle.fokus.fraunhofer.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:43:28 -0000 Harti Brandt wrote: >On Sun, 6 Jul 2003, Alin-Adrian Anton wrote: > >AA>>>In file included from raw.c:7: >AA>>>/usr/include/netinet/ip.h:156: syntax error before `n_long' >AA>>>/usr/include/netinet/ip.h:159: syntax error before `n_long' > >You may want to include > >harti > > Yes, indeed this solves the n_long problem. This is how my include list looks now: #include #include #include #include #include #include #include #include #include #include And this is what I get when trying to compile: beast# cc -o raw raw.c In file included from raw.c:7: /usr/include/netinet/ip.h:73: field `ip_src' has incomplete type /usr/include/netinet/ip.h:73: field `ip_dst' has incomplete type /usr/include/netinet/ip.h:158: field `ipt_addr' has incomplete type beast# Alin. From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:49:08 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 60F7C37B401 for ; Mon, 7 Jul 2003 07:49:08 -0700 (PDT) Received: from mailhub.fokus.fraunhofer.de (mailhub.fokus.fraunhofer.de [193.174.154.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1998A43F75 for ; Mon, 7 Jul 2003 07:49:07 -0700 (PDT) (envelope-from brandt@fokus.fraunhofer.de) Received: from beagle (beagle [193.175.132.100])h67En4Q01016; Mon, 7 Jul 2003 16:49:04 +0200 (MEST) Date: Mon, 7 Jul 2003 16:49:04 +0200 (CEST) From: Harti Brandt To: Alin-Adrian Anton In-Reply-To: <3F078DC9.3080708@reversedhell.net> Message-ID: <20030707164832.L49607@beagle.fokus.fraunhofer.de> References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <20030707162900.B49607@beagle.fokus.fraunhofer.de> <3F078DC9.3080708@reversedhell.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-hackers@freebsd.org Subject: Re: raw socket programming X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:49:08 -0000 On Sun, 6 Jul 2003, Alin-Adrian Anton wrote: AA>Harti Brandt wrote: AA> AA>>On Sun, 6 Jul 2003, Alin-Adrian Anton wrote: AA>> AA>>AA>>>In file included from raw.c:7: AA>>AA>>>/usr/include/netinet/ip.h:156: syntax error before `n_long' AA>>AA>>>/usr/include/netinet/ip.h:159: syntax error before `n_long' AA>> AA>>You may want to include AA>> AA>>harti AA>> AA>> AA> AA>Yes, indeed this solves the n_long problem. This is how my include list AA>looks now: AA> AA>#include AA>#include AA>#include AA>#include AA>#include AA>#include AA>#include AA>#include AA>#include AA>#include AA> AA>And this is what I get when trying to compile: AA> AA>beast# cc -o raw raw.c AA>In file included from raw.c:7: AA>/usr/include/netinet/ip.h:73: field `ip_src' has incomplete type AA>/usr/include/netinet/ip.h:73: field `ip_dst' has incomplete type AA>/usr/include/netinet/ip.h:158: field `ipt_addr' has incomplete type AA>beast# Try to swap ip.h and in.h (in.h declares struct in_addr). harti -- harti brandt, http://www.fokus.fraunhofer.de/research/cc/cats/employees/hartmut.brandt/private brandt@fokus.fraunhofer.de, harti@freebsd.org From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 07:56:55 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 70BDE37B401 for ; Mon, 7 Jul 2003 07:56:55 -0700 (PDT) Received: from mail.rdstm.ro (mail.rdstm.ro [193.231.233.2]) by mx1.FreeBSD.org (Postfix) with ESMTP id 47F3C43F85 for ; Mon, 7 Jul 2003 07:56:54 -0700 (PDT) (envelope-from aanton@reversedhell.net) Received: from reversedhell.net (casa_auto [81.196.32.25]) by mail.rdstm.ro (8.12.9/8.12.1) with ESMTP id h67EuoFT018862; Mon, 7 Jul 2003 17:56:50 +0300 Message-ID: <3F0790EF.10407@reversedhell.net> Date: Sun, 06 Jul 2003 06:01:03 +0300 From: Alin-Adrian Anton User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.3.1) Gecko/20030606 X-Accept-Language: en-us, en, ro MIME-Version: 1.0 To: Harti Brandt References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> <20030707162900.B49607@beagle.fokus.fraunhofer.de> <3F078DC9.3080708@reversedhell.net> <20030707164832.L49607@beagle.fokus.fraunhofer.de> In-Reply-To: <20030707164832.L49607@beagle.fokus.fraunhofer.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: raw socket programming SOLVED X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 14:56:55 -0000 Harti Brandt wrote: >On Sun, 6 Jul 2003, Alin-Adrian Anton wrote: > >AA>Harti Brandt wrote: >AA> >AA>>On Sun, 6 Jul 2003, Alin-Adrian Anton wrote: >AA>> >AA>>AA>>>In file included from raw.c:7: >AA>>AA>>>/usr/include/netinet/ip.h:156: syntax error before `n_long' >AA>>AA>>>/usr/include/netinet/ip.h:159: syntax error before `n_long' >AA>> >AA>>You may want to include >AA>> >AA>>harti >AA>> >AA>> >AA> >AA>Yes, indeed this solves the n_long problem. This is how my include list >AA>looks now: >AA> >AA>#include >AA>#include >AA>#include >AA>#include >AA>#include >AA>#include >AA>#include >AA>#include >AA>#include >AA>#include >AA> >AA>And this is what I get when trying to compile: >AA> >AA>beast# cc -o raw raw.c >AA>In file included from raw.c:7: >AA>/usr/include/netinet/ip.h:73: field `ip_src' has incomplete type >AA>/usr/include/netinet/ip.h:73: field `ip_dst' has incomplete type >AA>/usr/include/netinet/ip.h:158: field `ipt_addr' has incomplete type >AA>beast# > >Try to swap ip.h and in.h (in.h declares struct in_addr). > >harti > > Yes, it works now, with these includes: ------------------------------- #include #include #include #include #include #include #include #include #include #include ------------------------------- Thank you very much everybody! Best Regards, Alin. From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 08:09:00 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E08AA37B401 for ; Mon, 7 Jul 2003 08:09:00 -0700 (PDT) Received: from grouse.mail.pas.earthlink.net (grouse.mail.pas.earthlink.net [207.217.120.116]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C37943F75 for ; Mon, 7 Jul 2003 08:09:00 -0700 (PDT) (envelope-from dgobeille@earthlink.net) Received: from cpe-66-87-106-157.il.sprintbbd.net ([66.87.106.157] helo=earthlink.net) by grouse.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 19ZXbp-0006gd-00; Mon, 07 Jul 2003 08:08:53 -0700 Message-ID: <3F098D11.2070802@earthlink.net> Date: Mon, 07 Jul 2003 10:09:05 -0500 From: "David A. Gobeille" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alin-Adrian Anton References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> <20030707162900.B49607@beagle.fokus.fraunhofer.de> <3F078DC9.3080708@reversedhell.net> <20030707164832.L49607@beagle.fokus.fraunhofer.de> <3F0790EF.10407@reversedhell.net> In-Reply-To: <3F0790EF.10407@reversedhell.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: raw socket programming SOLVED X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 15:09:01 -0000 Alin-Adrian Anton wrote: > Harti Brandt wrote: > >> On Sun, 6 Jul 2003, Alin-Adrian Anton wrote: >> >> AA>Harti Brandt wrote: >> AA> >> AA>>On Sun, 6 Jul 2003, Alin-Adrian Anton wrote: >> AA>> >> AA>>AA>>>In file included from raw.c:7: >> AA>>AA>>>/usr/include/netinet/ip.h:156: syntax error before `n_long' >> AA>>AA>>>/usr/include/netinet/ip.h:159: syntax error before `n_long' >> AA>> >> AA>>You may want to include >> AA>> >> AA>>harti >> AA>> >> AA>> >> AA> >> AA>Yes, indeed this solves the n_long problem. This is how my include >> list >> AA>looks now: >> AA> >> AA>#include >> AA>#include >> AA>#include >> AA>#include >> AA>#include >> AA>#include >> AA>#include >> AA>#include >> AA>#include >> AA>#include >> AA> >> AA>And this is what I get when trying to compile: >> AA> >> AA>beast# cc -o raw raw.c >> AA>In file included from raw.c:7: >> AA>/usr/include/netinet/ip.h:73: field `ip_src' has incomplete type >> AA>/usr/include/netinet/ip.h:73: field `ip_dst' has incomplete type >> AA>/usr/include/netinet/ip.h:158: field `ipt_addr' has incomplete type >> AA>beast# >> >> Try to swap ip.h and in.h (in.h declares struct in_addr). >> >> harti >> >> > Yes, it works now, with these includes: > ------------------------------- > #include > #include > #include > #include > #include > > #include > #include > #include > > #include > #include > ------------------------------- > > Thank you very much everybody! > > Best Regards, > Alin. Shouldn't the #included files themselves #include headers they are dependant on? With the use of #ifndef and #define in the headers to keep them from being #included more than once? It seems silly(more work) for the programmer to have to arrange everything in a specific order. -- Dave From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 08:22:20 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8478937B401 for ; Mon, 7 Jul 2003 08:22:20 -0700 (PDT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id 7853143FBD for ; Mon, 7 Jul 2003 08:22:18 -0700 (PDT) (envelope-from roam@ringlet.net) Received: (qmail 13004 invoked from network); 7 Jul 2003 15:14:43 -0000 Received: from office.sbnd.net (HELO straylight.ringlet.net) (217.75.140.130) by gandalf.online.bg with SMTP; 7 Jul 2003 15:14:42 -0000 Received: (qmail 70010 invoked by uid 1000); 7 Jul 2003 15:24:21 -0000 Date: Mon, 7 Jul 2003 18:24:21 +0300 From: Peter Pentchev To: "David A. Gobeille" Message-ID: <20030707152421.GE358@straylight.oblivion.bg> Mail-Followup-To: "David A. Gobeille" , Alin-Adrian Anton , freebsd-hackers@freebsd.org References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> <20030707162900.B49607@beagle.fokus.fraunhofer.de> <3F078DC9.3080708@reversedhell.net> <20030707164832.L49607@beagle.fokus.fraunhofer.de> <3F0790EF.10407@reversedhell.net> <3F098D11.2070802@earthlink.net> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Epv4kl9IRBfg3rk" Content-Disposition: inline In-Reply-To: <3F098D11.2070802@earthlink.net> User-Agent: Mutt/1.5.4i cc: freebsd-hackers@freebsd.org cc: Alin-Adrian Anton Subject: Re: raw socket programming SOLVED X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 15:22:20 -0000 --4Epv4kl9IRBfg3rk Content-Type: text/plain; charset=windows-1251 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 07, 2003 at 10:09:05AM -0500, David A. Gobeille wrote: [snip] >=20 > Shouldn't the #included files themselves #include headers they are=20 > dependant on? With the use of #ifndef and #define in the headers to=20 > keep them from being #included more than once? >=20 > It seems silly(more work) for the programmer to have to arrange=20 > everything in a specific order. Search the list archives for 'promiscuous includes'; I believe this has been discussed time and again over the years :) G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@sbnd.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 This sentence would be seven words long if it were six words shorter. --4Epv4kl9IRBfg3rk Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/CZCl7Ri2jRYZRVMRAp0+AJ0Vc0qChwmsNRdmn4rCXujm8w/ctgCdFq9T NuKpG8zLMk/opsbSWT6mF0o= =Pfbz -----END PGP SIGNATURE----- --4Epv4kl9IRBfg3rk-- From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 08:33:16 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E5C3E37B401 for ; Mon, 7 Jul 2003 08:33:16 -0700 (PDT) Received: from webboy.soth.at (door.soth.at [80.110.102.19]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2C72F43FA3 for ; Mon, 7 Jul 2003 08:33:16 -0700 (PDT) (envelope-from toni@webboy.soth.at) Received: by webboy.soth.at (Postfix, from userid 1000) id 9BE807C7; Mon, 7 Jul 2003 17:33:14 +0200 (CEST) Date: Mon, 7 Jul 2003 17:33:14 +0200 From: Toni Andjelkovic To: Socketd Message-ID: <20030707153314.GA1695@webboy.soth.at> References: <20030707012205.3103dfc8.db@traceroute.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030707012205.3103dfc8.db@traceroute.dk> User-Agent: Mutt/1.4i cc: hackers@freebsd.org Subject: Re: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 15:33:17 -0000 On Mon, Jul 07 2003 (01:22:05 +0200), Socketd wrote: > 1. Reading "man blackhole" I found that net.inet.udp.blackhole=1 will > prevent traceroute. Is this only if the host is the end target? or will > it simply disable sending an ICMP packet when it get's a packet with > ttl=1? Look in sys/netinet/udp_usrreq.c. This flag operates on the UDP layer and doesn't interfere with TTLs. > 2. Does net.inet.icmp.drop_redirect drop all redirects? > Redirect datagrams for the Network. > Redirect datagrams for the Host. > Redirect datagrams for the Type of Service and Network. > Redirect datagrams for the Type of Service and Host. Look in sys/netinet/ip_icmp.c, it checks for icp->icmp_type, not icp->icmp_code, so all incoming ICMP packets with a type of ICMP_REDIRECT would be dropped. > 3. What is the difference between net.inet.ip.redirect and the above? Look in sys/netinet/ip_input.c. This is different from incoming redirects. > 4. There is a net.inet.icmp.maskrepl, but can you also disable > timestamp, echo request and information request messages the same way or > do I need a firewall for that? Look in sys/netinet/ip_icmp.c. You need to block these packets separately. > 5. In order to drop SYN-FIN packets, do I need to compile the kernel > with "options TCP_DROP_SYNFIN" or can I just use "tcp_drop_synfin="YES"" in > /etc/rc.conf? Is there a net.inet.tcp.?? I can use instead of the above > suggestions? Look in netinet/tcp_input.c. You need the kernel option "TCP_DROP_SYNFIN" in addition to tcp_drop_synfin="YES". Cheers, Toni From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 08:54:35 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8DE6B37B401 for ; Mon, 7 Jul 2003 08:54:35 -0700 (PDT) Received: from cicero1.cybercity.dk (cicero1.cybercity.dk [212.242.40.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCDE443F85 for ; Mon, 7 Jul 2003 08:54:34 -0700 (PDT) (envelope-from db@traceroute.dk) Received: from user5.cybercity.dk (fxp0.user5.ip.cybercity.dk [212.242.41.51]) by cicero1.cybercity.dk (Postfix) with ESMTP id 8BE715C4C4D; Mon, 7 Jul 2003 17:54:32 +0200 (CEST) Received: from main (port132.ds1-arsy.adsl.cybercity.dk [212.242.239.73]) by user5.cybercity.dk (Postfix) with SMTP id ABDA556306; Mon, 7 Jul 2003 17:54:31 +0200 (CEST) Date: Mon, 7 Jul 2003 18:02:52 +0200 From: Socketd To: Toni Andjelkovic , hackers@freebsd.org Message-Id: <20030707180252.44036c61.db@traceroute.dk> In-Reply-To: <20030707153314.GA1695@webboy.soth.at> References: <20030707012205.3103dfc8.db@traceroute.dk> <20030707153314.GA1695@webboy.soth.at> X-Mailer: Sylpheed version 0.8.10claws (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 15:54:35 -0000 On Mon, 7 Jul 2003 17:33:14 +0200 Toni Andjelkovic wrote: > On Mon, Jul 07 2003 (01:22:05 +0200), Socketd wrote: > > 1. Reading "man blackhole" I found that net.inet.udp.blackhole=1 > > will prevent traceroute. Is this only if the host is the end target? > > or will it simply disable sending an ICMP packet when it get's a > > packet with ttl=1? > > Look in sys/netinet/udp_usrreq.c. This flag operates on the UDP layer > and doesn't interfere with TTLs. Ok, anyway to prevent sending ICMP's when ttl = 0? Or do I need a firewall? Thank you for your reply! br socketd From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 09:02:45 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4EF8737B401 for ; Mon, 7 Jul 2003 09:02:45 -0700 (PDT) Received: from ussenterprise.ufp.org (ussenterprise.ufp.org [208.185.30.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8F4E843F85 for ; Mon, 7 Jul 2003 09:02:44 -0700 (PDT) (envelope-from bicknell@ussenterprise.ufp.org) Received: from ussenterprise.ufp.org (bicknell@localhost [127.0.0.1]) by ussenterprise.ufp.org (8.12.9/8.12.9) with ESMTP id h67G2haT054732 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 7 Jul 2003 12:02:44 -0400 (EDT) Received: (from bicknell@localhost) by ussenterprise.ufp.org (8.12.9/8.12.9/Submit) id h67G2hwl054731 for freebsd-hackers@freebsd.org; Mon, 7 Jul 2003 12:02:43 -0400 (EDT) Date: Mon, 7 Jul 2003 12:02:43 -0400 From: Leo Bicknell To: freebsd-hackers@freebsd.org Message-ID: <20030707160243.GA54395@ussenterprise.ufp.org> Mail-Followup-To: freebsd-hackers@freebsd.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7JfCtLOvnd9MIVvH" Content-Disposition: inline Organization: United Federation of Planets X-PGP-Key: http://www.ufp.org/~bicknell/ Subject: tcsh / tset problem on 4.7 only? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 16:02:45 -0000 --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I have a script that I've been using since the dawn of time that seems to fail on 4.7-RELEASE boxes, but not on anything before or after. To duplicate: Run the stock (/bin/tcsh) tcsh binary, and do: % eval `tset -s -Q` Missing ]. Similarly: % tset -s -Q > runme % eval `cat runme` Missing ]. However, then a: % source runme Works just fine. So, it appears eval'ing the output of "tset -s -Q" fails, but only on 4.7. Again, I've been using this for about 10+ years on all sorts of systems, including 4.8 and 5.0 boxes, but I can reliably make it fail on 4.7. I checked the cvs logs for both /etc/termcap, and for tset, and see nothing that would have changed between those releases. I even looked briefly at csh aka tcsh, and saw nothing obvious. Anyone have any idea why this is broken on 4.7? --=20 Leo Bicknell - bicknell@ufp.org - CCIE 3440 PGP keys at http://www.ufp.org/~bicknell/ Read TMBG List - tmbg-list-request@tmbg.org, www.tmbg.org --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE/CZmjNh6mMG5yMTYRAlCCAJ4szxqSyrAEh131llH0gRX+1c5SFgCfVl0P fFTyR+DgNl3CHJoeePZ73oA= =IW2V -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH-- From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 09:49:25 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7991D37B401 for ; Mon, 7 Jul 2003 09:49:25 -0700 (PDT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id 8E8BB43F3F for ; Mon, 7 Jul 2003 09:49:23 -0700 (PDT) (envelope-from roam@ringlet.net) Received: (qmail 23882 invoked from network); 7 Jul 2003 16:41:49 -0000 Received: from office.sbnd.net (HELO straylight.ringlet.net) (217.75.140.130) by gandalf.online.bg with SMTP; 7 Jul 2003 16:41:49 -0000 Received: (qmail 70414 invoked by uid 1000); 7 Jul 2003 16:51:29 -0000 Date: Mon, 7 Jul 2003 19:51:29 +0300 From: Peter Pentchev To: freebsd-hackers@freebsd.org Message-ID: <20030707165129.GF358@straylight.oblivion.bg> Mail-Followup-To: freebsd-hackers@freebsd.org References: <20030707160243.GA54395@ussenterprise.ufp.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="7cm2iqirTL37Ot+N" Content-Disposition: inline In-Reply-To: <20030707160243.GA54395@ussenterprise.ufp.org> User-Agent: Mutt/1.5.4i Subject: Re: tcsh / tset problem on 4.7 only? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 16:49:25 -0000 --7cm2iqirTL37Ot+N Content-Type: text/plain; charset=windows-1251 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jul 07, 2003 at 12:02:43PM -0400, Leo Bicknell wrote: >=20 > I have a script that I've been using since the dawn of time that > seems to fail on 4.7-RELEASE boxes, but not on anything before or > after. To duplicate: >=20 > Run the stock (/bin/tcsh) tcsh binary, and do: >=20 > % eval `tset -s -Q` > Missing ]. [snip] > I checked the cvs logs for both /etc/termcap, and for tset, and see > nothing that would have changed between those releases. I even > looked briefly at csh aka tcsh, and saw nothing obvious. Anyone > have any idea why this is broken on 4.7? What terminal are you using? Could you post the 'runme' file resulting =66rom the 'tset -s -Q' command? G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@sbnd.net roam@FreeBSD.org PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 This sentence every third, but it still comprehensible. --7cm2iqirTL37Ot+N Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQE/CaUR7Ri2jRYZRVMRAlZcAKCDFDpi3fTSHlveIX1wMvJdOvLUfQCcD6mz JrPCfOEknasQYB88Osr9VhE= =Eafd -----END PGP SIGNATURE----- --7cm2iqirTL37Ot+N-- From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 10:14:05 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 618) id 854DF37B401; Mon, 7 Jul 2003 10:14:05 -0700 (PDT) In-Reply-To: <20030707.014628.18704844.imp@bsdimp.com> from "M. Warner Losh" at "Jul 7, 2003 01:46:28 am" To: imp@bsdimp.com (M. Warner Losh) Date: Mon, 7 Jul 2003 10:14:05 -0700 (PDT) X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-Id: <20030707171405.854DF37B401@hub.freebsd.org> From: wpaul@FreeBSD.ORG (Bill Paul) cc: hackers@freebsd.org cc: Scott Long cc: mobile@freebsd.org Subject: Re: MCT USB<->RS232 driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 17:14:05 -0000 > In message: <20030707043655.71E6537B422@hub.freebsd.org> > wpaul@freebsd.org (Bill Paul) writes: > : When I got it home, I found that almost everything is supported in > : FreeBSD 5.x, except for one thing: the serial port. The chip is a > : MCT USB-232 device, which is supported in NetBSD, but not FreeBSD. > > But Scott Long already committed his umct driver a few days ago... :-) > > Warner > Yes, so I have been told. :P And guess what. It has a bug. :) Well ok, to be fair, it doesn't really have a bug: it lacks a workaround for a buggy chip. The driver determines the bulk output buffer size by checking the data returned by the chip in its bulk out endpoint descriptor. This is right in most cases, but not for the USB_PRODUCT_MCT_SITECOM_USB232 device (which, unfortunately, is what they put in the port replicator I bought). The value it returns for wMaxPacketSize is 32, but in reality, you must use 16. If you don't, the chip drops data under certain circumstances. A good example: attach a modem to the serial adapter and set up a PPP link over it, then try to ssh to a remote host somewhere. Ssh will get about halfway through the connection attempt and then hang. I observed a similar problem with my IRC client. It turns out the NetBSD driver that I hacked up worked because it has a workaround for this chip bug. I applied a similar workaround to Scott's driver and now PPP works again. Here's a patch: --- umct.c.orig Thu Jul 3 18:50:39 2003 +++ umct.c Mon Jul 7 00:52:55 2003 @@ -241,7 +241,10 @@ if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) { ucom->sc_bulkout_no = ed->bEndpointAddress; - ucom->sc_obufsize = UGETW(ed->wMaxPacketSize); + if (uaa->product == USB_PRODUCT_MCT_SITECOM_USB232) + ucom->sc_obufsize = 16; /* device is broken */ + else + ucom->sc_obufsize = UGETW(ed->wMaxPacketSize); continue; } This is almost literally what NetBSD does. Barring any objections, I'd like to check this in. (CC'ing Scott on this e-mail.) -Bill -- ============================================================================= -Bill Paul (510) 749-2329 | Senior Engineer, Master of Unix-Fu wpaul@windriver.com | Wind River Systems ============================================================================= "If stupidity were a handicap, you'd have the best parking spot." ============================================================================= From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 10:21:12 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7B16B37B401 for ; Mon, 7 Jul 2003 10:21:12 -0700 (PDT) Received: from smtp.mho.com (smtp.mho.net [64.58.4.6]) by mx1.FreeBSD.org (Postfix) with SMTP id C098343F93 for ; Mon, 7 Jul 2003 10:21:10 -0700 (PDT) (envelope-from scottl@freebsd.org) Received: (qmail 97239 invoked by uid 1002); 7 Jul 2003 17:21:07 -0000 Received: from adsl-64-58-12-196.mho.net (HELO freebsd.org) (64.58.12.196) by smtp.mho.net with SMTP; 7 Jul 2003 17:21:07 -0000 Message-ID: <3F09AC10.4010401@freebsd.org> Date: Mon, 07 Jul 2003 11:21:20 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.3.1) Gecko/20030425 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Bill Paul References: <20030707171405.854DF37B401@hub.freebsd.org> In-Reply-To: <20030707171405.854DF37B401@hub.freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: hackers@FreeBSD.ORG cc: mobile@FreeBSD.ORG Subject: Re: MCT USB<->RS232 driver X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 17:21:12 -0000 Bill Paul wrote: >>In message: <20030707043655.71E6537B422@hub.freebsd.org> >> wpaul@freebsd.org (Bill Paul) writes: >>: When I got it home, I found that almost everything is supported in >>: FreeBSD 5.x, except for one thing: the serial port. The chip is a >>: MCT USB-232 device, which is supported in NetBSD, but not FreeBSD. >> >>But Scott Long already committed his umct driver a few days ago... :-) >> >>Warner >> > > > Yes, so I have been told. :P > > And guess what. It has a bug. :) > > Well ok, to be fair, it doesn't really have a bug: it lacks a workaround > for a buggy chip. The driver determines the bulk output buffer size > by checking the data returned by the chip in its bulk out endpoint > descriptor. This is right in most cases, but not for the > USB_PRODUCT_MCT_SITECOM_USB232 device (which, unfortunately, is what > they put in the port replicator I bought). The value it returns for > wMaxPacketSize is 32, but in reality, you must use 16. If you don't, > the chip drops data under certain circumstances. A good example: attach > a modem to the serial adapter and set up a PPP link over it, then try > to ssh to a remote host somewhere. Ssh will get about halfway through > the connection attempt and then hang. I observed a similar problem > with my IRC client. > > It turns out the NetBSD driver that I hacked up worked because it has > a workaround for this chip bug. I applied a similar workaround to Scott's > driver and now PPP works again. Here's a patch: > > --- umct.c.orig Thu Jul 3 18:50:39 2003 > +++ umct.c Mon Jul 7 00:52:55 2003 > @@ -241,7 +241,10 @@ > > if (UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_OUT) { > ucom->sc_bulkout_no = ed->bEndpointAddress; > - ucom->sc_obufsize = UGETW(ed->wMaxPacketSize); > + if (uaa->product == USB_PRODUCT_MCT_SITECOM_USB232) > + ucom->sc_obufsize = 16; /* device is broken */ > + else > + ucom->sc_obufsize = UGETW(ed->wMaxPacketSize); > continue; > } > > This is almost literally what NetBSD does. Barring any objections, I'd > like to check this in. (CC'ing Scott on this e-mail.) > Bill, Excellent, feel free to commit this. I remember seeing this workaround, but since I didn't have the device that it applied to I must have dropped the code by accident. Scott From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 11:23:49 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B706637B401 for ; Mon, 7 Jul 2003 11:23:49 -0700 (PDT) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2FBCE43F75 for ; Mon, 7 Jul 2003 11:23:49 -0700 (PDT) (envelope-from kientzle@acm.org) Received: from acm.org ([66.166.149.53]) by kientzle.com (8.12.9/8.12.9) with ESMTP id h67INmgY000493; Mon, 7 Jul 2003 11:23:48 -0700 (PDT) (envelope-from kientzle@acm.org) Message-ID: <3F09BB5D.5000106@acm.org> Date: Mon, 07 Jul 2003 11:26:37 -0700 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.0.1) Gecko/20021005 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Leo Bicknell References: <20030707160243.GA54395@ussenterprise.ufp.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-hackers@freebsd.org Subject: Re: tcsh / tset problem on 4.7 only? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: kientzle@acm.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 18:23:50 -0000 Leo Bicknell wrote: > I have a script that ... seems to fail on 4.7-RELEASE boxes ... > > % eval `tset -s -Q` > Missing ]. I just encountered this bug on 4.8-STABLE as well. Trimming down the output of tset, I eventually came up with the following very short test case for tcsh: # echo '{[' {[ # eval `echo '{['` Missing ]. # eval `echo '{{'` Missing }. The problem seems to be triggered by a {{ or {[ within '' within ``. (The termcap entry for vt100 contains {{ in the ac capability. Removing that capability is a workaround for this bug.) Hope this helps someone to track the problem down. For the record: # uname -spr FreeBSD 4.8-STABLE i386 # echo $version tcsh 6.12.00 (Astron) 2002-07-23 (i386-intel-FreeBSD) options 8b,nls,dl,al,kan,sm,rh,color,dspm,filec Tim Kientzle From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 11:30:46 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2668237B404 for ; Mon, 7 Jul 2003 11:30:46 -0700 (PDT) Received: from freebie.xs4all.nl (freebie.xs4all.nl [213.84.32.253]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0993D43FAF for ; Mon, 7 Jul 2003 11:30:45 -0700 (PDT) (envelope-from wkb@freebie.xs4all.nl) Received: from freebie.xs4all.nl (localhost [127.0.0.1]) by freebie.xs4all.nl (8.12.9/8.12.9) with ESMTP id h67IUiX9000515 for ; Mon, 7 Jul 2003 20:30:44 +0200 (CEST) (envelope-from wkb@freebie.xs4all.nl) Received: (from wkb@localhost) by freebie.xs4all.nl (8.12.9/8.12.9/Submit) id h67IUhtQ000514 for hackers@freebsd.org; Mon, 7 Jul 2003 20:30:44 +0200 (CEST) Date: Mon, 7 Jul 2003 20:30:43 +0200 From: Wilko Bulte To: hackers@freebsd.org Message-ID: <20030707183043.GA488@freebie.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-OS: FreeBSD 4.8-STABLE X-PGP: finger wilko@freebsd.org Subject: Interesting bootup hang on 4.7/4.8/5.1-release X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 18:30:46 -0000 I just noticed that my system hangs with sysinstall displaying 'Probing devices, this can take a while' as long as I have the following card installed: Jul 4 18:51:10 freebie /kernel: puc0: port 0x8800-0x880f,0x9000-0x9007,0x9400-0x9407,0x9800-0x9807,0xa000-0xa007,0xa400-0xa407 irq 5 at device 9.0 on pci0 This happens on 4.7-R, 4.8-R and 5.1-R. Boot from CD or floppy, both no go. Ripping the card out solves the problem, and a kernel with the puc driver compiled in works just dandy (this card drives my Alpha farm's serial consoles without problems) Wilko -- | / o / /_ _ wilko@FreeBSD.org |/|/ / / /( (_) Bulte From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 12:12:26 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 58B2237B404 for ; Mon, 7 Jul 2003 12:12:26 -0700 (PDT) Received: from ussenterprise.ufp.org (ussenterprise.ufp.org [208.185.30.210]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2663943FBF for ; Mon, 7 Jul 2003 12:12:25 -0700 (PDT) (envelope-from bicknell@ussenterprise.ufp.org) Received: from ussenterprise.ufp.org (bicknell@localhost [127.0.0.1]) by ussenterprise.ufp.org (8.12.9/8.12.9) with ESMTP id h67JCNaT061059 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 7 Jul 2003 15:12:23 -0400 (EDT) Received: (from bicknell@localhost) by ussenterprise.ufp.org (8.12.9/8.12.9/Submit) id h67JCNbs061056; Mon, 7 Jul 2003 15:12:23 -0400 (EDT) Date: Mon, 7 Jul 2003 15:12:23 -0400 From: Leo Bicknell To: freebsd-hackers@freebsd.org, Tim Kientzle Message-ID: <20030707191223.GA60881@ussenterprise.ufp.org> Mail-Followup-To: freebsd-hackers@freebsd.org, Tim Kientzle References: <20030707160243.GA54395@ussenterprise.ufp.org> <3F09BB5D.5000106@acm.org> <20030707160243.GA54395@ussenterprise.ufp.org> <20030707165129.GF358@straylight.oblivion.bg> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="C7zPtVaVf+AK4Oqc" Content-Disposition: inline In-Reply-To: <3F09BB5D.5000106@acm.org> <20030707165129.GF358@straylight.oblivion.bg> Organization: United Federation of Planets X-PGP-Key: http://www.ufp.org/~bicknell/ Subject: Re: tcsh / tset problem on 4.7 only? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 19:12:26 -0000 --C7zPtVaVf+AK4Oqc Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In a message written on Mon, Jul 07, 2003 at 07:51:29PM +0300, Peter Pentch= ev wrote: > What terminal are you using? Could you post the 'runme' file resulting > from the 'tset -s -Q' command? I see the problem with both xterm and vt100. % tset -s -Q set noglob; setenv TERM xterm; setenv TERMCAP 'xterm|vs100:li#65:kh=3D\EOH:@7=3D\EOF:kb=3D^H:kD=3D^?:k1=3D= \EOP:k2=3D\EOQ:k3=3D\EOR:k4=3D\EOS:km:is=3D\E>\E[?1;3;4;5l\E[?7;8h\E[1;65r\= E[65;1H:rs=3D\E>\E[?1;3;4;5l\E[?7;8h:kI=3D\E[2~:kN=3D\E[6~:kP=3D\E[5~:k6=3D= \E[17~:k7=3D\E[18~:k8=3D\E[19~:k9=3D\E[20~:k;=3D\E[21~:k5=3D\E[15~:ve=3D\E[= ?25h:vi=3D\E[?25l:k0@:im@:ei@:F1=3D\E[23~:F2=3D\E[24~:ic=3D\E[@:IC=3D\E[%d@= :ec=3D\E[%dX:al=3D\E[L:dl=3D\E[M:mi:dc=3D\E[P:AL=3D\E[%dL:DL=3D\E[%dM:DC=3D= \E[%dP:do=3D\E[B:cl=3D\E[H\E[J:sf=3D\ED:as=3D\E(0:ae=3D\E(B:cm=3D\E[%i%d;%d= H:nd=3D\E[C:up=3D\E[A:nw=3D\EE:ce=3D\E[K:cd=3D\E[J:so=3D\E[7m:se=3D\E[m:us= =3D\E[4m:ue=3D\E[m:md=3D\E[1m:mr=3D\E[7m:mb=3D\E[5m:me=3D\E[m:sr=3D\EM:sc= =3D\E7:rc=3D\E8:cs=3D\E[%i%d;%dr:UP=3D\E[%dA:DO=3D\E[%dB:RI=3D\E[%dC:LE=3D\= E[%dD:ct=3D\E[3g:st=3D\EH:co#80:le=3D^H:bs:am:if=3D/usr/share/tabset/vt100:= ho=3D\E[H:ac=3Dllmmkkjjuuttvvwwqqxxnnpprr\140\140aa:ks=3D\E[?1h\E=3D:ke=3D\= E[?1l\E>:ku=3D\EOA:kd=3D\EOB:kr=3D\EOC:kl=3D\EOD:@8=3D\EOM:K1=3D\EOq:K2=3D\= EOr:K3=3D\EOs:K4=3D\EOp:K5=3D\EOn:pt:vt#3:xn:ta=3D^I:ms:bl=3D^G:cr=3D^M:eo:= it#8:ut:RA=3D\E[?7l:SA=3D\E[?7h:'; unset noglob; In a message written on Mon, Jul 07, 2003 at 11:26:37AM -0700, Tim Kientzle= wrote: > The problem seems to be triggered by a > {{ or {[ within '' within ``. (The termcap entry > for vt100 contains {{ in the ac capability. Removing > that capability is a workaround for this bug.) > Hope this helps someone to track the problem down. I think you've tracked down the problem, probably a tcsh parser error with eval. I wonder if there is a tcsh guru around. --=20 Leo Bicknell - bicknell@ufp.org - CCIE 3440 PGP keys at http://www.ufp.org/~bicknell/ Read TMBG List - tmbg-list-request@tmbg.org, www.tmbg.org --C7zPtVaVf+AK4Oqc Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (FreeBSD) iD8DBQE/CcYXNh6mMG5yMTYRAjgDAJ9vf3MDUx8uLS90PmWHMBB0YJgQ+wCfcPPf 2OcXjiOjIN31QVZ4rKyV8ao= =7P+E -----END PGP SIGNATURE----- --C7zPtVaVf+AK4Oqc-- From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 12:25:08 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B1DC437B401 for ; Mon, 7 Jul 2003 12:25:08 -0700 (PDT) Received: from webboy.soth.at (door.soth.at [80.110.102.19]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF82B43F3F for ; Mon, 7 Jul 2003 12:25:07 -0700 (PDT) (envelope-from toni@webboy.soth.at) Received: by webboy.soth.at (Postfix, from userid 1000) id 9B45E7C7; Mon, 7 Jul 2003 21:25:06 +0200 (CEST) Date: Mon, 7 Jul 2003 21:25:06 +0200 From: Toni Andjelkovic To: Socketd Message-ID: <20030707192506.GB1695@webboy.soth.at> References: <20030707012205.3103dfc8.db@traceroute.dk> <20030707153314.GA1695@webboy.soth.at> <20030707180252.44036c61.db@traceroute.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030707180252.44036c61.db@traceroute.dk> User-Agent: Mutt/1.4i cc: hackers@freebsd.org cc: Toni Andjelkovic Subject: Re: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 19:25:09 -0000 On Mon, Jul 07 2003 (18:02:52 +0200), Socketd wrote: > Ok, anyway to prevent sending ICMP's when ttl = 0? Or do I need a > firewall? Yes, you'd need a firewall. Cheers, Toni From owner-freebsd-hackers@FreeBSD.ORG Mon Jul 7 13:03:34 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A88B537B401 for ; Mon, 7 Jul 2003 13:03:34 -0700 (PDT) Received: from hysteria.spc.org (hysteria.spc.org [195.206.69.234]) by mx1.FreeBSD.org (Postfix) with SMTP id DDDDC43F93 for ; Mon, 7 Jul 2003 13:03:30 -0700 (PDT) (envelope-from bms@hysteria.spc.org) Received: (qmail 17091 invoked by uid 5013); 7 Jul 2003 20:01:34 -0000 Date: Mon, 7 Jul 2003 21:01:34 +0100 From: Bruce M Simpson To: Tim Kientzle Message-ID: <20030707200134.GQ23471@spc.org> References: <3F05C989.7040908@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3F05C989.7040908@acm.org> User-Agent: Mutt/1.4.1i cc: hackers@freebsd.org cc: Julian Elischer cc: Kris Kennaway Subject: Re: libtarfile (Was Re: pkg_create broken by design?) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 20:03:34 -0000 On Fri, Jul 04, 2003 at 11:38:01AM -0700, Tim Kientzle wrote: > * Remove the need to install a package before > creating the package file. In particular, using this library, > you can separate the filename written into the > library from the file used as a source of data. Yes please! Where do I sign? BMS From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 00:37:33 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3EC2137B401 for ; Tue, 8 Jul 2003 00:37:33 -0700 (PDT) Received: from hysteria.spc.org (hysteria.spc.org [195.206.69.234]) by mx1.FreeBSD.org (Postfix) with SMTP id 0A9E543F93 for ; Tue, 8 Jul 2003 00:37:32 -0700 (PDT) (envelope-from bms@hysteria.spc.org) Received: (qmail 26595 invoked by uid 5013); 8 Jul 2003 07:35:35 -0000 Date: Tue, 8 Jul 2003 08:35:34 +0100 From: Bruce M Simpson To: imp@bsdimp.com Message-ID: <20030708073534.GA22295@spc.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline User-Agent: Mutt/1.4.1i cc: hackers@freebsd.org Subject: NMI-on-ThinkPad-button hack X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 07:37:33 -0000 --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Warner, I send you this hack that I may have your advice. I haven't tried bringing up the SMP kernel on my T22. APIC_IO is needed in order for this to work, as we don't use the APIC within a uniprocessor build of -CURRENT on i386. But I imagine it should work. I couldn't find any other way within the chipset on the IBM T22 of generating the NMI. Caveats: 1) selfnmi.c is strictly for proof of concept. 2) the ACPI ASL patch makes assumptions about the BSP's APIC always being mapped in at its default address. Enjoy, BMS --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="selfnmi.c" /* $FreeBSD$ */ /* * Generate a soft-NMI by frobbing our own local APIC. * Note: kernel option APIC requires SMP. Leaving the local APIC enabled, * by patching the init_ppro() function in i386/i386/initcpu.c, will * panic the kernel; full APIC/SMP support is required. * XXX what about trying to run an SMP kernel on a UP box without an * mptable? */ /* * Copyright (c) 2003 Bruce M. Simpson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Bruce M. Simpson. * 4. Neither the name of Bruce M. Simpson nor the names of co- * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY Bruce M. Simpson AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Bruce M. Simpson OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef _DEV_MEM #define _DEV_MEM "/dev/mem" #endif #define LAPIC_BASE 0xFEE00000UL /* APIC base mapping */ #define LAPIC_ICRBASE 0x00000300UL /* APIC command register base */ #define LAPIC_SVR 0x000000F0UL /* spurious vector register */ #define LAPIC_SIZE 0x00004000UL /* size of APIC space (1 page)*/ #define SVR_APIC_ENABLE 0x100 void usage(void) { printf("usage: selfnmi\n"); exit(EXIT_FAILURE); } int main(int argc, char *argv[]) { int ret; int memfd; void *apicbase; struct mem_range_op mro; struct mem_range_desc mrd; u_int32_t cpuid[4]; u_int32_t reg; #if 0 /* see if the IA32_APIC_BASE MSR reveals anything */ /* XXX This is a privileged instruction */ reg = rdmsr(MSR_APICBASE); fprintf(stderr, "IA32_APIC_BASE MSR: %08lx\n", reg); #endif #if 1 /* Issue CPUID to discover Local APIC */ /* XXX init_ppro() in i386/i386/initcpu.c will disable the * local APIC for a non-UP kernel build. annoying. * is it possible to keep it enabled? */ do_cpuid(1, cpuid); fprintf(stderr, "cpuid(1): eax=%08lx ebx=%08lx ecx=%08lx edx=%08lx\n", cpuid[0], cpuid[1], cpuid[2], cpuid[3]); if ((cpuid[3] & CPUID_APIC) == 0) { fprintf(stderr, "local apic was software disabled\n"); } #endif /* Open the mem(4) device. */ memfd = open(_DEV_MEM, O_RDWR); if (memfd == -1) { perror("open"); goto cleanup; } /* XXX Mark the APIC range as uncacheable */ bzero(&mro, sizeof(mro)); mro.mo_arg[0] = MEMRANGE_SET_UPDATE; mro.mo_desc = &mrd; bzero(&mrd, sizeof(mrd)); mrd.mr_base = LAPIC_BASE; mrd.mr_len = LAPIC_SIZE; mrd.mr_flags = MDF_UNCACHEABLE|MDF_ACTIVE|MDF_BUSY; strncpy(mrd.mr_owner, "APIC\0", sizeof(mrd.mr_owner)); ret = ioctl(memfd, MEMRANGE_SET, &mro); if (ret == -1) perror("ioctl MEMRANGE_SET_UPDATE"); /* Map the APIC into our address space. */ apicbase = mmap(NULL, LAPIC_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, memfd, LAPIC_BASE); if (apicbase == MAP_FAILED) { perror("mmap"); goto cleanup; } #if 1 fprintf(stderr, "LAPIC SVR: %08lx\n", *((u_int32_t *)apicbase + LAPIC_SVR)); #endif #if 1 /* * Issue an NMI via the APIC memory-mapped register set. * Destination: self. * Delivery mode: NMI. (Change 0400 to 0200 for SMI) */ *((u_int32_t *)(apicbase + LAPIC_ICRBASE + 0)) = 0x00040400; #endif cleanup: if (apicbase != MAP_FAILED) munmap(apicbase, LAPIC_SIZE); mrd.mr_flags = MDF_UNCACHEABLE; ret = ioctl(memfd, MEMRANGE_SET, &mro); if (ret == -1) perror("ioctl MEMRANGE_SET_UPDATE"); mro.mo_arg[0] = MEMRANGE_SET_REMOVE; ret = ioctl(memfd, MEMRANGE_SET, &mro); if (ret == -1) perror("ioctl MEMRANGE_SET_REMOVE"); close(memfd); exit(EXIT_SUCCESS); } --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="thinkpad-key-nmi-asl.patch" --- t22_dsdt_dist.dsl Fri Jun 13 12:06:30 2003 +++ t22_dsdt_nmi.dsl Mon Jun 23 06:35:42 2003 @@ -8725,9 +8725,18 @@ SMI (0x86, 0x02, 0x00, 0x00, 0x00) } + /* Define a region for the Local APIC */ + OperationRegion (APIC, SystemMemory, 0xFEE00000, 0x4000) + Field (APIC, DWordAcc, NoLock, Preserve) + { + Offset (0x300), + ICR0 , 32 + } + Method (TPKY, 0, NotSerialized) { - SMI (0x86, 0x03, 0x00, 0x00, 0x00) + /* Generate a Local APIC NMI interrupt */ + Store (0x00040400, \ICR0) } Method (BRIU, 0, NotSerialized) --1yeeQ81UyVL57Vl7-- From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 01:53:21 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 89F4237B401 for ; Tue, 8 Jul 2003 01:53:21 -0700 (PDT) Received: from hysteria.spc.org (hysteria.spc.org [195.206.69.234]) by mx1.FreeBSD.org (Postfix) with SMTP id 10DC343FAF for ; Tue, 8 Jul 2003 01:53:18 -0700 (PDT) (envelope-from bms@hysteria.spc.org) Received: (qmail 26950 invoked by uid 5013); 8 Jul 2003 08:51:21 -0000 Date: Tue, 8 Jul 2003 09:51:21 +0100 From: Bruce M Simpson To: hackers@freebsd.org Message-ID: <20030708085121.GC22295@spc.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="rS8CxjVDS/+yyDmU" Content-Disposition: inline User-Agent: Mutt/1.4.1i cc: alc@freebsd.org cc: dillon@freebsd.org Subject: mlockall() for 5.1-RELEASE X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 08:53:21 -0000 --rS8CxjVDS/+yyDmU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi all, Here is a patch to add mlockall()/munlockall() to FreeBSD 5.1-RELEASE. I believe it is ready for public consumption (here, anyway), with some caveats/points:- - Uses fine grained locking, but acquires Giant right now. - Tested with WITNESS, MUTEX_PROFILING, INVARIANTS. Caught a lock not being backed out in vm_unix.c, fixed now. - Inspected at the vmstat, top and vm pager sysctl stats level. - The RES size for a process may appear to be greater than its SIZE. This is believed to be due to pre-faulted stack pages being wired when they may not count against the per-process SIZE. Please share your feedback and reviews with me. Regards BMS --rS8CxjVDS/+yyDmU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="mlockall.patch" Generated by diffcoll on Thu 3 Jul 2003 22:57:53 BST diff -uN src/lib/libc/alpha/sys/Makefile.inc.orig src/lib/libc/alpha/sys/Makefile.inc --- /usr/src/lib/libc/alpha/sys/Makefile.inc.orig Fri May 30 11:25:46 2003 +++ /usr/src/lib/libc/alpha/sys/Makefile.inc Fri Jun 27 07:33:35 2003 @@ -5,7 +5,7 @@ # Don't generate default code for these syscalls: NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ + lseek.o mmap.o openbsd_poll.o pread.o \ pwrite.o setdomainname.o sstk.o truncate.o uname.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o diff -uN src/lib/libc/amd64/sys/Makefile.inc.orig src/lib/libc/amd64/sys/Makefile.inc --- /usr/src/lib/libc/amd64/sys/Makefile.inc.orig Fri May 30 11:26:03 2003 +++ /usr/src/lib/libc/amd64/sys/Makefile.inc Fri Jun 27 07:33:35 2003 @@ -6,7 +6,7 @@ # Don't generate default code for these syscalls: NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ + lseek.o mmap.o openbsd_poll.o pread.o \ pwrite.o setdomainname.o sstk.o truncate.o uname.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o diff -uN src/lib/libc/i386/sys/Makefile.inc.orig src/lib/libc/i386/sys/Makefile.inc --- /usr/src/lib/libc/i386/sys/Makefile.inc.orig Fri May 30 04:44:28 2003 +++ /usr/src/lib/libc/i386/sys/Makefile.inc Fri Jun 27 07:33:35 2003 @@ -9,7 +9,7 @@ # Don't generate default code for these syscalls: NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ + lseek.o mmap.o openbsd_poll.o pread.o \ pwrite.o setdomainname.o sstk.o truncate.o uname.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o diff -uN src/lib/libc/ia64/sys/Makefile.inc.orig src/lib/libc/ia64/sys/Makefile.inc --- /usr/src/lib/libc/ia64/sys/Makefile.inc.orig Fri May 30 11:26:25 2003 +++ /usr/src/lib/libc/ia64/sys/Makefile.inc Fri Jun 27 07:33:35 2003 @@ -5,7 +5,7 @@ # Don't generate default code for these syscalls: NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ + lseek.o mmap.o openbsd_poll.o pread.o \ pwrite.o setdomainname.o sstk.o truncate.o uname.o vfork.o yield.o PSEUDO= _getlogin.o _exit.o diff -uN src/lib/libc/powerpc/sys/Makefile.inc.orig src/lib/libc/powerpc/sys/Makefile.inc --- /usr/src/lib/libc/powerpc/sys/Makefile.inc.orig Fri May 30 11:26:40 2003 +++ /usr/src/lib/libc/powerpc/sys/Makefile.inc Fri Jun 27 07:33:35 2003 @@ -4,7 +4,7 @@ # Don't generate default code for these syscalls: NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ + lseek.o mmap.o openbsd_poll.o pread.o \ pwrite.o setdomainname.o sstk.o truncate.o uname.o yield.o PSEUDO= _getlogin.o _exit.o diff -uN src/lib/libc/sparc64/sys/Makefile.inc.orig src/lib/libc/sparc64/sys/Makefile.inc --- /usr/src/lib/libc/sparc64/sys/Makefile.inc.orig Fri May 30 11:27:02 2003 +++ /usr/src/lib/libc/sparc64/sys/Makefile.inc Fri Jun 27 07:33:35 2003 @@ -16,7 +16,7 @@ # Don't generate default code for these syscalls: NOASM= break.o exit.o ftruncate.o getdomainname.o getlogin.o \ - lseek.o mlockall.o mmap.o munlockall.o openbsd_poll.o pread.o \ + lseek.o mmap.o openbsd_poll.o pread.o \ pwrite.o setdomainname.o sstk.o truncate.o uname.o yield.o PSEUDO= _getlogin.o _exit.o diff -uN src/lib/libc/sys/Makefile.inc.orig src/lib/libc/sys/Makefile.inc --- /usr/src/lib/libc/sys/Makefile.inc.orig Sat Jun 21 10:03:26 2003 +++ /usr/src/lib/libc/sys/Makefile.inc Fri Jun 27 08:51:45 2003 @@ -69,8 +69,8 @@ kldfind.2 kldfirstmod.2 kldload.2 kldnext.2 kldstat.2 kldsym.2 \ kldunload.2 kqueue.2 kse.2 ktrace.2 link.2 lio_listio.2 listen.2 \ lseek.2 \ - madvise.2 mincore.2 minherit.2 mkdir.2 mkfifo.2 mknod.2 mlock.2 mmap.2 \ - modfind.2 modnext.2 modstat.2 mount.2 \ + madvise.2 mincore.2 minherit.2 mkdir.2 mkfifo.2 mknod.2 mlock.2 \ + mlockall.2 mmap.2 modfind.2 modnext.2 modstat.2 mount.2 \ mprotect.2 msync.2 munmap.2 nanosleep.2 ntp_adjtime.2 ntp_gettime.2 \ nfssvc.2 open.2 pathconf.2 pipe.2 poll.2 profil.2 ptrace.2 quotactl.2 \ read.2 readlink.2 reboot.2 recv.2 rename.2 revoke.2 rfork.2 rmdir.2 \ diff -uN src/lib/libc/sys/mlockall.2.orig src/lib/libc/sys/mlockall.2 --- /usr/src/lib/libc/sys/mlockall.2.orig Fri May 30 07:01:26 2003 +++ /usr/src/lib/libc/sys/mlockall.2 Fri Jun 27 07:33:35 2003 @@ -0,0 +1,140 @@ +.\" $NetBSD: mlockall.2,v 1.11 2003/04/16 13:34:54 wiz Exp $ +.\" +.\" Copyright (c) 1999 The NetBSD Foundation, Inc. +.\" All rights reserved. +.\" +.\" This code is derived from software contributed to The NetBSD Foundation +.\" by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, +.\" NASA Ames Research Center. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the NetBSD +.\" Foundation, Inc. and its contributors. +.\" 4. Neither the name of The NetBSD Foundation nor the names of its +.\" contributors may be used to endorse or promote products derived +.\" from this software without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +.\" POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd June 12, 1999 +.Dt MLOCKALL 2 +.Os +.Sh NAME +.Nm mlockall , +.Nm munlockall +.Nd lock (unlock) the address space of a process +.Sh LIBRARY +.Lb libc +.Sh SYNOPSIS +.In sys/mman.h +.Ft int +.Fn mlockall "int flags" +.Ft int +.Fn munlockall "void" +.Sh DESCRIPTION +The +.Nm mlockall +system call locks into memory the physical pages associated with the +address space of a process until the address space is unlocked, the +process exits, or execs another program image. +.Pp +The following flags affect the behavior of +.Nm mlockall : +.Bl -tag -width MCL_CURRENT +.It Dv MCL_CURRENT +Lock all pages currently mapped into the process's address space. +.It Dv MCL_FUTURE +Lock all pages mapped into the process's address space in the future, +at the time the mapping is established. +Note that this may cause future mappings to fail if those mappings +cause resource limits to be exceeded. +.El +.Pp +Since physical memory is a potentially scarce resource, processes are +limited in how much they can lock down. +A single process can lock the minimum of a system-wide +.Dq wired pages +limit and the per-process +.Li RLIMIT_MEMLOCK +resource limit. +.Pp +The +.Nm munlockall +call unlocks any locked memory regions in the process address space. +Any regions mapped after an +.Nm munlockall +call will not be locked. +.Sh RETURN VALUES +A return value of 0 indicates that the call +succeeded and all pages in the range have either been locked or unlocked. +A return value of -1 indicates an error occurred and the locked +status of all pages in the range remains unchanged. +In this case, the global location +.Va errno +is set to indicate the error. +.Sh ERRORS +.Fn mlockall +will fail if: +.Bl -tag -width Er +.It Bq Er EINVAL +The +.Ar flags +argument is zero, or includes unimplemented flags. +.It Bq Er ENOMEM +Locking the indicated range would exceed either the system or per-process +limit for locked memory. +.It Bq Er EAGAIN +Some or all of the memory mapped into the process's address space +could not be locked when the call was made. +.It Bq Er EPERM +The calling process does not have the appropriate privilege to perform +the requested operation. +.El +.Sh SEE ALSO +.Xr mincore 2 , +.Xr mlock 2 , +.Xr mmap 2 , +.Xr munmap 2 , +.Xr setrlimit 2 +.Sh STANDARDS +The +.Fn mlockall +and +.Fn munlockall +functions are believed to conform to +.St -p1003.1-2001 . +.Sh HISTORY +The +.Fn mlockall +and +.Fn munlockall +functions first appeared in +.Fx 5.1 . +.Sh BUGS +The per-process resource limit is a limit on the amount of virtual +memory locked, while the system-wide limit is for the number of locked +physical pages. +Hence a process with two distinct locked mappings of the same physical page +counts as 2 pages against the per-process limit and as only a single page +in the system limit. diff -uN src/sys/kern/link_elf.c.orig src/sys/kern/link_elf.c --- /usr/src/sys/kern/link_elf.c.orig Fri Jun 27 07:47:39 2003 +++ /usr/src/sys/kern/link_elf.c Fri Jun 27 07:48:13 2003 @@ -744,7 +744,7 @@ vm_map_wire(kernel_map, (vm_offset_t) segbase, (vm_offset_t) segbase + segs[i]->p_memsz, - FALSE); + VM_MAP_WIRE_SYSTEM); #endif } diff -uN src/sys/vm/vm_contig.c.orig src/sys/vm/vm_contig.c --- /usr/src/sys/vm/vm_contig.c.orig Fri Jun 27 07:48:49 2003 +++ /usr/src/sys/vm/vm_contig.c Fri Jun 27 07:49:14 2003 @@ -254,7 +254,7 @@ tmp_addr += PAGE_SIZE; } VM_OBJECT_UNLOCK(kernel_object); - vm_map_wire(map, addr, addr + size, FALSE); + vm_map_wire(map, addr, addr + size, VM_MAP_WIRE_SYSTEM); splx(s); return ((void *)addr); diff -uN src/sys/vm/vm_glue.c.orig src/sys/vm/vm_glue.c --- /usr/src/sys/vm/vm_glue.c.orig Fri Jun 27 07:49:23 2003 +++ /usr/src/sys/vm/vm_glue.c Fri Jun 27 08:00:33 2003 @@ -186,7 +186,7 @@ { vm_map_wire(&curproc->p_vmspace->vm_map, trunc_page((vm_offset_t)addr), - round_page((vm_offset_t)addr + len), FALSE); + round_page((vm_offset_t)addr + len), VM_MAP_WIRE_SYSTEM); } /* @@ -200,7 +200,7 @@ vm_map_unwire(&curproc->p_vmspace->vm_map, trunc_page((vm_offset_t)addr), - round_page((vm_offset_t)addr + len), FALSE); + round_page((vm_offset_t)addr + len), VM_MAP_WIRE_SYSTEM); } /* diff -uN src/sys/vm/vm_kern.c.orig src/sys/vm/vm_kern.c --- /usr/src/sys/vm/vm_kern.c.orig Fri Jun 27 07:50:53 2003 +++ /usr/src/sys/vm/vm_kern.c Fri Jun 27 07:51:14 2003 @@ -210,7 +210,7 @@ /* * And finally, mark the data as non-pageable. */ - (void) vm_map_wire(map, addr, addr + size, FALSE); + (void) vm_map_wire(map, addr, addr + size, VM_MAP_WIRE_SYSTEM); return (addr); } diff -uN src/sys/vm/vm_map.c.orig src/sys/vm/vm_map.c --- /usr/src/sys/vm/vm_map.c.orig Wed Jun 4 11:01:59 2003 +++ /usr/src/sys/vm/vm_map.c Thu Jul 3 22:57:47 2003 @@ -1559,19 +1559,32 @@ */ int vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, - boolean_t user_unwire) + int flags) { vm_map_entry_t entry, first_entry, tmp_entry; vm_offset_t saved_start; unsigned int last_timestamp; int rv; boolean_t need_wakeup, result; + boolean_t user_unwire; + + user_unwire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); - if (!vm_map_lookup_entry(map, start, &first_entry)) { - vm_map_unlock(map); - return (KERN_INVALID_ADDRESS); + if (start != (vm_offset_t) 0) { + /* operating on arbitrary range */ + if (!vm_map_lookup_entry(map, start, &first_entry)) { + vm_map_unlock(map); + return (KERN_INVALID_ADDRESS); + } + } else { + /* operating on entire process space */ + if (map->header.next == NULL) { + vm_map_unlock(map); + return (KERN_INVALID_ADDRESS); + } + first_entry = map->header.next; } last_timestamp = map->timestamp; entry = first_entry; @@ -1627,9 +1640,11 @@ entry->eflags |= MAP_ENTRY_IN_TRANSITION; /* * Check the map for holes in the specified region. + * If VM_MAP_WIRE_NONCONTIG was specified, skip this check. */ - if (entry->end < end && (entry->next == &map->header || - entry->next->start > entry->end)) { + if (((flags & VM_MAP_WIRE_NONCONTIG) == 0) && + (entry->end < end && (entry->next == &map->header || + entry->next->start > entry->end))) { end = entry->end; rv = KERN_INVALID_ADDRESS; goto done; @@ -1688,19 +1703,32 @@ */ int vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, - boolean_t user_wire) + int flags) { vm_map_entry_t entry, first_entry, tmp_entry; vm_offset_t saved_end, saved_start; unsigned int last_timestamp; int rv; boolean_t need_wakeup, result; + boolean_t user_wire; + + user_wire = (flags & VM_MAP_WIRE_USER) ? TRUE : FALSE; vm_map_lock(map); VM_MAP_RANGE_CHECK(map, start, end); - if (!vm_map_lookup_entry(map, start, &first_entry)) { - vm_map_unlock(map); - return (KERN_INVALID_ADDRESS); + if (start != (vm_offset_t) 0) { + /* operating on arbitrary range */ + if (!vm_map_lookup_entry(map, start, &first_entry)) { + vm_map_unlock(map); + return (KERN_INVALID_ADDRESS); + } + } else { + /* operating on entire process space */ + if (map->header.next == NULL) { + vm_map_unlock(map); + return (KERN_INVALID_ADDRESS); + } + first_entry = map->header.next; } last_timestamp = map->timestamp; entry = first_entry; @@ -1811,9 +1839,11 @@ } /* * Check the map for holes in the specified region. + * If VM_MAP_WIRE_NONCONTIG was specified, skip this check. */ - if (entry->end < end && (entry->next == &map->header || - entry->next->start > entry->end)) { + if (((flags & VM_MAP_WIRE_NONCONTIG) == 0) && + (entry->end < end && (entry->next == &map->header || + entry->next->start > entry->end))) { end = entry->end; rv = KERN_INVALID_ADDRESS; goto done; @@ -1866,6 +1896,52 @@ } /* + * vm_map_unwire_all + * + * Unwire all pages in a map, by calling vm_map_unwire() with the + * VM_MAP_WIRE_NONCONTIG flag set. An underlying region's vm_map_entry will + * only be unwired if it has previously been wired. + * + * Acquires a temporary lock on map. + * Return values are identical to vm_map_unwire(). + */ +int +vm_map_unwire_all(vm_map_t map, int flags) +{ + vm_offset_t start, end; + + vm_map_lock_read(map); + start = vm_map_min(map); + end = vm_map_max(map); + vm_map_unlock_read(map); + return (vm_map_unwire(map, start, end, flags | VM_MAP_WIRE_NONCONTIG)); +} + +/* + * vm_map_wire_all + * + * Wire all pages in a map, by calling vm_map_wire() with the + * VM_MAP_WIRE_NONCONTIG flag set. The wire count of the pages in the + * underlying vm_map_entry of each region will be unconditionally + * incremented. + * + * This function is likely to cause a burst of page faults when called. + * Acquires a temporary lock on map. + * Return values are identical to vm_map_wire(). + */ +int +vm_map_wire_all(vm_map_t map, int flags) +{ + vm_offset_t start, end; + + vm_map_lock_read(map); + start = vm_map_min(map); + end = vm_map_max(map); + vm_map_unlock_read(map); + return (vm_map_wire(map, start, end, flags | VM_MAP_WIRE_NONCONTIG)); +} + +/* * vm_map_clean * * Push any dirty cached pages in the address range to their pager. @@ -2351,6 +2427,10 @@ new_map = &vm2->vm_map; /* XXX */ new_map->timestamp = 1; + /* Do not inherit the MAP_WIREFUTURE property. */ + if ((new_map->flags & MAP_WIREFUTURE) == MAP_WIREFUTURE) + new_map->flags &= ~MAP_WIREFUTURE; + old_entry = old_map->header.next; while (old_entry != &old_map->header) { @@ -2660,6 +2740,14 @@ } vm_map_unlock(map); + /* + * Heed the MAP_WIREFUTURE flag if it was set for this process. + */ + if (rv == KERN_SUCCESS && (map->flags & MAP_WIREFUTURE)) + vm_map_wire(map, addr, stack_entry->start, + (p->p_flag & P_SYSTEM ? VM_MAP_WIRE_SYSTEM : + VM_MAP_WIRE_USER)); + return (rv); } diff -uN src/sys/vm/vm_map.h.orig src/sys/vm/vm_map.h --- /usr/src/sys/vm/vm_map.h.orig Wed Jun 4 13:45:35 2003 +++ /usr/src/sys/vm/vm_map.h Fri Jun 27 08:27:51 2003 @@ -81,6 +81,7 @@ * vm_map_entry_t an entry in an address map. */ +typedef u_int vm_flags_t; typedef u_int vm_eflags_t; /* @@ -177,8 +178,11 @@ pmap_t pmap; /* (c) Physical map */ #define min_offset header.start /* (c) */ #define max_offset header.end /* (c) */ + vm_flags_t flags; /* flags for this vm_map */ }; +#define MAP_WIREFUTURE 0x0001 /* wire all future pages */ + #ifdef _KERNEL static __inline vm_offset_t vm_map_max(vm_map_t map) @@ -197,6 +201,12 @@ { return (map->pmap); } + +static __inline void +vm_map_modflags(vm_map_t map, vm_flags_t set, vm_flags_t clear) +{ + map->flags = (map->flags | set) & ~clear; +} #endif /* _KERNEL */ /* @@ -296,6 +306,13 @@ #define VM_FAULT_WIRE_MASK (VM_FAULT_CHANGE_WIRING|VM_FAULT_USER_WIRE) #define VM_FAULT_DIRTY 8 /* Dirty the page */ +/* + * vm_map_[un]wire option flags + */ +#define VM_MAP_WIRE_SYSTEM 0 /* wiring in a kernel map */ +#define VM_MAP_WIRE_USER 1 /* wiring in a user map */ +#define VM_MAP_WIRE_NONCONTIG 2 /* requested region has holes */ + #ifdef _KERNEL boolean_t vm_map_check_protection (vm_map_t, vm_offset_t, vm_offset_t, vm_prot_t); struct pmap; @@ -321,9 +338,11 @@ int vm_map_stack (vm_map_t, vm_offset_t, vm_size_t, vm_prot_t, vm_prot_t, int); int vm_map_growstack (struct proc *p, vm_offset_t addr); int vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, - boolean_t user_unwire); + int flags); +int vm_map_unwire_all(vm_map_t map, int flags); int vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, - boolean_t user_wire); + int flags); +int vm_map_wire_all(vm_map_t map, int flags); int vmspace_swap_count (struct vmspace *vmspace); #endif /* _KERNEL */ #endif /* _VM_MAP_ */ diff -uN src/sys/vm/vm_mmap.c.orig src/sys/vm/vm_mmap.c --- /usr/src/sys/vm/vm_mmap.c.orig Fri Jun 27 08:32:54 2003 +++ /usr/src/sys/vm/vm_mmap.c Fri Jun 27 08:31:27 2003 @@ -1039,7 +1039,7 @@ #endif error = vm_map_wire(&td->td_proc->p_vmspace->vm_map, addr, - addr + size, TRUE); + addr + size, VM_MAP_WIRE_USER); return (error == KERN_SUCCESS ? 0 : ENOMEM); } @@ -1057,14 +1057,56 @@ struct thread *td; struct mlockall_args *uap; { - /* mtx_lock(&Giant); */ - /* mtx_unlock(&Giant); */ - return 0; + int error; + vm_map_t map; + + error = 0; + map = &td->td_proc->p_vmspace->vm_map; + + if ((uap->how == 0) || ((uap->how & ~(MCL_CURRENT|MCL_FUTURE)) != 0)) + return (EINVAL); + +#ifdef pmap_wired_count + /* + * If wiring all pages in the process would cause it to exceed + * a hard resource limit, return ENOMEM. + */ + if (map->size - ptoa(pmap_wired_count(vm_map_pmap(map)) > + td->td_proc->p_rlimit[RLIMIT_MEMLOCK].rlim_cur)) + return (ENOMEM); +#else + error = suser(td); + if (error) + return (error); +#endif + mtx_lock(&Giant); + + if (uap->how & MCL_FUTURE) { + vm_map_lock(map); + vm_map_modflags(map, MAP_WIREFUTURE, 0); + vm_map_unlock(map); + error = 0; + } + + if (uap->how & MCL_CURRENT) { + /* + * P1003.1-2001 actually mandates that all currently + * mapped pages will be memory resident and locked (wired). + * This implies that we need to prefault. However, the act + * of wiring the page will incur a call to vm_fault_wire(), + * which will fault in the newly wired page. + */ + error = vm_map_wire_all(map, VM_MAP_WIRE_USER); + error = (error == KERN_SUCCESS ? 0 : EAGAIN); + } + + mtx_unlock(&Giant); + return (error); } #ifndef _SYS_SYSPROTO_H_ struct munlockall_args { - int how; + register_t dummy; }; #endif @@ -1076,9 +1118,30 @@ struct thread *td; struct munlockall_args *uap; { - /* mtx_lock(&Giant); */ - /* mtx_unlock(&Giant); */ - return 0; + int error; + vm_map_t map; + +#ifndef pmap_wired_count + error = suser(td); + if (error) + return (error); +#endif + + error = 0; + map = &td->td_proc->p_vmspace->vm_map; + + mtx_lock(&Giant); + + /* Clear the MAP_WIREFUTURE flag from this vm_map. */ + vm_map_lock(map); + vm_map_modflags(map, 0, MAP_WIREFUTURE); + vm_map_unlock(map); + + /* Forcibly unwire all pages. */ + error = vm_map_unwire_all(map, VM_MAP_WIRE_USER); + + mtx_unlock(&Giant); + return (error); } #ifndef _SYS_SYSPROTO_H_ @@ -1118,7 +1181,7 @@ #endif error = vm_map_unwire(&td->td_proc->p_vmspace->vm_map, addr, - addr + size, TRUE); + addr + size, VM_MAP_WIRE_USER); return (error == KERN_SUCCESS ? 0 : ENOMEM); } @@ -1275,6 +1338,14 @@ if (rv != KERN_SUCCESS) (void) vm_map_remove(map, *addr, *addr + size); } + + /* + * If the process has requested that all future mappings + * be wired, then heed this. + */ + if ((rv == KERN_SUCCESS) && (map->flags & MAP_WIREFUTURE)) + vm_map_wire(map, *addr, *addr + size, VM_MAP_WIRE_USER); + switch (rv) { case KERN_SUCCESS: return (0); diff -uN src/sys/vm/vm_unix.c.orig src/sys/vm/vm_unix.c --- /usr/src/sys/vm/vm_unix.c.orig Wed Jun 4 22:40:38 2003 +++ /usr/src/sys/vm/vm_unix.c Thu Jul 3 22:50:21 2003 @@ -77,6 +77,9 @@ vm_offset_t new, old, base; int rv; int error = 0; + boolean_t do_map_wirefuture; + + do_map_wirefuture = FALSE; new = round_page((vm_offset_t)uap->nsize); vm_map_lock(&vm->vm_map); @@ -119,6 +122,21 @@ goto done; } vm->vm_dsize += btoc(new - old); + /* + * Handle the MAP_WIREFUTURE case for legacy applications, + * by marking the newly mapped range of pages as wired. + * + * We are not required to perform a corresponding + * vm_map_unwire() before vm_map_delete() below, as + * it will forcibly unwire the pages in the range. + * + * XXX If the pages cannot be wired, no error is returned. + */ + if ((vm->vm_map.flags & MAP_WIREFUTURE) == MAP_WIREFUTURE) { + if (bootverbose) + printf("obreak: MAP_WIREFUTURE set\n"); + do_map_wirefuture = TRUE; + } } else if (new < old) { rv = vm_map_delete(&vm->vm_map, new, old); if (rv != KERN_SUCCESS) { @@ -129,6 +147,10 @@ } done: vm_map_unlock(&vm->vm_map); + + if (do_map_wirefuture) + (void) vm_map_wire(&vm->vm_map, old, new, VM_MAP_WIRE_USER); + return (error); } --rS8CxjVDS/+yyDmU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="test-mlockall.c" /* $Id$ */ /* * Copyright (c) 2003 Bruce M. Simpson * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Bruce M. Simpson. * 4. Neither the name of Bruce M. Simpson nor the names of co- * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY Bruce M. Simpson AND CONTRIBUTORS * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Bruce M. Simpson OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /* * Test harness for my implementation of mlockall() for FreeBSD. -bms * Use this when hooking up whatever tools you need (DDB/GDB, top, vmstat). */ #include #include #include #include #define SYSCTL_WIRECOUNT "vm.stats.vm.v_wire_count" int main(int argc, char *argv[]) { int err; int wire_count; int wire_count_len; wire_count_len = sizeof(wire_count); sysctlbyname(SYSCTL_WIRECOUNT, &wire_count, &wire_count_len, NULL, 0); fprintf(stderr, "%s: %d\n", SYSCTL_WIRECOUNT, wire_count); fprintf(stderr, "Sleeping 5 seconds.\n"); sleep(5); fprintf(stderr, "About to invoke mlockall().\n"); err = mlockall(MCL_CURRENT|MCL_FUTURE); if (err == -1) { perror("mlockall"); } sysctlbyname(SYSCTL_WIRECOUNT, &wire_count, &wire_count_len, NULL, 0); fprintf(stderr, "%s: %d\n", SYSCTL_WIRECOUNT, wire_count); fprintf(stderr, "Sleeping 5 seconds.\n"); sleep(5); fprintf(stderr, "About to invoke munlockall().\n"); err = munlockall(); if (err == -1) { perror("munlockall"); } sysctlbyname(SYSCTL_WIRECOUNT, &wire_count, &wire_count_len, NULL, 0); fprintf(stderr, "%s: %d\n", SYSCTL_WIRECOUNT, wire_count); exit(EXIT_SUCCESS); } --rS8CxjVDS/+yyDmU-- From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 03:07:39 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FAC237B401 for ; Tue, 8 Jul 2003 03:07:39 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id E588443FDF for ; Tue, 8 Jul 2003 03:07:38 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-38lc01p.dialup.mindspring.com ([209.86.0.57] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZpNo-0000ia-00; Tue, 08 Jul 2003 03:07:37 -0700 Message-ID: <3F0A97A8.464123FF@mindspring.com> Date: Tue, 08 Jul 2003 03:06:32 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "David A. Gobeille" References: <0193271C683D5844A478A359271B8F66147AD8@DC1.dynatec.com> <3F07860E.9060702@reversedhell.net> <20030707162900.B49607@beagle.fokus.fraunhofer.de> <3F078DC9.3080708@reversedhell.net> <20030707164832.L49607@beagle.fokus.fraunhofer.de> <3F0790EF.10407@reversedhell.net> <3F098D11.2070802@earthlink.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4af2c67c0433213870b2140814161e021350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org cc: Alin-Adrian Anton Subject: Re: raw socket programming SOLVED X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 10:07:40 -0000 "David A. Gobeille" wrote: > Shouldn't the #included files themselves #include headers they are > dependant on? With the use of #ifndef and #define in the headers to > keep them from being #included more than once? > > It seems silly(more work) for the programmer to have to arrange > everything in a specific order. The order is documented. Maybe we could have one big header file that declares everything in the right order so that no one has to think at all? 8-) 8-). In general, FreeBSD headers are independent. Unless you have compiler support for precompiled header files, there is a significant reduction in compile time for not having promiscuous headers (headers which include other headers). There are also issues having to do with whether or not certain functions or manifest constants end up in the namespace, and conflict with user header definitions. By including only a minimal set of the headers needed to compile the program, you reduce the possibility of such conflicts occurring. As another point: the craftsman should know his tools; in other words, you should be aware of which headers are necessary, because you know what you are doing (or are able to figure it out, and remember it for the next time you need the information). Finally, POSIX compliance -- strict compliance -- requires that certain headers *not* define values into the implementation space. This is particularly problematic when it comes to inline functions wrapped by macros (for example) or compiler built-ins (for another example) when you want to get a specific implementation, or when the compiler built-in is the only way to do something correctly, as in the recent issues FreeBSD had with alloca() and stack alignment with certain "cputype" values. -- Terry From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 03:19:10 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6898237B401 for ; Tue, 8 Jul 2003 03:19:10 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id D7BA743FB1 for ; Tue, 8 Jul 2003 03:19:09 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-38lc01p.dialup.mindspring.com ([209.86.0.57] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZpYP-0001iC-00; Tue, 08 Jul 2003 03:18:34 -0700 Message-ID: <3F0A9A1C.25E6EB35@mindspring.com> Date: Tue, 08 Jul 2003 03:17:00 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Socketd References: <20030707012205.3103dfc8.db@traceroute.dk> <20030707180252.44036c61.db@traceroute.dk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4a4a835edb01d7fed58517baf058fd0f3350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: hackers@freebsd.org cc: Toni Andjelkovic Subject: Re: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 10:19:10 -0000 Socketd wrote: > Ok, anyway to prevent sending ICMP's when ttl = 0? Or do I need a > firewall? I guess you want to do this so that you can break path MTU discovery and fail to properly exchange packets with the DF bit set in the headers, and which don't take into account intermediate links with smaller MTUs, like VPNs or PPPOE links? What exactly are you getting from disabling ICMP, besides a broken network connection to some systems you may wish to be able to exchange packets with? -- Terry From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 03:48:51 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FBEE37B401 for ; Tue, 8 Jul 2003 03:48:51 -0700 (PDT) Received: from webmail.kent.edu (webmail.kent.edu [131.123.74.25]) by mx1.FreeBSD.org (Postfix) with ESMTP id 920A343FB1 for ; Tue, 8 Jul 2003 03:48:50 -0700 (PDT) (envelope-from sdavu@kent.edu) X-WebMail-UserID: sdavu Date: Tue, 8 Jul 2003 07:01:20 -0400 Sender: Sandeep Kumar Davu From: Sandeep Kumar Davu To: freebsd-hackers@freebsd.org X-EXP32-SerialNo: 00002334 Message-ID: <3F220AA7@webmail.kent.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Mailer: WebMail (Hydra) SMTP v3.51.06 Subject: kernel hacking X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 10:48:51 -0000 Hi, I was making changes to 4.5 source code. I tried to recompile the kernel. it compiles well but is not able to link it. I used the function inet_aton in uipc_socket.c This is the error i got. uipc_socket.o(.text+0xid8): undefined refernce to '__inet_aton' I added all the header files that were required. Can anyone tell what is missing. Thanks. sandeep. From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 04:05:20 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BEBD537B401 for ; Tue, 8 Jul 2003 04:05:20 -0700 (PDT) Received: from cicero2.cybercity.dk (cicero2.cybercity.dk [212.242.40.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id C73E443F75 for ; Tue, 8 Jul 2003 04:05:19 -0700 (PDT) (envelope-from db@traceroute.dk) Received: from user1.cybercity.dk (fxp0.user1.ip.cybercity.dk [212.242.41.34]) by cicero2.cybercity.dk (Postfix) with ESMTP id C736B18F71C; Tue, 8 Jul 2003 13:05:17 +0200 (CEST) Received: from main (port132.ds1-arsy.adsl.cybercity.dk [212.242.239.73]) by user1.cybercity.dk (Postfix) with SMTP id 0B1A268B4A; Tue, 8 Jul 2003 13:05:17 +0200 (CEST) Date: Tue, 8 Jul 2003 13:13:39 +0200 From: Socketd To: Terry Lambert , hackers@freebsd.org Message-Id: <20030708131339.16da151f.db@traceroute.dk> In-Reply-To: <3F0A9A1C.25E6EB35@mindspring.com> References: <20030707012205.3103dfc8.db@traceroute.dk> <20030707153314.GA1695@webboy.soth.at> <20030707180252.44036c61.db@traceroute.dk> <3F0A9A1C.25E6EB35@mindspring.com> X-Mailer: Sylpheed version 0.8.10claws (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 11:05:21 -0000 On Tue, 08 Jul 2003 03:17:00 -0700 Terry Lambert wrote: > Socketd wrote: > > Ok, anyway to prevent sending ICMP's when ttl = 0? Or do I need a > > firewall? > > I guess you want to do this so that you can break path MTU > discovery and fail to properly exchange packets with the DF > bit set in the headers, and which don't take into account > intermediate links with smaller MTUs, like VPNs or PPPOE > links? > > What exactly are you getting from disabling ICMP, besides a > broken network connection to some systems you may wish to be > able to exchange packets with? I don't want to disable ICMP, just don't want to respond when ttl=0, meaning when my firewall/gateway is on a "traceroute path". br socketd From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 04:15:21 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F54637B401 for ; Tue, 8 Jul 2003 04:15:21 -0700 (PDT) Received: from bluejay.mail.pas.earthlink.net (bluejay.mail.pas.earthlink.net [207.217.120.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id D324043FB1 for ; Tue, 8 Jul 2003 04:15:20 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-38lc01p.dialup.mindspring.com ([209.86.0.57] helo=mindspring.com) by bluejay.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZqRK-0001Sc-00; Tue, 08 Jul 2003 04:15:19 -0700 Message-ID: <3F0AA77F.521FE9C4@mindspring.com> Date: Tue, 08 Jul 2003 04:14:07 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Sandeep Kumar Davu References: <3F220AA7@webmail.kent.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a4393873c806a2959f03b4d173fd886fec350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: freebsd-hackers@freebsd.org Subject: Re: kernel hacking X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 11:15:21 -0000 Sandeep Kumar Davu wrote: > I was making changes to 4.5 source code. I tried to recompile the kernel. > it compiles well but is not able to link it. > I used the function inet_aton in uipc_socket.c > This is the error i got. > > uipc_socket.o(.text+0xid8): undefined refernce to '__inet_aton' > > I added all the header files that were required. > > Can anyone tell what is missing. You are trying to call a libc function from within the kernel. In general, you can not use /usr/include headers in kernel code, only /usr/include/sys headers. This is because the kernel is not linked againsts libc. Mostly, you should not be dealing with strings in the kernel; if you are adding a kernel entry point to be called from user space, you should convert the address into a sockaddr_in before you pass it into the kernel, instead. -- Terry From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 04:18:19 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0486737B401 for ; Tue, 8 Jul 2003 04:18:19 -0700 (PDT) Received: from bluejay.mail.pas.earthlink.net (bluejay.mail.pas.earthlink.net [207.217.120.218]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8495843FA3 for ; Tue, 8 Jul 2003 04:18:18 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-38lc01p.dialup.mindspring.com ([209.86.0.57] helo=mindspring.com) by bluejay.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZqUC-0001mj-00; Tue, 08 Jul 2003 04:18:17 -0700 Message-ID: <3F0AA830.9A82CB37@mindspring.com> Date: Tue, 08 Jul 2003 04:17:04 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Socketd References: <20030707012205.3103dfc8.db@traceroute.dk> <20030707153314.GA1695@webboy.soth.at> <20030707180252.44036c61.db@traceroute.dk> <20030708131339.16da151f.db@traceroute.dk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a431c29aa38c963e9095e6b1fe965ab4aa350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: hackers@freebsd.org Subject: Re: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 11:18:19 -0000 Socketd wrote: > > I guess you want to do this so that you can break path MTU > > discovery and fail to properly exchange packets with the DF > > bit set in the headers, and which don't take into account > > intermediate links with smaller MTUs, like VPNs or PPPOE > > links? > > > > What exactly are you getting from disabling ICMP, besides a > > broken network connection to some systems you may wish to be > > able to exchange packets with? > > I don't want to disable ICMP, just don't want to respond when ttl=0, > meaning when my firewall/gateway is on a "traceroute path". You should specifically modify the ICMP code to not respond to echo datagrams, or when ttl == 0, then, and work it that way. In other words, it's time to hack your network stack to specifically add that "feature". -- Terry From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 04:31:48 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 95AA837B405 for ; Tue, 8 Jul 2003 04:31:48 -0700 (PDT) Received: from stork.mail.pas.earthlink.net (stork.mail.pas.earthlink.net [207.217.120.188]) by mx1.FreeBSD.org (Postfix) with ESMTP id B1EF543FF3 for ; Tue, 8 Jul 2003 04:31:43 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from user-38lc01p.dialup.mindspring.com ([209.86.0.57] helo=mindspring.com) by stork.mail.pas.earthlink.net with asmtp (SSLv3:RC4-MD5:128) (Exim 3.33 #1) id 19ZqhA-0002Tq-00; Tue, 08 Jul 2003 04:31:42 -0700 Message-ID: <3F0AAB50.39D36684@mindspring.com> Date: Tue, 08 Jul 2003 04:30:24 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Rich Morin References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-ELNK-Trace: b1a02af9316fbb217a47c185c03b154d40683398e744b8a431c29aa38c963e90ba686ef4c2420dcd350badd9bab72f9c350badd9bab72f9c350badd9bab72f9c cc: hackers@freebsd.org Subject: Re: Adding second-level resolution to cron(8). X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 11:31:48 -0000 Rich Morin wrote: > I have a project for which I need a generalized time-based scheduling > daemon. cron(8) is almost ideal, but it only has minute-level resolution. > So, I'm thinking about modifying cron to add second-level resolution. > > Before I start, I thought I'd ask a few questions: > > * Has someone already done this? There are a couple of programs that can do this, but they aren't cron, per se. > * Is it a Really Bad Idea for some reason? One really bad thing about using cron as your starting point is that each time it wakes up, it stats the crontab file to see if it has changed (historical cron implementations needed to be sent a SIGHUP instead). It's also lazy about time changes. The net effect of the first is that it wildly spins updating atime on the file; this is bad from a number of perspectives, but the worst thing about it is that there ar a limited number of duty cycles on things like flash memory "ATA" devices that you would use in an embedded system, so you end up having to do a lot of work to get a copy of the crontab into a ramdisk. The net effect of the second is that cron would, in effect, need to increase its rate of stat to once a second, which means sixty time less MTBF, even if we are talking a disk inode write, rather than a flash device. Again, the fix would have to be "move the crontab somewhere else". Really, this type of thing needs a timer set to go off on or after a spcific time, rather than using an interval timer, or the code needs to get a lot smarter about calculating when the next work needs to be done, and use a kqueue to watch the file for modifications, instead, so it can use a select to implement both the watching and the interval timer. It also needs to be smarter about not rereading the file every time it needs to run, and using a cached copy instead. Unfortunately, cron is not a happy program. 8-(. -- Terry From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 04:51:54 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9596637B401 for ; Tue, 8 Jul 2003 04:51:54 -0700 (PDT) Received: from cicero0.cybercity.dk (cicero0.cybercity.dk [212.242.40.52]) by mx1.FreeBSD.org (Postfix) with ESMTP id EA62D43F75 for ; Tue, 8 Jul 2003 04:51:51 -0700 (PDT) (envelope-from db@traceroute.dk) Received: from user1.cybercity.dk (fxp0.user1.ip.cybercity.dk [212.242.41.34]) by cicero0.cybercity.dk (Postfix) with ESMTP id 3457128DC3; Tue, 8 Jul 2003 13:51:50 +0200 (CEST) Received: from main (port132.ds1-arsy.adsl.cybercity.dk [212.242.239.73]) by user1.cybercity.dk (Postfix) with SMTP id 878F968B01; Tue, 8 Jul 2003 13:51:49 +0200 (CEST) Date: Tue, 8 Jul 2003 14:00:12 +0200 From: Socketd To: Terry Lambert , hackers@freebsd.org Message-Id: <20030708140012.0fd685c8.db@traceroute.dk> In-Reply-To: <3F0AA830.9A82CB37@mindspring.com> References: <20030707012205.3103dfc8.db@traceroute.dk> <20030707153314.GA1695@webboy.soth.at> <20030707180252.44036c61.db@traceroute.dk> <3F0A9A1C.25E6EB35@mindspring.com> <20030708131339.16da151f.db@traceroute.dk> <3F0AA830.9A82CB37@mindspring.com> X-Mailer: Sylpheed version 0.8.10claws (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 11:51:54 -0000 On Tue, 08 Jul 2003 04:17:04 -0700 Terry Lambert wrote: > > I don't want to disable ICMP, just don't want to respond when ttl=0, > > meaning when my firewall/gateway is on a "traceroute path". > > You should specifically modify the ICMP code to not respond > to echo datagrams, or when ttl == 0, then, and work it that > way. In other words, it's time to hack your network stack > to specifically add that "feature". Hmm, why not just use a firewall? br socketd From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 04:55:05 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A5AD437B401 for ; Tue, 8 Jul 2003 04:55:05 -0700 (PDT) Received: from cicero2.cybercity.dk (cicero2.cybercity.dk [212.242.40.53]) by mx1.FreeBSD.org (Postfix) with ESMTP id 16CF743F3F for ; Tue, 8 Jul 2003 04:55:05 -0700 (PDT) (envelope-from db@traceroute.dk) Received: from user1.cybercity.dk (fxp0.user1.ip.cybercity.dk [212.242.41.34]) by cicero2.cybercity.dk (Postfix) with ESMTP id EC26118F745; Tue, 8 Jul 2003 13:55:03 +0200 (CEST) Received: from main (port132.ds1-arsy.adsl.cybercity.dk [212.242.239.73]) by user1.cybercity.dk (Postfix) with SMTP id 3174F68B01; Tue, 8 Jul 2003 13:54:53 +0200 (CEST) Date: Tue, 8 Jul 2003 14:03:15 +0200 From: Socketd To: "Andrey Alekseyev" , hackers@freebsd.org Message-Id: <20030708140315.651b3799.db@traceroute.dk> In-Reply-To: References: <3F0AA830.9A82CB37@mindspring.com> X-Mailer: Sylpheed version 0.8.10claws (GTK+ 1.2.10; i386-portbld-freebsd4.8) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: 5 "Advanced" networking questions X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 11:55:05 -0000 On Tue, 08 Jul 2003 15:50:30 +0400 "Andrey Alekseyev" wrote: > You may also take a look at the IPSTEALTH kernel config > option (see LINT): > > # IPSTEALTH enables code to support stealth forwarding (i.e., > forwarding > # packets without touching the ttl). This can be useful to hide > firewalls > # from traceroute and similar tools. Jep, have already seen that one :-) br socketd From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 12:23:57 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 46C1037B401 for ; Tue, 8 Jul 2003 12:23:57 -0700 (PDT) Received: from intarweb.us (pool-138-88-176-214.res.east.verizon.net [138.88.176.214]) by mx1.FreeBSD.org (Postfix) with SMTP id 273B143FA3 for ; Tue, 8 Jul 2003 12:23:56 -0700 (PDT) (envelope-from exarkun@intarweb.us) Received: from meson ([127.0.0.1]) by meson with smtp (Twisted 1.0.6) for hackers@freebsd.org; Tue, 08 Jul 2003 15:23:54 -0400 Date: Tue, 8 Jul 2003 15:23:53 -0400 From: Jp Calderone To: hackers@freebsd.org Message-ID: <20030708192342.GA4899@intarweb.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.25i Subject: telldir()/seekdir() confusion X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 19:23:57 -0000 I'm trying to work out some inconsistent behavior in my app across platforms. On FreeBSD, seekdir() doesn't seem to behave as I expect it to. Here's a short program that demonstrates my confusion: #include #include #include int main() { DIR* dirp; off_t pos; struct dirent* ent; dirp = opendir("."); if (!dirp) perror("opendir"); ent = readdir(dirp); if (!ent) perror("readdir"); pos = telldir(dirp); if (pos == -1) perror("telldir"); ent = readdir(dirp); if (!ent) perror("readdir 2"); seekdir(dirp, pos); printf("First telldir:%d\nSecond telldir:%d\n", pos, telldir(dirp)); return 0; } On other platforms, the first and second telldir() return the same value. On the two FreeBSD machines I've tried it on, the first telldir() returns 1 and the second returns 0. Can anyone explain this? Thanks in advance, Jp From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 13:30:29 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2EE9737B401 for ; Tue, 8 Jul 2003 13:30:29 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 584DD43F75 for ; Tue, 8 Jul 2003 13:30:28 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h68KUQVQ042267; Tue, 8 Jul 2003 15:30:26 -0500 (CDT) (envelope-from dan) Date: Tue, 8 Jul 2003 15:30:26 -0500 From: Dan Nelson To: Jp Calderone Message-ID: <20030708203026.GM87950@dan.emsphone.com> References: <20030708192342.GA4899@intarweb.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030708192342.GA4899@intarweb.us> X-OS: FreeBSD 5.1-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i cc: hackers@freebsd.org Subject: Re: telldir()/seekdir() confusion X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 20:30:29 -0000 In the last episode (Jul 08), Jp Calderone said: > I'm trying to work out some inconsistent behavior in my app across > platforms. On FreeBSD, seekdir() doesn't seem to behave as I expect > it to. Here's a short program that demonstrates my confusion: > > off_t pos; > dirp = opendir("."); > ent = readdir(dirp); > pos = telldir(dirp); > ent = readdir(dirp); > seekdir(dirp, pos); > printf("First telldir:%d\nSecond telldir:%d\n", pos, telldir(dirp)); > > On other platforms, the first and second telldir() return the same > value. On the two FreeBSD machines I've tried it on, the first > telldir() returns 1 and the second returns 0. > > Can anyone explain this? Well, your first problem is that pos is a long long, but you only printed a %d value. Change pos to a "long" type, and you'll get the correct result :) First telldir:1 Second telldir:2 But your basic question still stands: why aren't they the same? When telldir() is called, the base offset into the directory and filecount past that offset are stored in a linked list (see the getdirentries manpage; directory entries are read in blocks, so you don't necessarily know the absolute offset to a particular entry). A cookie value is returned to the user, and that value is used to look up the stored values when seekdir() is called later. Each call to telldir will return an integer one higher that the result of the previous call. I don't think there's any pstandard that says that telldir has to return a seekable file offset, or that consecutive calls on the same position must return the same value. Think about a filesystem that uses hashed or btree-based directories, for example; there may not be a way to store the correct position in a single "long" value without using a cookie like FreeBSD does. -- Dan Nelson dnelson@allantgroup.com From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 16:28:57 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E8E0A37B401 for ; Tue, 8 Jul 2003 16:28:57 -0700 (PDT) Received: from tevn.com (www.tevn.com [203.39.125.34]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A0DF43FCB for ; Tue, 8 Jul 2003 16:28:56 -0700 (PDT) (envelope-from jennifer@tevn.com) Received: from spicygirl ([10.10.10.193]) by tevn.com (8.11.3/8.11.3) with SMTP id h68NV8p00450 for ; Wed, 9 Jul 2003 09:31:08 +1000 (EST) (envelope-from jennifer@tevn.com) Message-ID: <003801c345a8$b2520d90$c10a0a0a@spicygirl> From: "Jennifer" To: Date: Wed, 9 Jul 2003 09:28:54 +1000 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: mount USB storage device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 23:28:58 -0000 Dear FreeBSD hackers, Though I just started to learn and use FreeBSD less than one year, I = started to love it's powers and stability. However, I have one question need your help here if you get time and = willing to have me. I bought a USB memory chip (64 Mb capacity). It works fine in any = windows PC. But I tried to mount it in my FreeBSD4.3 box. I read some tips from the internet that some people use the following = command to mount it as mkdir /mnt/usb mount -t msdos /dev/da0s1 /mnt/usb So I tried this way. First, I insert my memory chip into a USB port on = FreeBSD4.3 box. The dmesg.boot shows : umassQ: USB Solid State Disk rev 1.10/1.00, addr 2 da0 at umass-sim0 bus 0=20 da0: Removable Direct Access SCSI-2 Device da0: 650kb/s transfers da0:63MB (129024 512bye sectors 64H32S/T63C) Then I tried to mount it as=20 mkdir /mnt/usb mount -t msdos /dev/da0s1 /mnt/usb But the console shows: da0:( umass-sim0:0:0:0):READ(06),cbd:800010 da0:( umass-sim0:0:0:0):ILLEGAL REQUEST ASC:20,0 da0:( umass-sim0:0:0:0):Invalid command operation code da0:reading primary partition table:error reading fsbn0 msdos: /dev/da0s1: input/output error So it seems the mounting is not successful. So I tried this way: mount /dev/da0s1 /mnt/usb This time the console shows:=20 da0:reading primary partition table:error reading fsbn0 msdos: /dev/da0s1: input/output error I know there must some thing wrong with my mounting command, but I do = not know what it is. I understand you people are real FreeBSD gurus, but = not sure you have time to help in such trivel thing. Still, I hold my = breath to waiting for your reply. Best regards to FreeBSD Development FreeBSD user: Jennifer From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 16:48:43 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2CC1737B401 for ; Tue, 8 Jul 2003 16:48:43 -0700 (PDT) Received: from priv-edtnes09-hme0.telusplanet.net (outbound02.telus.net [199.185.220.221]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5769F43FB1 for ; Tue, 8 Jul 2003 16:48:42 -0700 (PDT) (envelope-from pfak@telus.net) Received: from starfly ([209.121.12.209]) by priv-edtnes09-hme0.telusplanet.netSMTP <20030708234842.ZXSB29389.priv-edtnes09-hme0.telusplanet.net@starfly>; Tue, 8 Jul 2003 17:48:42 -0600 Message-ID: <000c01c345ab$7bd70880$c601a8c0@starfly> From: "Peter" To: "Jennifer" , References: <003801c345a8$b2520d90$c10a0a0a@spicygirl> Date: Tue, 8 Jul 2003 16:48:51 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1193 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1193 Subject: Re: mount USB storage device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 23:48:43 -0000 I'd say your best bet would be to use the latest version of FreeBSD (4.8-RELEASE) or FreeBSD 5.1-RELEASE, as 4.3 is from ~2000 and does not support alot of "nextgen" hardware. Try that, and then come back to the list if that doesn't fix your problem. -- Peter ----- Original Message ----- From: "Jennifer" To: Sent: Tuesday, July 08, 2003 4:28 PM Subject: mount USB storage device Dear FreeBSD hackers, Though I just started to learn and use FreeBSD less than one year, I started to love it's powers and stability. However, I have one question need your help here if you get time and willing to have me. I bought a USB memory chip (64 Mb capacity). It works fine in any windows PC. But I tried to mount it in my FreeBSD4.3 box. I read some tips from the internet that some people use the following command to mount it as mkdir /mnt/usb mount -t msdos /dev/da0s1 /mnt/usb So I tried this way. First, I insert my memory chip into a USB port on FreeBSD4.3 box. The dmesg.boot shows : umassQ: USB Solid State Disk rev 1.10/1.00, addr 2 da0 at umass-sim0 bus 0 da0: Removable Direct Access SCSI-2 Device da0: 650kb/s transfers da0:63MB (129024 512bye sectors 64H32S/T63C) Then I tried to mount it as mkdir /mnt/usb mount -t msdos /dev/da0s1 /mnt/usb But the console shows: da0:( umass-sim0:0:0:0):READ(06),cbd:800010 da0:( umass-sim0:0:0:0):ILLEGAL REQUEST ASC:20,0 da0:( umass-sim0:0:0:0):Invalid command operation code da0:reading primary partition table:error reading fsbn0 msdos: /dev/da0s1: input/output error So it seems the mounting is not successful. So I tried this way: mount /dev/da0s1 /mnt/usb This time the console shows: da0:reading primary partition table:error reading fsbn0 msdos: /dev/da0s1: input/output error I know there must some thing wrong with my mounting command, but I do not know what it is. I understand you people are real FreeBSD gurus, but not sure you have time to help in such trivel thing. Still, I hold my breath to waiting for your reply. Best regards to FreeBSD Development FreeBSD user: Jennifer _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 16:50:45 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4165137B401 for ; Tue, 8 Jul 2003 16:50:45 -0700 (PDT) Received: from priv-edtnes46.telusplanet.net (defout.telus.net [199.185.220.240]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7F0B243FA3 for ; Tue, 8 Jul 2003 16:50:44 -0700 (PDT) (envelope-from pfak@telus.net) Received: from starfly ([209.121.12.209]) by priv-edtnes46.telusplanet.net (InterMail vM.5.01.05.17 201-253-122-126-117-20021021) with SMTP id <20030708235044.HOQF23741.priv-edtnes46.telusplanet.net@starfly>; Tue, 8 Jul 2003 17:50:44 -0600 Message-ID: <001201c345ab$c4fc0240$c601a8c0@starfly> From: "Peter" To: "Jennifer" , References: <003801c345a8$b2520d90$c10a0a0a@spicygirl> Date: Tue, 8 Jul 2003 16:50:54 -0700 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1193 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1193 Subject: Re: mount USB storage device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Jul 2003 23:50:45 -0000 Errm, forgot something.. Also, did you try running `newfs` on the drive? (man newfs) --Peter ----- Original Message ----- From: "Jennifer" To: Sent: Tuesday, July 08, 2003 4:28 PM Subject: mount USB storage device Dear FreeBSD hackers, Though I just started to learn and use FreeBSD less than one year, I started to love it's powers and stability. However, I have one question need your help here if you get time and willing to have me. I bought a USB memory chip (64 Mb capacity). It works fine in any windows PC. But I tried to mount it in my FreeBSD4.3 box. I read some tips from the internet that some people use the following command to mount it as mkdir /mnt/usb mount -t msdos /dev/da0s1 /mnt/usb So I tried this way. First, I insert my memory chip into a USB port on FreeBSD4.3 box. The dmesg.boot shows : umassQ: USB Solid State Disk rev 1.10/1.00, addr 2 da0 at umass-sim0 bus 0 da0: Removable Direct Access SCSI-2 Device da0: 650kb/s transfers da0:63MB (129024 512bye sectors 64H32S/T63C) Then I tried to mount it as mkdir /mnt/usb mount -t msdos /dev/da0s1 /mnt/usb But the console shows: da0:( umass-sim0:0:0:0):READ(06),cbd:800010 da0:( umass-sim0:0:0:0):ILLEGAL REQUEST ASC:20,0 da0:( umass-sim0:0:0:0):Invalid command operation code da0:reading primary partition table:error reading fsbn0 msdos: /dev/da0s1: input/output error So it seems the mounting is not successful. So I tried this way: mount /dev/da0s1 /mnt/usb This time the console shows: da0:reading primary partition table:error reading fsbn0 msdos: /dev/da0s1: input/output error I know there must some thing wrong with my mounting command, but I do not know what it is. I understand you people are real FreeBSD gurus, but not sure you have time to help in such trivel thing. Still, I hold my breath to waiting for your reply. Best regards to FreeBSD Development FreeBSD user: Jennifer _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 17:01:54 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 53C6C37B401 for ; Tue, 8 Jul 2003 17:01:54 -0700 (PDT) Received: from smtp.goamerica.net (ny-mx-01.goamerica.net [208.200.67.108]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7070443F3F for ; Tue, 8 Jul 2003 17:01:53 -0700 (PDT) (envelope-from eaja@erols.com) Received: from localhost (165.sub-166-141-30.myvzw.com [166.141.30.165]) by smtp.goamerica.net (8.12.8/8.12.8) with SMTP id h6901fNf015808; Tue, 8 Jul 2003 20:01:43 -0400 (EDT) Date: Tue, 8 Jul 2003 19:59:39 -0400 From: Eric Jacobs To: freebsd-hackers@freebsd.org, jennifer@tevn.com Message-Id: <20030708195939.16001c8b.eaja@erols.com> In-Reply-To: <003801c345a8$b2520d90$c10a0a0a@spicygirl> References: <003801c345a8$b2520d90$c10a0a0a@spicygirl> X-Mailer: Sylpheed version 0.8.5 (GTK+ 1.2.10; i386-portbld-freebsd4.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: mount USB storage device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jul 2003 00:01:54 -0000 On Wed, 9 Jul 2003 09:28:54 +1000 "Jennifer" wrote: > > But the console shows: > > da0:( umass-sim0:0:0:0):READ(06),cbd:800010 > da0:( umass-sim0:0:0:0):ILLEGAL REQUEST ASC:20,0 > da0:( umass-sim0:0:0:0):Invalid command operation code > da0:reading primary partition table:error reading fsbn0 > msdos: /dev/da0s1: input/output error READ_6 and WRITE_6 are not supported by a good number of these types of devices. You'll either need to upgrade to a version of the kernel that has the cmd6workaround functionality in sys/cam/scsi/scsi_da.c (I believe this is in 4.7-RELEASE and newer), or else add the DA_Q_NO_6_BYTE quirk for your device into the quirk entries in that file manually. Eric From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 18:05:49 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 869F137B401 for ; Tue, 8 Jul 2003 18:05:49 -0700 (PDT) Received: from intarweb.us (pool-138-88-176-214.res.east.verizon.net [138.88.176.214]) by mx1.FreeBSD.org (Postfix) with SMTP id 503F043F85 for ; Tue, 8 Jul 2003 18:05:48 -0700 (PDT) (envelope-from exarkun@intarweb.us) Received: from meson ([127.0.0.1]) by meson with smtp (Twisted 1.0.6) for hackers@freebsd.org; Tue, 08 Jul 2003 21:05:46 -0400 Date: Tue, 8 Jul 2003 21:05:43 -0400 From: Jp Calderone To: hackers@freebsd.org Message-ID: <20030709010543.GA6014@intarweb.us> References: <20030708192342.GA4899@intarweb.us> <20030708203026.GM87950@dan.emsphone.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030708203026.GM87950@dan.emsphone.com> User-Agent: Mutt/1.3.25i Subject: Re: telldir()/seekdir() confusion X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jul 2003 01:05:49 -0000 On Tue, Jul 08, 2003 at 03:30:26PM -0500, Dan Nelson wrote: > > [snip] > > I don't think there's any pstandard that says that telldir has to > return a seekable file offset, or that consecutive calls on the same > position must return the same value. Think about a filesystem that > uses hashed or btree-based directories, for example; there may not be a > way to store the correct position in a single "long" value without > using a cookie like FreeBSD does. > Thanks, it all makes sense now. Jp From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 18:42:23 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4234337B401 for ; Tue, 8 Jul 2003 18:42:23 -0700 (PDT) Received: from falcon.mail.pas.earthlink.net (falcon.mail.pas.earthlink.net [207.217.120.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id A717A43F93 for ; Tue, 8 Jul 2003 18:42:22 -0700 (PDT) (envelope-from andrei@andruxa.sytes.net) Received: from h-68-164-89-164.snvacaid.covad.net ([68.164.89.164] helo=andruxa.sytes.net) by falcon.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 19a3yQ-0005RL-00 for freebsd-hackers@freebsd.org; Tue, 08 Jul 2003 18:42:22 -0700 Received: from andruxa.sytes.net (localhost [127.0.0.1]) by andruxa.sytes.net (8.12.9/8.12.6) with ESMTP id h691fxZh022414 for ; Tue, 8 Jul 2003 18:41:59 -0700 (PDT) (envelope-from andrei@andruxa.sytes.net) Received: (from andrei@localhost) by andruxa.sytes.net (8.12.9/8.12.9/Submit) id h691fswT022413 for freebsd-hackers@freebsd.org; Tue, 8 Jul 2003 18:41:54 -0700 (PDT) Date: Tue, 8 Jul 2003 18:41:53 -0700 From: Andrew Konstantinov To: freebsd-hackers@freebsd.org Message-ID: <20030709014153.GA5165@andruxa.sytes.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.1i Subject: lpt0 - device busy X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: abkonstantinov@earthlink.net List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jul 2003 01:42:23 -0000 Hello, I have a problem accessing lpt0 device node. Whenever I do 'echo "check" > /dev/lpt0' it responds with "/dev/lpt0: Device busy" but at the same time 'fstat' doesn't show that any application is currently using that device. I asked about this issue on #freebsd @ efnet and someone said that this behavior is caused by a bug in the code. It seems that I am not the only one who confronted this problem according to google. Is it really a bug or is it a problem with my system's configuration? I run FreeBSD 5.1 and my kernel is configured with ppc, ppbus, lpt, and ppi devices. Thank you in advance. From owner-freebsd-hackers@FreeBSD.ORG Tue Jul 8 19:22:08 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0CEF737B401 for ; Tue, 8 Jul 2003 19:22:08 -0700 (PDT) Received: from STYX.ORG (mail.styx.org [204.138.67.194]) by mx1.FreeBSD.org (Postfix) with ESMTP id E7DAC43FA3 for ; Tue, 8 Jul 2003 19:22:06 -0700 (PDT) (envelope-from ww@STYX.ORG) Received: by STYX.ORG (Postfix, from userid 1001) id 8246A4F44; Tue, 8 Jul 2003 22:22:05 -0400 (EDT) Date: Tue, 8 Jul 2003 22:22:05 -0400 From: news+freebsd_hackers@news.styx.org To: abkonstantinov@earthlink.net Message-ID: <20030709022205.GK12955@styx.org> References: <20030709014153.GA5165@andruxa.sytes.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030709014153.GA5165@andruxa.sytes.net> User-Agent: Mutt/1.4i cc: freebsd-hackers@freebsd.org Subject: DMA issues (Was Re: lpt0 - device busy) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: news+freebsd_hackers@news.styx.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jul 2003 02:22:08 -0000 FWIW, I have similar symptoms with 5.1. Worse in fact. Nothing that does DMA (which includes the parallel port in ECP mode) functions correctly on this VIA C3 board. Disks running PIO4 -- it is necessary to turn off UDMA in the BIOS for 5.1 to boot (5.0 boots ok off the CD) Strangely, the disk shows up in the dmesg as supporting UDMA. Not sure which interface is being used in reality. The cdrom drive acting *really* weird -- skipping all over the place, then locking up -- if I try to access any audio data. For example, booting and logging in with an audio CD in the drive causes a very unpleasant reaction when the KDE desktop gunk tries to see what sort of disc is in the drive... I'm on a very slow network connection right now, so I haven't tried updating my source from CVS. I believe the DMA problems have been mentioned on the freebsd-hardware list recently, specifically relating to the IDE subsystem. I believe that someone was working on an improved IDE driver that didn't have this problem. I'm not sure if the fix is general enough make DMA work properly for the printer port also. As well, I believe the CPU should be running at 1GHz, but it looks like 666MHz from the dmesg (and feels like it too). Can anyone offer any elucidations about the status of FreeBSD on this sort of hardware? Dmesg follows. Cheers, -w Copyright (c) 1992-2003 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.1-RELEASE #1: Fri Jul 4 22:15:26 GMT 2003 ww@parc.styx.org:/usr/obj/export/FreeBSD/src/sys/PARC Preloaded elf kernel "/boot/kernel/kernel" at 0xc070a000. Preloaded elf module "/boot/kernel/acpi.ko" at 0xc070a244. Timecounter "i8254" frequency 1193182 Hz Timecounter "TSC" frequency 667815180 Hz CPU: VIA C3 Samuel 2 (667.82-MHz 686-class CPU) Origin = "CentaurHauls" Id = 0x672 Stepping = 2 Features=0x803035 real memory = 528416768 (503 MB) avail memory = 504606720 (481 MB) npx0: on motherboard npx0: INT 16 interface acpi0: on motherboard pcibios: BIOS version 2.10 Using $PIR table, 6 entries at 0xc00fdc70 acpi0: power button is handled as a fixed feature programming model. Timecounter "ACPI-fast" frequency 3579545 Hz acpi_timer0: <24-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0 acpi_cpu0: on acpi0 acpi_button0: on acpi0 pcib0: port 0x6000-0x607f,0x5000-0x500f,0x4080-0x40ff,0x4 000-0x407f,0xcf8-0xcff on acpi0 pci0: on pcib0 agp0: mem 0xd0000000-0xd3ffffff at device 0.0 o n pci0 pcib1: at device 1.0 on pci0 pci1: on pcib1 pci1: at device 0.0 (no driver attached) isab0: at device 7.0 on pci0 isa0: on isab0 atapci0: port 0x9000-0x900f at device 7.1 on pc i0 ata0: at 0x1f0 irq 14 on atapci0 ata1: at 0x170 irq 15 on atapci0 uhci0: port 0x9400-0x941f irq 11 at device 7.2 on pc i0 usb0: on uhci0 usb0: USB revision 1.0 uhub0: VIA UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered ums0: Logitech USB-PS/2 Optical Mouse, rev 2.00/11.10, addr 2, iclass 3/1 ums0: 3 buttons and Z dir. pci0: at device 7.4 (no driver attached) pci0: at device 7.5 (no driver attached) cbb0: mem 0xd8404000-0xd8404fff irq 12 at device 8. 0 on pci0 cardbus0: on cbb0 pccard0: <16-bit PCCard bus> on cbb0 dc0: port 0xbc00-0xbcff mem 0xd8403000-0xd84033ff ir q 10 at device 9.0 on pci0 dc0: Ethernet address: 00:50:bf:fe:68:d6 miibus0: on dc0 ukphy0: on miibus0 ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto pci0: at device 10.0 (no driver attached) rl0: port 0xc000-0xc0ff mem 0xd8406000-0xd84060ff ir q 11 at device 14.0 on pci0 rl0: Realtek 8139B detected. Warning, this may be unstable in autoselect mode rl0: Ethernet address: 00:07:95:58:8b:75 miibus1: on rl0 rlphy0: on miibus1 rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto fdc0: port 0x3f7,0x3f0-0 x3f5 irq 6 drq 2 on acpi0 fdc0: FIFO enabled, 8 bytes threshold fd0: <1440-KB 3.5" drive> on fdc0 drive 0 sio0 port 0x3f8-0x3ff irq 4 on acpi0 sio0: type 16550A ppc0 port 0x778-0x77b,0x378-0x37f irq 7 drq 3 on acpi0 ppc0: SMC-like chipset (ECP/EPP/PS2/NIBBLE) in COMPATIBLE mode ppc0: FIFO with 16/16/8 bytes threshold ppbus0: on ppc0 plip0: on ppbus0 lpt0: on ppbus0 lpt0: Interrupt-driven port ppi0: on ppbus0 atkbdc0: port 0x64,0x60 irq 1 on acpi0 atkbd0: flags 0x1 irq 1 on atkbdc0 kbd0 at atkbd0 orm0: