From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 10:24:47 2009 Return-Path: Delivered-To: hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F2CC106566C for ; Sun, 28 Jun 2009 10:24:47 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: from mail.embedded-brains.de (host-82-135-62-35.customer.m-online.net [82.135.62.35]) by mx1.freebsd.org (Postfix) with ESMTP id B1CEE8FC08 for ; Sun, 28 Jun 2009 10:24:46 +0000 (UTC) (envelope-from sebastian.huber@embedded-brains.de) Received: by mail.embedded-brains.de (Postfix, from userid 65534) id 3F1796F823F; Sun, 28 Jun 2009 12:06:51 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on fidibus.eb.z X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from [192.168.126.38] (38.vpnclient.eb.z [192.168.126.38]) by mail.embedded-brains.de (Postfix) with ESMTP id 377206F823F for ; Sun, 28 Jun 2009 12:06:50 +0200 (CEST) Message-ID: <4A4740B8.8090205@embedded-brains.de> Date: Sun, 28 Jun 2009 12:06:48 +0200 From: Sebastian Huber User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: hackers@FreeBSD.ORG Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: Subject: callout(9) and Giant lock X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 10:24:47 -0000 Hi, suppose that a certain time event triggered several callout functions. What happens if the first of these callout functions blocks on the Giant lock? Does this delay all further callout functions until the Giant lock is available for the first callout function? What happens if one of the callout function blocks forever? Does this deadlock the system? CU -- Sebastian Huber, Embedded Brains GmbH Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany Phone : +49 89 18 90 80 79-6 Fax : +49 89 18 90 80 79-9 E-Mail : sebastian.huber@embedded-brains.de PGP : Public key available on request Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG. From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 15:43:55 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 156261065675 for ; Sun, 28 Jun 2009 15:43:55 +0000 (UTC) (envelope-from kpielorz_lst@tdx.co.uk) Received: from lorca.tdx.co.uk (lorca.tdx.co.uk [62.13.128.6]) by mx1.freebsd.org (Postfix) with ESMTP id A6E918FC08 for ; Sun, 28 Jun 2009 15:43:54 +0000 (UTC) (envelope-from kpielorz_lst@tdx.co.uk) Received: from Octa64 (rainbow.tdx.co.uk [62.13.130.232] (may be forged)) (authenticated bits=0) by lorca.tdx.co.uk (8.14.0/8.14.0/Kp) with ESMTP id n5SFUNJ1090360 for ; Sun, 28 Jun 2009 16:30:23 +0100 (BST) Date: Sun, 28 Jun 2009 16:30:24 +0100 From: Karl Pielorz To: freebsd-hackers@freebsd.org Message-ID: <20E145B15D43DBD9A741F1DB@Octa64> X-Mailer: Mulberry/4.0.8 (Win32) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: ata 'Flush Cache' errors, on non-failing disk? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 15:43:55 -0000 Hi, I've recently updated my amd64 system from 6.4 to 7.2-Stable - this works fine, but I've started picking up errors on the console: ad36: TIMEOUT - FLUSHCACHE retrying (1 retry left) The drive (an WD5000AAKS) appears healthy - SMART reports no errors, or problems - and the timeouts only appear when that drive is 'being hammered' by write requests (e.g. during ZFS re-silvering to it) The Western-Digi drive doctor CD/ISO runs a full test, and reports no problems (in that machine, with that drive). I did find a number of posts, such as: Which point to the default timeout for the ATA flushcache command being 5 seconds, when perhaps it should be 30... But the code in 7.2-STABLE bears no resemblance to the code that the patch is for - so I'm guessing things have moved on since then... Is there anywhere I might apply a similar patch to up the timeout to see if that cures the problem? The only mentions of ATA_FLUSHCACHE appears to be calls to "ata_controlcmd( xxxx, ATA_FLUSHCACHE, 0, 0, 0);" - "ata_controlcmd" in turn seems to set a request timeout of '1' - but I can't tell if that's a timeout of 1 second, 1 tick, or 1 what - or if it's a timeout for adding the command to the queue, or actually a timeout for executing that command... Is upping that request timeout conditionally for cache flushes likely to have the effect I'm looking for? -Kp From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 15:57:06 2009 Return-Path: Delivered-To: hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 227A5106566C for ; Sun, 28 Jun 2009 15:57:06 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id F2A6E8FC14 for ; Sun, 28 Jun 2009 15:57:05 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id 6845346B49; Sun, 28 Jun 2009 11:57:05 -0400 (EDT) Date: Sun, 28 Jun 2009 16:57:05 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Sebastian Huber In-Reply-To: <4A4740B8.8090205@embedded-brains.de> Message-ID: References: <4A4740B8.8090205@embedded-brains.de> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: hackers@FreeBSD.ORG Subject: Re: callout(9) and Giant lock X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 15:57:06 -0000 On Sun, 28 Jun 2009, Sebastian Huber wrote: > suppose that a certain time event triggered several callout functions. What > happens if the first of these callout functions blocks on the Giant lock? > Does this delay all further callout functions until the Giant lock is > available for the first callout function? What happens if one of the callout > function blocks forever? Does this deadlock the system? Callouts are marked as MPSAFE or non-MPSAFE when registered. If non-MPSAFE, we will acquire Giant automatically for the callout, but I believe we'll also try and sort non-MPSAFE callouts behind MPSAFE ones in execution order to minimize latency for MPSAFE callouts. Most callouts acquire locks of some sort, and stalling any callout indefinitely will stall the entire callout thread indefinitely, which in turn could lead to a variety of odd behaviors and potentially (although not necessarily) deadlock. In general, we do not allow callouts to "block", however, in the sense that with INVARIANTS enabled we will actually panic if a callout tries to call msleep() or related functions. Likewise, if another thread sleeps while holding Giant, it will automatically release it when it sleeps. Relatively few kernel subsystems use Giant at this point, FYI, and even fewer in FreeBSD 8. One of our goals for FreeBSD 9 is to eliminate all last remaining references to the Giant lock in the kernel. Robert N M Watson Computer Laboratory University of Cambridge From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 17:39:41 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 483661065679 for ; Sun, 28 Jun 2009 17:39:41 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojteks.tensor.gdynia.pl (wojteks.tensor.gdynia.pl [IPv6:2001:4070:101:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 8BF3A8FC2B for ; Sun, 28 Jun 2009 17:39:40 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [IPv6:2001:4070:101:2::2]) by wojteks.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n5SHdgdp012127 for ; Sun, 28 Jun 2009 19:39:42 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n5SHaFWj001813 for ; Sun, 28 Jun 2009 19:36:15 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3/Submit) with ESMTP id n5SHaFdX001810 for ; Sun, 28 Jun 2009 19:36:15 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Sun, 28 Jun 2009 19:36:15 +0200 (CEST) From: Wojciech Puchar To: freebsd-hackers@freebsd.org Message-ID: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Subject: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 17:39:42 -0000 i enabled vm.pmap.pg_ps_enabled: 1 could you please explain what exactly this values means? because i don't understand why promotions-demotions!=mappings vm.pmap.pde.promotions: 2703 vm.pmap.pde.p_failures: 6290 vm.pmap.pde.mappings: 610 vm.pmap.pde.demotions: 289 other question - tried enabling it on my i386 laptop (256 megs ram), always mappings==0, while promitions>demotions>0. certainly there are apps that could be put on big pages, gimp editing 40MB bitmap for example From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 18:20:02 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FC501065677 for ; Sun, 28 Jun 2009 18:20:02 +0000 (UTC) (envelope-from msnkipa@mail.ru) Received: from f103.mail.ru (f103.mail.ru [217.69.128.63]) by mx1.freebsd.org (Postfix) with ESMTP id B8FAB8FC19 for ; Sun, 28 Jun 2009 18:20:01 +0000 (UTC) (envelope-from msnkipa@mail.ru) Received: from mail by f103.mail.ru with local id 1MKyyu-0002jv-00 for freebsd-hackers@freebsd.org; Sun, 28 Jun 2009 22:20:00 +0400 Received: from [188.134.1.94] by win.mail.ru with HTTP; Sun, 28 Jun 2009 22:20:00 +0400 From: =?koi8-r?Q?=ED=C9=C8=C1=C9=CC_=EB=C9=D0=C1?= To: freebsd-hackers@freebsd.org Mime-Version: 1.0 X-Mailer: mPOP Web-Mail 2.19 X-Originating-IP: [188.134.1.94] Date: Sun, 28 Jun 2009 22:20:00 +0400 X-Mru-Data: 2695:1:1:107:107:0 Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8bit Message-Id: X-Spam: Not detected X-Mras: Ok Subject: Can I bind POSIX thread to cpu core? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: =?koi8-r?Q?=ED=C9=C8=C1=C9=CC_=EB=C9=D0=C1?= List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 18:20:02 -0000 I have system with 4 core cpu. How can I bind POSIX thread to the one core? I mean that this thread can be executed on the fixed core. From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 20:23:58 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADAED1065670 for ; Sun, 28 Jun 2009 20:23:58 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: from mail-qy0-f186.google.com (mail-qy0-f186.google.com [209.85.221.186]) by mx1.freebsd.org (Postfix) with ESMTP id 668388FC19 for ; Sun, 28 Jun 2009 20:23:58 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: by qyk16 with SMTP id 16so4013069qyk.3 for ; Sun, 28 Jun 2009 13:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=129n3zwdKB6zz7KQv8zXWGGvotghMAFV6qdeQgxzwgg=; b=Az+QD5DssaG5RjQem3UFNS/yMKhP2QX7RmUDhp5RutrR/Bs/d7qcBbXhZb9fEduZw7 VUOliovg8zuMcHkpiuiNVbehg04KC2zU94ivSz+4asxOoo8k6UUBbQPQSKC/KeOvxwaj m7M+lpIc0hhGVk81V3Il6urGl7x+3XcRor9lw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=xNTXc1WvdUo0et6FZag9nRRGINaHbjzCQ0/k1+z28o/9tTMl0VQQNkFsRSDbVZIZu7 B75JLq6906YkqzAA6vh+x1PLj6x9yAKyMJMHSmbtLhjczbtRWEWGKOJYOxGHtICgIn7n TPxW9vub4Ojv78lfBJK4s77MY5GY+gC8SSDL0= Received: by 10.224.6.143 with SMTP id 15mr4935469qaz.193.1246219269716; Sun, 28 Jun 2009 13:01:09 -0700 (PDT) Received: from aryeh-desktop.istudentunion.com (ool-44c0cd7a.dyn.optonline.net [68.192.205.122]) by mx.google.com with ESMTPS id 7sm13624758qwb.30.2009.06.28.13.01.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 28 Jun 2009 13:01:09 -0700 (PDT) Message-ID: <4A47CC07.1080506@gmail.com> Date: Sun, 28 Jun 2009 16:01:11 -0400 From: "Aryeh M. Friedman" User-Agent: Thunderbird 2.0.0.22 (X11/20090626) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: dynamic and static DNS in the samie name server X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 20:23:58 -0000 We have a name server set up that contains all our static IP's (in office but not for remote workers because they all have dynamic IP's).... we currently use dns/no-ip2 to manage this but I was wondering if it is possible to (easily) configure our internal nameserver to do this? From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 20:44:51 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1D641065677 for ; Sun, 28 Jun 2009 20:44:51 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from email1.allantgroup.com (email1.emsphone.com [199.67.51.115]) by mx1.freebsd.org (Postfix) with ESMTP id AA2058FC27 for ; Sun, 28 Jun 2009 20:44:51 +0000 (UTC) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by email1.allantgroup.com (8.14.0/8.14.0) with ESMTP id n5SKinuk057438 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 28 Jun 2009 15:44:50 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: from dan.emsphone.com (smmsp@localhost [127.0.0.1]) by dan.emsphone.com (8.14.3/8.14.3) with ESMTP id n5SKinY1031863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 28 Jun 2009 15:44:49 -0500 (CDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.14.3/8.14.3/Submit) id n5SKim7R031789; Sun, 28 Jun 2009 15:44:48 -0500 (CDT) (envelope-from dan) Date: Sun, 28 Jun 2009 15:44:47 -0500 From: Dan Nelson To: msnkipa@mail.ru Message-ID: <20090628204446.GI76275@dan.emsphone.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-OS: FreeBSD 7.2-STABLE User-Agent: Mutt/1.5.19 (2009-01-05) X-Virus-Scanned: ClamAV version 0.94.1, clamav-milter version 0.94.1 on email1.allantgroup.com X-Virus-Status: Clean X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2 (email1.allantgroup.com [199.67.51.78]); Sun, 28 Jun 2009 15:44:50 -0500 (CDT) X-Scanned-By: MIMEDefang 2.45 Cc: freebsd-hackers@freebsd.org Subject: Re: Can I bind POSIX thread to cpu core? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 20:44:52 -0000 In the last episode (Jun 28): > I have system with 4 core cpu. How can I bind POSIX thread to the one > core? I mean that this thread can be executed on the fixed core. See the cpuset(2) and cpuset_setaffinity(2) manpages. Something like this should work: #include #include #include #include int main(void) { int i; cpuset_t myset; /* Get CPU mask for the current thread */ if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(myset), &myset) == -1) err(1, "getaffinity failed"); /* Find first available CPU - don't assume CPU0 is always available */ for (i = 0; i < CPU_SETSIZE; i++) if (CPU_ISSET(i, &myset)) break; if (i == CPU_SETSIZE) err(1, "Not allowed to run on any CPUs? How did I print this, then?"); /* Set new CPU mask */ printf ("Setting affinity to CPU %d\n", i); CPU_ZERO(&myset); CPU_SET(i, &myset); if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(myset), &myset) == -1) warn("setaffinity failed"); /* Do CPU-intensive stuff here */ return 0; } -- Dan Nelson dnelson@allantgroup.com From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 21:37:55 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DB370106566C for ; Sun, 28 Jun 2009 21:37:55 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: from mail-qy0-f186.google.com (mail-qy0-f186.google.com [209.85.221.186]) by mx1.freebsd.org (Postfix) with ESMTP id 8F0098FC08 for ; Sun, 28 Jun 2009 21:37:55 +0000 (UTC) (envelope-from aryeh.friedman@gmail.com) Received: by qyk16 with SMTP id 16so4034597qyk.3 for ; Sun, 28 Jun 2009 14:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=U1LCJkaKFKuv1tdHSX+BUBom1An5LYBFzgseon6Fj2A=; b=BywiPuEU8d8sd/VzHd5qxW39dDRLWUcwipTf+njl8Bef8A3yNmVEQoDrkUL3rsnYl7 wYWOifxrxxO0pX+lLeigfJuED4+o/1sCr/1Ro9NWrls9o17o4OOVMr+nsLd3zwwMRR5k Bw0nkVY9830yToFlPzeTj43Cs4p97nYcLPV1U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=w9FU1njsCJwr0HooI0Y0spac0KijvJtyyVZ4weuYWG4x10zhwjwAqG6Gd21mv/MAfm cq+BGhX8Gevi8uFrdr17UbRuzysl6ocZGaeucYeqEL2efgR4OsBp3vSB7466TL5rG2te yjx0Ldan4BjIOhhVCxle1VXYkMEFrNV6+hZfI= Received: by 10.224.6.148 with SMTP id 20mr4999331qaz.203.1246225074196; Sun, 28 Jun 2009 14:37:54 -0700 (PDT) Received: from aryeh-desktop.istudentunion.com (ool-44c0cd7a.dyn.optonline.net [68.192.205.122]) by mx.google.com with ESMTPS id 5sm13834058qwg.55.2009.06.28.14.37.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 28 Jun 2009 14:37:53 -0700 (PDT) Message-ID: <4A47E2B3.8040103@gmail.com> Date: Sun, 28 Jun 2009 17:37:55 -0400 From: "Aryeh M. Friedman" User-Agent: Thunderbird 2.0.0.22 (X11/20090626) MIME-Version: 1.0 To: Mike Meyer References: <4A47CC07.1080506@gmail.com> <20090628170140.7169d64b@bhuda.mired.org> In-Reply-To: <20090628170140.7169d64b@bhuda.mired.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: dynamic and static DNS in the samie name server X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 21:37:56 -0000 Mike Meyer wrote: > On Sun, 28 Jun 2009 16:01:11 -0400 > "Aryeh M. Friedman" wrote: > > >> We have a name server set up that contains all our static IP's (in >> office but not for remote workers because they all have dynamic >> IP's).... we currently use dns/no-ip2 to manage this but I was >> wondering if it is possible to (easily) configure our internal >> nameserver to do this? >> > > This question is really more appropriate for -questions than > -hackers. If you asked on -questions and didn't get an answer there or > someone there pointed you here, you should let us know: it's always > wise to indicate previous research. > > You also didn't say what you were using for your internal name server, > which makes the matter of "easily" hard to answer. If you're a bind > expert, it's easy. If you're not a bind expert but using bind, it > probably isn't. Personally, I use dns/dnsmasq for such situations, as > that's pretty much what it's designed to do. It's also very > light-weight, sufficiently so that the various FOSS router builds > include it. > > > Thanks for attempting to help me find the right place to post but in my experience -questions@ tends to be about "standard" usage not "non-standard" usage questions thus I asked here... yes I am using BIND (the base system one) From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 22:16:02 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B52031065670 for ; Sun, 28 Jun 2009 22:16:02 +0000 (UTC) (envelope-from alan.l.cox@gmail.com) Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.210.181]) by mx1.freebsd.org (Postfix) with ESMTP id 6CE578FC16 for ; Sun, 28 Jun 2009 22:16:02 +0000 (UTC) (envelope-from alan.l.cox@gmail.com) Received: by yxe11 with SMTP id 11so3211201yxe.3 for ; Sun, 28 Jun 2009 15:16:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=a+jWFGK6f2IkXArxyaZVqY5AzJ9vy7k0RBULVzImqO8=; b=pc8CwIKxcQU+A3ZnZoC+YGM+b/nPjO9j65YXemVMifLoVPlMJziZ4KBcKMneJYXzP1 XXI+DFbFoKYb/2969C9CZ9MWyPF3V2HN9XmSX4uRtb+E0pGh2NsmFjigdEQJ+oClmmUx 59jjhwsWDkwFLOgI2rJP7y61ypG4yagEUotx8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=GuPu3mNMBZvHw4cEVklL+QMTUnw7LJlJ0NJ8t4nozrVgKlWdEpSBDTVw5BwT2oH+uh gcWbXdN16mb/1K/xH01KeJMwExhkWqxONE6OqMZIefrQRqFydahD5/whYWV80GPNfopX MjCvGNl1zpnrmhCUfZjrLInQ3gweUxRerM7Lo= MIME-Version: 1.0 Received: by 10.151.48.20 with SMTP id a20mr500486ybk.112.1246225877144; Sun, 28 Jun 2009 14:51:17 -0700 (PDT) In-Reply-To: References: Date: Sun, 28 Jun 2009 16:51:17 -0500 Message-ID: From: Alan Cox To: Wojciech Puchar Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: alc@freebsd.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 22:16:03 -0000 On Sun, Jun 28, 2009 at 12:36 PM, Wojciech Puchar < wojtek@wojtek.tensor.gdynia.pl> wrote: > i enabled > vm.pmap.pg_ps_enabled: 1 > > > could you please explain what exactly this values means? > because i don't understand why promotions-demotions!=mappings > "mappings" is not what you seem to think it is. vm.pmap.pde.mappings is the number of 2/4MB page mappings that are created directly and not through the incremental promotion process. For example, it counts the 2/4MB page mappings that are created when the text segment of a large executable, e.g., gcc, is pre-faulted at startup or when a graphics card's frame buffer is mmap()ed. Moreover, not every promoted mapping is demoted. A promoted mapping may be destroyed without demotion, for example, when a process exits. This is, in fact, the ideal case because it is cheaper to destroy a single 2/4MB page mapping instead of 512 or 1024 4KB page mappings. > > vm.pmap.pde.promotions: 2703 > vm.pmap.pde.p_failures: 6290 > vm.pmap.pde.mappings: 610 > vm.pmap.pde.demotions: 289 > > > > > other question - tried enabling it on my i386 laptop (256 megs ram), always > mappings==0, while promitions>demotions>0. > The default starting address for executables on i386 is not aligned to a 2/4MB page boundary. Hence, "mappings" are much less likely to occur. > certainly there are apps that could be put on big pages, gimp editing 40MB > bitmap for example Regards, Alan From owner-freebsd-hackers@FreeBSD.ORG Sun Jun 28 22:28:48 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 294DD1065674; Sun, 28 Jun 2009 22:28:48 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojteks.tensor.gdynia.pl (wojteks.tensor.gdynia.pl [IPv6:2001:4070:101:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id E7EF98FC17; Sun, 28 Jun 2009 22:28:46 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [IPv6:2001:4070:101:2::2]) by wojteks.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n5SMSnJ9014018; Mon, 29 Jun 2009 00:28:49 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n5SMPKg7037505; Mon, 29 Jun 2009 00:25:20 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3/Submit) with ESMTP id n5SMPK1N037502; Mon, 29 Jun 2009 00:25:20 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Mon, 29 Jun 2009 00:25:20 +0200 (CEST) From: Wojciech Puchar To: alc@freebsd.org In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Jun 2009 22:28:48 -0000 > > other question - tried enabling it on my i386 laptop (256 megs ram), always > mappings==0, while promitions>demotions>0. > > > The default starting address for executables on i386 is not aligned to a 2/4MB page boundary. > Hence, "mappings" are much less likely to occur. > > > certainly there are apps that could be put on big pages, gimp editing 40MB bitmap for > example > > > Regards, > Alan > > > how can i check how much (or maybe - what processes) 2MB pages are actually allocated? From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 00:10:18 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A0A1106567A for ; Mon, 29 Jun 2009 00:10:18 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 118848FC1B for ; Mon, 29 Jun 2009 00:10:17 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 0F4302C2AAC; Sun, 28 Jun 2009 18:41:58 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id IytAcNxCkx5W; Sun, 28 Jun 2009 18:41:50 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 440162C2B02; Sun, 28 Jun 2009 18:41:50 -0500 (CDT) Message-ID: <4A47FFBD.3070900@cs.rice.edu> Date: Sun, 28 Jun 2009 18:41:49 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.22 (X11/20090626) MIME-Version: 1.0 To: Wojciech Puchar References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: alc@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 00:10:18 -0000 Wojciech Puchar wrote: >> >> other question - tried enabling it on my i386 laptop (256 megs >> ram), always >> mappings==0, while promitions>demotions>0. >> >> >> The default starting address for executables on i386 is not aligned >> to a 2/4MB page boundary. Hence, "mappings" are much less likely to >> occur. >> >> >> certainly there are apps that could be put on big pages, gimp >> editing 40MB bitmap for >> example >> >> >> Regards, >> Alan >> >> >> > how can i check how much (or maybe - what processes) 2MB pages are > actually allocated? I'm afraid that you can't with great precision. For a given program execution, on an otherwise idle machine, you can only estimate the number by looking at the change in the quantity "promotions + mappings - demotions" before, during, and after the program execution. A program can call mincore(2) in order to determine if a virtual address is part of a 2 or 4MB virtual page. Alan From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 00:27:09 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 158DC106564A for ; Mon, 29 Jun 2009 00:27:09 +0000 (UTC) (envelope-from nhoyle@hoyletech.com) Received: from mout.perfora.net (mout.perfora.net [74.208.4.195]) by mx1.freebsd.org (Postfix) with ESMTP id D63E88FC23 for ; Mon, 29 Jun 2009 00:27:08 +0000 (UTC) (envelope-from nhoyle@hoyletech.com) Received: from [192.168.1.10] (pool-96-231-140-65.washdc.fios.verizon.net [96.231.140.65]) by mrelay.perfora.net (node=mrus0) with ESMTP (Nemesis) id 0MKp8S-1ML4Vv0GkL-000SW8; Sun, 28 Jun 2009 20:14:29 -0400 Message-ID: <4A480760.50705@hoyletech.com> Date: Sun, 28 Jun 2009 20:14:24 -0400 From: Nathanael Hoyle User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: Wojciech Puchar References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1/3Ajplncj0A0qp4qSPbvv8sxfxiJAZUcW3KBk nZWRxdlmJI/BfxkaaMDFIZA0CPYUvF+Lhjiiu6c5zD2RGQyDJV UobbuME4iO5KEbQbB8pU/9oMfOOuuaU Cc: freebsd-hackers@freebsd.org Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 00:27:09 -0000 Wojciech Puchar wrote: > i enabled > vm.pmap.pg_ps_enabled: 1 > > > could you please explain what exactly this values means? > because i don't understand why promotions-demotions!=mappings > > vm.pmap.pde.promotions: 2703 > vm.pmap.pde.p_failures: 6290 > vm.pmap.pde.mappings: 610 > vm.pmap.pde.demotions: 289 > > > > > other question - tried enabling it on my i386 laptop (256 megs ram), > always mappings==0, while promitions>demotions>0. > > certainly there are apps that could be put on big pages, gimp editing > 40MB bitmap for example Just to be clear, since you say i386 (I presume you mean architecture), I believe the Physical Address Extensions which allowed 2MB Page Size bit to be set was introduced with Pentium Pro. Processors prior to this were limited to standard 4KB pages. -Nathanael From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 00:35:19 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DD285106567D for ; Mon, 29 Jun 2009 00:35:19 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from www.sonnenberger.org (www.ostsee-abc.de [62.206.222.50]) by mx1.freebsd.org (Postfix) with ESMTP id 99D208FC08 for ; Mon, 29 Jun 2009 00:35:19 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from britannica.bec.de (www.sonnenberger.org [192.168.1.10]) by www.sonnenberger.org (Postfix) with ESMTP id 72A8866797 for ; Mon, 29 Jun 2009 02:35:17 +0200 (CEST) Received: by britannica.bec.de (Postfix, from userid 1000) id 2C21B1BD949; Mon, 29 Jun 2009 02:35:23 +0200 (CEST) Date: Mon, 29 Jun 2009 02:35:22 +0200 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org Message-ID: <20090629003522.GA18543@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org References: <4A480760.50705@hoyletech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A480760.50705@hoyletech.com> User-Agent: Mutt/1.5.19 (2009-01-05) Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 00:35:20 -0000 On Sun, Jun 28, 2009 at 08:14:24PM -0400, Nathanael Hoyle wrote: > Just to be clear, since you say i386 (I presume you mean architecture), > I believe the Physical Address Extensions which allowed 2MB Page Size > bit to be set was introduced with Pentium Pro. Processors prior to this > were limited to standard 4KB pages. PSE != PAE != PSE36. Pentium Pro sounds about right though. Joerg From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 00:41:15 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DF6E0106564A for ; Mon, 29 Jun 2009 00:41:15 +0000 (UTC) (envelope-from alan.l.cox@gmail.com) Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.210.181]) by mx1.freebsd.org (Postfix) with ESMTP id 9727D8FC18 for ; Mon, 29 Jun 2009 00:41:15 +0000 (UTC) (envelope-from alan.l.cox@gmail.com) Received: by yxe11 with SMTP id 11so3301511yxe.3 for ; Sun, 28 Jun 2009 17:41:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=uA8sN5jVCbleWHVEURmxF9YJy2brUR+DZSbMyOfIDoo=; b=ukdeFYiHNhEIpV6VuKFjVkifQEuqm1qoXTwJmIGvXMQ9KGSa8SmRJjTK0k2UI4yIwi aykBta9GdKLAziS22KZCDi/Vn2ltdECWv9vs5ygALOPh//h89RNefnHXq9mE/YN9pWAo tqq067Cjb5ZEjhji4e3oZA4IMbSOrMFuj6FTE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; b=UzOF7sOhABrvSRBvMmMcfs+tOjzPKfRabXvMCad8JdZseKnBvtlAAkD0bnIdgxbd3D hLiyr66TT+NsNWHxS4/4YNMfICWfTsBIg2qxqe/7ZPf4claFKNuz4fqkXBKuAzVW2nLo S2/MjpaaCcXnRBeQOfMc/QSIOUIiDjZmwAgRA= MIME-Version: 1.0 Received: by 10.151.72.4 with SMTP id z4mr3385131ybk.25.1246236074574; Sun, 28 Jun 2009 17:41:14 -0700 (PDT) In-Reply-To: <4A480760.50705@hoyletech.com> References: <4A480760.50705@hoyletech.com> Date: Sun, 28 Jun 2009 19:41:14 -0500 Message-ID: From: Alan Cox To: Nathanael Hoyle Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Wojciech Puchar , freebsd-hackers@freebsd.org Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: alc@freebsd.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 00:41:16 -0000 On Sun, Jun 28, 2009 at 7:14 PM, Nathanael Hoyle wrote: > Wojciech Puchar wrote: > >> i enabled >> vm.pmap.pg_ps_enabled: 1 >> >> >> could you please explain what exactly this values means? >> because i don't understand why promotions-demotions!=mappings >> >> vm.pmap.pde.promotions: 2703 >> vm.pmap.pde.p_failures: 6290 >> vm.pmap.pde.mappings: 610 >> vm.pmap.pde.demotions: 289 >> >> >> >> >> other question - tried enabling it on my i386 laptop (256 megs ram), >> always mappings==0, while promitions>demotions>0. >> >> certainly there are apps that could be put on big pages, gimp editing 40MB >> bitmap for example >> > > Just to be clear, since you say i386 (I presume you mean architecture), I > believe the Physical Address Extensions which allowed 2MB Page Size bit to > be set was introduced with Pentium Pro. Processors prior to this were > limited to standard 4KB pages. > No. Many of those processors supported 4MB pages. Regards, Alan From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 00:54:29 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75C9A106567E for ; Mon, 29 Jun 2009 00:54:29 +0000 (UTC) (envelope-from nhoyle@hoyletech.com) Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) by mx1.freebsd.org (Postfix) with ESMTP id 3FDDE8FC18 for ; Mon, 29 Jun 2009 00:54:29 +0000 (UTC) (envelope-from nhoyle@hoyletech.com) Received: from [192.168.1.10] (pool-96-231-140-65.washdc.fios.verizon.net [96.231.140.65]) by mrelay.perfora.net (node=mrus1) with ESMTP (Nemesis) id 0MKpCa-1ML58Z1wua-000BsW; Sun, 28 Jun 2009 20:54:27 -0400 Message-ID: <4A4810BB.1010007@hoyletech.com> Date: Sun, 28 Jun 2009 20:54:19 -0400 From: Nathanael Hoyle User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: alc@freebsd.org References: <4A480760.50705@hoyletech.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX1+jiPym52ZTDjC1TcLHGqQVGtw3sYrT4a7Ixbo QeO992NOXSI2WrNnv/InAXh32raLZy6vyzErZv2s1Mhc8jIccU s6gr+41OSwgAl/cVPq3fPK5wp46+V8Q Cc: Wojciech Puchar , freebsd-hackers@freebsd.org Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 00:54:30 -0000 Alan Cox wrote: > On Sun, Jun 28, 2009 at 7:14 PM, Nathanael Hoyle wrote: > > >> Wojciech Puchar wrote: >> >> >>> i enabled >>> vm.pmap.pg_ps_enabled: 1 >>> >>> >>> could you please explain what exactly this values means? >>> because i don't understand why promotions-demotions!=mappings >>> >>> vm.pmap.pde.promotions: 2703 >>> vm.pmap.pde.p_failures: 6290 >>> vm.pmap.pde.mappings: 610 >>> vm.pmap.pde.demotions: 289 >>> >>> >>> >>> >>> other question - tried enabling it on my i386 laptop (256 megs ram), >>> always mappings==0, while promitions>demotions>0. >>> >>> certainly there are apps that could be put on big pages, gimp editing 40MB >>> bitmap for example >>> >>> >> Just to be clear, since you say i386 (I presume you mean architecture), I >> believe the Physical Address Extensions which allowed 2MB Page Size bit to >> be set was introduced with Pentium Pro. Processors prior to this were >> limited to standard 4KB pages. >> >> > > No. Many of those processors supported 4MB pages. > > Regards, > Alan > _______________________________________________ > Having been corrected by both you and Joerg (thank you!), I went back to re-verify my understanding. It appears that while I was slightly mixing PAE in with PSE, PSE support for 4MB pages was introduced 'silently' with the Pentium, and documented first with the Pentium Pro. I haven't found anything that points to earlier inclusion. Certainly the 80386 processor specifically, I am fairly confident would be limited to the 4KB pages. Agreed? Or are you aware of earlier usage than the Pentium for 4MB pages? Thanks, -Nathanael From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 26 20:24:10 2009 Return-Path: Delivered-To: hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 195521065675; Fri, 26 Jun 2009 20:24:10 +0000 (UTC) (envelope-from sos@deepcore.dk) Received: from deepcore.dk (adsl.deepcore.dk [87.63.29.106]) by mx1.freebsd.org (Postfix) with ESMTP id 9BCBE8FC1B; Fri, 26 Jun 2009 20:24:09 +0000 (UTC) (envelope-from sos@deepcore.dk) Received: from [192.168.0.138] ([192.168.0.138]) by deepcore.dk (8.14.3/8.14.2) with ESMTP id n5QKB8Fv003798; Fri, 26 Jun 2009 22:11:08 +0200 (CEST) (envelope-from sos@deepcore.dk) Message-Id: <8EB69F68-8ED2-469C-B83E-2555A72630B4@deepcore.dk> From: =?ISO-8859-1?Q?S=F8ren_Schmidt?= To: stable@FreeBSD.ORG Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v935.3) Date: Fri, 26 Jun 2009 22:11:08 +0200 X-Mailer: Apple Mail (2.935.3) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (deepcore.dk [217.20.59.72]); Fri, 26 Jun 2009 22:11:08 +0200 (CEST) X-Mailman-Approved-At: Mon, 29 Jun 2009 01:00:40 +0000 Cc: hackers@FreeBSD.ORG Subject: ATA driver update for 7.2RELEASE available X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 20:24:10 -0000 Over the past months I've gotten huge amounts of requests for ATA =20 related things, so I've whipped up what I use here for FreeBSD 7.2-=20 Release. This is a total replacement of the ATA driver, modulerized as in -=20 current, but based on my WIP not from what might have happend to -=20 current since I gave up maintainership. There is a number of new chipsets supported in here that I dont think =20= is in any of the official sources (havn't checked in quite some time =20 though), mostly newish ATI, nVidia and Marvell chips (yeah those =20 buggers with both ATA & SATA ports). You can find and install.sh script and a tarball of the needed files at: http://www.deepcore.dk/pub/ATA Put both in /usr/src and run install.sh. As I dont subscribe to any of the mailing lists nor does my =20 FreeBSD.org mail address seem to work anymore, you will need to reply =20= to me directly if needed. As always - Enjoy! -S=F8ren -- From owner-freebsd-hackers@FreeBSD.ORG Fri Jun 26 23:39:03 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DCA60106564A for ; Fri, 26 Jun 2009 23:39:03 +0000 (UTC) (envelope-from bvowk@math.ualberta.ca) Received: from 3jane.math.ualberta.ca (3jane.math.ualberta.ca [129.128.206.44]) by mx1.freebsd.org (Postfix) with ESMTP id B4BFD8FC08 for ; Fri, 26 Jun 2009 23:39:03 +0000 (UTC) (envelope-from bvowk@math.ualberta.ca) Received: from 3jane.math.ualberta.ca (localhost.math.ualberta.ca [127.0.0.1]) by 3jane.math.ualberta.ca (8.14.3/8.14.3) with ESMTP id n5QMxTuR096668 for ; Fri, 26 Jun 2009 16:59:29 -0600 (MDT) (envelope-from bvowk@math.ualberta.ca) Received: from localhost (bvowk@localhost) by 3jane.math.ualberta.ca (8.14.3/8.14.3/Submit) with ESMTP id n5QMxTa4096665 for ; Fri, 26 Jun 2009 16:59:29 -0600 (MDT) (envelope-from bvowk@math.ualberta.ca) X-Authentication-Warning: 3jane.math.ualberta.ca: bvowk owned process doing -bs Date: Fri, 26 Jun 2009 16:59:29 -0600 (MDT) From: Barkley Vowk To: hackers@freebsd.org Message-ID: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Mailman-Approved-At: Mon, 29 Jun 2009 01:00:54 +0000 Cc: Subject: rpc.yppasswdd fails in 7.2? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2009 23:39:04 -0000 I've got a 7.2 box acting as NIS master, running rpc.yppasswdd. When remote users try to change their passwords they see: testing1# passwd mytest Changing NIS password for mytest Old Password: New Password: Retype New Password: passwd: pam_chauthtok(): error in service module On the server I get this in the logs: rpc.yppasswdd[36858]: pw_mkdb() failed I tracked the error message down to line 620 of yppasswdd_server.c, which lead me to libutil/pw_util.c. It looks like waitpid in mk_pwdb is returning the error "No child processes", which then makes mk_pwdb return an error. But the child does run and do it's job as expected. If you edit yppasswdd_server.c to ignore the return value of mk_pwdb, passwords are changed as expected. From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 01:03:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 645041065674 for ; Mon, 29 Jun 2009 01:03:50 +0000 (UTC) (envelope-from nhoyle@hoyletech.com) Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) by mx1.freebsd.org (Postfix) with ESMTP id 3046A8FC19 for ; Mon, 29 Jun 2009 01:03:49 +0000 (UTC) (envelope-from nhoyle@hoyletech.com) Received: from [192.168.1.10] (pool-96-231-140-65.washdc.fios.verizon.net [96.231.140.65]) by mrelay.perfora.net (node=mrus0) with ESMTP (Nemesis) id 0MKp8S-1ML5Hg0HVe-000SSE; Sun, 28 Jun 2009 21:03:49 -0400 Message-ID: <4A4812F0.2080208@hoyletech.com> Date: Sun, 28 Jun 2009 21:03:44 -0400 From: Nathanael Hoyle User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <4A480760.50705@hoyletech.com> <20090629003522.GA18543@britannica.bec.de> In-Reply-To: <20090629003522.GA18543@britannica.bec.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V01U2FsdGVkX19nMwxvmrS8MKNuSAb3uweNpDWkYQZjwo901e3 gn3ObL8qt7hlh9OBW5VsaeZB51Zh7jS7wVaVIvvhdBhOS5Dau4 Ws5JllidRvQaiTT1FoqsU76rSQg+/BQ Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 01:03:51 -0000 Joerg Sonnenberger wrote: > On Sun, Jun 28, 2009 at 08:14:24PM -0400, Nathanael Hoyle wrote: > >> Just to be clear, since you say i386 (I presume you mean architecture), >> I believe the Physical Address Extensions which allowed 2MB Page Size >> bit to be set was introduced with Pentium Pro. Processors prior to this >> were limited to standard 4KB pages. >> > > PSE != PAE != PSE36. Pentium Pro sounds about right though. > > Joerg > Thanks for the clarification/correction. PSE does not depend on PAE, though both were introduced at roughly the same time (appears PSE was introduced silently in Pentium, officially in Pentium Pro). I definitely wasn't thinking of PSE36, which was the Pentium III. -Nathanael From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 05:59:16 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F00D1065686; Mon, 29 Jun 2009 05:59:16 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 756E08FC0A; Mon, 29 Jun 2009 05:59:16 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id E62162C2AAC; Mon, 29 Jun 2009 00:59:15 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 3DWwfxvHYiYq; Mon, 29 Jun 2009 00:59:08 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 073882C2A8E; Mon, 29 Jun 2009 00:59:08 -0500 (CDT) Message-ID: <4A48582B.8050009@cs.rice.edu> Date: Mon, 29 Jun 2009 00:59:07 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.22 (X11/20090626) MIME-Version: 1.0 To: Nathanael Hoyle References: <4A480760.50705@hoyletech.com> <4A4810BB.1010007@hoyletech.com> In-Reply-To: <4A4810BB.1010007@hoyletech.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: alc@freebsd.org, Wojciech Puchar , freebsd-hackers@freebsd.org Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 05:59:16 -0000 Nathanael Hoyle wrote: [snip] > Having been corrected by both you and Joerg (thank you!), I went back > to re-verify my understanding. It appears that while I was slightly > mixing PAE in with PSE, PSE support for 4MB pages was introduced > 'silently' with the Pentium, and documented first with the Pentium > Pro. I haven't found anything that points to earlier inclusion. > Certainly the 80386 processor specifically, I am fairly confident > would be limited to the 4KB pages. > > Agreed? Or are you aware of earlier usage than the Pentium for 4MB pages? > Yes, I agree. I'm not aware of 4MB page support before the Pentium. Regards, Alan From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 10:02:18 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA1441065678; Mon, 29 Jun 2009 10:02:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (skuns.zoral.com.ua [91.193.166.194]) by mx1.freebsd.org (Postfix) with ESMTP id 524B58FC13; Mon, 29 Jun 2009 10:02:18 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id n5T9nNdR020252 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 29 Jun 2009 12:49:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3) with ESMTP id n5T9nNnq001173; Mon, 29 Jun 2009 12:49:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.3/8.14.3/Submit) id n5T9nNFM001172; Mon, 29 Jun 2009 12:49:23 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 29 Jun 2009 12:49:23 +0300 From: Kostik Belousov To: Barkley Vowk Message-ID: <20090629094923.GU2884@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EzyTiZo8w1pFn3ee" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.1 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: hackers@freebsd.org, delphij@freebsd.org, rafan@freebsd.org Subject: Re: rpc.yppasswdd fails in 7.2? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 10:02:19 -0000 --EzyTiZo8w1pFn3ee Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Jun 26, 2009 at 04:59:29PM -0600, Barkley Vowk wrote: > I've got a 7.2 box acting as NIS master, running rpc.yppasswdd. When=20 > remote users try to change their passwords they see: >=20 > testing1# passwd mytest > Changing NIS password for mytest > Old Password: > New Password: > Retype New Password: > passwd: pam_chauthtok(): error in service module >=20 > On the server I get this in the logs: > rpc.yppasswdd[36858]: pw_mkdb() failed >=20 > I tracked the error message down to line 620 of yppasswdd_server.c, which > lead me to libutil/pw_util.c. >=20 > It looks like waitpid in mk_pwdb is returning the error "No child=20 > processes", which then makes mk_pwdb return an error. But the child does= =20 > run and do it's job as expected. If you edit yppasswdd_server.c to ignore= =20 > the return value of mk_pwdb, passwords are changed as expected. I think this is a side-effect of r184459/r186756, that made rpc.yppasswdd to ignore SIGCHLD. --EzyTiZo8w1pFn3ee Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkpIjiIACgkQC3+MBN1Mb4hkDwCfbwZN8ules/o3b8fv7V28bHf0 pUUAn2Rwuf0WogYhBDeij1Axm6KH8hc+ =W9lh -----END PGP SIGNATURE----- --EzyTiZo8w1pFn3ee-- From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 11:40:32 2009 Return-Path: Delivered-To: hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0655110656AB; Mon, 29 Jun 2009 11:40:32 +0000 (UTC) (envelope-from rafan@svm.csie.ntu.edu.tw) Received: from svm.csie.ntu.edu.tw (svm.csie.ntu.edu.tw [140.112.90.75]) by mx1.freebsd.org (Postfix) with ESMTP id 8216B8FC14; Mon, 29 Jun 2009 11:40:31 +0000 (UTC) (envelope-from rafan@svm.csie.ntu.edu.tw) Received: from svm.csie.ntu.edu.tw (localhost [127.0.0.1]) by svm.csie.ntu.edu.tw (8.14.3/8.14.3) with ESMTP id n5TBLiqL080024; Mon, 29 Jun 2009 19:21:44 +0800 (CST) (envelope-from rafan@svm.csie.ntu.edu.tw) Received: (from rafan@localhost) by svm.csie.ntu.edu.tw (8.14.3/8.14.3/Submit) id n5TBLinR095167; Mon, 29 Jun 2009 19:21:44 +0800 (CST) (envelope-from rafan) Date: Mon, 29 Jun 2009 19:21:44 +0800 From: Rong-En Fan To: Kostik Belousov Message-ID: <20090629112144.GD27380@svm.csie.ntu.edu.tw> References: <20090629094923.GU2884@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="11Y7aswkeuHtSBEs" Content-Disposition: inline In-Reply-To: <20090629094923.GU2884@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.19 (2009-01-05) X-Mailman-Approved-At: Mon, 29 Jun 2009 12:03:07 +0000 Cc: Barkley Vowk , delphij@FreeBSD.ORG, rafan@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: rpc.yppasswdd fails in 7.2? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 11:40:32 -0000 --11Y7aswkeuHtSBEs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 29, 2009 at 12:49:23PM +0300, Kostik Belousov wrote: > On Fri, Jun 26, 2009 at 04:59:29PM -0600, Barkley Vowk wrote: > > I've got a 7.2 box acting as NIS master, running rpc.yppasswdd. When=20 > > remote users try to change their passwords they see: > >=20 > > testing1# passwd mytest > > Changing NIS password for mytest > > Old Password: > > New Password: > > Retype New Password: > > passwd: pam_chauthtok(): error in service module > >=20 > > On the server I get this in the logs: > > rpc.yppasswdd[36858]: pw_mkdb() failed > >=20 > > I tracked the error message down to line 620 of yppasswdd_server.c, whi= ch > > lead me to libutil/pw_util.c. > >=20 > > It looks like waitpid in mk_pwdb is returning the error "No child=20 > > processes", which then makes mk_pwdb return an error. But the child doe= s=20 > > run and do it's job as expected. If you edit yppasswdd_server.c to igno= re=20 > > the return value of mk_pwdb, passwords are changed as expected. >=20 > I think this is a side-effect of r184459/r186756, that made rpc.yppasswdd= to > ignore SIGCHLD. It only happens when the master uses /etc/master.passwd instead of /var/yp/master.passwd.=20 The zombie mentioned in the commit log was yppwupdate. Two possible soluutions are: we wait until the push is succeed or we use a double fork. Personally, I prefer the former approach. Regards, Rong-En Fan --11Y7aswkeuHtSBEs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.11 (FreeBSD) iEYEARECAAYFAkpIo8cACgkQ144QkYb9jGhHNgCgikckvIMIi0guUQ6Vs3cMxRoO BgYAoIZ21t0k5lSynquMALK6k5Xgv7Wz =z7s/ -----END PGP SIGNATURE----- --11Y7aswkeuHtSBEs-- From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 21:17:13 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DECD4106566C for ; Mon, 29 Jun 2009 21:17:13 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id AC4118FC24 for ; Mon, 29 Jun 2009 21:17:13 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from smoochies.rachie.is-a-geek.net (mailhub.lan.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id E36657E837; Mon, 29 Jun 2009 13:17:12 -0800 (AKDT) From: Mel Flynn To: freebsd-hackers@freebsd.org Date: Mon, 29 Jun 2009 13:17:11 -0800 User-Agent: KMail/1.11.4 (FreeBSD/8.0-CURRENT; KDE/4.2.4; i386; ; ) References: <4A47FFBD.3070900@cs.rice.edu> In-Reply-To: <4A47FFBD.3070900@cs.rice.edu> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200906291317.12040.mel.flynn+fbsd.hackers@mailing.thruhere.net> Cc: Wojciech Puchar , Alan Cox Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 21:17:14 -0000 On Sunday 28 June 2009 15:41:49 Alan Cox wrote: > Wojciech Puchar wrote: > > how can i check how much (or maybe - what processes) 2MB pages are > > actually allocated? > > I'm afraid that you can't with great precision. For a given program > execution, on an otherwise idle machine, you can only estimate the > number by looking at the change in the quantity "promotions + mappings - > demotions" before, during, and after the program execution. > > A program can call mincore(2) in order to determine if a virtual address > is part of a 2 or 4MB virtual page. Would it be possible to expose the super page count as kve_super in the kinfo_vmentry struct so that procstat can show this information? If only to determine if one is using the feature and possibly benefiting from it. It looks like sys/kern/kern_proc.c could call mincore around the loop at line 1601 (rev 194498), but I know nothing about the vm subsystem to know the implications or locking involved. There's still 16 bytes of spare to consume, in the kve_vminfo struct though ;) -- Mel From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 21:36:55 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82E581065674 for ; Mon, 29 Jun 2009 21:36:55 +0000 (UTC) (envelope-from xorquewasp@googlemail.com) Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com [209.85.219.213]) by mx1.freebsd.org (Postfix) with ESMTP id 158818FC0C for ; Mon, 29 Jun 2009 21:36:54 +0000 (UTC) (envelope-from xorquewasp@googlemail.com) Received: by ewy9 with SMTP id 9so3966500ewy.43 for ; Mon, 29 Jun 2009 14:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:subject :message-id:mime-version:content-type:content-disposition; bh=Xm502DgN30k7wiB4KkoQX+F8jsTw9bC7nZ3FWT8kRmw=; b=MAYDZsIVWDYn7rXuR2KI5VUYpxNlIqSKKwTIjAeeoJhTvDEOxSoelF0piX4vMbLKG6 bB1BmHGUVwom9qli297UKV+m4H7W7sN8kaZSdAgZmY5hCywaCKNSJt2KZi0XSUrQYjCn vl735DIgmAJjQHtyFy/tcLcY7RYsmqHWP5ElY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition; b=FXAE5NMqvtYGhmbQAaIyfOwEKitcSIIg2Y/Or0DaazLSYBX7Dbnz7LsinZrMLwzSQe Ji/8pCUmtbdNHWdCcD2+DHNnvohfvIEABpmM4tQydS0H43Lo/9iVMzNJxgfF76koGOQK gFN78a4Nf0AEJkFSesFkFK0IYJgLv/dYQ+Uas= Received: by 10.210.110.2 with SMTP id i2mr166000ebc.31.1246311413674; Mon, 29 Jun 2009 14:36:53 -0700 (PDT) Received: from logik.internal.network (geeshaulage.lcdsl.co.uk [62.249.247.223]) by mx.google.com with ESMTPS id 4sm12821521ewy.8.2009.06.29.14.36.53 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Jun 2009 14:36:53 -0700 (PDT) Received: by logik.internal.network (Postfix, from userid 11001) id 2A2735D59; Mon, 29 Jun 2009 21:36:52 +0000 (UTC) Date: Mon, 29 Jun 2009 22:36:52 +0100 From: xorquewasp@googlemail.com To: freebsd-hackers@freebsd.org Message-ID: <20090629213652.GA28392@logik.internal.network> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: Re: bootstrapping gnat GCC on amd64 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 21:36:55 -0000 On 2009-06-29 17:27:40, Daniel Eischen wrote: > How's this all going? > > I'm updating lang/gnat to gnat-2009 right now. In the > GNAT sources, it has build instructions including how > to build the cross - see below. 'Lo, Thanks for the info. GPL 2009 was also on my list, as was SPARK (apparently that's going to take a bit of work as it doesn't work out of the box with any freely available prolog). I'm currently stalled trying to get the test suite to run so that I can submit a couple of patches back upstream to the GCC project. Once they're in, I can start working on a lang/gnat-gcc44 port. xw From owner-freebsd-hackers@FreeBSD.ORG Mon Jun 29 21:47:35 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83874106566C for ; Mon, 29 Jun 2009 21:47:35 +0000 (UTC) (envelope-from eischen@vigrid.com) Received: from mail.netplex.net (mail.netplex.net [204.213.176.10]) by mx1.freebsd.org (Postfix) with ESMTP id 18F9D8FC14 for ; Mon, 29 Jun 2009 21:47:34 +0000 (UTC) (envelope-from eischen@vigrid.com) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) by mail.netplex.net (8.14.3/8.14.3/NETPLEX) with ESMTP id n5TLRenu001508; Mon, 29 Jun 2009 17:27:40 -0400 (EDT) X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.netplex.net) X-Greylist: Message whitelisted by DRAC access database, not delayed by milter-greylist-4.2.2 (mail.netplex.net [204.213.176.10]); Mon, 29 Jun 2009 17:27:41 -0400 (EDT) Date: Mon, 29 Jun 2009 17:27:40 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: xorquewasp@googlemail.com In-Reply-To: <20090519135917.GA5391@logik.internal.network> Message-ID: References: <20090505022151.GA32477@logik.internal.network> <20090506140325.GA69468@logik.internal.network> <20090506152222.GC69468@logik.internal.network> <20090508211022.GA37475@logik.internal.network> <20090518084831.GA95354@logik.internal.network> <20090519114548.GA8610@logik.internal.network> <20090519135917.GA5391@logik.internal.network> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org Subject: Re: bootstrapping gnat GCC on amd64 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 21:47:35 -0000 How's this all going? I'm updating lang/gnat to gnat-2009 right now. In the GNAT sources, it has build instructions including how to build the cross - see below. -- DE -------------------------------------- -- BUILDING GNAT - EXAMPLE SEQUENCE -- -------------------------------------- Supposing you have one tarball for the GCC sources and one for the GNAT sources, here is a possible way to proceed: 0/ If not available on your system, build libgmp and libmpfr following build instructions from these packages. 1/ Create a root directory into which you'll later setup the source and build subdirectories: ~ $ mkdir GNAT ~ $ cd GNAT 2/ Setup an initial source tree from the GCC and the GNAT tarballs: ~/GNAT $ gzip -dc [...]/gcc-4.3*.tgz | tar xf - ~/GNAT $ mv gcc-4* src ~/GNAT $ cd src ~/GNAT/src $ gzip -dc [...]/gnat-xxx-src.tgz | tar xf - ~/GNAT/src $ mv gnat-xxx-src/src/ada gcc ~/GNAT/src $ patch -p0 < gnat-xxx-src/src/gcc-43.dif ~/GNAT/src $ touch gcc/cstamp-h.in 3/ Prepare and configure the build tree: ~/GNAT/src $ mkdir ../obj; cd ../obj ~/GNAT/obj $ ../src/configure --enable-languages="c,ada" --disable-libada ... [see the GCC documentation for other relevant configure options] 4/ Build the compiler, run time and tools: Note that the use of "GNU Make" is required by the GCC Makefiles. ~/GNAT/obj $ make bootstrap ~/GNAT/obj $ make -C gcc gnatlib gnattools If you are building a cross compiler, you will need to replace the above sequence by something similar to: ~/GNAT/obj $ make ~/GNAT/obj $ make -C gcc gnatlib cross-gnattools ada.all.cross 5/ Install the whole package: ~/GNAT/obj $ make install From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 08:24:09 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C8381065673 for ; Tue, 30 Jun 2009 08:24:09 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id 24D558FC08 for ; Tue, 30 Jun 2009 08:24:09 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id B65282C2A91; Tue, 30 Jun 2009 03:24:08 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id WY53dH6diArl; Tue, 30 Jun 2009 03:24:01 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id E6A5A2C2A7E; Tue, 30 Jun 2009 03:24:00 -0500 (CDT) Message-ID: <4A49CBA0.1050806@cs.rice.edu> Date: Tue, 30 Jun 2009 03:24:00 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.22 (X11/20090626) MIME-Version: 1.0 To: Mel Flynn References: <4A47FFBD.3070900@cs.rice.edu> <200906291317.12040.mel.flynn+fbsd.hackers@mailing.thruhere.net> In-Reply-To: <200906291317.12040.mel.flynn+fbsd.hackers@mailing.thruhere.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Wojciech Puchar Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 08:24:09 -0000 Mel Flynn wrote: > On Sunday 28 June 2009 15:41:49 Alan Cox wrote: > >> Wojciech Puchar wrote: >> > > >>> how can i check how much (or maybe - what processes) 2MB pages are >>> actually allocated? >>> >> I'm afraid that you can't with great precision. For a given program >> execution, on an otherwise idle machine, you can only estimate the >> number by looking at the change in the quantity "promotions + mappings - >> demotions" before, during, and after the program execution. >> >> A program can call mincore(2) in order to determine if a virtual address >> is part of a 2 or 4MB virtual page. >> > > Would it be possible to expose the super page count as kve_super in the > kinfo_vmentry struct so that procstat can show this information? If only to > determine if one is using the feature and possibly benefiting from it. > > Yes, I think so. > It looks like sys/kern/kern_proc.c could call mincore around the loop at line > 1601 (rev 194498), but I know nothing about the vm subsystem to know the > implications or locking involved. There's still 16 bytes of spare to consume, > in the kve_vminfo struct though ;) > Yes, to start with, you could replace the call to pmap_extract() with a call to pmap_mincore() and export a Boolean to user space that says, "This region of the address space contains one or more superpage mappings." Counting the number of superpages is a little trickier. The problem being that pmap_mincore() doesn't tell you how large the underlying page is. So, the loop at line 1601 can't easily tell where one superpage ends and the next 4KB page or superpage begins, making counting the number of superpages in a region a little tricky. One possibility is to change pmap_mincore() to return the page size (or the logarithm of the page size) rather than a single bit. If you want to give it a try, I'll be happy to help. There aren't really any "implications" or synchronization issues that you need to worry about. Alan From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 09:52:58 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 202D21065673; Tue, 30 Jun 2009 09:52:58 +0000 (UTC) (envelope-from malathiramya@gmail.com) Received: from mail-pz0-f198.google.com (mail-pz0-f198.google.com [209.85.222.198]) by mx1.freebsd.org (Postfix) with ESMTP id E496C8FC18; Tue, 30 Jun 2009 09:52:57 +0000 (UTC) (envelope-from malathiramya@gmail.com) Received: by pzk36 with SMTP id 36so11468pzk.29 for ; Tue, 30 Jun 2009 02:52:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=0UK+aVSP24BulgwA3ccAcUAdaAJ/YAor9941PClugig=; b=pFnwlqNlpCEuwUSd6z/tUzG+W6GsWe0ft1RR1pNWusifSzN5suiJ0GKI503KGHd1Ae Kpc2vZI9+b//lQWdu/YfIZbEjZGnRCVYZ3cjxojBtJIChEY21Bw+2ghvkIEm0s28fnzj nClcabg2rsHJ984Kft25cWf0+WxmveuNxcwFw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=IvruvvDlT7ovxEnNEY1CcxmgzZWWo+c4n/UvON5qLF3ApVTeAgkVjI7f8icwxC1/c1 Odpw6H3uFyxHxvaNNX1dar+SAOdmYmitEAv/wUBexJ+Zp6mEgEb0pE0MOlP0qTL9JrIz A4KCvGxObY/aZiP41yq/SImzzNg6+EQU6YTRM= MIME-Version: 1.0 Received: by 10.143.9.11 with SMTP id m11mr2089766wfi.25.1246355577427; Tue, 30 Jun 2009 02:52:57 -0700 (PDT) Date: Tue, 30 Jun 2009 15:22:57 +0530 Message-ID: From: malathi selvaraj To: freebsd-questions@freebsd.org, freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: good afternoon to all X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 09:52:58 -0000 i am not able to made rcpbind, i get an error while making the rcpbind like this RPC: Unknown host showmount: can't do exports rpc Thanks in advance -- S.MALATHI From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 16:12:21 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 576CE106567E for ; Tue, 30 Jun 2009 16:12:21 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out1.uni-muenster.de (ZIVM-OUT1.UNI-MUENSTER.DE [128.176.192.8]) by mx1.freebsd.org (Postfix) with ESMTP id E006F8FC19 for ; Tue, 30 Jun 2009 16:12:20 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.42,317,1243807200"; d="scan'208";a="275902026" Received: from zivmaildisp2.uni-muenster.de (HELO ZIVMAILUSER04.UNI-MUENSTER.DE) ([128.176.188.143]) by zivm-relay1.uni-muenster.de with ESMTP; 30 Jun 2009 18:12:19 +0200 Received: by ZIVMAILUSER04.UNI-MUENSTER.DE (Postfix, from userid 149459) id 10961614001; Tue, 30 Jun 2009 18:12:19 +0200 (CEST) Date: Tue, 30 Jun 2009 18:12:18 +0200 (CEST) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Subject: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 16:12:22 -0000 hi there, i need to output the header of a file to stdout. the header looks like this: struct Header { u_int8_t rom_entry[4]; u_int8_t nintendo_logo[156]; u_char game_title[12]; u_char game_code[4]; u_char maker_code[2]; u_int8_t fixed_val; u_int8_t unit_code; u_int8_t device_type; u_int8_t reserved_area1[7]; u_int8_t software_version; u_int8_t complement_check; u_int8_t reserved_area2; u_int8_t ram_entry[4]; u_int8_t boot_mode; u_int8_t slave_id; u_int8_t unused_area[26]; u_int8_t joybus_entry[4]; }; if there a way to use printf or some other variant of *printf without using sizeof()-loops for all the arrays? cheers. From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 16:49:34 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFA721065674 for ; Tue, 30 Jun 2009 16:49:34 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com [209.85.219.213]) by mx1.freebsd.org (Postfix) with ESMTP id 3A10B8FC0C for ; Tue, 30 Jun 2009 16:49:33 +0000 (UTC) (envelope-from tevans.uk@googlemail.com) Received: by ewy9 with SMTP id 9so332484ewy.43 for ; Tue, 30 Jun 2009 09:49:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=fKHZB8mI3nabLrfSFwMm4z0iGvXRqqQHw2WKnX99hpM=; b=GGKSfVYvO0oWMLU3dp72uoRqGu0h//0k/ubyAG6IsxQIRFdExID2X+vRd25QIYCRyp 1yRWawTEdkplpz/BzfQxBb/3agBQXJ//zzdcNne9yRW/qIdlkdDhL+m3/vOpqU1guRxS B3IvnSd7u5yms5WKB2YFOnzFqMtJB38+jTMyg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=dj39sOmNfZMQm4tGGlBsGOJagkbkHoTfCagQDs88JWDBV+jmGsYPz/v3JbDLhUSmgO pUMmp3S45axWg4id1dNuaEwB4oXdyUlyvF4EgcdB386P8na+ldhG6XyWkt26KEpMA69c YaJevOudmZ8Q9+YbMp+V41+6fz69k8fNdjgK8= Received: by 10.210.30.1 with SMTP id d1mr2262506ebd.37.1246380572848; Tue, 30 Jun 2009 09:49:32 -0700 (PDT) Received: from ?127.0.0.1? (87-194-39-182.bethere.co.uk [87.194.39.182]) by mx.google.com with ESMTPS id 10sm722653eyd.38.2009.06.30.09.49.31 (version=SSLv3 cipher=RC4-MD5); Tue, 30 Jun 2009 09:49:32 -0700 (PDT) From: Tom Evans To: Alexander Best In-Reply-To: References: Content-Type: text/plain Date: Tue, 30 Jun 2009 17:49:30 +0100 Message-Id: <1246380570.2437.219.camel@strangepork.london.mintel.ad> Mime-Version: 1.0 X-Mailer: Evolution 2.26.1.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@FreeBSD.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 16:49:34 -0000 On Tue, 2009-06-30 at 18:12 +0200, Alexander Best wrote: > hi there, > > i need to output the header of a file to stdout. the header looks like this: > > struct Header > { > u_int8_t rom_entry[4]; > u_int8_t nintendo_logo[156]; > u_char game_title[12]; > u_char game_code[4]; > u_char maker_code[2]; > u_int8_t fixed_val; > u_int8_t unit_code; > u_int8_t device_type; > u_int8_t reserved_area1[7]; > u_int8_t software_version; > u_int8_t complement_check; > u_int8_t reserved_area2; > u_int8_t ram_entry[4]; > u_int8_t boot_mode; > u_int8_t slave_id; > u_int8_t unused_area[26]; > u_int8_t joybus_entry[4]; > }; > > if there a way to use printf or some other variant of *printf without using > sizeof()-loops for all the arrays? > > cheers. None of your arrays are dynamically sized, so surely write(fd, &hdr, sizeof(Header)); would do the trick? Cheers Tom From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 17:10:46 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 618D0106567A for ; Tue, 30 Jun 2009 17:10:46 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out3.uni-muenster.de (ZIVM-OUT3.UNI-MUENSTER.DE [128.176.192.18]) by mx1.freebsd.org (Postfix) with ESMTP id EB12A8FC20 for ; Tue, 30 Jun 2009 17:10:45 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.42,317,1243807200"; d="scan'208";a="7214605" Received: from zivmaildisp2.uni-muenster.de (HELO ZIVMAILUSER05.UNI-MUENSTER.DE) ([128.176.188.143]) by zivm-relay3.uni-muenster.de with ESMTP; 30 Jun 2009 19:10:44 +0200 Received: by ZIVMAILUSER05.UNI-MUENSTER.DE (Postfix, from userid 149459) id 51B3F1B07E4; Tue, 30 Jun 2009 19:10:44 +0200 (CEST) Date: Tue, 30 Jun 2009 19:10:44 +0200 (CEST) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Tom Evans Message-ID: In-Reply-To: <1246380570.2437.219.camel@strangepork.london.mintel.ad> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@FreeBSD.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 17:10:46 -0000 thanks. but that simply dumps the contents of the struct to stdout. but since most of the struct's contents aren't ascii the output isn't really of much use. cheers. Tom Evans schrieb am 2009-06-30: > On Tue, 2009-06-30 at 18:12 +0200, Alexander Best wrote: > > hi there, > > i need to output the header of a file to stdout. the header looks > > like this: > > struct Header > > { > > u_int8_t rom_entry[4]; > > u_int8_t nintendo_logo[156]; > > u_char game_title[12]; > > u_char game_code[4]; > > u_char maker_code[2]; > > u_int8_t fixed_val; > > u_int8_t unit_code; > > u_int8_t device_type; > > u_int8_t reserved_area1[7]; > > u_int8_t software_version; > > u_int8_t complement_check; > > u_int8_t reserved_area2; > > u_int8_t ram_entry[4]; > > u_int8_t boot_mode; > > u_int8_t slave_id; > > u_int8_t unused_area[26]; > > u_int8_t joybus_entry[4]; > > }; > > if there a way to use printf or some other variant of *printf > > without using > > sizeof()-loops for all the arrays? > > cheers. > None of your arrays are dynamically sized, so surely > write(fd, &hdr, sizeof(Header)); > would do the trick? > Cheers > Tom From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 17:32:43 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8183E106566C for ; Tue, 30 Jun 2009 17:32:43 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out1.uni-muenster.de (ZIVM-OUT1.UNI-MUENSTER.DE [128.176.192.8]) by mx1.freebsd.org (Postfix) with ESMTP id 151798FC2D for ; Tue, 30 Jun 2009 17:32:42 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.42,317,1243807200"; d="scan'208";a="275907856" Received: from zivmaildisp2.uni-muenster.de (HELO ZIVMAILUSER05.UNI-MUENSTER.DE) ([128.176.188.143]) by zivm-relay1.uni-muenster.de with ESMTP; 30 Jun 2009 19:32:41 +0200 Received: by ZIVMAILUSER05.UNI-MUENSTER.DE (Postfix, from userid 149459) id A82C81B07E4; Tue, 30 Jun 2009 19:32:41 +0200 (CEST) Date: Tue, 30 Jun 2009 19:32:41 +0200 (CEST) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Igor Mozolevsky Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Tom Evans , freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 17:32:43 -0000 that works, but i really want to have a pretty output to stdout. i guess i have to stick with printf and use `for (i=0; i < sizeof(XXX); i++)` for each array in the struct. just thought i could avoid it. btw. `./my-program | hexdump` works, but if i do `./my-program > output` output is being created, but is empty. is this normal? cheers. Igor Mozolevsky schrieb am 2009-06-30: > 2009/6/30 Alexander Best : > > thanks. but that simply dumps the contents of the struct to stdout. > > but since > > most of the struct's contents aren't ascii the output isn't really > > of much > > use. > How about ./your-program | hexdump ? > -- > Igor From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 17:41:45 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 083F41065670 for ; Tue, 30 Jun 2009 17:41:45 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mx1.freebsd.org (Postfix) with ESMTP id 81E5B8FC16 for ; Tue, 30 Jun 2009 17:41:44 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: by bwz12 with SMTP id 12so282521bwz.43 for ; Tue, 30 Jun 2009 10:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=j1olM7XlHRbLjCNT52IXfVtsOIl8MloG6+CWS52Ya90=; b=eKYsNNhvSfD8iwLkTM8ns+a+Uo+krwB7K6VpQn3eNefz+NzZW2mXVmx8I8NHWRla6J 7AqTDgl+ejR9O9IrcHDkwGInEihvBn5xcKDZE//ZXJp5BkIAja+Wf4wOWdM2PXhuOX22 8M3Pl7SclC580+1/0TMyT1j6ENvtmtm+wk9PQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=rT+VE8FKXvqDW8CyzfhH0UTyrF4hPWohUeBdjldusYEvB+RmtLi1TSou2qlmxVq3bM qiN5RIA8MpFiO2nYam2EZdTL8lahKZ39cJDYT8HP7M5dNbk4DszxPyqOriGUGzySWLuO 7BAy/B00qrFOGJywndHdBzEluPDfQXpz5BWWs= MIME-Version: 1.0 Sender: mozolevsky@gmail.com Received: by 10.204.60.135 with SMTP id p7mr5157215bkh.83.1246382232750; Tue, 30 Jun 2009 10:17:12 -0700 (PDT) In-Reply-To: References: <1246380570.2437.219.camel@strangepork.london.mintel.ad> From: Igor Mozolevsky Date: Tue, 30 Jun 2009 18:16:49 +0100 X-Google-Sender-Auth: 5d40e3d7a41eb0af Message-ID: To: Alexander Best Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Tom Evans , freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 17:41:45 -0000 2009/6/30 Alexander Best : > thanks. but that simply dumps the contents of the struct to stdout. but since > most of the struct's contents aren't ascii the output isn't really of much > use. How about ./your-program | hexdump ? -- Igor From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 18:00:43 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F0621065680 for ; Tue, 30 Jun 2009 18:00:43 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 1EC318FC0C for ; Tue, 30 Jun 2009 18:00:42 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: by fxm18 with SMTP id 18so295602fxm.43 for ; Tue, 30 Jun 2009 11:00:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=pAGyP77lu9JhOJsLCTfpB0u0fWagsMd1nimeN41aLTI=; b=snDoMoYB0y1ku8D6mOktTq4XqjX5VwrSZ7bkYYjqaLhfQ2xvGlQbDmsogYxiF14Ruo uDfg5ihC017KH/UtwD83sj3BVWTMXbJ/0u35JHMTfXctMiJAdZIJewA7b1WwJ0k7cAFj 9QQyRXImgGE6HkwCqTjPAGjqaOUXog6bL1Il0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=Jav4wrS3dxSlB7QnFDCffEsnXp9Irsq69x/yk9oSAExi8pP9MV//XhZQo1ba/BXiGg iIxYsZyZL1wYyw2wzaKrYeBqtzBcxdahtUO/68rPz9wl0KkAh+Dab5Jdou23ujBAtvLw AyEg67GlrxrXyUzNBCs04TcoLOlQBGzXKwAx0= MIME-Version: 1.0 Sender: mozolevsky@gmail.com Received: by 10.204.63.8 with SMTP id z8mr8577135bkh.55.1246384841312; Tue, 30 Jun 2009 11:00:41 -0700 (PDT) In-Reply-To: References: From: Igor Mozolevsky Date: Tue, 30 Jun 2009 19:00:21 +0100 X-Google-Sender-Auth: 28b50dff6e48e35f Message-ID: To: Alexander Best Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 18:00:43 -0000 2009/6/30 Alexander Best : > that works, but i really want to have a pretty output to stdout. i guess i > have to stick with printf and use `for (i=0; i < sizeof(XXX); i++)` for each > array in the struct. just thought i could avoid it. > > btw. `./my-program | hexdump` works, but if i do `./my-program > output` > output is being created, but is empty. is this normal? Depends if you output to stdout or stderr --- `>' redirects stdout. Cheers, -- Igor From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 18:03:35 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A2231065672 for ; Tue, 30 Jun 2009 18:03:35 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out1.uni-muenster.de (ZIVM-OUT1.UNI-MUENSTER.DE [128.176.192.8]) by mx1.freebsd.org (Postfix) with ESMTP id 933268FC26 for ; Tue, 30 Jun 2009 18:03:34 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.42,317,1243807200"; d="scan'208";a="275910304" Received: from zivmaildisp2.uni-muenster.de (HELO ZIVMAILUSER05.UNI-MUENSTER.DE) ([128.176.188.143]) by zivm-relay1.uni-muenster.de with ESMTP; 30 Jun 2009 20:03:21 +0200 Received: by ZIVMAILUSER05.UNI-MUENSTER.DE (Postfix, from userid 149459) id 47CE11B07E4; Tue, 30 Jun 2009 20:03:21 +0200 (CEST) Date: Tue, 30 Jun 2009 20:03:21 +0200 (CEST) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Igor Mozolevsky Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 18:03:35 -0000 should be stdout. struct Header *hdr = rom; int new_fd = open("/dev/stdout", O_RDWR); printf("SIZE: %d\n",sizeof(*hdr)); write(new_fd, hdr, sizeof(*hdr)); close(new_fd); Igor Mozolevsky schrieb am 2009-06-30: > 2009/6/30 Alexander Best : > > that works, but i really want to have a pretty output to stdout. i > > guess i > > have to stick with printf and use `for (i=0; i < sizeof(XXX); i++)` > > for each > > array in the struct. just thought i could avoid it. > > btw. `./my-program | hexdump` works, but if i do `./my-program > > > output` > > output is being created, but is empty. is this normal? > Depends if you output to stdout or stderr --- `>' redirects stdout. > Cheers, > -- > Igor From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 18:11:22 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 430A1106567A for ; Tue, 30 Jun 2009 18:11:22 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: from hamlet.setfilepointer.com (hamlet.SetFilePointer.com [63.224.10.2]) by mx1.freebsd.org (Postfix) with SMTP id 029508FC20 for ; Tue, 30 Jun 2009 18:11:21 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: (qmail 76004 invoked from network); 30 Jun 2009 13:11:21 -0500 Received: from keira.kiwi-computer.com (HELO kiwi-computer.com) (63.224.10.3) by hamlet.setfilepointer.com with SMTP; 30 Jun 2009 13:11:21 -0500 Received: (qmail 32727 invoked by uid 2001); 30 Jun 2009 18:11:21 -0000 Date: Tue, 30 Jun 2009 13:11:21 -0500 From: "Rick C. Petty" To: Alexander Best Message-ID: <20090630181121.GA32665@keira.kiwi-computer.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rick-freebsd2008@kiwi-computer.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 18:11:23 -0000 On Tue, Jun 30, 2009 at 08:03:21PM +0200, Alexander Best wrote: > should be stdout. > > > struct Header *hdr = rom; > > int new_fd = open("/dev/stdout", O_RDWR); > printf("SIZE: %d\n",sizeof(*hdr)); > write(new_fd, hdr, sizeof(*hdr)); > close(new_fd); Why are you reopening stdout? It should already be open, so use "fileno(stdout)" or just plain "STDOUT_FILENO" instead of "new_fd". -- Rick C. Petty From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 18:19:45 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF5FE106564A for ; Tue, 30 Jun 2009 18:19:45 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 3D5848FC0C for ; Tue, 30 Jun 2009 18:19:44 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: by fxm18 with SMTP id 18so306478fxm.43 for ; Tue, 30 Jun 2009 11:19:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=SV7dNoh9ZR4hw87SUz1xBkE3misXv89ijbrQoHpBWoA=; b=X2MRWZPL/menoe+6V2OXb0VKruJvWLvpMx0Eo3dsXTooi/GR22xBb70EjWAqdjaO+I 3ldtH7ufR9RPzWwbwwletTOtFht6AG2duF1NKJPhnRW3nwjVL2AqNM8EEc8578+WjsOm hWObc6FBU1xGgf1Fiq/VCWo6WMz+b3HVwpuwo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=QYsqHPtABRAdyDG1/GYJZavWGKHKps+mPhGAOr0EkxS4pLR9LiCpAVFd4t3KCBqedo Ce3wAtYy3hdKup25IQzn3kmZ48P53/XoSIE/GfEx+n/PZNAwgCSwxaKakDEpNxJGGyJ8 PCKCo0ZIRV1e6EyGSZ9DlY+5IuLQxq8KVZZqw= MIME-Version: 1.0 Sender: mozolevsky@gmail.com Received: by 10.204.101.13 with SMTP id a13mr8616053bko.89.1246385984113; Tue, 30 Jun 2009 11:19:44 -0700 (PDT) In-Reply-To: References: From: Igor Mozolevsky Date: Tue, 30 Jun 2009 19:19:24 +0100 X-Google-Sender-Auth: 5299631fefd51254 Message-ID: To: Alexander Best Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 18:19:45 -0000 2009/6/30 Alexander Best : > should be stdout. > > > struct Header *hdr = rom; > > int new_fd = open("/dev/stdout", O_RDWR); > > printf("SIZE: %d\n",sizeof(*hdr)); > > write(new_fd, hdr, sizeof(*hdr)); > > close(new_fd); You should really be checking what open returns, opening /dev/stdout for reading is a bit weird not sure if that would work, and most likely it's already open... Just use fileno(...):- #include #include int main(void) { write(fileno(stdout), "Hello world!\n", 13); return 0; } Cheers, -- Igor From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 18:21:05 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B9D651065674 for ; Tue, 30 Jun 2009 18:21:05 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out1.uni-muenster.de (ZIVM-OUT1.UNI-MUENSTER.DE [128.176.192.8]) by mx1.freebsd.org (Postfix) with ESMTP id 4E3A88FC14 for ; Tue, 30 Jun 2009 18:21:04 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.42,317,1243807200"; d="scan'208";a="275911556" Received: from zivmaildisp2.uni-muenster.de (HELO ZIVMAILUSER05.UNI-MUENSTER.DE) ([128.176.188.143]) by zivm-relay1.uni-muenster.de with ESMTP; 30 Jun 2009 20:21:03 +0200 Received: by ZIVMAILUSER05.UNI-MUENSTER.DE (Postfix, from userid 149459) id A4B281B07E4; Tue, 30 Jun 2009 20:21:03 +0200 (CEST) Date: Tue, 30 Jun 2009 20:21:03 +0200 (CEST) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Message-ID: In-Reply-To: <20090630181121.GA32665@keira.kiwi-computer.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 18:21:06 -0000 thanks. now the output gets redirected using >. i'm quite new to programming under unix. sorry for the inconvenience. so i guess there is no really easy way to output an inhomogeneous struct to stdout without using a loop to output each array contained in the struct. cheers. Rick C. Petty schrieb am 2009-06-30: > On Tue, Jun 30, 2009 at 08:03:21PM +0200, Alexander Best wrote: > > should be stdout. > > struct Header *hdr = rom; > > int new_fd = open("/dev/stdout", O_RDWR); > > printf("SIZE: %d\n",sizeof(*hdr)); > > write(new_fd, hdr, sizeof(*hdr)); > > close(new_fd); > Why are you reopening stdout? It should already be open, so use > "fileno(stdout)" or just plain "STDOUT_FILENO" instead of "new_fd". > -- Rick C. Petty From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 19:27:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AE4771065672 for ; Tue, 30 Jun 2009 19:27:50 +0000 (UTC) (envelope-from stephen@missouri.edu) Received: from cauchy.math.missouri.edu (cauchy.math.missouri.edu [128.206.184.213]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3308FC12 for ; Tue, 30 Jun 2009 19:27:50 +0000 (UTC) (envelope-from stephen@missouri.edu) Received: from [128.206.184.213] (cauchy.math.missouri.edu [128.206.184.213]) by cauchy.math.missouri.edu (8.14.3/8.14.3) with ESMTP id n5UJHYeJ047529; Tue, 30 Jun 2009 14:17:34 -0500 (CDT) (envelope-from stephen@missouri.edu) Message-ID: <4A4A64CE.1030906@missouri.edu> Date: Tue, 30 Jun 2009 14:17:34 -0500 From: Stephen Montgomery-Smith User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.8.1.21) Gecko/20090611 SeaMonkey/1.1.16 MIME-Version: 1.0 To: Alexander Best References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 19:27:50 -0000 Alexander Best wrote: > thanks. now the output gets redirected using >. i'm quite new to programming > under unix. sorry for the inconvenience. > > so i guess there is no really easy way to output an inhomogeneous struct to > stdout without using a loop to output each array contained in the struct. > > cheers. I think you are asking for a print command, that when given a structure, can look at the data type of each element of the structure, and produces the appropriate print command for each data type. I think what you are asking for is antithetical to the philosophy of C - for example, the printf command demands that you tell the printf command what are the data types of the data you give to it. So I think that the kind of long winded print command you are advocating is the correct way to do it. Stephen From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 21:02:39 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86749106564A for ; Tue, 30 Jun 2009 21:02:39 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: from hamlet.setfilepointer.com (hamlet.SetFilePointer.com [63.224.10.2]) by mx1.freebsd.org (Postfix) with SMTP id 2FB7E8FC14 for ; Tue, 30 Jun 2009 21:02:39 +0000 (UTC) (envelope-from rick@kiwi-computer.com) Received: (qmail 25677 invoked from network); 30 Jun 2009 16:02:38 -0500 Received: from keira.kiwi-computer.com (HELO kiwi-computer.com) (63.224.10.3) by hamlet.setfilepointer.com with SMTP; 30 Jun 2009 16:02:38 -0500 Received: (qmail 34031 invoked by uid 2001); 30 Jun 2009 21:02:38 -0000 Date: Tue, 30 Jun 2009 16:02:38 -0500 From: "Rick C. Petty" To: Alexander Best Message-ID: <20090630210238.GA33849@keira.kiwi-computer.com> References: <20090630181121.GA32665@keira.kiwi-computer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rick-freebsd2008@kiwi-computer.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 21:02:39 -0000 On Tue, Jun 30, 2009 at 08:21:03PM +0200, Alexander Best wrote: > thanks. now the output gets redirected using >. i'm quite new to programming > under unix. sorry for the inconvenience. No problem; we all had to learn sometime. But what I suggested should work for every platform that adheres to POSIX. If you were using fprintf/fwrite, then it would work on anything that's standard C. As for redirection, windows command line allows the same type of redirection. > so i guess there is no really easy way to output an inhomogeneous struct to > stdout without using a loop to output each array contained in the struct. That's not something C would ever provide easily. You may want to use a different high-level language. However, I often use macros for printing pieces of structures, for example I used this to print out sizes of kernel structures: #define SIZE(astruct, member) \ printf("%d\t\t.%s\n", sizeof(astruct.member), #member) #include ... struct ktr_header header; struct ktr_genio genio; printf("%d\tktr_header:\n", sizeof(header)); SIZE(header, ktr_len); SIZE(header, ktr_type); SIZE(header, ktr_pid); SIZE(header, ktr_comm); SIZE(header, ktr_time); SIZE(header, ktr_time.tv_sec); SIZE(header, ktr_time.tv_sec); SIZE(header, ktr_tid); printf("\n%d\tktr_genio:\n", sizeof(genio)); SIZE(genio, ktr_fd); SIZE(genio, ktr_rw); In your case, you could make a macro for each type. Without an example of how you want the output to look, it's hard for us to show you code that will produce such output. -- Rick C. Petty From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 22:06:07 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CABB1065677 for ; Tue, 30 Jun 2009 22:06:07 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out3.uni-muenster.de (ZIVM-OUT3.UNI-MUENSTER.DE [128.176.192.18]) by mx1.freebsd.org (Postfix) with ESMTP id 307258FC0A for ; Tue, 30 Jun 2009 22:06:06 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.42,319,1243807200"; d="scan'208";a="7230655" Received: from zivmaildisp2.uni-muenster.de (HELO ZIVMAILUSER04.UNI-MUENSTER.DE) ([128.176.188.143]) by zivm-relay3.uni-muenster.de with ESMTP; 01 Jul 2009 00:06:05 +0200 Received: by ZIVMAILUSER04.UNI-MUENSTER.DE (Postfix, from userid 149459) id 59FFC1B002E; Wed, 1 Jul 2009 00:06:05 +0200 (CEST) Date: Wed, 01 Jul 2009 00:06:05 +0200 (CEST) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Message-ID: In-Reply-To: <20090630210238.GA33849@keira.kiwi-computer.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 22:06:08 -0000 thanks for all the help. i decided to take the pill and coded all the fprintfs by hand. here's the result. usually i'd stick to a higher level languag, but i need C's inline assembly support: struct Header { u_int8_t rom_entry[4]; u_int8_t nintendo_logo[156]; u_char game_title[12]; u_char game_code[4]; u_char maker_code[2]; u_int8_t fixed_val; u_int8_t unit_code; u_int8_t device_type; u_int8_t reserved_area1[7]; u_int8_t software_version; u_int8_t complement_check; u_int8_t reserved_area2; u_int8_t ram_entry[4]; u_int8_t boot_mode; u_int8_t slave_id; u_int8_t unused_area[26]; u_int8_t joybus_entry[4]; }; struct Header * hdr = rom; int i; fprintf(stderr, "ROM Entry: 0x"); for (i=0; i < 4; i++) fprintf(stderr, "%x", hdr->rom_entry[i]); fprintf(stderr, "\nNintendo Logo: 0x"); for (i=0; i < sizeof(hdr->nintendo_logo); i++) fprintf(stderr, "%x", hdr->nintendo_logo[i]); fprintf(stderr, "\nGame Title: %s", hdr->game_title); fprintf(stderr, "\nGame Code: %s", hdr->game_code); fprintf(stderr, "\nMaker Code: %s", hdr->maker_code); fprintf(stderr, "\nFixed Value: 0x"); fprintf(stderr, "%x", hdr->fixed_val); fprintf(stderr, "\nUnit Code: 0x"); fprintf(stderr, "%x", hdr->unit_code); fprintf(stderr, "\nDevice Type: 0x"); fprintf(stderr, "%x", hdr->device_type); fprintf(stderr, "\nReserved Area: 0x"); for (i=0; i < sizeof(hdr->reserved_area1); i++) fprintf(stderr, "%x", hdr->reserved_area1[i]); fprintf(stderr, "\nSoftware Version: 0x"); fprintf(stderr, "%x", hdr->software_version); fprintf(stderr, "\nComplement Check: 0x"); fprintf(stderr, "%x", hdr->complement_check); fprintf(stderr, "\nReserved Area: 0x"); fprintf(stderr, "%x", hdr->reserved_area2); fprintf(stderr, "\nRAM Entry Point: 0x"); for (i=0; i < sizeof(hdr->ram_entry); i++) fprintf(stderr, "%x", hdr->ram_entry[i]); fprintf(stderr, "\nBoot Mode: 0x"); fprintf(stderr, "%x", hdr->boot_mode); fprintf(stderr, "\nSlave ID: 0x"); fprintf(stderr, "%x", hdr->slave_id); fprintf(stderr, "\nUnused Area: 0x"); for (i=0; i < sizeof(hdr->unused_area); i++) fprintf(stderr, "%x", hdr->unused_area[i]); fprintf(stderr, "\nJoybus Entry Point: 0x"); for (i=0; i < sizeof(hdr->joybus_entry); i++) fprintf(stderr, "%x", hdr->joybus_entry[i]); cheers. Rick C. Petty schrieb am 2009-06-30: > On Tue, Jun 30, 2009 at 08:21:03PM +0200, Alexander Best wrote: > > thanks. now the output gets redirected using >. i'm quite new to > > programming > > under unix. sorry for the inconvenience. > No problem; we all had to learn sometime. But what I suggested > should > work for every platform that adheres to POSIX. If you were using > fprintf/fwrite, then it would work on anything that's standard C. As > for > redirection, windows command line allows the same type of > redirection. > > so i guess there is no really easy way to output an inhomogeneous > > struct to > > stdout without using a loop to output each array contained in the > > struct. > That's not something C would ever provide easily. You may want to > use a > different high-level language. However, I often use macros for > printing > pieces of structures, for example I used this to print out sizes of > kernel > structures: > #define SIZE(astruct, member) \ > printf("%d\t\t.%s\n", sizeof(astruct.member), #member) > #include > ... > struct ktr_header header; > struct ktr_genio genio; > printf("%d\tktr_header:\n", sizeof(header)); > SIZE(header, ktr_len); > SIZE(header, ktr_type); > SIZE(header, ktr_pid); > SIZE(header, ktr_comm); > SIZE(header, ktr_time); > SIZE(header, ktr_time.tv_sec); > SIZE(header, ktr_time.tv_sec); > SIZE(header, ktr_tid); > printf("\n%d\tktr_genio:\n", sizeof(genio)); > SIZE(genio, ktr_fd); > SIZE(genio, ktr_rw); > In your case, you could make a macro for each type. Without an > example of > how you want the output to look, it's hard for us to show you code > that > will produce such output. > -- Rick C. Petty From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 22:31:54 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC009106564A; Tue, 30 Jun 2009 22:31:54 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 88F178FC1F; Tue, 30 Jun 2009 22:31:54 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from smoochies.rachie.is-a-geek.net (mailhub.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 17CE07E837; Tue, 30 Jun 2009 14:31:53 -0800 (AKDT) From: Mel Flynn To: freebsd-hackers@freebsd.org Date: Tue, 30 Jun 2009 14:31:37 -0800 User-Agent: KMail/1.11.4 (FreeBSD/8.0-CURRENT; KDE/4.2.4; i386; ; ) References: <200906291317.12040.mel.flynn+fbsd.hackers@mailing.thruhere.net> <4A49CBA0.1050806@cs.rice.edu> In-Reply-To: <4A49CBA0.1050806@cs.rice.edu> MIME-Version: 1.0 Content-Disposition: inline Content-Type: Multipart/Mixed; boundary="Boundary-00=_KJpSKBhXZSq2huD" Message-Id: <200906301431.38664.mel.flynn+fbsd.hackers@mailing.thruhere.net> Cc: Robert Watson , Wojciech Puchar , Alan Cox Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 22:31:55 -0000 --Boundary-00=_KJpSKBhXZSq2huD Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tuesday 30 June 2009 00:24:00 Alan Cox wrote: > Mel Flynn wrote: > > On Sunday 28 June 2009 15:41:49 Alan Cox wrote: > >> Wojciech Puchar wrote: > >>> how can i check how much (or maybe - what processes) 2MB pages are > >>> actually allocated? > >> > >> I'm afraid that you can't with great precision. For a given program > >> execution, on an otherwise idle machine, you can only estimate the > >> number by looking at the change in the quantity "promotions + mappings - > >> demotions" before, during, and after the program execution. > >> > >> A program can call mincore(2) in order to determine if a virtual address > >> is part of a 2 or 4MB virtual page. > > > > Would it be possible to expose the super page count as kve_super in the > > kinfo_vmentry struct so that procstat can show this information? If only > > to determine if one is using the feature and possibly benefiting from it. > > Yes, I think so. > > > It looks like sys/kern/kern_proc.c could call mincore around the loop at > > line 1601 (rev 194498), but I know nothing about the vm subsystem to know > > the implications or locking involved. There's still 16 bytes of spare to > > consume, in the kve_vminfo struct though ;) > > Yes, to start with, you could replace the call to pmap_extract() with a > call to pmap_mincore() and export a Boolean to user space that says, > "This region of the address space contains one or more superpage mappings." How about attached? % sudo procstat -av|grep 'S ' PID START END PRT RES PRES REF SHD FL TP PATH 1754 0x28900000 0x2ae00000 rw- 9385 0 3 0 --S df 2141 0x2f900000 0x30800000 rw- 3719 0 1 0 --S df 2146 0x3eec0000 0x4fac0000 rwx 1745 0 1 0 --S df -- Mel --Boundary-00=_KJpSKBhXZSq2huD Content-Type: text/x-patch; charset="ISO-8859-1"; name="procstat-superpages.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="procstat-superpages.patch" Index: sys/sys/user.h =================================================================== --- sys/sys/user.h (revision 195188) +++ sys/sys/user.h (working copy) @@ -348,6 +348,7 @@ #define KVME_FLAG_COW 0x00000001 #define KVME_FLAG_NEEDS_COPY 0x00000002 +#define KVME_FLAG_SUPER 0x00000004 #if defined(__amd64__) #define KINFO_OVMENTRY_SIZE 1168 Index: sys/kern/kern_proc.c =================================================================== --- sys/kern/kern_proc.c (revision 195188) +++ sys/kern/kern_proc.c (working copy) @@ -59,6 +59,7 @@ #include #include #include +#include #include #include #include @@ -1599,8 +1600,13 @@ kve->kve_resident = 0; addr = entry->start; while (addr < entry->end) { - if (pmap_extract(map->pmap, addr)) + int flags; + + flags = pmap_mincore(map->pmap, addr); + if ( flags & MINCORE_INCORE ) kve->kve_resident++; + if( flags & MINCORE_SUPER ) + kve->kve_flags |= KVME_FLAG_SUPER; addr += PAGE_SIZE; } Index: usr.bin/procstat/procstat_vm.c =================================================================== --- usr.bin/procstat/procstat_vm.c (revision 195188) +++ usr.bin/procstat/procstat_vm.c (working copy) @@ -49,7 +49,7 @@ ptrwidth = 2*sizeof(void *) + 2; if (!hflag) - printf("%5s %*s %*s %3s %4s %4s %3s %3s %2s %-2s %-s\n", + printf("%5s %*s %*s %3s %4s %4s %3s %3s %3s %-2s %-s\n", "PID", ptrwidth, "START", ptrwidth, "END", "PRT", "RES", "PRES", "REF", "SHD", "FL", "TP", "PATH"); @@ -69,8 +69,9 @@ printf("%3d ", kve->kve_ref_count); printf("%3d ", kve->kve_shadow_count); printf("%-1s", kve->kve_flags & KVME_FLAG_COW ? "C" : "-"); - printf("%-1s ", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" : + printf("%-1s", kve->kve_flags & KVME_FLAG_NEEDS_COPY ? "N" : "-"); + printf("%-1s ", kve->kve_flags & KVME_FLAG_SUPER ? "S" : "-"); switch (kve->kve_type) { case KVME_TYPE_NONE: str = "--"; Index: usr.bin/procstat/procstat.1 =================================================================== --- usr.bin/procstat/procstat.1 (revision 195188) +++ usr.bin/procstat/procstat.1 (working copy) @@ -332,6 +332,8 @@ copy-on-write .It N needs copy +.It S +One or more superpage mappings are used .El .Sh EXIT STATUS .Ex -std --Boundary-00=_KJpSKBhXZSq2huD-- From owner-freebsd-hackers@FreeBSD.ORG Tue Jun 30 22:54:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 95A421065675 for ; Tue, 30 Jun 2009 22:54:57 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 828CD8FC1D for ; Tue, 30 Jun 2009 22:54:57 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 29D611A3C58; Tue, 30 Jun 2009 15:54:57 -0700 (PDT) Date: Tue, 30 Jun 2009 15:54:57 -0700 From: Alfred Perlstein To: Alexander Best Message-ID: <20090630225457.GR84786@elvis.mu.org> References: <20090630210238.GA33849@keira.kiwi-computer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Jun 2009 22:54:57 -0000 Hey Alex, People frown on macros, but this could be a good one: #define SPRINT(f, fmt) \ do {\ for (_i = 0; _i < sizeof(f)/sizeof(f[0]); i++) \ printf(fmt, f[i]); \ }while(0) :D This should allow you to point to any _array_ and print each element of it using format "fmt". Example: SPRINT(Header->game_title, "%c"); -Alfred * Alexander Best [090630 15:06] wrote: > thanks for all the help. i decided to take the pill and coded all the fprintfs > by hand. here's the result. usually i'd stick to a higher level languag, but i > need C's inline assembly support: > > struct Header > { > u_int8_t rom_entry[4]; > u_int8_t nintendo_logo[156]; > u_char game_title[12]; > u_char game_code[4]; > u_char maker_code[2]; > u_int8_t fixed_val; > u_int8_t unit_code; > u_int8_t device_type; > u_int8_t reserved_area1[7]; > u_int8_t software_version; > u_int8_t complement_check; > u_int8_t reserved_area2; > u_int8_t ram_entry[4]; > u_int8_t boot_mode; > u_int8_t slave_id; > u_int8_t unused_area[26]; > u_int8_t joybus_entry[4]; > }; > > struct Header * hdr = rom; > int i; > > fprintf(stderr, "ROM Entry: 0x"); > for (i=0; i < 4; i++) fprintf(stderr, "%x", hdr->rom_entry[i]); > fprintf(stderr, "\nNintendo Logo: 0x"); > for (i=0; i < sizeof(hdr->nintendo_logo); i++) fprintf(stderr, "%x", > hdr->nintendo_logo[i]); > fprintf(stderr, "\nGame Title: %s", hdr->game_title); > fprintf(stderr, "\nGame Code: %s", hdr->game_code); > fprintf(stderr, "\nMaker Code: %s", hdr->maker_code); > fprintf(stderr, "\nFixed Value: 0x"); > fprintf(stderr, "%x", hdr->fixed_val); > fprintf(stderr, "\nUnit Code: 0x"); > fprintf(stderr, "%x", hdr->unit_code); > fprintf(stderr, "\nDevice Type: 0x"); > fprintf(stderr, "%x", hdr->device_type); > fprintf(stderr, "\nReserved Area: 0x"); > for (i=0; i < sizeof(hdr->reserved_area1); i++) fprintf(stderr, "%x", > hdr->reserved_area1[i]); > fprintf(stderr, "\nSoftware Version: 0x"); > fprintf(stderr, "%x", hdr->software_version); > fprintf(stderr, "\nComplement Check: 0x"); > fprintf(stderr, "%x", hdr->complement_check); > fprintf(stderr, "\nReserved Area: 0x"); > fprintf(stderr, "%x", hdr->reserved_area2); > fprintf(stderr, "\nRAM Entry Point: 0x"); > for (i=0; i < sizeof(hdr->ram_entry); i++) fprintf(stderr, "%x", > hdr->ram_entry[i]); > fprintf(stderr, "\nBoot Mode: 0x"); > fprintf(stderr, "%x", hdr->boot_mode); > fprintf(stderr, "\nSlave ID: 0x"); > fprintf(stderr, "%x", hdr->slave_id); > fprintf(stderr, "\nUnused Area: 0x"); > for (i=0; i < sizeof(hdr->unused_area); i++) fprintf(stderr, "%x", > hdr->unused_area[i]); > fprintf(stderr, "\nJoybus Entry Point: 0x"); > for (i=0; i < sizeof(hdr->joybus_entry); i++) fprintf(stderr, "%x", > hdr->joybus_entry[i]); > > cheers. > > Rick C. Petty schrieb am 2009-06-30: > > On Tue, Jun 30, 2009 at 08:21:03PM +0200, Alexander Best wrote: > > > thanks. now the output gets redirected using >. i'm quite new to > > > programming > > > under unix. sorry for the inconvenience. > > > No problem; we all had to learn sometime. But what I suggested > > should > > work for every platform that adheres to POSIX. If you were using > > fprintf/fwrite, then it would work on anything that's standard C. As > > for > > redirection, windows command line allows the same type of > > redirection. > > > > so i guess there is no really easy way to output an inhomogeneous > > > struct to > > > stdout without using a loop to output each array contained in the > > > struct. > > > That's not something C would ever provide easily. You may want to > > use a > > different high-level language. However, I often use macros for > > printing > > pieces of structures, for example I used this to print out sizes of > > kernel > > structures: > > > #define SIZE(astruct, member) \ > > printf("%d\t\t.%s\n", sizeof(astruct.member), #member) > > > #include > > ... > > struct ktr_header header; > > struct ktr_genio genio; > > > printf("%d\tktr_header:\n", sizeof(header)); > > SIZE(header, ktr_len); > > SIZE(header, ktr_type); > > SIZE(header, ktr_pid); > > SIZE(header, ktr_comm); > > SIZE(header, ktr_time); > > SIZE(header, ktr_time.tv_sec); > > SIZE(header, ktr_time.tv_sec); > > SIZE(header, ktr_tid); > > > printf("\n%d\tktr_genio:\n", sizeof(genio)); > > SIZE(genio, ktr_fd); > > SIZE(genio, ktr_rw); > > > In your case, you could make a macro for each type. Without an > > example of > > how you want the output to look, it's hard for us to show you code > > that > > will produce such output. > > > -- Rick C. Petty > _______________________________________________ > 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" -- - Alfred Perlstein VMOA #5191, 03 vmax, 92 gs500, ch250 - FreeBSD From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 1 00:01:56 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BC5541065670; Wed, 1 Jul 2009 00:01:56 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out3.uni-muenster.de (ZIVM-OUT3.UNI-MUENSTER.DE [128.176.192.18]) by mx1.freebsd.org (Postfix) with ESMTP id 9D7618FC14; Wed, 1 Jul 2009 00:01:55 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.42,319,1243807200"; d="scan'208";a="7236484" Received: from zivmaildisp2.uni-muenster.de (HELO ZIVMAILUSER05.UNI-MUENSTER.DE) ([128.176.188.143]) by zivm-relay3.uni-muenster.de with ESMTP; 01 Jul 2009 02:01:54 +0200 Received: by ZIVMAILUSER05.UNI-MUENSTER.DE (Postfix, from userid 149459) id B5E821B07E4; Wed, 1 Jul 2009 02:01:54 +0200 (CEST) Date: Wed, 01 Jul 2009 02:01:54 +0200 (CEST) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Alfred Perlstein Message-ID: In-Reply-To: <20090630225457.GR84786@elvis.mu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2009 00:01:57 -0000 wow. thanks. that's looking really nice. i'll change my sources tomorrow after a good dose of sleep. ;) alex Alfred Perlstein schrieb am 2009-07-01: > Hey Alex, > People frown on macros, but this could be a good one: > #define SPRINT(f, fmt) \ > do {\ > for (_i = 0; _i < sizeof(f)/sizeof(f[0]); i++) \ > printf(fmt, f[i]); \ > }while(0) > :D > This should allow you to point to any _array_ and print each > element of it using format "fmt". > Example: > SPRINT(Header->game_title, "%c"); > -Alfred > * Alexander Best [090630 15:06] > wrote: > > thanks for all the help. i decided to take the pill and coded all > > the fprintfs > > by hand. here's the result. usually i'd stick to a higher level > > languag, but i > > need C's inline assembly support: > > struct Header > > { > > u_int8_t rom_entry[4]; > > u_int8_t nintendo_logo[156]; > > u_char game_title[12]; > > u_char game_code[4]; > > u_char maker_code[2]; > > u_int8_t fixed_val; > > u_int8_t unit_code; > > u_int8_t device_type; > > u_int8_t reserved_area1[7]; > > u_int8_t software_version; > > u_int8_t complement_check; > > u_int8_t reserved_area2; > > u_int8_t ram_entry[4]; > > u_int8_t boot_mode; > > u_int8_t slave_id; > > u_int8_t unused_area[26]; > > u_int8_t joybus_entry[4]; > > }; > > struct Header * hdr = rom; > > int i; > > fprintf(stderr, "ROM Entry: 0x"); > > for (i=0; i < 4; i++) fprintf(stderr, "%x", hdr->rom_entry[i]); > > fprintf(stderr, "\nNintendo Logo: 0x"); > > for (i=0; i < sizeof(hdr->nintendo_logo); i++) fprintf(stderr, > > "%x", > > hdr->nintendo_logo[i]); > > fprintf(stderr, "\nGame Title: %s", hdr->game_title); > > fprintf(stderr, "\nGame Code: %s", hdr->game_code); > > fprintf(stderr, "\nMaker Code: %s", hdr->maker_code); > > fprintf(stderr, "\nFixed Value: 0x"); > > fprintf(stderr, "%x", hdr->fixed_val); > > fprintf(stderr, "\nUnit Code: 0x"); > > fprintf(stderr, "%x", hdr->unit_code); > > fprintf(stderr, "\nDevice Type: 0x"); > > fprintf(stderr, "%x", hdr->device_type); > > fprintf(stderr, "\nReserved Area: 0x"); > > for (i=0; i < sizeof(hdr->reserved_area1); i++) fprintf(stderr, > > "%x", > > hdr->reserved_area1[i]); > > fprintf(stderr, "\nSoftware Version: 0x"); > > fprintf(stderr, "%x", hdr->software_version); > > fprintf(stderr, "\nComplement Check: 0x"); > > fprintf(stderr, "%x", hdr->complement_check); > > fprintf(stderr, "\nReserved Area: 0x"); > > fprintf(stderr, "%x", hdr->reserved_area2); > > fprintf(stderr, "\nRAM Entry Point: 0x"); > > for (i=0; i < sizeof(hdr->ram_entry); i++) fprintf(stderr, > > "%x", > > hdr->ram_entry[i]); > > fprintf(stderr, "\nBoot Mode: 0x"); > > fprintf(stderr, "%x", hdr->boot_mode); > > fprintf(stderr, "\nSlave ID: 0x"); > > fprintf(stderr, "%x", hdr->slave_id); > > fprintf(stderr, "\nUnused Area: 0x"); > > for (i=0; i < sizeof(hdr->unused_area); i++) fprintf(stderr, > > "%x", > > hdr->unused_area[i]); > > fprintf(stderr, "\nJoybus Entry Point: 0x"); > > for (i=0; i < sizeof(hdr->joybus_entry); i++) fprintf(stderr, > > "%x", > > hdr->joybus_entry[i]); > > cheers. > > Rick C. Petty schrieb am 2009-06-30: > > > On Tue, Jun 30, 2009 at 08:21:03PM +0200, Alexander Best wrote: > > > > thanks. now the output gets redirected using >. i'm quite new > > > > to > > > > programming > > > > under unix. sorry for the inconvenience. > > > No problem; we all had to learn sometime. But what I suggested > > > should > > > work for every platform that adheres to POSIX. If you were using > > > fprintf/fwrite, then it would work on anything that's standard C. > > > As > > > for > > > redirection, windows command line allows the same type of > > > redirection. > > > > so i guess there is no really easy way to output an > > > > inhomogeneous > > > > struct to > > > > stdout without using a loop to output each array contained in > > > > the > > > > struct. > > > That's not something C would ever provide easily. You may want > > > to > > > use a > > > different high-level language. However, I often use macros for > > > printing > > > pieces of structures, for example I used this to print out sizes > > > of > > > kernel > > > structures: > > > #define SIZE(astruct, member) \ > > > printf("%d\t\t.%s\n", sizeof(astruct.member), #member) > > > #include > > > ... > > > struct ktr_header header; > > > struct ktr_genio genio; > > > printf("%d\tktr_header:\n", sizeof(header)); > > > SIZE(header, ktr_len); > > > SIZE(header, ktr_type); > > > SIZE(header, ktr_pid); > > > SIZE(header, ktr_comm); > > > SIZE(header, ktr_time); > > > SIZE(header, ktr_time.tv_sec); > > > SIZE(header, ktr_time.tv_sec); > > > SIZE(header, ktr_tid); > > > printf("\n%d\tktr_genio:\n", sizeof(genio)); > > > SIZE(genio, ktr_fd); > > > SIZE(genio, ktr_rw); > > > In your case, you could make a macro for each type. Without an > > > example of > > > how you want the output to look, it's hard for us to show you > > > code > > > that > > > will produce such output. > > > -- Rick C. Petty > > _______________________________________________ > > 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 Wed Jul 1 12:58:25 2009 Return-Path: Delivered-To: hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3666B106567C; Wed, 1 Jul 2009 12:58:25 +0000 (UTC) (envelope-from sos@deepcore.dk) Received: from deepcore.dk (adsl.deepcore.dk [87.63.29.106]) by mx1.freebsd.org (Postfix) with ESMTP id B4E168FC19; Wed, 1 Jul 2009 12:58:24 +0000 (UTC) (envelope-from sos@deepcore.dk) Received: from [172.18.2.117] (axiell-gw1.novi.dk [77.243.61.137]) by deepcore.dk (8.14.3/8.14.2) with ESMTP id n61CwI21012217; Wed, 1 Jul 2009 14:58:19 +0200 (CEST) (envelope-from sos@deepcore.dk) Message-Id: <4202EA69-6973-4638-8A0B-040F4FAA0B27@deepcore.dk> From: =?ISO-8859-1?Q?S=F8ren_Schmidt?= To: Bruce Cran In-Reply-To: <20090627132941.5d212017@tau.draftnet> Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v935.3) Date: Wed, 1 Jul 2009 14:58:17 +0200 References: <8EB69F68-8ED2-469C-B83E-2555A72630B4@deepcore.dk> <20090627132941.5d212017@tau.draftnet> X-Mailer: Apple Mail (2.935.3) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0 (deepcore.dk [87.63.29.106]); Wed, 01 Jul 2009 14:58:20 +0200 (CEST) X-Mailman-Approved-At: Wed, 01 Jul 2009 14:05:48 +0000 Cc: stable@FreeBSD.ORG, hackers@FreeBSD.ORG Subject: Re: ATA driver update for 7.2RELEASE available X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2009 12:58:25 -0000 On 27Jun, 2009, at 14:29 , Bruce Cran wrote: > On Fri, 26 Jun 2009 22:11:08 +0200 > S=F8ren Schmidt wrote: > >> This is a total replacement of the ATA driver, modulerized as in - >> current, but based on my WIP not from what might have happend to - >> current since I gave up maintainership. > > It's great to see the driver be modularised since removing unneeded > drivers (for example, on powerpc and embedded platforms) can save > ~200KB. Yep, thats the main idea behind this move, minimizing the footprint. With this and some of the _NO_ options to the world build an almost =20 reasonable sized FreeBSD can be made. FreeBSD seems to have grown *alot* of fat over the last years, not to =20= mention ports where installing one small application gets you both a =20 pony and a barn to keep it in as a "bonus" 8^) > Could you add some documentation for the modules in /sys/conf/NOTES > please? I looked through the sources and put together the patch for > 8.0 which is avaiable at > http://www.freebsd.org/cgi/query-pr.cgi?pr=3Dkern/133162 but it sounds > like some more drivers will need to be added for 7.2. Good catch, included in my WIP here, when/if I get to put up another =20 release of this it will be in there, thanks! PS: For official inclusion in FreeBSD someone with a commit bit will =20 have to look into this. -S=F8ren -- From owner-freebsd-hackers@FreeBSD.ORG Wed Jul 1 21:20:23 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FCC2106566C for ; Wed, 1 Jul 2009 21:20:23 +0000 (UTC) (envelope-from frederic.praca@freebsd-fr.org) Received: from smtpfb1-g21.free.fr (smtpfb1-g21.free.fr [212.27.42.9]) by mx1.freebsd.org (Postfix) with ESMTP id 859388FC20 for ; Wed, 1 Jul 2009 21:20:20 +0000 (UTC) (envelope-from frederic.praca@freebsd-fr.org) Received: from smtp6-g21.free.fr (smtp6-g21.free.fr [212.27.42.6]) by smtpfb1-g21.free.fr (Postfix) with ESMTP id 28D0477C7C7 for ; Wed, 1 Jul 2009 23:01:16 +0200 (CEST) Received: from smtp6-g21.free.fr (localhost [127.0.0.1]) by smtp6-g21.free.fr (Postfix) with ESMTP id 81D2EE080E9 for ; Wed, 1 Jul 2009 23:01:10 +0200 (CEST) Received: from tatooine (coruscant.dnsalias.net [88.169.125.217]) by smtp6-g21.free.fr (Postfix) with ESMTP id 4EC4EE08092 for ; Wed, 1 Jul 2009 23:01:08 +0200 (CEST) Date: Wed, 1 Jul 2009 23:01:01 +0200 From: =?UTF-8?B?RnLDqWTDqXJpYw==?= Praca To: freebsd-hackers@freebsd.org Message-ID: <20090701230101.5d50741c@tatooine> X-Mailer: Claws Mail 3.5.0 (GTK+ 2.14.4; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Problem compiling kernel with ath device X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Jul 2009 21:20:23 -0000 Hello guys, I got the following compilation error in if_ath.c when compiling the RELENG_7 today : ../../../dev/ath/if_ath.c: In function 'ath_rx_tap': ../../../dev/ath/if_ath.c:3414: error: 'const struct ath_rx_status' has no member named 'rs_flags' ../../../dev/ath/if_ath.c:3416: error: 'const struct ath_rx_status' has no member named 'rs_flags' *** Error code 1 After investigating, this part appears only when HAL_ABI_VERSION is greater than 0x07050400 The current value seems to be 0x08112800 as specified in ath_hal/hal.h. The problem is that for rs_flags to be present in the ath_rx_status structure, defined in ath_hal/ah_desc.h, AH_SUPPORT_AR5416 has to be defined. Do I need something more than the three following lines in my kernel configuration especially the AH_SUPPORT_AR5416 option even if my PCI card is a 5212 chipset powered ? device ath # Atheros pci/cardbus NIC's device ath_hal # Atheros HAL (Hardware Access Layer) device ath_rate_sample # SampleRate tx rate control for ath Well, in fact, I already know the answer as I compiled my kernel by adding AH_SUPPORT_AR5416 option but isn't it a problem there ? Regards Fred From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 2 00:39:46 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 62C631065678; Thu, 2 Jul 2009 00:39:46 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id BCDCC8FC16; Thu, 2 Jul 2009 00:39:45 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: by fxm18 with SMTP id 18so1081568fxm.43 for ; Wed, 01 Jul 2009 17:39:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7Hm8mrvQ6C1BVA1/7lVpNlobGW1V67EWxEHMyprkI1c=; b=NKFy7bYdwugKI2kRneGu/x18q675nJPeK9Ckye6TF7nnIrYi+g2u3hDg/cJ20UcV/V Gx1qcy5+60IEHhCAQJKDDuCd1tmrt784dC3V9VaOJGyD1ACSC6h5MEyAKi+qh9a3H02w zkkzSkZEHfYvP+/k3Lez0dk7TutR6P4OqDh+0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=MQhqxDbAYtE4WbrFnrZq6JDrPNYGDCAgPPVpUvsNL2/w1YxlGobBqteg8sNsyWCpbZ OMUEVjF4bsP1XOHwdbYs7oJ2uS4JQjE4LldrVsu0rGieuBKDBLAARRQN2qff54ooAWyn 74YoyRMO5r8OiP0xuQxUbAxBVEccszecj4Y0g= MIME-Version: 1.0 Received: by 10.239.170.68 with SMTP id r4mr885875hbe.12.1246495183767; Wed, 01 Jul 2009 17:39:43 -0700 (PDT) In-Reply-To: <20090630225457.GR84786@elvis.mu.org> References: <20090630210238.GA33849@keira.kiwi-computer.com> <20090630225457.GR84786@elvis.mu.org> Date: Wed, 1 Jul 2009 21:39:43 -0300 Message-ID: From: "Carlos A. M. dos Santos" To: Alfred Perlstein Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org, Alexander Best Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 00:39:46 -0000 On Tue, Jun 30, 2009 at 7:54 PM, Alfred Perlstein wrote= : > Hey Alex, > > People frown on macros, but this could be a good one: > > #define SPRINT(f, fmt) \ > =A0 =A0 =A0 =A0do {\ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0for (_i =3D 0; _i < sizeof(f)/sizeof(f[0])= ; i++) \ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0printf(fmt, f[i]); \ > =A0 =A0 =A0 =A0}while(0) > > :D > > This should allow you to point to any _array_ and print each > element of it using format "fmt". > > Example: > SPRINT(Header->game_title, "%c"); Yes, it works, but using a loop to print a character array one char at a time is terribly inefficient. --=20 My preferred quotation of Robert Louis Stevenson is "You cannot make an omelette without breaking eggs". Not because I like the omelettes, but because I like the sound of eggs being broken. From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 2 01:48:24 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D318F1065678 for ; Thu, 2 Jul 2009 01:48:24 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: from mail-bw0-f216.google.com (mail-bw0-f216.google.com [209.85.218.216]) by mx1.freebsd.org (Postfix) with ESMTP id 506968FC18 for ; Thu, 2 Jul 2009 01:48:23 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: by bwz12 with SMTP id 12so1094344bwz.43 for ; Wed, 01 Jul 2009 18:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=hv1U3MIqY0OcMHAFDAfQvAhDxYfGmg4Y8+ZLbbWk0ac=; b=QG9zjqs3BT4ne5vlrlesAZjxoNDMgmAvQ/xMAeLAmWdY5ku4jQ6sAkomLRGXAF7uoS 2nJSrSO1nHar1FKSkYYgqEpsir4DMeGoZtoF/sWmlgtW4aBCuWy8dQbW20ZkeomOaWJr Y2qMih8VudeLk3n57DQ9WveB4uroGAoJlHgdQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Mb/1KAZ8GfrtU0raMoLIUcJ5WUHPL+Y4wDMuvl1pOR4De21+DRoLfbFHkpsm1RzvKm pATvqu0t4gqlWwqb77otbh52vFY6ymv14TYOAfhoWlZhZSr9drm1ADVCRb5la7fSVfDm hmpNDFhkqwmNQvJoAylDpyIvx41+dFMTbQ89k= MIME-Version: 1.0 Received: by 10.239.141.68 with SMTP id b4mr888956hba.11.1246499303066; Wed, 01 Jul 2009 18:48:23 -0700 (PDT) In-Reply-To: References: <20090630210238.GA33849@keira.kiwi-computer.com> Date: Wed, 1 Jul 2009 22:48:23 -0300 Message-ID: From: "Carlos A. M. dos Santos" To: Alexander Best Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 01:48:25 -0000 On Tue, Jun 30, 2009 at 7:06 PM, Alexander Best wrote: > thanks for all the help. i decided to take the pill and coded all the fpr= intfs > by hand. here's the result. usually i'd stick to a higher level languag, = but i > need C's inline assembly support: > > =A0 =A0struct Header > =A0 =A0{ > =A0 =A0 =A0 =A0u_int8_t rom_entry[4]; > =A0 =A0 =A0 =A0u_int8_t nintendo_logo[156]; > =A0 =A0 =A0 =A0u_char game_title[12]; > =A0 =A0 =A0 =A0u_char game_code[4]; > =A0 =A0 =A0 =A0u_char maker_code[2]; > =A0 =A0 =A0 =A0u_int8_t fixed_val; > =A0 =A0 =A0 =A0u_int8_t unit_code; > =A0 =A0 =A0 =A0u_int8_t device_type; > =A0 =A0 =A0 =A0u_int8_t reserved_area1[7]; > =A0 =A0 =A0 =A0u_int8_t software_version; > =A0 =A0 =A0 =A0u_int8_t complement_check; > =A0 =A0 =A0 =A0u_int8_t reserved_area2; > =A0 =A0 =A0 =A0u_int8_t ram_entry[4]; > =A0 =A0 =A0 =A0u_int8_t boot_mode; > =A0 =A0 =A0 =A0u_int8_t slave_id; > =A0 =A0 =A0 =A0u_int8_t unused_area[26]; > =A0 =A0 =A0 =A0u_int8_t joybus_entry[4]; > =A0 =A0}; > > =A0 =A0struct Header * hdr =3D rom; > =A0 =A0int i; > > =A0 =A0fprintf(stderr, "ROM Entry: 0x"); > =A0 =A0for (i=3D0; i < 4; i++) fprintf(stderr, "%x", hdr->rom_entry[i]); > =A0 =A0fprintf(stderr, "\nNintendo Logo: 0x"); > =A0 =A0for (i=3D0; i < sizeof(hdr->nintendo_logo); i++) fprintf(stderr, "= %x", > =A0 =A0hdr->nintendo_logo[i]); > =A0 =A0fprintf(stderr, "\nGame Title: %s", =A0hdr->game_title); > =A0 =A0fprintf(stderr, "\nGame Code: %s", =A0hdr->game_code); > =A0 =A0fprintf(stderr, "\nMaker Code: %s", =A0hdr->maker_code); > =A0 =A0fprintf(stderr, "\nFixed Value: 0x"); > =A0 =A0fprintf(stderr, "%x", hdr->fixed_val); > =A0 =A0fprintf(stderr, "\nUnit Code: 0x"); > =A0 =A0fprintf(stderr, "%x", hdr->unit_code); > =A0 =A0fprintf(stderr, "\nDevice Type: 0x"); > =A0 =A0fprintf(stderr, "%x", hdr->device_type); > =A0 =A0fprintf(stderr, "\nReserved Area: 0x"); > =A0 =A0for (i=3D0; i < sizeof(hdr->reserved_area1); i++) fprintf(stderr, = "%x", > =A0 =A0hdr->reserved_area1[i]); > =A0 =A0fprintf(stderr, "\nSoftware Version: 0x"); > =A0 =A0fprintf(stderr, "%x", hdr->software_version); > =A0 =A0fprintf(stderr, "\nComplement Check: 0x"); > =A0 =A0fprintf(stderr, "%x", hdr->complement_check); > =A0 =A0fprintf(stderr, "\nReserved Area: 0x"); > =A0 =A0fprintf(stderr, "%x", hdr->reserved_area2); > =A0 =A0fprintf(stderr, "\nRAM Entry Point: 0x"); > =A0 =A0for (i=3D0; i < sizeof(hdr->ram_entry); i++) fprintf(stderr, "%x", > =A0 =A0hdr->ram_entry[i]); > =A0 =A0fprintf(stderr, "\nBoot Mode: 0x"); > =A0 =A0fprintf(stderr, "%x", hdr->boot_mode); > =A0 =A0fprintf(stderr, "\nSlave ID: 0x"); > =A0 =A0fprintf(stderr, "%x", hdr->slave_id); > =A0 =A0fprintf(stderr, "\nUnused Area: 0x"); > =A0 =A0for (i=3D0; i < sizeof(hdr->unused_area); i++) fprintf(stderr, "%x= ", > =A0 =A0hdr->unused_area[i]); > =A0 =A0fprintf(stderr, "\nJoybus Entry Point: 0x"); > =A0 =A0for (i=3D0; i < sizeof(hdr->joybus_entry); i++) fprintf(stderr, "%= x", > =A0 =A0hdr->joybus_entry[i]); The code below is a bit more efficient and easier to read. It is also safer, since it limits the width of the %s conversions to the sizes of the corresponding arrays. fprintf(stderr, "ROM Entry: 0x"); for (i=3D0; i < 4; i++) fprintf(stderr, "%x", hdr->rom_entry[i]); fprintf(stderr, "\nNintendo Logo: 0x"); for (i=3D0; i < sizeof(hdr->nintendo_logo); i++) fprintf(stderr, "%x", hdr->nintendo_logo[i]); fprintf(stderr, "\nGame Title: %.*s" "\nGame Code: %.*s" "\nMaker Code: %.*s" "\nFixed Value: 0x%x" "\nUnit Code: 0x%x" "\nDevice Type: 0x%x" "\nReserved Area: 0x", sizeof(hdr->game_title), hdr->game_title, sizeof(hdr->game_code), hdr->game_code, sizeof(hdr->maker_code), hdr->maker_code, hdr->fixed_val, hdr->unit_code, hdr->device_type); for (i=3D0; i < sizeof(hdr->reserved_area1); i++) fprintf(stderr, "%x", hdr->reserved_area1[i]); fprintf(stderr, "\nSoftware Version: 0x%x" "\nComplement Check: 0x%x" "\nReserved Area: 0x%x" "\nRAM Entry Point: 0x", hdr->software_version, hdr->complement_check, hdr->reserved_area2); for (i=3D0; i < sizeof(hdr->ram_entry); i++) fprintf(stderr, "%x", hdr->ram_entry[i]); fprintf(stderr, "\nBoot Mode: 0x""%x" "\nSlave ID: 0x""%x" "\nUnused Area: 0x", hdr->boot_mode, hdr->slave_id); for (i=3D0; i < sizeof(hdr->unused_area); i++) fprintf(stderr, "%x", hdr->unused_area[i]); fprintf(stderr, "\nJoybus Entry Point: 0x"); for (i=3D0; i < sizeof(hdr->joybus_entry); i++) fprintf(stderr, "%x", hdr->joybus_entry[i]); fprintf(stderr, "\n"); --=20 My preferred quotation of Robert Louis Stevenson is "You cannot make an omelette without breaking eggs". Not because I like the omelettes, but because I like the sound of eggs being broken. From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 2 16:03:32 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7B814106566C for ; Thu, 2 Jul 2009 16:03:32 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 3E4238FC0C for ; Thu, 2 Jul 2009 16:03:31 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id E8BFF6D418; Thu, 2 Jul 2009 18:03:30 +0200 (CEST) Received: by ds4.des.no (Postfix, from userid 1001) id C42F3844B5; Thu, 2 Jul 2009 18:03:30 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Alexander Best References: Date: Thu, 02 Jul 2009 18:03:30 +0200 In-Reply-To: (Alexander Best's message of "Wed, 01 Jul 2009 00:06:05 +0200 (CEST)") Message-ID: <864otvax7x.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 16:03:32 -0000 Alexander Best writes: > for (i=3D0; i < sizeof(hdr->nintendo_logo); i++) > fprintf(stderr, "%x", hdr->nintendo_logo[i]); What will this print if nintendo_logo is { 0x01, 0x02, 0x03, 0x04 }? DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 2 18:10:59 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2933106564A for ; Thu, 2 Jul 2009 18:10:59 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 56E218FC14 for ; Thu, 2 Jul 2009 18:10:59 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: by fxm18 with SMTP id 18so1538106fxm.43 for ; Thu, 02 Jul 2009 11:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=HPKM4uBn57Tlz9TqWYG0AyRurmSAirUwY8N6O2kwt40=; b=Szgp7mqQbcCjRWx6JHZBlBGjwdEugSsGNkiMBEs1Sx2v6nl180hlTDeC6llJznanfA OZC3vUigPYvjY8nvt58NDUWPfZ/AE0+JP/2djw7/4XyK2Q8LYyhXxd3WP4eLLs9nvzCK q0lHpub34TjIsVfrKknY5IpsEui33930biBo4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Np0OyXbEo190DL68N1l480Octvz9yjyzzUGYPy9oh8E9lfaCejcJywHaL2jBxB32PV tL/8LNuKYs7TgbcNEhdsv4/YZPqEqLo19WNxq2GNOvH6roqFzUjZlW9dwtMbkX2m5lOc jYMGWR26KWlHfYjRCa3Dk1YTz1VOXnHhW9Df8= MIME-Version: 1.0 Received: by 10.239.168.6 with SMTP id i6mr34452hbe.25.1246558258284; Thu, 02 Jul 2009 11:10:58 -0700 (PDT) In-Reply-To: <864otvax7x.fsf@ds4.des.no> References: <864otvax7x.fsf@ds4.des.no> Date: Thu, 2 Jul 2009 15:10:58 -0300 Message-ID: From: "Carlos A. M. dos Santos" To: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org, Alexander Best Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 18:11:00 -0000 2009/7/2 Dag-Erling Sm=F8rgrav : > Alexander Best writes: >> =A0 =A0 for (i=3D0; i < sizeof(hdr->nintendo_logo); i++) >> =A0 =A0 =A0 =A0 fprintf(stderr, "%x", hdr->nintendo_logo[i]); > > What will this print if nintendo_logo is { 0x01, 0x02, 0x03, 0x04 }? Good catch. It will print "0x1234" but it should print "0x01020304". My example has the same error. The conversion specification should be "%02x", not just "%x". --=20 My preferred quotation of Robert Louis Stevenson is "You cannot make an omelette without breaking eggs". Not because I like the omelettes, but because I like the sound of eggs being broken. From owner-freebsd-hackers@FreeBSD.ORG Thu Jul 2 18:18:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43E0B10656BD for ; Thu, 2 Jul 2009 18:18:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 1C0E28FC15 for ; Thu, 2 Jul 2009 18:18:50 +0000 (UTC) (envelope-from rwatson@FreeBSD.org) Received: from fledge.watson.org (fledge.watson.org [65.122.17.41]) by cyrus.watson.org (Postfix) with ESMTPS id C2CE746B90; Thu, 2 Jul 2009 14:18:49 -0400 (EDT) Date: Thu, 2 Jul 2009 19:18:49 +0100 (BST) From: Robert Watson X-X-Sender: robert@fledge.watson.org To: Mel Flynn In-Reply-To: <200906301431.38664.mel.flynn+fbsd.hackers@mailing.thruhere.net> Message-ID: References: <200906291317.12040.mel.flynn+fbsd.hackers@mailing.thruhere.net> <4A49CBA0.1050806@cs.rice.edu> <200906301431.38664.mel.flynn+fbsd.hackers@mailing.thruhere.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: freebsd-hackers@freebsd.org, Alan Cox , Wojciech Puchar Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jul 2009 18:18:50 -0000 On Tue, 30 Jun 2009, Mel Flynn wrote: >>> It looks like sys/kern/kern_proc.c could call mincore around the loop at >>> line 1601 (rev 194498), but I know nothing about the vm subsystem to know >>> the implications or locking involved. There's still 16 bytes of spare to >>> consume, in the kve_vminfo struct though ;) >> >> Yes, to start with, you could replace the call to pmap_extract() with a >> call to pmap_mincore() and export a Boolean to user space that says, "This >> region of the address space contains one or more superpage mappings." > > How about attached? I like the idea -- there are some style nits that need fixing though. Assuming Alan is happy with the VM side of things, I can do the cleanup and get it in the tree. Robert N M Watson Computer Laboratory University of Cambridge > > % sudo procstat -av|grep 'S ' > PID START END PRT RES PRES REF SHD FL TP PATH > 1754 0x28900000 0x2ae00000 rw- 9385 0 3 0 --S df > 2141 0x2f900000 0x30800000 rw- 3719 0 1 0 --S df > 2146 0x3eec0000 0x4fac0000 rwx 1745 0 1 0 --S df > > -- > Mel > > From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 3 13:46:59 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 11A071065672 for ; Fri, 3 Jul 2009 13:46:59 +0000 (UTC) (envelope-from ez.c0re@gmail.com) Received: from mail-yx0-f181.google.com (mail-yx0-f181.google.com [209.85.210.181]) by mx1.freebsd.org (Postfix) with ESMTP id C27088FC1A for ; Fri, 3 Jul 2009 13:46:58 +0000 (UTC) (envelope-from ez.c0re@gmail.com) Received: by yxe11 with SMTP id 11so3421004yxe.3 for ; Fri, 03 Jul 2009 06:46:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=KyKwqrZgKEG2nrPRuKELG4QesVAVKjwGkGEEXC6MuQ0=; b=yEwyQ+8rWPDfoIYXapIvCZ+jO5Fj3yaXgbU7q7UgKC4G9nWAthq9zS/JU3kqVvhzRA itMROdkqLFwQ9O7lEjMOxphfJCQqKfQkjBmLR8shMUg/ieOTfomlU/3ctbGuO5uqFtNA BZS0E5AeZXRPBznbTgl1c9FPgFDS1IiVFkPy4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=ilLQOeEG/zFXpUjU4KH9CwV/OcvBcRW4+X7C9eeEjtBZy/5XhJlCYEWe2uTCQfwnWc KKkyxJYTcSe4qIxAub8mxY27sOdMBvk0FGwtOsN1hYnx8dAK+AvZx5hleuxr7Cb/v+dB pMTNLyQ9KPqasOut0oQxx6a5dA+c88M98R8po= MIME-Version: 1.0 Received: by 10.100.215.12 with SMTP id n12mr2144067ang.154.1246627126884; Fri, 03 Jul 2009 06:18:46 -0700 (PDT) Date: Fri, 3 Jul 2009 10:18:46 -0300 Message-ID: <6dd8736a0907030618o722d8252x59479543fef23cc4@mail.gmail.com> From: c0re dumped To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Problem with vm.pmap.shpgperproc and vm.pmap.pv_entry_max X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2009 13:46:59 -0000 So, I never had problem with this server, but recently it starts to giv me the following messages *every* minute : Jul 3 10:04:00 squid kernel: Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max tunable. Jul 3 10:05:00 squid kernel: Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max tunable. Jul 3 10:06:00 squid kernel: Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max tunable. Jul 3 10:07:01 squid kernel: Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max tunable. Jul 3 10:08:01 squid kernel: Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max tunable. Jul 3 10:09:01 squid kernel: Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max tunable. Jul 3 10:10:01 squid kernel: Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max tunable. Jul 3 10:11:01 squid kernel: Approaching the limit on PV entries, consider increasing either the vm.pmap.shpgperproc or the vm.pmap.pv_entry_max tunable. This server is running Squid + dansguardian. The users are complaining about slow navigation and they are driving me crazy ! Have anyone faced this problem before ? Some infos: # uname -a FreeBSD squid 7.2-RELEASE FreeBSD 7.2-RELEASE #0: Fri May 1 08:49:13 UTC 2009 root@walker.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 # sysctl vm vm.vmtotal: System wide totals computed every five seconds: (values in kilobytes) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Processes: (RUNQ: 1 Disk Wait: 1 Page Wait: 0 Sleep: 230) Virtual Memory: (Total: 19174412K, Active 9902152K) Real Memory: (Total: 1908080K Active 1715908K) Shared Virtual Memory: (Total: 647372K Active: 10724K) Shared Real Memory: (Total: 68092K Active: 4436K) Free Memory Pages: 88372K vm.loadavg: { 0.96 0.96 1.13 } vm.v_free_min: 4896 vm.v_free_target: 20635 vm.v_free_reserved: 1051 vm.v_inactive_target: 30952 vm.v_cache_min: 20635 vm.v_cache_max: 41270 vm.v_pageout_free_min: 34 vm.pageout_algorithm: 0 vm.swap_enabled: 1 vm.kmem_size_scale: 3 vm.kmem_size_max: 335544320 vm.kmem_size_min: 0 vm.kmem_size: 335544320 vm.nswapdev: 1 vm.dmmax: 32 vm.swap_async_max: 4 vm.zone_count: 84 vm.swap_idle_threshold2: 10 vm.swap_idle_threshold1: 2 vm.exec_map_entries: 16 vm.stats.misc.zero_page_count: 0 vm.stats.misc.cnt_prezero: 0 vm.stats.vm.v_kthreadpages: 0 vm.stats.vm.v_rforkpages: 0 vm.stats.vm.v_vforkpages: 340091 vm.stats.vm.v_forkpages: 3604123 vm.stats.vm.v_kthreads: 53 vm.stats.vm.v_rforks: 0 vm.stats.vm.v_vforks: 2251 vm.stats.vm.v_forks: 19295 vm.stats.vm.v_interrupt_free_min: 2 vm.stats.vm.v_pageout_free_min: 34 vm.stats.vm.v_cache_max: 41270 vm.stats.vm.v_cache_min: 20635 vm.stats.vm.v_cache_count: 5734 vm.stats.vm.v_inactive_count: 242259 vm.stats.vm.v_inactive_target: 30952 vm.stats.vm.v_active_count: 445958 vm.stats.vm.v_wire_count: 58879 vm.stats.vm.v_free_count: 16335 vm.stats.vm.v_free_min: 4896 vm.stats.vm.v_free_target: 20635 vm.stats.vm.v_free_reserved: 1051 vm.stats.vm.v_page_count: 769244 vm.stats.vm.v_page_size: 4096 vm.stats.vm.v_tfree: 12442098 vm.stats.vm.v_pfree: 1657776 vm.stats.vm.v_dfree: 0 vm.stats.vm.v_tcached: 253415 vm.stats.vm.v_pdpages: 254373 vm.stats.vm.v_pdwakeups: 14 vm.stats.vm.v_reactivated: 414 vm.stats.vm.v_intrans: 1912 vm.stats.vm.v_vnodepgsout: 0 vm.stats.vm.v_vnodepgsin: 6593 vm.stats.vm.v_vnodeout: 0 vm.stats.vm.v_vnodein: 891 vm.stats.vm.v_swappgsout: 0 vm.stats.vm.v_swappgsin: 0 vm.stats.vm.v_swapout: 0 vm.stats.vm.v_swapin: 0 vm.stats.vm.v_ozfod: 56314 vm.stats.vm.v_zfod: 2016628 vm.stats.vm.v_cow_optim: 1959 vm.stats.vm.v_cow_faults: 584331 vm.stats.vm.v_vm_faults: 3661086 vm.stats.sys.v_soft: 23280645 vm.stats.sys.v_intr: 18528397 vm.stats.sys.v_syscall: 1990471112 vm.stats.sys.v_trap: 8079878 vm.stats.sys.v_swtch: 105613021 vm.stats.object.bypasses: 14893 vm.stats.object.collapses: 55259 vm.v_free_severe: 2973 vm.max_proc_mmap: 49344 vm.old_msync: 0 vm.msync_flush_flags: 3 vm.boot_pages: 48 vm.max_wired: 255475 vm.pageout_lock_miss: 0 vm.disable_swapspace_pageouts: 0 vm.defer_swapspace_pageouts: 0 vm.swap_idle_enabled: 0 vm.pageout_stats_interval: 5 vm.pageout_full_stats_interval: 20 vm.pageout_stats_max: 20635 vm.max_launder: 32 vm.phys_segs: SEGMENT 0: start: 0x1000 end: 0x9a000 free list: 0xc0cca168 SEGMENT 1: start: 0x100000 end: 0x400000 free list: 0xc0cca168 SEGMENT 2: start: 0x1025000 end: 0xbc968000 free list: 0xc0cca060 vm.phys_free: FREE LIST 0: ORDER (SIZE) | NUMBER | POOL 0 | POOL 1 -- -- -- -- -- -- 10 ( 4096K) | 0 | 0 9 ( 2048K) | 0 | 0 8 ( 1024K) | 0 | 0 7 ( 512K) | 0 | 0 6 ( 256K) | 0 | 0 5 ( 128K) | 0 | 0 4 ( 64K) | 0 | 0 3 ( 32K) | 0 | 0 2 ( 16K) | 0 | 0 1 ( 8K) | 0 | 0 0 ( 4K) | 24 | 3562 FREE LIST 1: ORDER (SIZE) | NUMBER | POOL 0 | POOL 1 -- -- -- -- -- -- 10 ( 4096K) | 0 | 0 9 ( 2048K) | 0 | 0 8 ( 1024K) | 0 | 0 7 ( 512K) | 0 | 0 6 ( 256K) | 0 | 0 5 ( 128K) | 0 | 2 4 ( 64K) | 0 | 3 3 ( 32K) | 6 | 11 2 ( 16K) | 6 | 21 1 ( 8K) | 14 | 35 0 ( 4K) | 20 | 70 vm.reserv.reclaimed: 187 vm.reserv.partpopq: LEVEL SIZE NUMBER -1: 71756K, 19 vm.reserv.freed: 35575 vm.reserv.broken: 94 vm.idlezero_enable: 0 vm.kvm_free: 310374400 vm.kvm_size: 1073737728 vm.pmap.pmap_collect_active: 0 vm.pmap.pmap_collect_inactive: 0 vm.pmap.pv_entry_spare: 50408 vm.pmap.pv_entry_allocs: 38854797 vm.pmap.pv_entry_frees: 37052501 vm.pmap.pc_chunk_tryfail: 0 vm.pmap.pc_chunk_frees: 130705 vm.pmap.pc_chunk_allocs: 136219 vm.pmap.pc_chunk_count: 5514 vm.pmap.pv_entry_count: 1802296 vm.pmap.pde.promotions: 0 vm.pmap.pde.p_failures: 0 vm.pmap.pde.mappings: 0 vm.pmap.pde.demotions: 0 vm.pmap.shpgperproc: 200 vm.pmap.pv_entry_max: 2002224 vm.pmap.pg_ps_enabled: 0 Either pmap.shpgperproc and vm.pmap.pv_entry_max are with their default values. I read here (http://lists.freebsd.org/pipermail/freebsd-hackers/2003-May/000695.html) tha its not a good ideia to increase these values arbitrarily. Thanks F=E1bio --=20 "To err is human, to blame it on somebody else shows management potential." From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 3 14:22:28 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CB5D10656AB for ; Fri, 3 Jul 2009 14:22:28 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojteks.tensor.gdynia.pl (wojteks.tensor.gdynia.pl [IPv6:2001:4070:101:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id 55CBC8FC15 for ; Fri, 3 Jul 2009 14:22:27 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [IPv6:2001:4070:101:2::2]) by wojteks.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n63EMjQ2023309 for ; Fri, 3 Jul 2009 16:22:45 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n63E7uDB013002 for ; Fri, 3 Jul 2009 16:07:56 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3/Submit) with ESMTP id n63E7uVH012999 for ; Fri, 3 Jul 2009 16:07:56 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 3 Jul 2009 16:07:56 +0200 (CEST) From: Wojciech Puchar To: freebsd-hackers@freebsd.org Message-ID: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII Subject: possibly tmpfs bug X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2009 14:22:28 -0000 repeatable put something on tmpfs filesystem, then download it to other machine using ftp (server is ftpd on first machine). no errors, download is fine, but you get rubbish - simply data from wrong places in memory. using rcp works. most probably ftpd uses sendfile, while rcp does not From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 3 14:24:17 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A19EA1065674 for ; Fri, 3 Jul 2009 14:24:17 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojteks.tensor.gdynia.pl (wojteks.tensor.gdynia.pl [IPv6:2001:4070:101:2::1]) by mx1.freebsd.org (Postfix) with ESMTP id DD6FC8FC14 for ; Fri, 3 Jul 2009 14:24:16 +0000 (UTC) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (wojtek.tensor.gdynia.pl [IPv6:2001:4070:101:2::2]) by wojteks.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n63EOaUq023383 for ; Fri, 3 Jul 2009 16:24:36 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from wojtek.tensor.gdynia.pl (localhost [127.0.0.1]) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3) with ESMTP id n63E9l08013030 for ; Fri, 3 Jul 2009 16:09:47 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Received: from localhost (wojtek@localhost) by wojtek.tensor.gdynia.pl (8.14.3/8.14.3/Submit) with ESMTP id n63E9lQI013027 for ; Fri, 3 Jul 2009 16:09:47 +0200 (CEST) (envelope-from wojtek@wojtek.tensor.gdynia.pl) Date: Fri, 3 Jul 2009 16:09:47 +0200 (CEST) From: Wojciech Puchar To: freebsd-hackers@freebsd.org In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Subject: possibly tmpfs bug - part 2 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2009 14:24:18 -0000 works even over localhost [wojtek@wojtek /tmp]$ cp /bin/sh . [wojtek@wojtek /tmp]$ ftp localhost Trying ::1... Connected to localhost. 220 wojtek.tensor.gdynia.pl FTP server (Version 6.00LS) ready. Name (localhost:wojtek): 331 Password required for wojtek. Password: 230 User wojtek logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> get sh sh2 local: sh2 remote: sh 229 Entering Extended Passive Mode (|||59220|) 550 sh: No such file or directory. ftp> cd /tmp 250 CWD command successful. ftp> get sh sh2 local: sh2 remote: sh 229 Entering Extended Passive Mode (|||63477|) 150 Opening BINARY mode data connection for 'sh' (114688 bytes). 100% |***********************************************************| 112 KB 56.87 MB/s 00:00 ETA 226 Transfer complete. 114688 bytes received in 00:00 (51.91 MB/s) ftp> ^D 221 Goodbye. [wojtek@wojtek /tmp]$ cmp sh sh2 sh sh2 differ: char 1, line 1 From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 3 19:19:17 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E27B7106566C for ; Fri, 3 Jul 2009 19:19:17 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (mail.cs.rice.edu [128.42.1.31]) by mx1.freebsd.org (Postfix) with ESMTP id AB71A8FC1B for ; Fri, 3 Jul 2009 19:19:17 +0000 (UTC) (envelope-from alc@cs.rice.edu) Received: from mail.cs.rice.edu (localhost.localdomain [127.0.0.1]) by mail.cs.rice.edu (Postfix) with ESMTP id 3472E2C2AAC; Fri, 3 Jul 2009 14:19:17 -0500 (CDT) X-Virus-Scanned: by amavis-2.4.0 at mail.cs.rice.edu Received: from mail.cs.rice.edu ([127.0.0.1]) by mail.cs.rice.edu (mail.cs.rice.edu [127.0.0.1]) (amavisd-new, port 10024) with LMTP id uzNYn0tIXhDc; Fri, 3 Jul 2009 14:19:09 -0500 (CDT) Received: from adsl-216-63-78-18.dsl.hstntx.swbell.net (adsl-216-63-78-18.dsl.hstntx.swbell.net [216.63.78.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.cs.rice.edu (Postfix) with ESMTP id 62CF62C2A81; Fri, 3 Jul 2009 14:19:09 -0500 (CDT) Message-ID: <4A4E59AD.7090007@cs.rice.edu> Date: Fri, 03 Jul 2009 14:19:09 -0500 From: Alan Cox User-Agent: Thunderbird 2.0.0.22 (X11/20090626) MIME-Version: 1.0 To: Robert Watson References: <200906291317.12040.mel.flynn+fbsd.hackers@mailing.thruhere.net> <4A49CBA0.1050806@cs.rice.edu> <200906301431.38664.mel.flynn+fbsd.hackers@mailing.thruhere.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, Mel Flynn , Wojciech Puchar Subject: Re: large pages (amd64) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2009 19:19:18 -0000 Robert Watson wrote: > > On Tue, 30 Jun 2009, Mel Flynn wrote: > >>>> It looks like sys/kern/kern_proc.c could call mincore around the >>>> loop at line 1601 (rev 194498), but I know nothing about the vm >>>> subsystem to know the implications or locking involved. There's >>>> still 16 bytes of spare to consume, in the kve_vminfo struct though ;) >>> >>> Yes, to start with, you could replace the call to pmap_extract() >>> with a call to pmap_mincore() and export a Boolean to user space >>> that says, "This region of the address space contains one or more >>> superpage mappings." >> >> How about attached? > > I like the idea -- there are some style nits that need fixing though. > Assuming Alan is happy with the VM side of things, I can do the > cleanup and get it in the tree. Aside from the style nits, it looks good to me. Alan From owner-freebsd-hackers@FreeBSD.ORG Fri Jul 3 21:41:56 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 18E90106566C for ; Fri, 3 Jul 2009 21:41:56 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 95B9A8FC0C for ; Fri, 3 Jul 2009 21:41:55 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: by fxm18 with SMTP id 18so2149165fxm.43 for ; Fri, 03 Jul 2009 14:41:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:to:cc:subject:references :organization:from:date:in-reply-to:message-id:user-agent :mime-version:content-type; bh=Pzgru1N8BhlAKdT0qckYSEEYNLQB0uSg3orsK8aCTz0=; b=R29/SO3hNTA7ZDO4ftc0da9XklOPexERmHYns13l+v7uJLUTEBfWyy0wgijQHJmaop om14BKbzLjd+u/vNnh8jmKbu7iZ9PKfrOUviM+kM4uazQvHoPX+5dgD5eKIsNN4KZqwK HgVhLbAsRKqZFZFoa56kvYCI6vnLjRGJLKaPo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=to:cc:subject:references:organization:from:date:in-reply-to :message-id:user-agent:mime-version:content-type; b=xtyVzDpz8fg7kRbUPfyer7n5GaYXILsZF5ElkBwm7GL9kLiWXNlMXci9l50OfB0ceg mxdhPIuFWRJwdyYkVW51NItc00KnybWanCINCf9EE00oC4wOIecM85W4jlDpEdSlEKAl FFLYmLibcmNpkTfr9GbQnk5nCVZ/CTb4S1HHo= Received: by 10.103.168.12 with SMTP id v12mr1075704muo.67.1246657314463; Fri, 03 Jul 2009 14:41:54 -0700 (PDT) Received: from localhost ([95.69.163.210]) by mx.google.com with ESMTPS id s10sm19889188muh.57.2009.07.03.14.41.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 03 Jul 2009 14:41:53 -0700 (PDT) To: Wojciech Puchar References: Organization: TOA Ukraine From: Mikolaj Golub Date: Sat, 04 Jul 2009 00:41:52 +0300 In-Reply-To: (Wojciech Puchar's message of "Fri\, 3 Jul 2009 16\:07\:56 +0200 \(CEST\)") Message-ID: <86skhdmokf.fsf@kopusha.onet> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-hackers@freebsd.org Subject: Re: possibly tmpfs bug X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Jul 2009 21:41:56 -0000 On Fri, 3 Jul 2009 16:07:56 +0200 (CEST) Wojciech Puchar wrote: WP> repeatable WP> put something on tmpfs filesystem, then download it to other machine WP> using ftp (server is ftpd on first machine). no errors, download is WP> fine, but you get rubbish - simply data from wrong places in memory. WP> using rcp works. most probably ftpd uses sendfile, while rcp does not Yes, this is sendfile problem. It has been reported. http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/127213 -- Mikolaj Golub From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 4 07:17:19 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E7CF2106567D for ; Sat, 4 Jul 2009 07:17:19 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 9271C8FC19 for ; Sat, 4 Jul 2009 07:17:19 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id BB8FAEB4C89; Sat, 4 Jul 2009 09:51:26 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id A034D4509B; Sat, 4 Jul 2009 09:51:26 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G1vIA46HMJW3; Sat, 4 Jul 2009 09:51:26 +0300 (EEST) Received: from kobe.laptop (adsl70-250.kln.forthnet.gr [77.49.117.250]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 6E86544002; Sat, 4 Jul 2009 09:51:26 +0300 (EEST) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n646pP24066145; Sat, 4 Jul 2009 09:51:25 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n646pO2P066144; Sat, 4 Jul 2009 09:51:24 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Alexander Best References: Date: Sat, 04 Jul 2009 09:51:24 +0300 In-Reply-To: (Alexander Best's message of "Tue, 30 Jun 2009 20:21:03 +0200 (CEST)") Message-ID: <87ljn5rleb.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2009 07:17:20 -0000 On Tue, 30 Jun 2009 20:21:03 +0200 (CEST), Alexander Best wrote: > thanks. now the output gets redirected using >. i'm quite new to programming > under unix. sorry for the inconvenience. > > so i guess there is no really easy way to output an inhomogeneous struct to > stdout without using a loop to output each array contained in the struct. No not really. You have to do the sizeof() dance. From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 4 07:17:20 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28267106567E for ; Sat, 4 Jul 2009 07:17:20 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 9269C8FC18 for ; Sat, 4 Jul 2009 07:17:19 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 48182EB4F4C; Sat, 4 Jul 2009 09:59:25 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 3A3AC4509B; Sat, 4 Jul 2009 09:59:25 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JonymHWOUCQU; Sat, 4 Jul 2009 09:59:25 +0300 (EEST) Received: from kobe.laptop (adsl70-250.kln.forthnet.gr [77.49.117.250]) by mail.ceid.upatras.gr (Postfix) with ESMTP id EE52144002; Sat, 4 Jul 2009 09:59:24 +0300 (EEST) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n646xOLq066166; Sat, 4 Jul 2009 09:59:24 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n646xOVm066165; Sat, 4 Jul 2009 09:59:24 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Alexander Best References: Date: Sat, 04 Jul 2009 09:59:24 +0300 In-Reply-To: (Alexander Best's message of "Wed, 01 Jul 2009 00:06:05 +0200 (CEST)") Message-ID: <87hbxtrl0z.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2009 07:17:20 -0000 On Wed, 01 Jul 2009 00:06:05 +0200 (CEST), Alexander Best wrote: > thanks for all the help. i decided to take the pill and coded all the > fprintfs by hand. here's the result. usually i'd stick to a higher > level languag, but i need C's inline assembly support: > > struct Header > { > u_int8_t rom_entry[4]; > u_int8_t nintendo_logo[156]; ... > fprintf(stderr, "\nNintendo Logo: 0x"); > for (i=0; i < sizeof(hdr->nintendo_logo); i++) > fprintf(stderr, "%x", hdr->nintendo_logo[i]); Note that %x will only print *one* digit for values smaller than 16, i.e. printf("%x", 10) => "a", so it may be useful to use "%02x" instead. > fprintf(stderr, "\nFixed Value: 0x"); > fprintf(stderr, "%x", hdr->fixed_val); For multi-byte fields, it makes sense to print "0x" first and then iterate. For single-byte values, it's probably a tiny bit faster to go only _once_ through for *printf() family formatter, i.e.: - fprintf(stderr, "\nFixed Value: 0x"); - fprintf(stderr, "%x", hdr->fixed_val); + fprintf(stderr, "\nFixed Value: 0x%x", hdr->fixed_val); Another nit that I noticed is that your last line doesn't end with "\n": > fprintf(stderr, "\nJoybus Entry Point: 0x"); > for (i=0; i < sizeof(hdr->joybus_entry); i++) fprintf(stderr, "%x", > hdr->joybus_entry[i]); Some terminal setups will *not* output the last line if it does not finish properly with a "\n", so it may be worth editing the code to avoid the "\nXXX" format idiom, and go for a format style that puts "\n" at the _end_ of output lines: fprintf(stderr, "Nintendo Logo: 0x"); for (i = 0; i < sizeof(hdr->nintendo_logo); i++) fprintf(stderr, "%02x", hdr->nintendo_logo[i]); fprintf(stderr, "\n"); fprintf(stderr, "Fixed Value: 0x%02x\n", hdr->fixed_val); From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 4 08:52:56 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13834106564A for ; Sat, 4 Jul 2009 08:52:56 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: from mail-fx0-f218.google.com (mail-fx0-f218.google.com [209.85.220.218]) by mx1.freebsd.org (Postfix) with ESMTP id 949EA8FC1A for ; Sat, 4 Jul 2009 08:52:55 +0000 (UTC) (envelope-from mozolevsky@gmail.com) Received: by fxm18 with SMTP id 18so2270919fxm.43 for ; Sat, 04 Jul 2009 01:52:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=Ir5eY9f2w5ItrZyVziTniJ70W6XJkJ5Speaq1uLk9jQ=; b=HaDj9bepDoUrRgnJQTP4qpovb9/QYdQk+waUJTe4w1f9ZSfwPXPFr4QYRI/xeqgpOn 1hZXJ8Hef2pCDLhTrKeLPDzOMo0xzSvpIkcB8IW8njXaRQtN2nlKvBlm/Zu3U/AcEDv8 YjokXH/RCYsXQ4QeVw73QCrBT7YUHeP0OKi0Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=ba4l+sSOqxjNyPLLecrT2ESV15Yn6eMJWn8ziDlf27H+ECVVF3hmfdWLgam7V1Nmc8 5fsfA+dSTEElXSWCOPKMreoL5WfPTaojvEDCd9dq6/tr0sZaJoB9SmPuwPSHi7qgcA5v eVKJ5JmKLY70cpQqyycPohoHOnO9CKkEfJLfw= MIME-Version: 1.0 Sender: mozolevsky@gmail.com Received: by 10.204.120.16 with SMTP id b16mr2153098bkr.64.1246697574635; Sat, 04 Jul 2009 01:52:54 -0700 (PDT) In-Reply-To: <87hbxtrl0z.fsf@kobe.laptop> References: <87hbxtrl0z.fsf@kobe.laptop> From: Igor Mozolevsky Date: Sat, 4 Jul 2009 09:52:34 +0100 X-Google-Sender-Auth: 6b5e97e6db475ef9 Message-ID: To: Giorgos Keramidas Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: rick-freebsd2008@kiwi-computer.com, freebsd-hackers@freebsd.org, Alexander Best Subject: Re: c question: *printf'ing arrays X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2009 08:52:56 -0000 2009/7/4 Giorgos Keramidas : [snip] s/0x%/%#.2hh/g -- Igor From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 4 13:13:52 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C90E0106564A for ; Sat, 4 Jul 2009 13:13:52 +0000 (UTC) (envelope-from xorquewasp@googlemail.com) Received: from mail-ew0-f213.google.com (mail-ew0-f213.google.com [209.85.219.213]) by mx1.freebsd.org (Postfix) with ESMTP id 51A608FC1E for ; Sat, 4 Jul 2009 13:13:52 +0000 (UTC) (envelope-from xorquewasp@googlemail.com) Received: by ewy9 with SMTP id 9so3022048ewy.43 for ; Sat, 04 Jul 2009 06:13:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:received:date:from:to:cc :subject:message-id:references:mime-version:content-type :content-disposition:in-reply-to; bh=I+qNsYof19l/y9mZvdh6669Nc2q4mGjTS15XLdntp5k=; b=STRqMORs73T6llTKbfgHvYGcNbq3Xr8XiHC/3Jf9PuuBZpDF8SDsSXZzkDYkk5k9iQ BCHOU8gSsE4bTpsjXFLdQ1y715lXn8GWHiMtxqJYD8WXqFbF79cYPlumBxEWjz10H0SD cN8ug/gyJxmrEmrgcRl+wmum3fb5psi2mT+e0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; b=pjHpwOHseRLO5HwFlPqiDQC4HQsUUZEoxYDu3P/nxxbG4hcoES/YdJ9s1Yo42Xn1kK +fHeHaENK2iBG18GEA+uKNlYiophvm9mdwWfYvPHjKaFNVISFxZNI1QLgX5rRzTu0IuH MSwxd4//fv73x5PfkaUJq24pc2nwAbAsVrkOU= Received: by 10.210.63.2 with SMTP id l2mr2988712eba.69.1246713231205; Sat, 04 Jul 2009 06:13:51 -0700 (PDT) Received: from viper.internal.network (geeshaulage.lcdsl.co.uk [62.249.247.223]) by mx.google.com with ESMTPS id 5sm8571282ewy.4.2009.07.04.06.13.49 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 04 Jul 2009 06:13:49 -0700 (PDT) Received: by viper.internal.network (Postfix, from userid 11001) id 2C12F4AC67; Sat, 4 Jul 2009 14:09:12 +0100 (BST) Date: Sat, 4 Jul 2009 14:09:12 +0100 From: xorquewasp@googlemail.com To: Daniel Eischen Message-ID: <20090704130912.GA9332@logik.internal.network> References: <20090506140325.GA69468@logik.internal.network> <20090506152222.GC69468@logik.internal.network> <20090508211022.GA37475@logik.internal.network> <20090518084831.GA95354@logik.internal.network> <20090519114548.GA8610@logik.internal.network> <20090519135917.GA5391@logik.internal.network> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: freebsd-hackers@freebsd.org Subject: Re: bootstrapping gnat GCC on amd64 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2009 13:13:53 -0000 Status update: http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00102.html I replied to the last email in the thread but haven't heard back yet. Presumably I'll be maintaining the FreeBSD x86_64 port. I'm about to start work on the FreeBSD port now. From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 4 22:48:47 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBB3E1065673 for ; Sat, 4 Jul 2009 22:48:47 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) Received: from zivm-out3.uni-muenster.de (ZIVM-OUT3.UNI-MUENSTER.DE [128.176.192.18]) by mx1.freebsd.org (Postfix) with ESMTP id 635418FC1B for ; Sat, 4 Jul 2009 22:48:46 +0000 (UTC) (envelope-from a_best01@uni-muenster.de) X-IronPort-AV: E=Sophos;i="4.42,349,1243807200"; d="scan'208";a="7589543" Received: from zivmaildisp2.uni-muenster.de (HELO ZIVMAILUSER01.UNI-MUENSTER.DE) ([128.176.188.143]) by zivm-relay3.uni-muenster.de with ESMTP; 05 Jul 2009 00:48:45 +0200 Received: by ZIVMAILUSER01.UNI-MUENSTER.DE (Postfix, from userid 149459) id 7F3531B0764; Sun, 5 Jul 2009 00:48:45 +0200 (CEST) Date: Sun, 05 Jul 2009 00:48:45 +0200 (CEST) From: Alexander Best Sender: Organization: Westfaelische Wilhelms-Universitaet Muenster To: Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: Subject: mmap/munmap with zero length X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Jul 2009 22:48:48 -0000 i'm wondering why mmap and munmap behave differently when it comes to a length argument of zero. allocating memory with mmap for a zero length file returns a valid pointer to the mapped region. munmap however isn't able to remove a mapping with no length. wouldn't it be better to either forbid this in mmap or to allow it in munmap? cheers. alex