From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 00:54:19 2011 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 21C19106564A for ; Sun, 13 Feb 2011 00:54:19 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id 7B8098FC15 for ; Sun, 13 Feb 2011 00:54:18 +0000 (UTC) Received: from ur.dons.net.au (ppp203-122-198-229.lns6.adl6.internode.on.net [203.122.198.229]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p1D0TddE029406 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 13 Feb 2011 10:59:40 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: Date: Sun, 13 Feb 2011 10:59:37 +1030 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201102111909.p1BJ9UAE097045@fire.js.berklix.net> <66758C9D-DCE2-4381-A4B1-956A48423CDD@kientzle.com> To: Warren Block X-Mailer: Apple Mail (2.1082) X-Spam-Score: 0.163 () BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: "Julian H. Stacey" , hackers@freebsd.org Subject: Re: memstick.img is bloated with 7% 2K blocks of nulls 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, 13 Feb 2011 00:54:19 -0000 On 13/02/2011, at 8:45, Warren Block wrote: > On Sat, 12 Feb 2011, Tim Kientzle wrote: >> Alternatively, of course, is there any way to use >> isofs instead of ufs for memstick.img? >=20 > Devin Teske's DruidBSD (http://druidbsd.sourceforge.net/) uses the = same image for CD, hard disk, or memstick. I don't know the technical = details. (VirtualBox didn't like it, but maybe it's a trivial fix.) I would guess it uses ISOLinux plus some voodoo hackery the same as = various Linux distros which do the same trick. For work I have made a FAT32 USB stick which uses syslinux to load an = MFS containing the loader & kernel and sysinstall then reads the install = files off FAT32. I did it this way so that people using it could edit = the configuration file without needing a BSD box handy. In theory the loader can read off FAT32 so the kernel could go onto the = flash drive too, however I couldn't get it to work :( -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 03:40:06 2011 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 B521F106564A for ; Sun, 13 Feb 2011 03:40:06 +0000 (UTC) (envelope-from dieterbsd@engineer.com) Received: from imr-db01.mx.aol.com (imr-db01.mx.aol.com [205.188.91.95]) by mx1.freebsd.org (Postfix) with ESMTP id 6E33B8FC0A for ; Sun, 13 Feb 2011 03:40:06 +0000 (UTC) Received: from imo-da03.mx.aol.com (imo-da03.mx.aol.com [205.188.169.201]) by imr-db01.mx.aol.com (8.14.1/8.14.1) with ESMTP id p1D3e5C3024902 for ; Sat, 12 Feb 2011 22:40:05 -0500 Received: from dieterbsd@engineer.com by imo-da03.mx.aol.com (mail_out_v42.9.) id n.ff6.586c06e (55742) for ; Sat, 12 Feb 2011 22:40:00 -0500 (EST) Received: from smtprly-me02.mx.aol.com (smtprly-me02.mx.aol.com [64.12.95.103]) by cia-md05.mx.aol.com (v129.7) with ESMTP id MAILCIAMD051-b2cd4d57528e32; Sat, 12 Feb 2011 22:40:00 -0500 Received: from web-mmc-d04 (web-mmc-d04.sim.aol.com [205.188.103.94]) by smtprly-me02.mx.aol.com (v129.8) with ESMTP id MAILSMTPRLYME025-b2cd4d57528e32; Sat, 12 Feb 2011 22:39:58 -0500 To: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Date: Sat, 12 Feb 2011 22:39:58 -0500 X-MB-Message-Source: WebUI X-AOL-IP: 67.206.170.129 X-MB-Message-Type: User MIME-Version: 1.0 From: dieterbsd@engineer.com Content-Type: text/plain; charset="us-ascii" X-Mailer: Mail.com Webmail 33222-STANDARD Received: from 67.206.170.129 by web-mmc-d04.sysops.aol.com (205.188.103.94) with HTTP (WebMailUI); Sat, 12 Feb 2011 22:39:58 -0500 Message-Id: <8CD9946D22CB89E-1B70-1C204@web-mmc-d04.sysops.aol.com> X-Spam-Flag: NO X-AOL-SENDER: dieterbsd@engineer.com Subject: Re: memstick.img is bloated with 7% 2K blocks of nulls 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, 13 Feb 2011 03:40:06 -0000 Tim Kientzle wrote: > The current UFS code is designed to leave enough "slack space" to > support future file writes. What if you turned the knob all the way down and had just one cylinder group? I assume that newfs would need to be fixed to allow this, but would anything break? The current limits are also wasteful for normal read/write filesystems with large files. Too many cylinder groups, too many inodes, block/frag size too small, etc... From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 03:49:27 2011 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 B1D18106566B for ; Sun, 13 Feb 2011 03:49:27 +0000 (UTC) (envelope-from perryh@pluto.rain.com) Received: from agora.rdrop.com (agora.rdrop.com [IPv6:2607:f678:1010::34]) by mx1.freebsd.org (Postfix) with ESMTP id 9097E8FC15 for ; Sun, 13 Feb 2011 03:49:27 +0000 (UTC) Received: from agora.rdrop.com (66@localhost [127.0.0.1]) by agora.rdrop.com (8.13.1/8.12.7) with ESMTP id p1D3nJnd088004 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Sat, 12 Feb 2011 19:49:19 -0800 (PST) (envelope-from perryh@pluto.rain.com) Received: (from uucp@localhost) by agora.rdrop.com (8.13.1/8.12.9/Submit) with UUCP id p1D3nJ8G088002; Sat, 12 Feb 2011 19:49:19 -0800 (PST) Received: from fbsd61 by pluto.rain.com (4.1/SMI-4.1-pluto-M2060407) id AA27805; Sat, 12 Feb 11 19:46:15 PST Date: Sat, 12 Feb 2011 19:45:27 -0800 From: perryh@pluto.rain.com To: tim@kientzle.com Message-Id: <4d5753d7.BT5wqP8CnfTD02s8%perryh@pluto.rain.com> References: <201102111909.p1BJ9UAE097045@fire.js.berklix.net> <66758C9D-DCE2-4381-A4B1-956A48423CDD@kientzle.com> In-Reply-To: <66758C9D-DCE2-4381-A4B1-956A48423CDD@kientzle.com> User-Agent: nail 11.25 7/29/05 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: jhs@berklix.com, hackers@freebsd.org Subject: Re: memstick.img is bloated with 7% 2K blocks of nulls 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, 13 Feb 2011 03:49:27 -0000 Tim Kientzle wrote: > The strategy used by libarchive's recent ISO writer > is to concatenate the file bodies into a temp file > (with minimal padding between entries to meet alignment > requirements) while storing directory information > in memory. The final output then consists of the > directory information followed by the concatenated > file bodies. > > I suspect a similar strategy could be used to lay > out and write a read-only optimized UFS image ... > I think it's probably feasible but I doubt very > much of the existing UFS code can be recycled for > such a project. There was at one time a capability in mkfs(8) -- which no longer even exists as a separate entity, having been absorbed into newfs(8) -- to pre-populate the filesystem with specified content. Dunno if it was ever in any BSD release -- it's not mentioned in the 4.2BSD-derived SunOS 4.1.1 manpage -- so I may be remembering it from Bell Labs 6th edition on the PDP-11. The code to collect and write all of an existing filesystem's directories, followed by all of its files, exists in dump(8). From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 05:58:57 2011 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 7B281106564A for ; Sun, 13 Feb 2011 05:58:57 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 4EF3E8FC12 for ; Sun, 13 Feb 2011 05:58:57 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p1D5gLc9079964 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 12 Feb 2011 21:42:24 -0800 (PST) (envelope-from julian@freebsd.org) Message-ID: <4D576F49.5030201@freebsd.org> Date: Sat, 12 Feb 2011 21:42:33 -0800 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 To: perryh@pluto.rain.com References: <201102111909.p1BJ9UAE097045@fire.js.berklix.net> <66758C9D-DCE2-4381-A4B1-956A48423CDD@kientzle.com> <4d5753d7.BT5wqP8CnfTD02s8%perryh@pluto.rain.com> In-Reply-To: <4d5753d7.BT5wqP8CnfTD02s8%perryh@pluto.rain.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: jhs@berklix.com, hackers@freebsd.org Subject: Re: memstick.img is bloated with 7% 2K blocks of nulls 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, 13 Feb 2011 05:58:57 -0000 On 2/12/11 7:45 PM, perryh@pluto.rain.com wrote: > Tim Kientzle wrote: > >> The strategy used by libarchive's recent ISO writer >> is to concatenate the file bodies into a temp file >> (with minimal padding between entries to meet alignment >> requirements) while storing directory information >> in memory. The final output then consists of the >> directory information followed by the concatenated >> file bodies. >> >> I suspect a similar strategy could be used to lay >> out and write a read-only optimized UFS image ... >> I think it's probably feasible but I doubt very >> much of the existing UFS code can be recycled for >> such a project. > There was at one time a capability in mkfs(8) -- which no > longer even exists as a separate entity, having been absorbed > into newfs(8) -- to pre-populate the filesystem with specified > content. Dunno if it was ever in any BSD release -- it's not > mentioned in the 4.2BSD-derived SunOS 4.1.1 manpage -- so > I may be remembering it from Bell Labs 6th edition on the PDP-11. man makefs > The code to collect and write all of an existing filesystem's > directories, followed by all of its files, exists in dump(8). > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 06:47:38 2011 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 2A593106564A; Sun, 13 Feb 2011 06:47:38 +0000 (UTC) (envelope-from freebsd-hackers@herveybayaustralia.com.au) Received: from mail.unitedinsong.com.au (mail.unitedinsong.com.au [150.101.178.33]) by mx1.freebsd.org (Postfix) with ESMTP id 61CC78FC0C; Sun, 13 Feb 2011 06:47:37 +0000 (UTC) Received: from laptop1.herveybayaustralia.com.au (laptop1.herveybayaustralia.com.au [192.168.0.186]) by mail.unitedinsong.com.au (Postfix) with ESMTP id 539BB5C44; Sun, 13 Feb 2011 16:54:45 +1000 (EST) Message-ID: <4D577DF7.4090408@herveybayaustralia.com.au> Date: Sun, 13 Feb 2011 16:45:11 +1000 From: Da Rock User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.16) Gecko/20110204 Thunderbird/3.0.11 ThunderBrowse/3.3.4 MIME-Version: 1.0 To: Vlad Galu References: <4D54E39D.1000505@herveybayaustralia.com.au> <4D54F0B0.7010503@freebsd.org> <4D550300.5090000@herveybayaustralia.com.au> <4D5565C7.1010809@freebsd.org> <4D55CE5A.8040902@herveybayaustralia.com.au> <4D55E015.3010709@freebsd.org> <20110212103923.3098f6b3@ernst.jennejohn.org> <4D5660D9.2040002@herveybayaustralia.com.au> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: [maybe spam] Re: linux PF_PACKET compatibility 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, 13 Feb 2011 06:47:38 -0000 On 02/13/11 06:15, Vlad Galu wrote: > > > On Sat, Feb 12, 2011 at 12:28 PM, Da Rock > > wrote: > > On 02/12/11 19:39, Gary Jennejohn wrote: > > On Fri, 11 Feb 2011 17:19:17 -0800 > Julian Elischer > wrote: > > > On 2/11/11 4:03 PM, Da Rock wrote: > > Unfortunately this software uses this family instead > of pcap or bpf. > So when built it errors. > > I guess if I am to use this app I will have to rewrite > the way it > uses the network stack. > > l2tp runs over UDP packets (port 1701 (like the starship > enterprise)) > I have no idea why they want raw packets. > > > Ther's a sendarp() routine which uses PF_PACKET to directly > access the > network driver and bypass the stack. Lazy Linuxers who have > no idea > or don't care that other operating systems exist. > > > Indeed. Is it possible to leverage another compatible routine? I > haven't had a look yet as I just read the message, but can I > (after checking return values and arguments) just drop in another > arp routine? Or are they simply incompatible across the board? > > From what I understand they should all be essentially doing the > same thing, but I could be wrong on this. Alternatively would I > have to basically rewrite the arp.c to be posix compatible (for > portability)? > > Cheers > > > You only need to rewrite the sendarp() routine, using a BPF device > descriptor instead of the PF_PACKET socket descriptor. Take a look at > libdnet[1] and rbootd[2]'s source. > > [1] http://libdnet.sf.net/ > [2] http://ftp.fr.openbsd.org/pub/OpenBSD/src/usr.sbin/rbootd/ > > You will need, however, to fill the source with #ifdefs to compensate > the fact that Linux has assigned different names and sizes to the > members of struct ether_header and arphdr (and has a _BSD_SOURCE knob > to accomodate compiling BSD-based software)./ / Ok, I think I know where I have this thing ass-backwards now: I was looking for similar structs with the same _size_- they don't have to be! Duh! I've figured the out the members like ETH_ALEN and defined the bsd equivalent, I'll have to look into the _BSD_SOURCE. Thx for the recorrect :) From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 09:11:41 2011 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 CF5E71065670 for ; Sun, 13 Feb 2011 09:11:41 +0000 (UTC) (envelope-from gujjenaveen@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id 649E18FC1E for ; Sun, 13 Feb 2011 09:11:41 +0000 (UTC) Received: by ywl2 with SMTP id 2so1721237ywl.13 for ; Sun, 13 Feb 2011 01:11:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=R2ev0ICyc+tPOWAXOZrCnJgOOhIaCElo+UbB+kPPuJw=; b=HCvEtGdF+zg9wRDubM4/j/3pntGpap24AHhsSxTFc19LWUgKNy5rX4jo/nAsmml87F Lh1yVaIqhJkpUM4RJ7mSSIiS4dh1dcGAJTY8LPAiezzShrpk6Diy1OEpZBETPVWgQGJP nm8jqnfnoU45ln2XvqGqUEMWkgnuTx66oxfCg= 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; b=dnnhb6GGw1lBiB7Yh6CHXJRYey+m3rYwO3ZGe0AAy46hmSnZcW77mjLHCwQiQmGj+g TV7mOY6rpxlI4ANmJN5rlrC6omr8Pasl8743c9wPqQBuwBPHVNjax3KXkkSg+f4Ttg52 21nIz/XdhD/7akrkUKfAsxdF7fK51RU5PDZoI= MIME-Version: 1.0 Received: by 10.236.105.226 with SMTP id k62mr4180319yhg.53.1297588300632; Sun, 13 Feb 2011 01:11:40 -0800 (PST) Received: by 10.236.110.52 with HTTP; Sun, 13 Feb 2011 01:11:40 -0800 (PST) In-Reply-To: <4D56F278.1060801@freebsd.org> References: <4D56F278.1060801@freebsd.org> Date: Sun, 13 Feb 2011 14:41:40 +0530 Message-ID: From: Naveen Gujje To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Daniel Eischen , freebsd-hackers@freebsd.org Subject: Re: SO_SETFIB socket option 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, 13 Feb 2011 09:11:41 -0000 On Sun, Feb 13, 2011 at 2:20 AM, Julian Elischer wrote: > On 2/12/11 8:40 AM, Daniel Eischen wrote: > >> On Sat, 12 Feb 2011, Naveen Gujje wrote: >> >> Hi All, >>> >>> On my FreeBSD 7.2 box, I've two routing tables (FIBs). Fib 0 and Fib 1 >>> (net.fibs = 2). >>> >>> I have a simple echo client which is the counterpart of an echo server >>> running somewhere. >>> If I run this echo client against fib 0 as 'setfib 0 ./echo-client', it >>> properly uses Fib 0. >>> But, if I run this echo client against Fib 0 by using setsockopt & >>> SO_SETFIB >>> option, setsockopt fails with EINVAL. >>> >>> setsockopt & SO_SETFIB for Fib 1 succeeds. But it fails for Fib 0. >>> >>> By looking at the man page and /sys/kern/uipc_socket.c >>> >> >> [ snip ] >> >> Where as both Fib 0 and Fib 1 work fine if I use setfib() call. >>> >> >> Looks like the code is wrong. Have you tried patching the source >> to see if it works for you? Looks like you already know the fix, >> but here is a patch if you'd like to rebuild your kernel to see >> if it works. >> >> > yeah looks like a braino on my part.. I probably only tested by going UP > from fib0 to fib 1 and not > teh other way around. > > > Thanks for the confirmation Daniel and Julian. Tried with patched kernel and it fixes the problem. Thanks, Naveen G. From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 12:20:41 2011 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 0B29C1065670 for ; Sun, 13 Feb 2011 12:20:40 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id 536518FC08 for ; Sun, 13 Feb 2011 12:20:39 +0000 (UTC) Received: from park.js.berklix.net (p5B22D4D1.dip.t-dialin.net [91.34.212.209]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p1DCKaxk055724 for ; Sun, 13 Feb 2011 12:20:38 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p1DCKQIm020699 for ; Sun, 13 Feb 2011 13:20:26 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id p1DCKxRY077335 for ; Sun, 13 Feb 2011 13:21:04 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201102131221.p1DCKxRY077335@fire.js.berklix.net> To: hackers@freebsd.org From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Linux Unix Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com/~jhs/cv/ Date: Sun, 13 Feb 2011 13:20:58 +0100 Sender: jhs@berklix.com Cc: Subject: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 12:20:41 -0000 Hi Hackers Ref.: man 3 getopt int getopt(int argc, char * const argv[], const char *optstring); Ref.: K&R 2nd Ed P.211 last indent, 2nd sentence The purpose of const is to announce objjects that may be placed in read-only memory, and perhaps to increas opportunities for optimization optstring is obviously const, but I don't see that argv can calim to be const ? Did some ISO standard redefine const ? If so URL please ? (I learnt my C from K&R #1 decades ago :-) Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Reply below indented '> ' original, to read like a play script, in order. Mail plain text format; Not quoted-printable, Not HTML, Not base 64. From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 13:23:05 2011 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 16F0B106566C for ; Sun, 13 Feb 2011 13:23:05 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from unimail.uni-dortmund.de (mx1.HRZ.Uni-Dortmund.DE [129.217.128.51]) by mx1.freebsd.org (Postfix) with ESMTP id 977CE8FC1C for ; Sun, 13 Feb 2011 13:23:04 +0000 (UTC) Received: from webmail.tu-dortmund.de (vmx028.itmc.tu-dortmund.de [129.217.131.82]) by unimail.uni-dortmund.de (8.14.4/8.14.4) with ESMTP id p1DCxcEC022785; Sun, 13 Feb 2011 13:59:39 +0100 (CET) Received: from 77.5.78.247 (SquirrelMail authenticated user smmaandr) by webmail.tu-dortmund.de with HTTP; Sun, 13 Feb 2011 13:59:38 +0100 Message-ID: Date: Sun, 13 Feb 2011 13:59:38 +0100 From: "Matthias Andree" To: "Julian H. Stacey" User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Cc: hackers@FreeBSD.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 13:23:05 -0000 Am So, 13.02.2011, 13:20 schrieb Julian H. Stacey: > Hi Hackers > Ref.: man 3 getopt > int getopt(int argc, char * const argv[], const char *optstring); > Ref.: K&R 2nd Ed P.211 last indent, 2nd sentence > The purpose of const is to announce [objects] that may be > placed in read-only memory, and perhaps to increas[e] opportunities for optimization > optstring is obviously const, > but I don't see that argv can calim to be const ? Hi Julian, the prototype is in line with the Single Unix Specification v4 aka IEEE Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check you can access it free of charge after registering name and email address). The const basically states that the argv[] elements (i. e. the char * pointers) are const[ant], or, read another way, that getopt promises not to mess with the *pointers* but is free to modify the actual strings pointed to (with the usual constraints of not assuming they can be extended, for instance) - and I don't see the problem in that. Does that help? If not, please explain you confusion in a bit more detail. Best Matthias -- Matthias Andree From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 14:20:57 2011 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 7CC8D106566B; Sun, 13 Feb 2011 14:20:57 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 1905D8FC15; Sun, 13 Feb 2011 14:20:57 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 1CC171DD633; Sun, 13 Feb 2011 15:20:56 +0100 (CET) Received: by turtle.stack.nl (Postfix, from userid 1677) id 03CAA17316; Sun, 13 Feb 2011 15:20:55 +0100 (CET) Date: Sun, 13 Feb 2011 15:20:55 +0100 From: Jilles Tjoelker To: Matthias Andree Message-ID: <20110213142055.GA59587@stack.nl> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "Julian H. Stacey" , hackers@FreeBSD.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 14:20:57 -0000 On Sun, Feb 13, 2011 at 01:59:38PM +0100, Matthias Andree wrote: > Am So, 13.02.2011, 13:20 schrieb Julian H. Stacey: > > Hi Hackers > > Ref.: man 3 getopt > > int getopt(int argc, char * const argv[], const char *optstring); > > Ref.: K&R 2nd Ed P.211 last indent, 2nd sentence > > The purpose of const is to announce [objects] that may be > > placed in read-only memory, and perhaps to increas[e] opportunities for > > optimization const only rarely allows optimization, mostly because a declaration like const foo *p only says that the foo may not be modified via p, not that it may not be modified at all. Another important purpose of const is to allow the programmer to document what is not changed by a function, and have the compiler check this documentation. > > optstring is obviously const, > > but I don't see that argv can calim to be const ? > The const basically states that the argv[] elements (i. e. the char * > pointers) are const[ant], or, read another way, that getopt promises not > to mess with the *pointers* but is free to modify the actual strings > pointed to (with the usual constraints of not assuming they can be > extended, for instance) - and I don't see the problem in that. getopt() should not modify the strings themselves either, but there are at least two reasons why the type is not const char *const argv[]: 1. Elements of argv are written into char *optarg. 2. Many programs declare main's second argument as char *argv[] which cannot be converted to const char *const [], other than via a cast. -- Jilles Tjoelker From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 17:15:17 2011 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 BB29A1065693 for ; Sun, 13 Feb 2011 17:15:17 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id 117CF8FC14 for ; Sun, 13 Feb 2011 17:15:16 +0000 (UTC) Received: from park.js.berklix.net (p5B22D4D1.dip.t-dialin.net [91.34.212.209]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p1DHFDHn058970; Sun, 13 Feb 2011 17:15:14 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p1DHF7UO022586; Sun, 13 Feb 2011 18:15:07 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id p1DHFbM7052163; Sun, 13 Feb 2011 18:15:42 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201102131715.p1DHFbM7052163@fire.js.berklix.net> To: "Matthias Andree" From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Sun, 13 Feb 2011 13:59:38 +0100." Date: Sun, 13 Feb 2011 18:15:37 +0100 Sender: jhs@berklix.com Cc: hackers@freebsd.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 17:15:17 -0000 Hi, Thanks to all respondents, I'll re-read comments in a bit, I went searching for reference: Matthias wrote: > the prototype is in line with the Single Unix Specification v4 aka IEEE > Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check > you can access it free of charge after > registering name and email address). Thanks, but I didn't find it. ( I used X Open's Search but wan't easy, (I recall fat green cardboard boxes from XOpen 20+ years back) : impression remains: opaque unattractive. Part of the attraction of C was a slim light affordable volume, 1cm thick, well written, 2 indexes, easy reading, carrying & reference :-) Oh for a free modern cross reference style C definition in Asc & HTML like http://apache.org has on line for httpd.conf ... Not old PDF (harder to search), or money wanting ISO, or login wanting Xopen. Or a same style K&R#3 ? Prentice hall ... http://www.pearsonhighered.com/ Yawn ... http://www.google.de/search?hl=en&source=hp&q=The+C+Programming+Language+Third+Edition&btnG=Google+Search http://www.google.de/search?hl=en&q=The+C+Programming+Language+Fourth+Edition&aq=f&aqi=&aql=&oq= http://wikipedia.org ... http://www.open-std.org/JTC1/SC22/WG14/www/standards no need to create a login, Click on "The lastest publically available version of the standard is the combined C99 + TC1 + TC2 + TC3, WG14 N1256, dated 2007-09-07. This is a WG14 working paper, but it reflects the consolidated standard at the time of issue." & get n1256.pdf ... 550 pages. P 535 (XPDF number, not visual number on page) in the alphabetic index (alpha. like the back of the C book, nice) Ref. to const type qualifier, 6.7.3 P.120 (XPDF numbering) Footnote 114) The implementation may place a const object that is not volatile in a read-only region of storage. Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail plain text; Not quoted-printable, Not HTML, Not base 64. Reply below text sections not at top, to avoid breaking cumulative context. From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 18:42:31 2011 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 C903B10656C7 for ; Sun, 13 Feb 2011 18:42:31 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from unimail.uni-dortmund.de (mx1.HRZ.Uni-Dortmund.DE [129.217.128.51]) by mx1.freebsd.org (Postfix) with ESMTP id 299B28FC0A for ; Sun, 13 Feb 2011 18:42:30 +0000 (UTC) Received: from [192.168.0.4] (g225199015.adsl.alicedsl.de [92.225.199.15]) (authenticated bits=0) by unimail.uni-dortmund.de (8.14.4/8.14.4) with ESMTP id p1DIgQkZ009563 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NOT); Sun, 13 Feb 2011 19:42:27 +0100 (CET) Message-ID: <4D582613.60007@FreeBSD.org> Date: Sun, 13 Feb 2011 19:42:27 +0100 From: Matthias Andree Organization: FreeBSD User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Mnenhy/0.8.3 Thunderbird/3.1.7 MIME-Version: 1.0 To: "Julian H. Stacey" References: <201102131715.p1DHFbM7052163@fire.js.berklix.net> In-Reply-To: <201102131715.p1DHFbM7052163@fire.js.berklix.net> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: hackers@FreeBSD.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 18:42:31 -0000 Am 13.02.2011 18:15, schrieb Julian H. Stacey: > Hi, > Thanks to all respondents, I'll re-read comments in a bit, > I went searching for reference: > > Matthias wrote: >> the prototype is in line with the Single Unix Specification v4 aka IEEE >> Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check >> you can access it free of charge after >> registering name and email address). > Thanks, but I didn't find it. Julian, Deep link sent off-list. Start page http://www.unix.org/online.html - sorry that the opengroup.org links led you onto long-winded detours. > ( I used X Open's Search but wan't easy, (I recall fat green > cardboard boxes from XOpen 20+ years back) : impression > remains: opaque unattractive. Part of the attraction of C > was a slim light affordable volume, 1cm thick, well written, > 2 indexes, easy reading, carrying & reference :-) Well, instead of ranting, you might just appreciate the difference between the core language and ANSI-C (1989/1990) standard library features, and the enhanced environment that Unix provides nearly two decades later... Try gcc -std=c89 -pedantic-errors on your average Unix software for a change... :) HTH Matthias From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 19:02:54 2011 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 8C7031065694 for ; Sun, 13 Feb 2011 19:02:54 +0000 (UTC) (envelope-from bakul@bitblocks.com) Received: from mail.bitblocks.com (mail.bitblocks.com [64.142.15.60]) by mx1.freebsd.org (Postfix) with ESMTP id 736F98FC19 for ; Sun, 13 Feb 2011 19:02:54 +0000 (UTC) Received: from bitblocks.com (localhost.bitblocks.com [127.0.0.1]) by mail.bitblocks.com (Postfix) with ESMTP id 4A0FC5B44; Sun, 13 Feb 2011 10:54:43 -0800 (PST) To: "Julian H. Stacey" In-reply-to: Your message of "Sun, 13 Feb 2011 13:20:58 +0100." <201102131221.p1DCKxRY077335@fire.js.berklix.net> References: <201102131221.p1DCKxRY077335@fire.js.berklix.net> Comments: In-reply-to "Julian H. Stacey" message dated "Sun, 13 Feb 2011 13:20:58 +0100." Date: Sun, 13 Feb 2011 10:54:42 -0800 From: Bakul Shah Message-Id: <20110213185443.4A0FC5B44@mail.bitblocks.com> Cc: hackers@freebsd.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 19:02:54 -0000 On Sun, 13 Feb 2011 13:20:58 +0100 "Julian H. Stacey" wrote: > Hi Hackers > Ref.: man 3 getopt > int getopt(int argc, char * const argv[], const char *optstring); > > Ref.: K&R 2nd Ed P.211 last indent, 2nd sentence > The purpose of const is to announce objjects that may be > placed in read-only memory, and perhaps to increas opportunities > for optimization > > optstring is obviously const, > but I don't see that argv can calim to be const ? > > Did some ISO standard redefine const ? If so URL please ? > (I learnt my C from K&R #1 decades ago :-) Not quite what you asked for but this may help in making sense of const.... $ cdecl # from /usr/ports/devel/cdecl explain const char* x declare x as pointer to const char explain char * const x declare x as const pointer to char From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 19:34:29 2011 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 C7DC81065672; Sun, 13 Feb 2011 19:34:29 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (unknown [IPv6:2a01:348:0:15:5d59:5c40:0:1]) by mx1.freebsd.org (Postfix) with ESMTP id ED93E8FC17; Sun, 13 Feb 2011 19:34:28 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 6FD75E8333; Sun, 13 Feb 2011 19:34:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cran.org.uk; h=from:to :subject:date:cc:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id; s=mail; bh=W IWsOUbgwuAVeDG0l7oVVm5Mt94=; b=Btxzajm5JoDuokgIif42GQN6deT9HKtbZ /WBY2FYAEE0YbpXzjzwceiWGgYOLEDtcOI/F7tq2QZfrYHlf2ZrDJa5EUCpQn9CV akWk3+h4KqGc96BrZMT56+xoX7qAwOWLf2tgxHn+YAZEP0GJXwvbGVNVm7liz1B+ enOUQfc244= DomainKey-Signature: a=rsa-sha1; c=nofws; d=cran.org.uk; h=from:to :subject:date:cc:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id; q=dns; s= mail; b=fiOmPBiRyWAEtLof94JGttTqoBQMnwavbwb1F+TVySWRIrZnELxP+pXM P3hPE2HH1CPtrT6OxWAObfX2a8BKel60id+8iDZmQP3o8s+9IO1+Stl9c0ZLdC9W 4c5TBAeUg9PCFJS/ZKGQDkP+AECH5IzTRBgKWtVE8K2P1mq9qE4= Received: from core.nessbank (client-86-31-165-87.oxfd.adsl.virginmedia.com [86.31.165.87]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA id 4FD4EE8329; Sun, 13 Feb 2011 19:34:21 +0000 (GMT) From: Bruce Cran To: freebsd-hackers@freebsd.org Date: Sun, 13 Feb 2011 19:34:18 +0000 User-Agent: KMail/1.13.5 (FreeBSD/9.0-CURRENT; KDE/4.5.5; amd64; ; ) References: <201102131715.p1DHFbM7052163@fire.js.berklix.net> In-Reply-To: <201102131715.p1DHFbM7052163@fire.js.berklix.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201102131934.18357.bruce@cran.org.uk> Cc: "Julian H. Stacey" , hackers@freebsd.org, Matthias Andree Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 19:34:29 -0000 On Sunday 13 February 2011 17:15:37 Julian H. Stacey wrote: > Hi, > Thanks to all respondents, I'll re-read comments in a bit, > I went searching for reference: > > Matthias wrote: > > the prototype is in line with the Single Unix Specification v4 aka IEEE > > Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check > > you can access it free of charge after > > registering name and email address). > > Thanks, but I didn't find it. > ( I used X Open's Search but wan't easy, (I recall fat green > cardboard boxes from XOpen 20+ years back) : impression > remains: opaque unattractive. Part of the attraction of C > was a slim light affordable volume, 1cm thick, well written, > 2 indexes, easy reading, carrying & reference :-) > http://www.google.co.uk/search?q=opengroup+getopt gets results for 1003.1-2004. -- Bruce Cran From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 19:34:29 2011 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 C7DC81065672; Sun, 13 Feb 2011 19:34:29 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (unknown [IPv6:2a01:348:0:15:5d59:5c40:0:1]) by mx1.freebsd.org (Postfix) with ESMTP id ED93E8FC17; Sun, 13 Feb 2011 19:34:28 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 6FD75E8333; Sun, 13 Feb 2011 19:34:21 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cran.org.uk; h=from:to :subject:date:cc:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id; s=mail; bh=W IWsOUbgwuAVeDG0l7oVVm5Mt94=; b=Btxzajm5JoDuokgIif42GQN6deT9HKtbZ /WBY2FYAEE0YbpXzjzwceiWGgYOLEDtcOI/F7tq2QZfrYHlf2ZrDJa5EUCpQn9CV akWk3+h4KqGc96BrZMT56+xoX7qAwOWLf2tgxHn+YAZEP0GJXwvbGVNVm7liz1B+ enOUQfc244= DomainKey-Signature: a=rsa-sha1; c=nofws; d=cran.org.uk; h=from:to :subject:date:cc:references:in-reply-to:mime-version :content-type:content-transfer-encoding:message-id; q=dns; s= mail; b=fiOmPBiRyWAEtLof94JGttTqoBQMnwavbwb1F+TVySWRIrZnELxP+pXM P3hPE2HH1CPtrT6OxWAObfX2a8BKel60id+8iDZmQP3o8s+9IO1+Stl9c0ZLdC9W 4c5TBAeUg9PCFJS/ZKGQDkP+AECH5IzTRBgKWtVE8K2P1mq9qE4= Received: from core.nessbank (client-86-31-165-87.oxfd.adsl.virginmedia.com [86.31.165.87]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA id 4FD4EE8329; Sun, 13 Feb 2011 19:34:21 +0000 (GMT) From: Bruce Cran To: freebsd-hackers@freebsd.org Date: Sun, 13 Feb 2011 19:34:18 +0000 User-Agent: KMail/1.13.5 (FreeBSD/9.0-CURRENT; KDE/4.5.5; amd64; ; ) References: <201102131715.p1DHFbM7052163@fire.js.berklix.net> In-Reply-To: <201102131715.p1DHFbM7052163@fire.js.berklix.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201102131934.18357.bruce@cran.org.uk> Cc: "Julian H. Stacey" , hackers@freebsd.org, Matthias Andree Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 19:34:29 -0000 On Sunday 13 February 2011 17:15:37 Julian H. Stacey wrote: > Hi, > Thanks to all respondents, I'll re-read comments in a bit, > I went searching for reference: > > Matthias wrote: > > the prototype is in line with the Single Unix Specification v4 aka IEEE > > Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check > > you can access it free of charge after > > registering name and email address). > > Thanks, but I didn't find it. > ( I used X Open's Search but wan't easy, (I recall fat green > cardboard boxes from XOpen 20+ years back) : impression > remains: opaque unattractive. Part of the attraction of C > was a slim light affordable volume, 1cm thick, well written, > 2 indexes, easy reading, carrying & reference :-) > http://www.google.co.uk/search?q=opengroup+getopt gets results for 1003.1-2004. -- Bruce Cran From owner-freebsd-hackers@FreeBSD.ORG Sun Feb 13 21:13:41 2011 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 34C1A106566C for ; Sun, 13 Feb 2011 21:13:41 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id AFD108FC18 for ; Sun, 13 Feb 2011 21:13:40 +0000 (UTC) Received: from park.js.berklix.net (p5B22D4D1.dip.t-dialin.net [91.34.212.209]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p1DLDXAn061136; Sun, 13 Feb 2011 21:13:34 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p1DLDVvQ023716; Sun, 13 Feb 2011 22:13:31 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id p1DLDruc013967; Sun, 13 Feb 2011 22:13:58 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201102132113.p1DLDruc013967@fire.js.berklix.net> To: Bakul Shah From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Sun, 13 Feb 2011 10:54:42 PST." <20110213185443.4A0FC5B44@mail.bitblocks.com> Date: Sun, 13 Feb 2011 22:13:53 +0100 Sender: jhs@berklix.com Cc: hackers@freebsd.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 13 Feb 2011 21:13:41 -0000 > Not quite what you asked for but this may help in making > sense of const.... > > $ cdecl # from /usr/ports/devel/cdecl Thanks Bakul, nice ! Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail plain text; Not quoted-printable, Not HTML, Not base 64. Reply below text sections not at top, to avoid breaking cumulative context. From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 02:41:25 2011 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 D91B4106564A; Mon, 14 Feb 2011 02:41:25 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id 481738FC1A; Mon, 14 Feb 2011 02:41:24 +0000 (UTC) Received: from park.js.berklix.net (p5B22C904.dip.t-dialin.net [91.34.201.4]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p1E2fM0Y063797; Mon, 14 Feb 2011 02:41:23 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p1E2fBpo027048; Mon, 14 Feb 2011 03:41:12 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id p1E2fmMh004864; Mon, 14 Feb 2011 03:41:53 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201102140241.p1E2fmMh004864@fire.js.berklix.net> To: hackers@freebsd.org From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Sun, 13 Feb 2011 19:42:27 +0100." <4D582613.60007@FreeBSD.org> Date: Mon, 14 Feb 2011 03:41:48 +0100 Sender: jhs@berklix.com Cc: Matthias Andree Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 14 Feb 2011 02:41:25 -0000 Matthias Andree wrote: > Am 13.02.2011 18:15, schrieb Julian H. Stacey: > > Hi, > > Thanks to all respondents, I'll re-read comments in a bit, > > I went searching for reference: > > > > Matthias wrote: > >> the prototype is in line with the Single Unix Specification v4 aka IEEE > >> Std. 1003.1-2008 (sorry no URL, I have checked my local copy, check > >> you can access it free of charge after > >> registering name and email address). > > Thanks, but I didn't find it. > > Julian, > > Deep link sent off-list. Thanks, so open.org quotes for getopt.html int getopt(int argc, char * const argv[], const char *optstring); but it would stll be nicer if we could read definition of C & const. > Well, instead of ranting, An inadvisable epithet ! Maybe you never had the luxury of working when one could buy a slim K&R, & it was all one needed. Now ISO sell standards, Not all free download. For C I've only found enormous PDFs. Some downloads may not be newest &/or might need logins or license or payment. Apache.org set a better example of free unobstructed hypertexted access to all versions of eg http.conf etc. > you might just appreciate the difference > between the core language and ANSI-C (1989/1990) standard library > features, and the enhanced environment that Unix provides nearly two > decades later... Try gcc -std=c89 -pedantic-errors on your average Unix > software for a change... :) Using Unix & C since '77, & '82, I 'appreciate' C is a heavily evolved = bent language. Const as case in point: FreeBSD getopt seems to conflict with K&R#2 so ... It would be nice to download a new C standard for reference. Is the newest definition of C free public access ? Is there a URL newer/ better than what I posted ? We could put a URL in man gcc See Also, & if allowed, a copy in /usr/share/doc/ http://www.open-std.org/JTC1/SC22/WG14/www/standards Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail plain text; Not quoted-printable, Not HTML, Not base 64. Reply below text sections not at top, to avoid breaking cumulative context. From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 08:16:54 2011 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 950C21065672 for ; Mon, 14 Feb 2011 08:16:54 +0000 (UTC) (envelope-from mahamuni.ashish@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2C5E48FC17 for ; Mon, 14 Feb 2011 08:16:53 +0000 (UTC) Received: by wyf19 with SMTP id 19so4502930wyf.13 for ; Mon, 14 Feb 2011 00:16:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=nmoC2yUhCcY+r1GY6HS9LSXEPFQtyD75iPEm+ac5/6U=; b=O835NqbG0NrXtly0r4xLGzXEMHyIx7+LigPjNY/bPCOsUlWYABK5qVw1fmUuYL8/Be sF4O74mLCN3/V21SZaVFZrcS6INcMEa/5Ypi5fWCdLHWboBqm25STBcxVFXcxgWjKg9r 037wyUw+YpS/OPpw5p5gknNvXTHjY/bk2QUVU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=HuE2+0P9/4DbGDUyQeNWCF5OslunRGg2ow9IVNjqxqMO9RwEqDKk/4TYQw8H4fYgJ/ h7iTaeHep7T1ZttYAhObtBwEm7wsBow93IsVup+N+KVp16v223lt4XM6vEp9UK95E4xs OinjYO5xoGpN5ZW4bbR3caxeMAyEKuvUbqgjM= MIME-Version: 1.0 Received: by 10.216.29.71 with SMTP id h49mr2923323wea.46.1297669575020; Sun, 13 Feb 2011 23:46:15 -0800 (PST) Received: by 10.216.254.82 with HTTP; Sun, 13 Feb 2011 23:46:14 -0800 (PST) Date: Mon, 14 Feb 2011 13:16:14 +0530 Message-ID: From: Ashish Mahamuni To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: setsid not found on freebsd 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, 14 Feb 2011 08:16:54 -0000 I am using FreeBSD 8.1. I am doing some automation stuff and running shell scripts remotely using setsid command. It seems that I do not have setsid on my system. Also, searched in /usr/ports for installation but no luck. Could you please tell me the way to install this command or may be the alternative? --Ashish From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 08:32:22 2011 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 98C3E106564A for ; Mon, 14 Feb 2011 08:32:22 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 2DDBB8FC18 for ; Mon, 14 Feb 2011 08:32:22 +0000 (UTC) Received: by wyf19 with SMTP id 19so4511974wyf.13 for ; Mon, 14 Feb 2011 00:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=iv/3nPGGYI8H6jsOtseS33ULJY5gY+35r8t95misjy8=; b=UtQDaSbwJGWVYc5udhWeq+oh/UXJQRE9AspaOvgXqFfuHCUEwpoO5gtWau5vZ4o7KK lemE8h3jLW0RWKINjzUVQ7GDOIFaSvdU+PHXD4evM/ytgejQGZoMVbx1VGjfvKT+aaHb r93lGig2c79rTpoIF0IbrhLahWNdpzso3gZoA= 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; b=U2Xrdy8aMvZwkEIDZiAMG2sIcufhTHl3xH31sKx6RkBl4E4VVIL7c6kscf2DN1JxR/ vhQLpoR9eN+qjFMK7Jd6Z2CyU9q1nB9q7enK4y9QXXOZZW3lo3gKEWNIC/Y5kpK5rZuF 91QIc4yfxqcXGACE/vm3bTgD9C9Fb4Dh3PYGc= MIME-Version: 1.0 Received: by 10.216.220.219 with SMTP id o69mr2955663wep.57.1297672341247; Mon, 14 Feb 2011 00:32:21 -0800 (PST) Received: by 10.216.71.200 with HTTP; Mon, 14 Feb 2011 00:32:21 -0800 (PST) In-Reply-To: References: Date: Mon, 14 Feb 2011 00:32:21 -0800 Message-ID: From: Garrett Cooper To: Ashish Mahamuni Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers@freebsd.org Subject: Re: setsid not found on freebsd 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, 14 Feb 2011 08:32:22 -0000 On Sun, Feb 13, 2011 at 11:46 PM, Ashish Mahamuni wrote: > I am using FreeBSD 8.1. > I am doing some automation stuff and running shell scripts remotely using > setsid command. > > It seems that I do not have setsid on my system. Also, searched in > /usr/ports for installation but no luck. > > Could you please tell me the way to install this command or may be the > alternative? It's a syscall, not an administrative command. How were you accessing it before? Thanks, -Garrett From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 09:09:30 2011 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 9E979106564A for ; Mon, 14 Feb 2011 09:09:30 +0000 (UTC) (envelope-from mahamuni.ashish@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 28ACB8FC0A for ; Mon, 14 Feb 2011 09:09:29 +0000 (UTC) Received: by wwf26 with SMTP id 26so4510245wwf.31 for ; Mon, 14 Feb 2011 01:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=sPmrJWsiZ10JsxHhJzsUtfdTSWfa0xpuu0iM6/OcreU=; b=eb6PTqRDMWepuigQoDQKz23THXUd+yLLxISpgLwp/cYEbCxocvV+IeSU04Q1KsabQA zFRDRwWztfNW1Gqm94oCcjWXO1P/O1Hgy913noI/g3iVcpOuTwjLRoGqG5nb/LSzNyRq 5Ztq++3qJYJDzUPYvjSDbzGyAiTasUHrBmT9A= 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 :content-type; b=NchAt8eDoRJBXJ9uu71EyCsi4H9IhDyR1AACuk+9mxRRLPc0VrNQUJh40TiiFZnLG+ 4SvhmMsDR/mC/Nfab5MMiE6/GTHM7YID83ejJSIBqBQ77/65aMothFcsBUB3jMss7/fY BIDY6v3cV6CGaHb2eQgB/tVdBFNhwdFHTkKec= MIME-Version: 1.0 Received: by 10.216.29.71 with SMTP id h49mr2980939wea.46.1297674569003; Mon, 14 Feb 2011 01:09:29 -0800 (PST) Received: by 10.216.254.82 with HTTP; Mon, 14 Feb 2011 01:09:28 -0800 (PST) In-Reply-To: <20110214085349.GC3074@straylight.ringlet.net> References: <20110214085349.GC3074@straylight.ringlet.net> Date: Mon, 14 Feb 2011 14:39:28 +0530 Message-ID: From: Ashish Mahamuni To: Garrett Cooper , Ashish Mahamuni , freebsd-hackers@freebsd.org, roam@ringlet.net Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: setsid not found on freebsd 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, 14 Feb 2011 09:09:30 -0000 Thanks for the reply !! Garrett, Its a command available in Linux distros. Peter, I am not able to find "util-linux-ng" under my ports. Anyways, I have found something called "detach", which eventually worked for me. --Ashish On Mon, Feb 14, 2011 at 2:23 PM, Peter Pentchev wrote: > On Mon, Feb 14, 2011 at 12:32:21AM -0800, Garrett Cooper wrote: > > On Sun, Feb 13, 2011 at 11:46 PM, Ashish Mahamuni > > wrote: > > > I am using FreeBSD 8.1. > > > I am doing some automation stuff and running shell scripts remotely > using > > > setsid command. > > > > > > It seems that I do not have setsid on my system. Also, searched in > > > /usr/ports for installation but no luck. > > > > > > Could you please tell me the way to install this command or may be the > > > alternative? > > > > It's a syscall, not an administrative command. How were you > > accessing it before? > > I believe that the original poster is referring to the setsid(1) command > available in at least some Linux distributions; it's distributed as part > of the util-linux-ng package and it basically does a fork(), setsid() > and execve() to run a user-specified command as a session group leader > in the style of daemon(8) (but without detaching or daemonizing :) > > I think it might not be too hard to implement it under FreeBSD. > > G'luck, > Peter > > -- > Peter Pentchev roam@ringlet.net roam@FreeBSD.org peter@packetscale.com > PGP key: http://people.FreeBSD.org/~roam/roam.key.asc > Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 > I am jealous of the first word in this sentence. > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > > iQIcBAEBCAAGBQJNWO2ZAAoJEGUe77AlJ98TtooP/2n59X0vqCHkW1bw/BN7iJeB > RkDNZA7cDDGRsEOkfSb9mROfoP5TsoqjC4AkoIZrq0aI7BH9UXfDFDx+qFmzsNrQ > ar2wYNxWcjr3eh0bVdgLLM/sAzqTzuj9VwNdE0v0DPTNjfVuCMB9bHE+cMJvihbU > MDpxFkzfL9/xXWIX9Aced3I1/aGV5tkjVZu9ZMmgMc+5R0kxrB2tJdE4ZTIYGxeb > Ca0NDooKnqpfwmQntp4WIr4DoysYbvO0GO00qON+wqPLS6a6mb+KKCEMwKuEWAl7 > GONLrmhmo5oGi83SR9NXnVA2gEFfsJeWeCtgPdXcOHNd+yZ5k79ly7ZPv/INqNfg > bH7Uhnpg4OUqXR8S7ojzgN3unglHrRb5JdiJH90YGtgB8gcaLMBS9P2Lep8+ll0n > tb/48FItLWgjJapqvpxx+lUaAJTuKmrMwxGA/RITpWOWP+B0RieE0pbvzMLy6LGj > Uc7BXYkS4H7fqc+rBqkINb50hzMOYTeVL/qR2OxuxCJS57fnQwKhBZXEjFiVCk/6 > qDG7Zjz2bNbTWJvOfmWBwBLfpESDEv9vGpli5Z69Zflvda5nyFUzAZQNSbahoZzt > wm9SRsUiUCT74jEnwySa/Gi3UMYOBieJUGjvb+5fIJtg/IM+7DKSqaOHeo8UR7cO > t0CY71JXXYW8OFn9JNc+ > =ykqU > -----END PGP SIGNATURE----- > > From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 09:12:41 2011 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 BB1F81065670 for ; Mon, 14 Feb 2011 09:12:41 +0000 (UTC) (envelope-from roam@ringlet.net) Received: from erengrad.hoster.bg (erengrad.hoster.bg [77.77.142.9]) by mx1.freebsd.org (Postfix) with ESMTP id 39E348FC0A for ; Mon, 14 Feb 2011 09:12:41 +0000 (UTC) Received: from middenheim.hoster.bg (middenheim.hoster.bg [77.77.142.11]) by erengrad.hoster.bg (Postfix) with ESMTP id 3A889DCC4C for ; Mon, 14 Feb 2011 10:53:56 +0200 (EET) Received: from straylight.ringlet.net (unknown [95.111.66.80]) (Authenticated sender: roam@hoster.bg) by mail.hoster.bg (Postfix) with ESMTP id 034F15C44C for ; Mon, 14 Feb 2011 10:53:49 +0200 (EET) Received: from roam (uid 1000) (envelope-from roam@ringlet.net) id 5066c1 by straylight.ringlet.net (DragonFly Mail Agent) Mon, 14 Feb 2011 10:53:49 +0200 Date: Mon, 14 Feb 2011 10:53:49 +0200 From: Peter Pentchev To: Garrett Cooper Message-ID: <20110214085349.GC3074@straylight.ringlet.net> Mail-Followup-To: Garrett Cooper , Ashish Mahamuni , freebsd-hackers@freebsd.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6c2NcOVqGQ03X4Wi" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-MailScanner-ID: 034F15C44C.30DF0 X-hoster-MailScanner: Found to be clean X-hoster-MailScanner-SpamCheck: not spam, SpamAssassin (cached, score=0.001, required 10, autolearn=disabled, UNPARSEABLE_RELAY 0.00) X-hoster-MailScanner-From: roam@ringlet.net X-hoster-MailScanner-To: freebsd-hackers@freebsd.org X-Spam-Status: No Cc: freebsd-hackers@freebsd.org, Ashish Mahamuni Subject: Re: setsid not found on freebsd 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, 14 Feb 2011 09:12:41 -0000 --6c2NcOVqGQ03X4Wi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 14, 2011 at 12:32:21AM -0800, Garrett Cooper wrote: > On Sun, Feb 13, 2011 at 11:46 PM, Ashish Mahamuni > wrote: > > I am using FreeBSD 8.1. > > I am doing some automation stuff and running shell scripts remotely usi= ng > > setsid command. > > > > It seems that I do not have setsid on my system. Also, searched in > > /usr/ports for installation but no luck. > > > > Could you please tell me the way to install this command or may be the > > alternative? >=20 > It's a syscall, not an administrative command. How were you > accessing it before? I believe that the original poster is referring to the setsid(1) command available in at least some Linux distributions; it's distributed as part of the util-linux-ng package and it basically does a fork(), setsid() and execve() to run a user-specified command as a session group leader in the style of daemon(8) (but without detaching or daemonizing :) I think it might not be too hard to implement it under FreeBSD. G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@FreeBSD.org peter@packetscale.com PGP key: http://people.FreeBSD.org/~roam/roam.key.asc Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553 I am jealous of the first word in this sentence. --6c2NcOVqGQ03X4Wi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAEBCAAGBQJNWO2ZAAoJEGUe77AlJ98TtooP/2n59X0vqCHkW1bw/BN7iJeB RkDNZA7cDDGRsEOkfSb9mROfoP5TsoqjC4AkoIZrq0aI7BH9UXfDFDx+qFmzsNrQ ar2wYNxWcjr3eh0bVdgLLM/sAzqTzuj9VwNdE0v0DPTNjfVuCMB9bHE+cMJvihbU MDpxFkzfL9/xXWIX9Aced3I1/aGV5tkjVZu9ZMmgMc+5R0kxrB2tJdE4ZTIYGxeb Ca0NDooKnqpfwmQntp4WIr4DoysYbvO0GO00qON+wqPLS6a6mb+KKCEMwKuEWAl7 GONLrmhmo5oGi83SR9NXnVA2gEFfsJeWeCtgPdXcOHNd+yZ5k79ly7ZPv/INqNfg bH7Uhnpg4OUqXR8S7ojzgN3unglHrRb5JdiJH90YGtgB8gcaLMBS9P2Lep8+ll0n tb/48FItLWgjJapqvpxx+lUaAJTuKmrMwxGA/RITpWOWP+B0RieE0pbvzMLy6LGj Uc7BXYkS4H7fqc+rBqkINb50hzMOYTeVL/qR2OxuxCJS57fnQwKhBZXEjFiVCk/6 qDG7Zjz2bNbTWJvOfmWBwBLfpESDEv9vGpli5Z69Zflvda5nyFUzAZQNSbahoZzt wm9SRsUiUCT74jEnwySa/Gi3UMYOBieJUGjvb+5fIJtg/IM+7DKSqaOHeo8UR7cO t0CY71JXXYW8OFn9JNc+ =ykqU -----END PGP SIGNATURE----- --6c2NcOVqGQ03X4Wi-- From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 09:31:14 2011 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 917A0106566B for ; Mon, 14 Feb 2011 09:31:14 +0000 (UTC) (envelope-from beezarliu@yahoo.com.cn) Received: from nm23.bullet.mail.ac4.yahoo.com (nm23.bullet.mail.ac4.yahoo.com [98.139.52.220]) by mx1.freebsd.org (Postfix) with SMTP id 0C2338FC0A for ; Mon, 14 Feb 2011 09:31:13 +0000 (UTC) Received: from [98.139.52.191] by nm23.bullet.mail.ac4.yahoo.com with NNFMP; 14 Feb 2011 09:18:53 -0000 Received: from [74.6.228.32] by tm4.bullet.mail.ac4.yahoo.com with NNFMP; 14 Feb 2011 09:18:53 -0000 Received: from [127.0.0.1] by smtp101.mail.ac4.yahoo.com with NNFMP; 14 Feb 2011 09:18:53 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.cn; s=s1024; t=1297675133; bh=0QajpE/TxGWVCHJcnC+IihnWzKux5hBgOgr4pKyhFuM=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Subject:Message-ID:X-mailer:Mime-Version:Content-Type; b=wydtzd1mRBRyHvW87dNbOYyrFLZD8ObMKX+mHwCWyldZrXuTbeXtSx3QN7QK73c5ylQcPPWyNrRq9A+m2a9P4JpBKVqhTDkce915Da3MkwV1JNKkbvAJvjEvWgFefTcYIB8UJNifpK3vd+JZvKfZtHz2XXDreNZ1LBHyxXu9aFA= X-Yahoo-Newman-Id: 465907.34224.bm@smtp101.mail.ac4.yahoo.com Received: from china (beezarliu@180.168.37.66 with login) by smtp101.mail.ac4.yahoo.com with SMTP; 14 Feb 2011 01:18:52 -0800 PST X-Yahoo-SMTP: YP5UPy2swBBHZGZlvbmOrntlD3fotw-- X-YMail-OSG: 4Hz870oVM1nBKdHkHQt7KybSOsAMNG9ooW_2cC6vAQQCfoi ra2rteo4ToWdz3LoMopg5icgL9Wg49aMf9d8rRwWgVWzarO81.3kaD9y4n5w JLMs3IsgU1BvBrMkR4p6qpbokURFXaO.ksuxCppmRoWhKZyOlr.W.i.vDkV6 GptcYSJf3s0NO81tOuf9YOm.Mqr41NW9pJvt1gPtnygRpM3yMNbOol_ntg_Q 8hY36Y6dYNooRztGlnT9FOUuXJVneAPV2BlPUi9xcjHPD109LFcugI_uomb_ MLU2N8CcqEZBBIWnUYQ.57P5J7Na4VIAWAZK8ZxduFRvHmrzEoMc- X-Yahoo-Newman-Property: ymail-3 Date: Mon, 14 Feb 2011 17:18:50 +0800 From: "beezarliu" To: "freebsd-hackers@freebsd.org" Message-ID: <201102141718415933573@yahoo.com.cn> X-mailer: Foxmail 6, 10, 201, 20 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: map share memory to kernel space 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, 14 Feb 2011 09:31:14 -0000 Hackers, I want to access a userland share memory in a kernel thread. So I tried to map the share memory to the kernel space. The basic idea is to map the shm_object into kernel_map when the share memory is created. Using the following patch, I found the vm_object in kernel_map, and the vm_object in the address space of userland process are the same. But their content in the kernel and userland address mapped are different. It's very strang since they are exactly the same vm_object. Do I miss something, please help. Thanks! Index: sys/kern/sysv_shm.c =================================================================== --- sys/kern/sysv_shm.c (revision xxxxxx) +++ sys/kern/sysv_shm.c (working copy) @@ -90,11 +90,14 @@ #include #include #include +#include #include #include #include #include static MALLOC_DEFINE(M_SHM, "shm", "SVID compatible shared memory segments"); static int shmget_allocate_segment(struct thread *td, @@ -421,6 +424,7 @@ shmseg->u.shm_atime = time_second; shmseg->u.shm_nattch++; td->td_retval[0] = attach_va; done2: mtx_unlock(&Giant); return (error); @@ -678,10 +682,61 @@ * We make sure that we have allocated a pager before we need * to. */ - shm_object = vm_pager_allocate(shm_use_phys ? OBJT_PHYS : OBJT_SWAP, - 0, size, VM_PROT_DEFAULT, 0, cred); + if (uap->key == aaaaaa) { + shm_object = vm_pager_allocate(shm_use_phys ? OBJT_PHYS : OBJT_SWAP, + 0, size, VM_PROT_DEFAULT, 0, cred); + } else { + shm_object = vm_pager_allocate(OBJT_PHYS, 0, size, + VM_PROT_DEFAULT, 0, cred); + } if (shm_object == NULL) return (ENOMEM); + + if (uap->key == aaaaaa) { + vm_offset_t addr; + vm_offset_t offset; + vm_offset_t i; + + printf("attach to kernel map.\n"); + + vm_map_lock(kernel_map); + if (vm_map_findspace(kernel_map, vm_map_min(kernel_map), + size, &addr)) { + vm_map_unlock(kernel_map); + return (0); + } + offset = addr - VM_MIN_KERNEL_ADDRESS; + vm_object_reference(shm_object); + vm_map_insert(kernel_map, shm_object, offset, addr, addr + size, + VM_PROT_ALL, VM_PROT_ALL, 0); + vm_map_unlock(kernel_map); + + VM_OBJECT_LOCK(shm_object); + for (i = 0; i < size; i += PAGE_SIZE) { + vm_page_t mem; + + mem = vm_page_grab(shm_object, OFF_TO_IDX(offset + i), + VM_ALLOC_NOBUSY | VM_ALLOC_ZERO | VM_ALLOC_RETRY); + mem->valid = VM_PAGE_BITS_ALL; + KASSERT((mem->flags & PG_UNMANAGED) != 0, + ("shm_alloc: page %p is managed", mem)); + } + VM_OBJECT_UNLOCK(shm_object); + + /* + * And finally, mark the data as non-pageable. + */ + (void) vm_map_wire(kernel_map, addr, addr + size, + VM_MAP_WIRE_USER|VM_MAP_WIRE_NOHOLES); + + vm_map_inherit(kernel_map, addr, addr + size, VM_INHERIT_SHARE); + } + VM_OBJECT_LOCK(shm_object); vm_object_clear_flag(shm_object, OBJ_ONEMAPPING); vm_object_set_flag(shm_object, OBJ_NOSPLIT); 2011-02-14 beezarliu From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 09:38:28 2011 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 784DD106564A for ; Mon, 14 Feb 2011 09:38:28 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 06C0F8FC1A for ; Mon, 14 Feb 2011 09:38:27 +0000 (UTC) Received: by wwf26 with SMTP id 26so4531833wwf.31 for ; Mon, 14 Feb 2011 01:38:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=0Lgm7NPSwXNWqCM0E7VTL06NVsPXoxWn7D7Vs7p5cpA=; b=ZhGF1TByba482uzUtEPuS7hIzPDfVJerU/feQG69WqfYGGPAMLAUoPeFzBaGPsPCsV BZ4XYvXooKAboatmNvgPKznp6RJXJahHMgc4k8odQ+UDrOiw1K5aGjS3G4YHNf74175a LLogpkGeNfcER3MFdiNx9cxK8LinEreFRebac= 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; b=MnqzLj3IUVlhWSvGtnCl2Eh2Lu0St1gEArTIAPFgVxMShT9A4dop4ss1O3JMJzfsx2 6XSG+1vmnHJWAJ82JXZC7X230stLksu8LUqY5U8H9RRWFQpPUu+TN5ZFB5WiBb6gqBU2 df567TjXNCTGV6BKZNHqwbdyFGgu/it6JEFx4= MIME-Version: 1.0 Received: by 10.216.155.75 with SMTP id i53mr453440wek.27.1297676306946; Mon, 14 Feb 2011 01:38:26 -0800 (PST) Received: by 10.216.71.200 with HTTP; Mon, 14 Feb 2011 01:38:26 -0800 (PST) In-Reply-To: References: <20110214085349.GC3074@straylight.ringlet.net> Date: Mon, 14 Feb 2011 01:38:26 -0800 Message-ID: From: Garrett Cooper To: Ashish Mahamuni Content-Type: multipart/mixed; boundary=0016e65b535a4f1aa5049c3acf1d X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: setsid not found on freebsd 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, 14 Feb 2011 09:38:28 -0000 --0016e65b535a4f1aa5049c3acf1d Content-Type: text/plain; charset=ISO-8859-1 On Mon, Feb 14, 2011 at 1:09 AM, Ashish Mahamuni wrote: > Thanks for the reply !! > Garrett, > Its a command available in Linux distros. > Peter, > I am not able to find "util-linux-ng" under my ports. > Anyways, I have found something called "detach", which eventually worked for > me. Ok. So basically this (I put very little effort into this :)...)? Thanks, -Garrett --0016e65b535a4f1aa5049c3acf1d-- From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 09:47:52 2011 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 A4FCF106566B for ; Mon, 14 Feb 2011 09:47:52 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 317008FC16 for ; Mon, 14 Feb 2011 09:47:51 +0000 (UTC) Received: by wwf26 with SMTP id 26so4538847wwf.31 for ; Mon, 14 Feb 2011 01:47:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=36e0ED8Vjl1D+QlsxATDp4yDIqE1RvPnr692q8v8sWQ=; b=wq1YTO8J6/S1F1BU/tRLFJnEUSeFeZkLfP4gTBz4/zcnx+yAG1FiFngZ/A0o791nj2 GZpI/A+AW4piKOJunjP5KYz8phsWH4iBr91RB1vkYR5m9pvwNRzOIm9bD0UvT99lC5uN Dd8akZVbKXrOsnCBR7wM0FvRPZrbJKqaROP+k= 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; b=u9NrKUySFya+F4NxzBg50FErDIPTqFLdFjtSnbPjxCbQXhft/GwEl9AR1Zmh5T4Q4C N3I5VkFnbrUtJ6RcVv+g/xSYs3/0nRW7hZMr1fA64XIlnAwocSAiffpuA4Pm9m6kC+G4 1uSGeosuswXdlitwyj6sH85LsCVVSkGRPx1nE= MIME-Version: 1.0 Received: by 10.216.59.193 with SMTP id s43mr457651wec.42.1297676870915; Mon, 14 Feb 2011 01:47:50 -0800 (PST) Received: by 10.216.71.200 with HTTP; Mon, 14 Feb 2011 01:47:50 -0800 (PST) In-Reply-To: References: <20110214085349.GC3074@straylight.ringlet.net> Date: Mon, 14 Feb 2011 01:47:50 -0800 Message-ID: From: Garrett Cooper To: Ashish Mahamuni Content-Type: multipart/mixed; boundary=000e0ce0d740ec9626049c3af06f X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: setsid not found on freebsd 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, 14 Feb 2011 09:47:52 -0000 --000e0ce0d740ec9626049c3af06f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Feb 14, 2011 at 1:38 AM, Garrett Cooper wrote: > On Mon, Feb 14, 2011 at 1:09 AM, Ashish Mahamuni > wrote: >> Thanks for the reply !! >> Garrett, >> Its a command available in Linux distros. >> Peter, >> I am not able to find "util-linux-ng" under my ports. >> Anyways, I have found something called "detach", which eventually worked= for >> me. > > =A0 =A0Ok. So basically this (I put very little effort into this :)...)? Silly me for forgetting the setsid(2) call. Proof positive that it's time to go to bed -_-... -Garrett --000e0ce0d740ec9626049c3af06f-- From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 09:58:32 2011 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 A7A23106566B for ; Mon, 14 Feb 2011 09:58:32 +0000 (UTC) (envelope-from mwm@mired.org) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 6723B8FC12 for ; Mon, 14 Feb 2011 09:58:32 +0000 (UTC) Received: by iyb26 with SMTP id 26so4666853iyb.13 for ; Mon, 14 Feb 2011 01:58:31 -0800 (PST) Received: by 10.42.239.8 with SMTP id ku8mr4697961icb.34.1297675920748; Mon, 14 Feb 2011 01:32:00 -0800 (PST) Received: from bhuda.mired.org (three.mired.org [74.143.213.44]) by mx.google.com with ESMTPS id d13sm2234414ice.4.2011.02.14.01.31.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Feb 2011 01:32:00 -0800 (PST) Date: Mon, 14 Feb 2011 04:31:43 -0500 From: Mike Meyer To: Ashish Mahamuni Message-ID: <20110214043143.7365eb0e@bhuda.mired.org> In-Reply-To: References: <20110214085349.GC3074@straylight.ringlet.net> Organization: Meyer Consulting X-Mailer: Claws Mail 3.7.7 (GTK+ 2.22.1; amd64-portbld-freebsd8.1) Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEXguIzRkGnhyaz069mXhW0WHRnbrnR9WCQ6LB0CchNMAAACSUlEQVQ4jV2TQW7jMAxFGaPQOgQEdZaGMsgBrAvUA03dCxj1Uu4U2gfwQD7AGNax51NK07RcxXz6/CSl0Ij450vkPG1jzpIZM1UwDCl/xB14TWnNX8A00Qj5a0mnVFVbVUz4MeErea2HikSRqZzY894zwg9p2+/AtO8LzxFED+tNAUFeU29iFOLRxlZAcdo9A8wi8ZBMV4BKPde82Oxrvs6BTkulQIClte0DLFzzsKk9j1MBex8iUaP00Bd78S/muyFScrTXz6zLkEUxJp+SabQfNOs4f4Jpx5qSZ/304PWwlEWP1cOn/mJQR7EOD+uKhjcBLziuL7xoY5Xm+VFAUSw/LwwwsHEHxihpwV4EJH0xXRkbw1PkRw+X4pEuSJwBggqk+HEYKkiL5/74/nQkogigzQsAFrakxZyfw3wMIEEZPv4AWMfxwqE5GNxGaERjmH+PG8AE0L4/w9g0lsp1raLYAN5azQa+AOoO9NwcpFkTrG2VKNMNEL5UKUUAw34tha0z7onUG0oBoNtczE04GwFE3wCHc0ChezAJ6A1WMV81AtY7wDAJSlXwV+4cwBvsOsrQMRawfQEBz0deEZ7WNpV2szckIKo5VpDHDSDvF1GItwqqAlG01Hh50BGtVhuUkjkasg/14bYFGCgWg1fSWHvmOoJck2xdp9ZvZBHzDVTzX23TkrOn7qe5U2COEw5D4Vx3qEQpFY2Z/3QFnJxzp7YCmSMG19nOUoe869zZfOQb5ywQuWu0yCn5+8gxZz+BE7vG3j4/wbf4D/sXN9Wug1s7AAAAAElFTkSuQmCC Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Garrett Cooper , freebsd-hackers@freebsd.org Subject: Re: setsid not found on freebsd 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, 14 Feb 2011 09:58:32 -0000 On Mon, 14 Feb 2011 14:39:28 +0530 Ashish Mahamuni wrote: > Thanks for the reply !! > > Garrett, > Its a command available in Linux distros. Yup. The linux folks seem to have gone on a campaign to make many syscalls available as shell commands - this being one of them. > Peter, > I am not able to find "util-linux-ng" under my ports. Given that that's a linux package name, this isn't surprising. And if you did find such a package, there's a fair chance it would depend on the linux emulation software. Running a command in a new session has a number of implications, and without knowing exactly which of those are important for your application, it's hard to say exactly what you might do to get the desired result. > Anyways, I have found something called "detach", which eventually worked for > me. Glad you found something that works. Knowing that, I'd recommend trying the "daemon" command, as it's in the base instead of ports - if that matters to you. http://www.mired.org/consulting.html Independent Software developer/SCM consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 13:27:00 2011 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 B3230106564A for ; Mon, 14 Feb 2011 13:27:00 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.22]) by mx1.freebsd.org (Postfix) with SMTP id 1E8F18FC0C for ; Mon, 14 Feb 2011 13:26:59 +0000 (UTC) Received: (qmail invoked by alias); 14 Feb 2011 13:00:18 -0000 Received: from g226230054.adsl.alicedsl.de (EHLO apollo.emma.line.org) [92.226.230.54] by mail.gmx.net (mp018) with SMTP; 14 Feb 2011 14:00:18 +0100 X-Authenticated: #428038 X-Provags-ID: V01U2FsdGVkX1/SihwMKfjSCgS2Dof7AJH5/BKaQ/ysi+cOEF5qIR fQ3Kyxi/zG+6jR Received: from localhost ([127.0.0.1] helo=apollo.emma.line.org) by apollo.emma.line.org with esmtp (Exim 4.74 (FreeBSD)) (envelope-from ) id 1Poy2J-000EOI-9y for freebsd-hackers@freebsd.org; Mon, 14 Feb 2011 14:00:15 +0100 Message-ID: <4D59275F.60002@gmx.de> Date: Mon, 14 Feb 2011 14:00:15 +0100 From: Matthias Andree User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; de-DE; rv:1.9.2.13) Gecko/20101210 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <201102140241.p1E2fmMh004864@fire.js.berklix.net> In-Reply-To: <201102140241.p1E2fmMh004864@fire.js.berklix.net> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 14 Feb 2011 13:27:00 -0000 Am 14.02.2011 03:41, schrieb Julian H. Stacey: >> Well, instead of ranting, > > An inadvisable epithet ! > > Maybe you never had the luxury of working when one could buy a slim > K&R,& it was all one needed. Now ISO sell standards, Not all free > download. For C I've only found enormous PDFs. Some downloads may > not be newest&/or might need logins or license or payment. Apache.org > set a better example of free unobstructed hypertexted access to all > versions of eg http.conf etc. Where have you been living the past two decades? It's been a not so recent development that small language cores (C, Java) are accompanied by humongous amounts of documentation for standard libraries... I understand the concerns about licensing, yet I see standards as reference material, and the SUS is available free of charge, that's about as much as I care for the current discussion. Take the political parts up with the respective entities and/or possibly the FreeBSD foundation. > Using Unix& C since '77,& '82, I 'appreciate' C is a heavily > evolved = bent language. Const as case in point: FreeBSD getopt > seems to conflict with K&R#2 so ... If K&R #2 is supposed to be Kernighan & Ritchie, The C Programming language, 2nd edition, then getopt() isn't even in my printed book's index. > It would be nice to download a new C standard for reference. Is Yes. > the newest definition of C free public access ? Is there a URL I never bothered to check. Check the final drafts that are getting voted "becomes standard yes/no" on, they are usually free. -- Matthias Andree From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 14:56:25 2011 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 807CF106566C for ; Mon, 14 Feb 2011 14:56:25 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 565FC8FC19 for ; Mon, 14 Feb 2011 14:56:25 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 0AFA846B0C; Mon, 14 Feb 2011 09:56:25 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.10]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 5237C8A027; Mon, 14 Feb 2011 09:56:24 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Mon, 14 Feb 2011 09:39:17 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: <201102141718415933573@yahoo.com.cn> In-Reply-To: <201102141718415933573@yahoo.com.cn> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102140939.17486.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Mon, 14 Feb 2011 09:56:24 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=0.5 required=4.2 tests=BAYES_00,MAY_BE_FORGED, RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: beezarliu Subject: Re: map share memory to kernel space 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, 14 Feb 2011 14:56:25 -0000 On Monday, February 14, 2011 4:18:50 am beezarliu wrote: > Hackers, > > I want to access a userland share memory in a kernel thread. > So I tried to map the share memory to the kernel space. > The basic idea is to map the shm_object into kernel_map > when the share memory is created. > > Using the following patch, I found the vm_object in kernel_map, > and the vm_object in the address space of userland process are the same. > But their content in the kernel and userland address mapped are different. > > It's very strang since they are exactly the same vm_object. > Do I miss something, please help. Hmm, this is a bit of code I use for something similar to map a VM object into the kernel. It does not use vm_page_grab() directly though: VM_OBJECT_LOCK(obj); vm_object_reference_locked(obj); VM_OBJECT_UNLOCK(obj); /* Map the object into the kernel_map and wire it. */ kva = vm_map_min(kernel_map); ofs = foff & PAGE_MASK; foff = trunc_page(foff); size = round_page(size + ofs); rv = vm_map_find(kernel_map, obj, foff, &kva, size, TRUE, VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE, 0); if (rv == KERN_SUCCESS) { rv = vm_map_wire(kernel_map, kva, kva + size, VM_MAP_WIRE_SYSTEM | VM_MAP_WIRE_NOHOLES); if (rv == KERN_SUCCESS) { *memp = (void *)(kva + ofs); return (0); } vm_map_remove(kernel_map, kva, kva + size); } else vm_object_deallocate(obj); Unmapping the object is easy of course: kva = (vm_offset_t)mem; ofs = kva & PAGE_MASK; kva = trunc_page(kva); size = round_page(size + ofs); vm_map_remove(kernel_map, kva, kva + size); -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 16:14:35 2011 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 4074B106566C for ; Mon, 14 Feb 2011 16:14:35 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ew0-f54.google.com (mail-ew0-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id CC6508FC19 for ; Mon, 14 Feb 2011 16:14:34 +0000 (UTC) Received: by ewy24 with SMTP id 24so2445060ewy.13 for ; Mon, 14 Feb 2011 08:14:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=SZvGQ7DlmDe5QO6x4/dnomIJ7Q3QjZDrzgLlb02Sjfw=; b=OUD47L9dGpkD738+e+r7ebJa6QCYUXRvhGWrKZk4uDe7tGGkRakyB9obHfL25Ukort QLKWd6rK24U9HvwtICoKEiUyNqSwLNLGY87KCKkRQKu/eNXDXpkQ0/1fhsNPtb4UrkBc tZyT1mi1JgMosYG4SEMsz/Bur/ls23KY9R3sE= 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; b=DojJ/Fp0DcE4EXsFKvmfn/kb23cu3fLg0cSsVaFHT7U7FNCYM/7Da5JF07GxvMrsz3 L1gJ1zO/l1DxWrT62gwvOATu6WlP5D10SouVQ3KlL5RqLKh4HiIz8t2nWg6cDs0rcAj+ n5lypPQAiaPYaNGXt4ael+H6aVAsV+z/DtjGI= MIME-Version: 1.0 Received: by 10.213.7.67 with SMTP id c3mr4151436ebc.68.1297700071953; Mon, 14 Feb 2011 08:14:31 -0800 (PST) Received: by 10.213.20.135 with HTTP; Mon, 14 Feb 2011 08:14:23 -0800 (PST) In-Reply-To: <201102141718415933573@yahoo.com.cn> References: <201102141718415933573@yahoo.com.cn> Date: Mon, 14 Feb 2011 11:14:23 -0500 Message-ID: From: Ryan Stone To: beezarliu Content-Type: text/plain; charset=ISO-8859-1 Cc: "freebsd-hackers@freebsd.org" Subject: Re: map share memory to kernel space 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, 14 Feb 2011 16:14:35 -0000 Is your goal just to share memory between userland applications and the kernel? Can the kernel allocate the memory? If so, the easiest way to share memory would be to create a device under /dev and have the userland application mmap it. From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 14 21:43:28 2011 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 C2364106566B for ; Mon, 14 Feb 2011 21:43:28 +0000 (UTC) (envelope-from arved@gazoz.arved.priv.at) Received: from gazoz.arved.priv.at (cl-1383.ham-01.de.sixxs.net [IPv6:2001:6f8:900:566::2]) by mx1.freebsd.org (Postfix) with ESMTP id 31BEC8FC08 for ; Mon, 14 Feb 2011 21:43:27 +0000 (UTC) Received: from gazoz.arved.priv.at (localhost [127.0.0.1]) by gazoz.arved.priv.at (8.14.3/8.14.3) with ESMTP id p1ELhQZI051805 for ; Mon, 14 Feb 2011 22:43:26 +0100 (CET) (envelope-from arved@gazoz.arved.priv.at) Received: (from arved@localhost) by gazoz.arved.priv.at (8.14.3/8.14.3/Submit) id p1ELhQQe051804 for freebsd-hackers@freebsd.org; Mon, 14 Feb 2011 22:43:26 +0100 (CET) (envelope-from arved) Resent-Message-Id: <201102142143.p1ELhQQe051804@gazoz.arved.priv.at> Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii X-Universally-Unique-Identifier: 42efd9f3-a13d-4e7e-bc10-cef156212bb8 From: =?iso-8859-1?Q?Tilman_Keskin=F6z?= In-Reply-To: Date: Mon, 14 Feb 2011 22:37:56 +0100 Content-Transfer-Encoding: 7bit Message-Id: X-Smtp-Server: inek.arved.priv.at References: To: Ashish Mahamuni X-UID: 66 X-Keywords: $NotJunk NotJunk Resent-From: arved@arved.priv.at Resent-Date: Mon, 14 Feb 2011 22:43:26 +0100 Resent-To: freebsd-hackers@freebsd.org Cc: Subject: Re: setsid not found on freebsd 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, 14 Feb 2011 21:43:28 -0000 On Feb 14, 2011, at 08:46 , Ashish Mahamuni wrote: > I am using FreeBSD 8.1. > I am doing some automation stuff and running shell scripts remotely using > setsid command. > > It seems that I do not have setsid on my system. Also, searched in > /usr/ports for installation but no luck. > > Could you please tell me the way to install this command or may be the > alternative? I used a very simple implementation in one of my ports. /usr/ports/net/nxproxy/files/setsid.c HTH arved From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 00:20:16 2011 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 9277F106566B for ; Tue, 15 Feb 2011 00:20:16 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id 1994D8FC14 for ; Tue, 15 Feb 2011 00:20:15 +0000 (UTC) Received: from park.js.berklix.net (p5B22FB43.dip.t-dialin.net [91.34.251.67]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p1F0K8Ei083315; Tue, 15 Feb 2011 00:20:09 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p1F0JuOe036538; Tue, 15 Feb 2011 01:19:58 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id p1F0Jjfc088901; Tue, 15 Feb 2011 01:19:50 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201102150019.p1F0Jjfc088901@fire.js.berklix.net> To: Bruce Cran From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Sat, 12 Feb 2011 17:05:26 GMT." <20110212170526.00004cab@unknown> Date: Tue, 15 Feb 2011 01:19:45 +0100 Sender: jhs@berklix.com Cc: hackers@freebsd.org, phk@freebsd.org Subject: Re: memstick.img is bloated with 7% 2K blocks of nulls 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, 15 Feb 2011 00:20:16 -0000 > But from the manual page: > > -f file > Filename to use for the vnode type memory disk. Options -a > and -t vnode are implied if not specified. > > So if you specify -f then you get -t vnode automatically. Ah yes. Reading src/sbin/mdconfig/mdconfig.c with your "mdconfig -a -f mfsroot" it seems the manual correctly represents the code ... except I'm lost what the purpose of cmdline is ? ( BTW I was wrong re: > I suspect -t default is malloc, though manual doesnt say that 'f' actually follows with: mdio.md_type = MD_VNODE; ) Could author phk@FreeBSD.ORG cc'd (or someone else if they are clear) please explain what cmdline is ? Possibly commit an appended // comment after "int cmdline = 0;" (in line 76 of 8.1 & current src/sbin/mdconfig/mdconfig.c) wgat it's for ? (cmdline seems in most places to maybe be an enum { 1 2 3 } for { a d l } alternate forms of command mdconfig, ... & yet case 'd': sets cmdline = 3 not 2 ? (& 't' & 'f' sets cmdline=2 ; not 1. Puzzling. Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail plain text; Not quoted-printable, Not HTML, Not base 64. Reply below text sections not at top, to avoid breaking cumulative context. From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 01:59:54 2011 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 9F05A106564A; Tue, 15 Feb 2011 01:59:54 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id DBD3B8FC1B; Tue, 15 Feb 2011 01:59:53 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p1F1xbN9050224 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Tue, 15 Feb 2011 12:29:38 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <201102102028.p1AKSnAl067323@apollo.backplane.com> Date: Tue, 15 Feb 2011 12:29:37 +1030 Content-Transfer-Encoding: quoted-printable Message-Id: <29157A8B-5B2C-4A08-9DE9-B8917F054DB1@gsoft.com.au> References: <53A394ED-7C2E-4E4B-A9A7-CB5F1B27DBE3@gsoft.com.au> <7108E013-77D1-47F8-892E-5027DB7D432B@gsoft.com.au> <990005CD-39BD-45F6-BD07-ACEE79DF5A03@gsoft.com.au> <772B352C-7241-4326-8B49-3FB675896609@gsoft.com.au> <71549325-5FD1-4516-B49E-098AFBEFE8B7@gsoft.com.au> <88A9D148-7E3C-4ADB-90FC-B95C4D3BBD2E@gsoft.com.au> <201102102028.p1AKSnAl067323@apollo.backplane.com> To: Matthew Dillon X-Mailer: Apple Mail (2.1082) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: freebsd-hackers@freebsd.org, Ivan Voras Subject: Re: Scheduler question 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, 15 Feb 2011 01:59:54 -0000 On 11/02/2011, at 6:58, Matthew Dillon wrote: > It sounds like there are at least two issues involved. >=20 > The first could be a buffer cache starvation issue due to the load = on > the filesystem from the tar. If the usb program is doing any = filesystem > operation at all, even at low bandwidths, it could be hitting = blockages > due to the disk intensive tar eating up available buffer cache = buffers > (e.g. causing an excessive ratio of dirty buffers vs clean buffers). > This would NOT be a scheduler problem per-say, but instead a kernel > resource management problem. OK.. Note that my program is split into 2 threads and queues up a large = number of buffers. One thread just calls the libusb event handler so if = the main thread is blocked for IO it should still run.. right? :) > The way to test this is to double-buffer or tripple-buffer the = output > via shared memory. A pipe might not do the job if it gets stuck = doing > direct transfers (I eventually gave up trying to optimize pipes in = DFly > due to a similar problem and just run everything through a kernel = buffer > now). Still, it may be possible to test against this particular = problem > by having the program write to a pipe and another program or fork = handle > the actual writing to the disk or filesystem. Hmm.. in effect I have this as I write all data to disk via mbuffer and = this did help, but it still drops out which seems to indicate to me that = my libusb event loop thread is being stalled.=20 Note that the total CPU consumed by it is very low (<1%) and that thread = does no I/O. >=20 > Another way to test this is to comment out the writing in the usb = program > entirely and see if things improve. If I write to /dev/null it works fine. > The second issue sounds more scheduler-related. Try running the > usb program at nice -20? You could even run it at a pseudo-realtime > priority using rtprio but nice -20 had better work properly against > a md5 or there is something seriously broken in the scheduler. Unfortunately neither of these improve things, I am pretty surprised a = nice -20 or rtprio'd thread doesn't beat a pure CPU user doing no IO :( >=20 > Dynamic priority handling is supposed to deal with this sort of = thing > automatically, particularly if the usb program is not using a lot of > cpu, but sometimes it can't tell whether a newly-exec'd program is > going to be interactive or batch until after it has run for a while. >=20 > Tuning initial conditions after an exec for the scheduler is not an > easy task. Simply giving a program a more batch/bulk-run priority = on > exec and letting the dynamic priority shift it more to interactive > operation tends to mess up interactive shells in the face of > cpu-intensive system operation, for example. Theoretically dynamic > priority handling should bump up the priority for the usb program = well > beyond any initial conditions for exec once it has been running a = while, > assuming it doesn't use tons of cpu. Hmm.. It is unfortunate the hinting mechanisms are very coarse :( > An md5, or any single-file reading operation, would not overload the > buffer cache. File writing and/or multi-file operations (such as a > tar extraction or a tar-up) can create blockages in the buffer = cache. The md5 process is just reading /dev/null - I run it to soak up the CPU = because in production the system will be doing CPU intensive data = analysis. > It takes a considerable amount of VM/buffer-cache tuning to get = those > subsystems to pipeline properly and sometimes things can go stale = and > stop pipelining properly for months without anyone realizing it. :( I am waiting on a new buffer card with 8 times bigger FIFOs which should = help I hope.. Also I am writing a kernel driver in the hope it will be more robust :) -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 03:19:44 2011 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 6E121106564A for ; Tue, 15 Feb 2011 03:19:44 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id D36A58FC12 for ; Tue, 15 Feb 2011 03:19:43 +0000 (UTC) Received: from park.js.berklix.net (p5B22EB2F.dip.t-dialin.net [91.34.235.47]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p1F3JfGB093027 for ; Tue, 15 Feb 2011 03:19:42 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p1F3JN6I038724 for ; Tue, 15 Feb 2011 04:19:23 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id p1F3JAo4090377 for ; Tue, 15 Feb 2011 04:19:27 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201102150319.p1F3JAo4090377@fire.js.berklix.net> To: freebsd-hackers@freebsd.org From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Mon, 14 Feb 2011 14:00:15 +0100." <4D59275F.60002@gmx.de> Date: Tue, 15 Feb 2011 04:19:10 +0100 Sender: jhs@berklix.com Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 15 Feb 2011 03:19:44 -0000 > I understand the concerns about licensing, yet I see standards as > reference material, ISO products are not standard when ISO restricts access by charging fees so they're not freely distributable to all individual programmers for reference in free software developer communities. Only draft ISO are freely available. FreeBSD & Linux & Apache & RFCs etc do better than ISO, publishing de facto standards as documentation & source free of charge. >and the SUS is available free of charge, that's Again you fail to post a precise complete URL for free open anonymous reference. One might wonder your involvment with open.org/ISO/IEEE. > Take the political parts up with the respective entities and/or possibly > the FreeBSD foundation. If free source developers co-operate on de facto standards, ISO may be ignored as an obstruction. > language, 2nd edition, then getopt() isn't even in my printed book's index. Yet again: The point is to find the latest specification of C language "const" Before considering latest getopt(). > > It would be nice to download a new C standard for reference. Is > > Yes. > > > the newest definition of C free public access ? Is there a URL > > I never bothered to check. Check the final drafts that are getting > voted "becomes standard yes/no" on, they are usually free. You Never bother to post precise URLs to list, please stop posting. A reminder for others I have found this free downloadable C spec > http://www.open-std.org/JTC1/SC22/WG14/www/standards > Is there a URL newer/ better than what I posted ? Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail plain text; Not quoted-printable, Not HTML, Not base 64. Reply below text sections not at top, to avoid breaking cumulative context. From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 04:12:04 2011 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 9B0FF1065670 for ; Tue, 15 Feb 2011 04:12:04 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 310168FC15 for ; Tue, 15 Feb 2011 04:12:03 +0000 (UTC) Received: by wwf26 with SMTP id 26so5496036wwf.31 for ; Mon, 14 Feb 2011 20:12:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=I/u6NgnH0FXTXJsKJwmynqfHl9GCY1U0TiaeFhsSbv4=; b=bJxdilBxfxB/Jr1s4V4Ylad3IzQuDA2d/zpeEd4AUA0sicK68svQ5ehQsRpXOoqcYS mmYRvHMyue0jmB1eFJoaMqXXPvXpyKgAOAHfIkvm9QF6YQvUsdK+Ld2pneXK8kmem0n7 Wd7uwbcTwVSSSnFZMg3hWB+0ZIUbZjV0xUU+o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=LqdPZWB5bGYqfM+XQCWoiwMhW0S1mN7MkUqbfjwVbrSZGzpCL9rqai5N068EUV5wkI 3Sg3p9ZL9+9Ujwb0c/R6aGADmro4/aF/iUmAvgGEBKj2qAFcoZP0PJ/FMEjX2Nb/V9ST F6AqOnD36R/i4pVqoLsNt6L9+15qNzyR2RKIs= MIME-Version: 1.0 Received: by 10.216.59.193 with SMTP id s43mr323604wec.42.1297743122996; Mon, 14 Feb 2011 20:12:02 -0800 (PST) Received: by 10.216.71.200 with HTTP; Mon, 14 Feb 2011 20:12:02 -0800 (PST) Date: Mon, 14 Feb 2011 20:12:02 -0800 Message-ID: From: Garrett Cooper To: freebsd-hackers@freebsd.org Content-Type: multipart/mixed; boundary=000e0ce0d740db28ea049c4a5daa Subject: [PATCH] fix impossible case with waitpid(2) in truss 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, 15 Feb 2011 04:12:04 -0000 --000e0ce0d740db28ea049c4a5daa Content-Type: text/plain; charset=ISO-8859-1 Hi, waitpid(2) returns a value in the set { -1, 0, } (-1 in the event of an ERROR, 0 when WNOHANG is specified, when the process exits according to wait(2)); it never returns a value < -1. If someone could commit this patch it would be appreciated. Thanks, -Garrett --000e0ce0d740db28ea049c4a5daa Content-Type: text/x-patch; charset=US-ASCII; name="impossible-waitpid-case.patch" Content-Disposition: attachment; filename="impossible-waitpid-case.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gk6amrik0 SW5kZXg6IHVzci5iaW4vdHJ1c3Mvc2V0dXAuYwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSB1c3IuYmluL3RydXNz L3NldHVwLmMJKHJldmlzaW9uIDIxODY4OSkKKysrIHVzci5iaW4vdHJ1c3Mvc2V0dXAuYwkod29y a2luZyBjb3B5KQpAQCAtODMsNyArODMsNyBAQAogCX0KIAkKIAkvKiBPbmx5IGluIHRoZSBwYXJl bnQgaGVyZSAqLwotCWlmICh3YWl0cGlkKHBpZCwgJndhaXR2YWwsIDApIDwgLTEpIHsKKwlpZiAo d2FpdHBpZChwaWQsICZ3YWl0dmFsLCAwKSA9PSAtMSkgewogCQllcnIoMSwgInVuZXhwZWN0IHN0 b3AgaW4gd2FpdHBpZCIpOwogCQlyZXR1cm4gMDsKIAl9Cg== --000e0ce0d740db28ea049c4a5daa-- From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 03:26:37 2011 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 6DAF81065675 for ; Tue, 15 Feb 2011 03:26:37 +0000 (UTC) (envelope-from beezarliu@yahoo.com.cn) Received: from nm10.bullet.mail.sp2.yahoo.com (nm10.bullet.mail.sp2.yahoo.com [98.139.91.80]) by mx1.freebsd.org (Postfix) with SMTP id 4A84B8FC24 for ; Tue, 15 Feb 2011 03:26:37 +0000 (UTC) Received: from [98.139.91.66] by nm10.bullet.mail.sp2.yahoo.com with NNFMP; 15 Feb 2011 03:13:03 -0000 Received: from [98.136.185.42] by tm6.bullet.mail.sp2.yahoo.com with NNFMP; 15 Feb 2011 03:13:03 -0000 Received: from [127.0.0.1] by smtp103.mail.gq1.yahoo.com with NNFMP; 15 Feb 2011 03:13:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.cn; s=s1024; t=1297739583; bh=VHL7aKS16c0SuDxA0GpF3rBAwFNx6Os0Bifkfo0KUBw=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:References:Subject:Message-ID:X-mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; b=3QcKKaJ4xc/Uk2RHXjCABo4KqjvUfDK2EkrHyNGGEUXzlkmhnpv+eXAcWqZQzZ0KfOU1daZ5EwpP3nPFng8SU72GENIH6OMDoYFh6SVVJ72DNNFZaELxoCQKSUipqf11fs3RdzJaGvgOMyJmrdQiL9Yp+wIKxm9OGVFkR+/TTHA= X-Yahoo-Newman-Id: 285543.70097.bm@smtp103.mail.gq1.yahoo.com Received: from china (beezarliu@180.168.37.66 with login) by smtp103.mail.gq1.yahoo.com with SMTP; 14 Feb 2011 19:13:02 -0800 PST X-Yahoo-SMTP: YP5UPy2swBBHZGZlvbmOrntlD3fotw-- X-YMail-OSG: OLHu5UoVM1nXBtroIPGGU.yiu6KYO6wFd.KxamsswzT77oL cdQGn9IpeQphCzs8jvhsoHr.9pHvHA9EzFZpRi7tO.eZv06qgjfzaA9POBzH Oh9okDDzzK6OUZKwqm.MOBwUwlMx1mLk8oK1HUUSNhsDin.ZWkb2nV9x4JvQ x._EK5hfyVz8sSp.vdh4AE4DPZ4Gz3A7KALWvydLQhOrzwH7RcsoIXfF704r fJWL0h3dC7RsEX7N.VihYYNF3rORzGCRXibxWrclZIwLM.z.T41Vy9rQp3Ij 3oHgag9CyBewKj8oBFwuW_4Rc6Q1dnslnZZft2JDjKyRvI0upFDI- X-Yahoo-Newman-Property: ymail-3 Date: Tue, 15 Feb 2011 11:12:59 +0800 From: "beezarliu" To: "John Baldwin" , "freebsd-hackers@freebsd.org" References: <201102141718415933573@yahoo.com.cn>, <201102140939.17486.jhb@freebsd.org> Message-ID: <201102151112522035530@yahoo.com.cn> X-mailer: Foxmail 6, 10, 201, 20 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 15 Feb 2011 05:03:53 +0000 Cc: Subject: Re: Re: map share memory to kernel space 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, 15 Feb 2011 03:26:37 -0000 On 2011-02-14 22:56:28, John Baldwin wrote: >On Monday, February 14, 2011 4:18:50 am beezarliu wrote: >> Hackers, >> >> I want to access a userland share memory in a kernel thread. >> So I tried to map the share memory to the kernel space. >> The basic idea is to map the shm_object into kernel_map >> when the share memory is created. >> >> Using the following patch, I found the vm_object in kernel_map, >> and the vm_object in the address space of userland process are the same. >> But their content in the kernel and userland address mapped are different. >> >> It's very strang since they are exactly the same vm_object. >> Do I miss something, please help. > >Hmm, this is a bit of code I use for something similar to map a VM object into >the kernel. It does not use vm_page_grab() directly though: Initially, I wanted to allocate all the pages needed when the share memory is created, in order to reduce page fault at the time it's used. This seems to be an extra step. :( John, thank you very much! Beezar __________________________________________________ ¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä? http://cn.mail.yahoo.com From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 03:26:40 2011 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 446711065761 for ; Tue, 15 Feb 2011 03:26:40 +0000 (UTC) (envelope-from beezarliu@yahoo.com.cn) Received: from nm10.bullet.mail.sp2.yahoo.com (nm10.bullet.mail.sp2.yahoo.com [98.139.91.80]) by mx1.freebsd.org (Postfix) with SMTP id 20C3C8FC12 for ; Tue, 15 Feb 2011 03:26:40 +0000 (UTC) Received: from [98.139.91.64] by nm10.bullet.mail.sp2.yahoo.com with NNFMP; 15 Feb 2011 03:14:08 -0000 Received: from [98.136.185.29] by tm4.bullet.mail.sp2.yahoo.com with NNFMP; 15 Feb 2011 03:14:08 -0000 Received: from [127.0.0.1] by smtp110.mail.gq1.yahoo.com with NNFMP; 15 Feb 2011 03:14:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.cn; s=s1024; t=1297739648; bh=j1pekwrrbZyI8InsQmdQIroO1vs+sr3CGktw1jlzkCI=; h=X-Yahoo-Newman-Id:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Date:From:To:Cc:References:Subject:Message-ID:X-mailer:Mime-Version:Content-Type:Content-Transfer-Encoding; b=KpTCbOxLuCYLKpEINCtwsP9+d4CY86Xs4TMc7pYh6iWPuThk3QupdC+O4Jb01f2cAVAIwVZSIWlG2L98m3a4Rsoz5QsyL67a/pF/6KAT0RXwGZLJYj2CIWhNGFGz2EL3FBZE8T9yhVaHxnVlY+vqlDcJJgcBmotgzPp4pOdF1dc= X-Yahoo-Newman-Id: 240208.44172.bm@smtp110.mail.gq1.yahoo.com Received: from china (beezarliu@180.168.37.66 with login) by smtp110.mail.gq1.yahoo.com with SMTP; 14 Feb 2011 19:14:07 -0800 PST X-Yahoo-SMTP: YP5UPy2swBBHZGZlvbmOrntlD3fotw-- X-YMail-OSG: SsN4SwUVM1nE21zDQGoIkXUTeLVYHo_t4kC7z3ZdFd5Z88n notqugc.0IejmRRKZyrBovjAFJalU2SUN3a6ynfDwi3zZzUtv.MYgbixdiXL YEjHdW5p5Wi2z_TKV3dYKBwSViPnG6HRJDsDMRfc5j6ACxt0l4gNaRdmhBsM VYJdAmRXV5n3oQ1Ie7oXI2b7ccnLi1vl5lRzWQAoLnFIJbo53bfiyLHqojhc .Md41kjaq1VQd4EJOd1XcImvX7ofBZ6t9YwhD3sz1uxLyQjfEY_xM88ZtbwY QLKo2_bFsVw3r_S1XRVAMaQmCSlO4Iioo0R.y3WtQ2W3OxEpPJiE- X-Yahoo-Newman-Property: ymail-3 Date: Tue, 15 Feb 2011 11:14:04 +0800 From: "beezarliu" To: "Ryan Stone" References: <201102141718415933573@yahoo.com.cn>, Message-ID: <201102151114019680728@yahoo.com.cn> X-mailer: Foxmail 6, 10, 201, 20 [cn] Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Tue, 15 Feb 2011 05:04:27 +0000 Cc: "freebsd-hackers@freebsd.org" Subject: Re: Re: map share memory to kernel space 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, 15 Feb 2011 03:26:40 -0000 On 2011-02-15 00:14:39, Ryan Stone wrote: >Is your goal just to share memory between userland applications and >the kernel? Can the kernel allocate the memory? If so, the easiest >way to share memory would be to create a device under /dev and have >the userland application mmap it. I'm too lazy to write a driver for each share memory. :) __________________________________________________ ¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä? http://cn.mail.yahoo.com From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 06:33:40 2011 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 061111065753; Tue, 15 Feb 2011 06:33:38 +0000 (UTC) (envelope-from jhellenthal@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3916C8FC08; Tue, 15 Feb 2011 06:33:37 +0000 (UTC) Received: by iwn39 with SMTP id 39so5676665iwn.13 for ; Mon, 14 Feb 2011 22:33:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:date:from:to:cc:subject:in-reply-to :message-id:references:user-agent:x-openpgp-key-id :x-openpgp-key-fingerprint:mime-version:content-type; bh=JBUpVJUufFJryQmTgDtlDCMwU93USPdHqw0SoHjFqrs=; b=cXFRrIIwnCjjzy4JlYA1aQPhInk7HOgnDVo+hHQyx2RtMuvD7gaVu+zXXgU4ee2DkR G0q0lHgfJp+I7OlDt8wlyKAmgQqECuQSGzQhMLDQi0zNL4Bo9Tm4YvT5gV7S/FwGegBf E6aWRKH2nAo4u8bUoNIcmXsZOs4L1zHJ2i8TI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:x-openpgp-key-id:x-openpgp-key-fingerprint:mime-version :content-type; b=IhfpTkx43Tv1bKTvM0CMMvXK2ALXV643NQjXUy3xcqioIpqXFkxgmY9M+coLIvmI/y x6H2e3pnMxlVzng1EQYuF0bqf2J5iBvA8vcLgvBrRzlKoanqoGXmmui3cljSHmdDqYve ZoI4GF1L22BZwHuC1Lv+CneVwIoKAD0qI/nAk= Received: by 10.42.8.19 with SMTP id g19mr231423icg.149.1297749898697; Mon, 14 Feb 2011 22:04:58 -0800 (PST) Received: from disbatch.dataix.local ([99.19.40.173]) by mx.google.com with ESMTPS id ey6sm2915716icb.5.2011.02.14.22.04.55 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Feb 2011 22:04:56 -0800 (PST) Sender: "J. Hellenthal" Date: Tue, 15 Feb 2011 01:04:35 -0500 From: jhell To: =?ISO-8859-15?Q?Tilman_Keskin=F6z?= In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-OpenPGP-Key-Id: 0x89D8547E X-OpenPGP-Key-Fingerprint: 85EF E26B 07BB 3777 76BE B12A 9057 8789 89D8 547E MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="80310268-1685349294-1297749895=:1852" Cc: arved@arved.priv.at, Ashish Mahamuni , FreeBSD Hackers Subject: Re: setsid not found on freebsd 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, 15 Feb 2011 06:33:40 -0000 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --80310268-1685349294-1297749895=:1852 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Mon, 14 Feb 2011 16:37, arved@ wrote: > > On Feb 14, 2011, at 08:46 , Ashish Mahamuni wrote: > >> I am using FreeBSD 8.1. >> I am doing some automation stuff and running shell scripts remotely using >> setsid command. >> >> It seems that I do not have setsid on my system. Also, searched in >> /usr/ports for installation but no luck. >> >> Could you please tell me the way to install this command or may be the >> alternative? > > I used a very simple implementation in one of my ports. > > /usr/ports/net/nxproxy/files/setsid.c > > > HTH > arved Yeah it is not very hard to grab the source yourself and do a little modification. gcc -O2 -o setsid setsid.c modified for your enjoyment... Regards, - -- jhell -----BEGIN PGP SIGNATURE----- Comment: THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND Comment: ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE Comment: IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE Comment: ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE Comment: FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL Comment: DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS Comment: OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) Comment: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT Comment: LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY Comment: OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF Comment: SUCH DAMAGE. iQEcBAEBAgAGBQJNWhd+AAoJEJBXh4mJ2FR++4wIAIKYp6uZH4VxKRv5JwkULg0H zezyaM9p49DJkJCobRJJLYmy7NuUfQRfvlMTNCJPJM4PnzPy7MgX5U+5xpl8Mdnm Yd5vWs3V9a8hPjTiP2YVqBjWRIxB1/j8/2BbfllrY2GUdGtr0cdyHmwSr3VuoXZH 4/7+a/TkadeLbR3pEnHk5fX3nkdhXViVyQb/QRF4PVfn3w8elO6RrzLHYV694DgB BF3pn8lmrWASh6vhI80SSzJIKAFBlFs3dtuWYwjIbuuoSDtOHwNci1lstmEfat+e 8AtF0KZLMXDFjJvjkEQ6DeRdTKsc1o5x/+umJWsDspm9iKrj+NA21PmTZVBfHjs= =1Ut0 -----END PGP SIGNATURE----- --80310268-1685349294-1297749895=:1852 Content-Type: TEXT/PLAIN; charset=ISO-8859-1; name=setsid.c Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: setsid code Content-Disposition: attachment; filename=setsid.c LyoNCiAqIHNldHNpZC5jIC0tIGV4ZWN1dGUgYSBjb21tYW5kIGluIGEgbmV3 IHNlc3Npb24NCiAqIFJpY2sgU2xhZGtleSA8anJzQHdvcmxkLnN0ZC5jb20+ DQogKiBJbiB0aGUgcHVibGljIGRvbWFpbi4NCiAqDQogKiAxOTk5LTAyLTIy IEFya2FkaXVzeiBNabZraWV3aWN6IDxtaXNpZWtAcGxkLk9SRy5QTD4NCiAq IC0gYWRkZWQgTmF0aXZlIExhbmd1YWdlIFN1cHBvcnQNCiAqDQogKiAyMDAx LTAxLTE4IEpvaG4gRnJlbWxpbiA8dmlpQHBlbmd1aW5wb3dlcmVkLmNvbT4N CiAqIC0gZm9yayBpbiBjYXNlIHdlIGFyZSBwcm9jZXNzIGdyb3VwIGxlYWRl cg0KICoNCiAqIDIwMTEtMDItMTQgSmFzb24gSi4gSGVsbGVudGhhbCA8amhl bGxARGF0YUlYLm5ldD4NCiAqIC0gcmVtb3ZlZCBubHMgc3VwcG9ydCBmb3Ig dGhpcyBzaW1wbGUgY29tbWFuZC4NCiAqDQogKi8NCg0KI2luY2x1ZGUgPHN0 ZGlvLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8c3RkbGli Lmg+DQoNCiNkZWZpbmUgXyhUZXh0KSAoVGV4dCkNCg0KaW50DQptYWluKGlu dCBhcmdjLCBjaGFyICphcmd2W10pIHsNCgkNCglpZiAoYXJnYyA8IDIpIHsN CgkJZnByaW50ZihzdGRlcnIsIF8oInVzYWdlOiAlcyBwcm9ncmFtIFthcmcg Li4uXVxuIiksDQoJCQlhcmd2WzBdKTsNCgkJZXhpdCgxKTsNCgl9DQoJaWYg KGdldHBncnAoKSA9PSBnZXRwaWQoKSkgew0KCQlzd2l0Y2goZm9yaygpKXsN CgkJY2FzZSAtMToNCgkJCXBlcnJvcigiZm9yayIpOw0KCQkJZXhpdCgxKTsN CgkJY2FzZSAwOgkJLyogY2hpbGQgKi8NCgkJCWJyZWFrOw0KCQlkZWZhdWx0 OgkvKiBwYXJlbnQgKi8NCgkJCWV4aXQoMCk7DQoJCX0NCgl9DQoJaWYgKHNl dHNpZCgpIDwgMCkgew0KCQlwZXJyb3IoInNldHNpZCIpOyAvKiBjYW5ub3Qg aGFwcGVuICovDQoJCWV4aXQoMSk7DQoJfQ0KCWV4ZWN2cChhcmd2WzFdLCBh cmd2ICsgMSk7DQoJcGVycm9yKCJleGVjdnAiKTsNCglleGl0KDEpOw0KfQ0K --80310268-1685349294-1297749895=:1852 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=setsid.c.asc Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Signature + Checksums Content-Disposition: attachment; filename=setsid.c.asc LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0NCkNvbW1lbnQ6IFRISVMg U09GVFdBUkUgSVMgUFJPVklERUQgQlkgVEhFIEFVVEhPUiBBTkQgQ09OVFJJ QlVUT1JTIGBgQVMgSVMnJyBBTkQNCkNvbW1lbnQ6IEFOWSBFWFBSRVNTIE9S IElNUExJRUQgV0FSUkFOVElFUywgSU5DTFVESU5HLCBCVVQgTk9UIExJTUlU RUQgVE8sIFRIRQ0KQ29tbWVudDogSU1QTElFRCBXQVJSQU5USUVTIE9GIE1F UkNIQU5UQUJJTElUWSBBTkQgRklUTkVTUyBGT1IgQSBQQVJUSUNVTEFSIFBV UlBPU0UNCkNvbW1lbnQ6IEFSRSBESVNDTEFJTUVELiAgSU4gTk8gRVZFTlQg U0hBTEwgVEhFIEFVVEhPUiBPUiBDT05UUklCVVRPUlMgQkUgTElBQkxFDQpD b21tZW50OiBGT1IgQU5ZIERJUkVDVCwgSU5ESVJFQ1QsIElOQ0lERU5UQUws IFNQRUNJQUwsIEVYRU1QTEFSWSwgT1IgQ09OU0VRVUVOVElBTA0KQ29tbWVu dDogREFNQUdFUyAoSU5DTFVESU5HLCBCVVQgTk9UIExJTUlURUQgVE8sIFBS T0NVUkVNRU5UIE9GIFNVQlNUSVRVVEUgR09PRFMNCkNvbW1lbnQ6IE9SIFNF UlZJQ0VTOyBMT1NTIE9GIFVTRSwgREFUQSwgT1IgUFJPRklUUzsgT1IgQlVT SU5FU1MgSU5URVJSVVBUSU9OKQ0KQ29tbWVudDogSE9XRVZFUiBDQVVTRUQg QU5EIE9OIEFOWSBUSEVPUlkgT0YgTElBQklMSVRZLCBXSEVUSEVSIElOIENP TlRSQUNULCBTVFJJQ1QNCkNvbW1lbnQ6IExJQUJJTElUWSwgT1IgVE9SVCAo SU5DTFVESU5HIE5FR0xJR0VOQ0UgT1IgT1RIRVJXSVNFKSBBUklTSU5HIElO IEFOWSBXQVkNCkNvbW1lbnQ6IE9VVCBPRiBUSEUgVVNFIE9GIFRISVMgU09G VFdBUkUsIEVWRU4gSUYgQURWSVNFRCBPRiBUSEUgUE9TU0lCSUxJVFkgT0YN CkNvbW1lbnQ6IFNVQ0ggREFNQUdFLg0KDQppUUVjQkFBQkFnQUdCUUpOV2hV U0FBb0pFSkJYaDRtSjJGUitaQ0FIL2o3REROemFhamxhMlhhN0dqWTQ0RnJx DQpzTUZOM05OOUZ5SVI1Wms2VzU1N1g1VHgzVmh6c29GUEhFOVQwTzQ5aW94 LzE4MCtEZFJCRWpwYVA0dDVWbFZ2DQpKaHhJOUtZVVdBbFg5TFhubTVPTnYx QXdlbTN3elFNSGtRNWFBNVBiMTJETWcwR2daa0RKOXNuM20rdmRBTlRsDQov dUpWNUt5cUs4ejFQcXhhYTFUVGV6UVliZlRuaDZ1NkRSRm90RjdaT20ydjlo eVZXNlp4U1lPNjlid1E3d2t1DQpFcFVLand0UlhGZXhMcDFxcmwzTTJPWm9W NCsxNHlHbml1ZW85bEVmU012SHdtK21BelhuNmdxbzNVcHRTRlExDQphenp1 WnQ1djNZNGx4a3J0azBNV2NDVUY4eDFhZStXTDBoRXphanpsY2s3akxTUk93 dE14WnV2NHdNaHp2ZXc9DQo9TVhGcw0KLS0tLS1FTkQgUEdQIFNJR05BVFVS RS0tLS0tDQpNRDUgKHNldHNpZC5jKSA9IDJjZGNhNDdhYzc5YzYzZDgxYjcy ZDY1MjE4YzViZGFlDQpTSEEyNTYgKHNldHNpZC5jKSA9IDY2ZGNiZTRlNWMx OTg2ZTYxZTJiNzhkYmEyZjlhNjM4ODY0NmZjNDRmZmE5M2Q3ZWE0M2IxOTI3 NDdhNzc1MjMNClNJWkUgKHNldHNpZC5jKSA9IDk0MQ0K --80310268-1685349294-1297749895=:1852 Content-Type: TEXT/PLAIN; charset=US-ASCII; name=setsid.1 Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Manual Content-Disposition: attachment; filename=setsid.1 LlwiIFJpY2sgU2xhZGtleSA8anJzQHdvcmxkLnN0ZC5jb20+DQouXCIgSW4g dGhlIHB1YmxpYyBkb21haW4uDQouXCIgUGF0aCBtb2RpZmljYXRpb25zIGJ5 IGZhaXRoQGNzLnVuYy5lZHUNCi5USCBTRVRTSUQgMSAiMjAgTm92ZW1iZXIg MTk5MyIgIkxpbnV4IDAuOTkiICJMaW51eCBQcm9ncmFtbWVyJ3MgTWFudWFs Ig0KLlNIIE5BTUUNCnNldHNpZCBcLSBydW4gYSBwcm9ncmFtIGluIGEgbmV3 IHNlc3Npb24NCi5TSCBTWU5PUFNJUw0KLkIgc2V0c2lkDQouSSBwcm9ncmFt DQouUkkgWyBhcmcgLi4uXQ0KLlNIIERFU0NSSVBUSU9ODQouQiBzZXRzaWQN CnJ1bnMgYSBwcm9ncmFtIGluIGEgbmV3IHNlc3Npb24uDQouU0ggIlNFRSBB TFNPIg0KLkJSIHNldHNpZCAoMikNCi5TSCBBVVRIT1INClJpY2sgU2xhZGtl eSA8anJzQHdvcmxkLnN0ZC5jb20+DQouU0ggQVZBSUxBQklMSVRZDQpUaGUg c2V0c2lkIGNvbW1hbmQgaXMgcGFydCBvZiB0aGUgdXRpbC1saW51eCBwYWNr YWdlIGFuZCBpcyBhdmFpbGFibGUgZnJvbQ0KZnRwOi8vZnRwLmtlcm5lbC5v cmcvcHViL2xpbnV4L3V0aWxzL3V0aWwtbGludXgvLg0K --80310268-1685349294-1297749895=:1852-- From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 09:12:43 2011 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 28464106566B for ; Tue, 15 Feb 2011 09:12:43 +0000 (UTC) (envelope-from gljennjohn@googlemail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id AADB78FC1C for ; Tue, 15 Feb 2011 09:12:42 +0000 (UTC) Received: by fxm16 with SMTP id 16so6281226fxm.13 for ; Tue, 15 Feb 2011 01:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:x-mailer:mime-version:content-type :content-transfer-encoding; bh=5gsJNA+7wz4wMJpGgdC0TPT4qrFKnmSWNi2k44FwRLw=; b=rcDy/97W6L2Rq15FWuB1BEtrTvrLdAPVrqVBQE4VaXoY7RMHK44m1ZvmKeT5PcBf6g YUGR/UljvKiMLThpgM1qk5yBgJ9fMdvFJ+I1Eu15oEy9MFbl+Y7hANdGMcSGdHMvMn88 DvLDJzU97A7yC7KpkuCKO6TofGcCq1cWoi/Xg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :x-mailer:mime-version:content-type:content-transfer-encoding; b=wdB1gsqCWZOfbZocNvfFnm6ORgEoDo1Aon0kuJQzpZOzi+1oV3R++pE3NcsJg3wgZV vxQvK+tS5a2M3OJGkveU/SupW2XoVU3P4PZ90brJkNAFHmBgZQRSBCQRUtd/SkJCON44 8NNqQTD6hg1PXLt+eZ4hvm7SPwlQKeIz12BSw= Received: by 10.223.125.196 with SMTP id z4mr1734450far.124.1297759525419; Tue, 15 Feb 2011 00:45:25 -0800 (PST) Received: from ernst.jennejohn.org (p578E2430.dip.t-dialin.net [87.142.36.48]) by mx.google.com with ESMTPS id n3sm1505215faa.29.2011.02.15.00.45.23 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 15 Feb 2011 00:45:24 -0800 (PST) Date: Tue, 15 Feb 2011 09:45:22 +0100 From: Gary Jennejohn To: "Julian H. Stacey" Message-ID: <20110215094522.383e5c47@ernst.jennejohn.org> In-Reply-To: <201102150019.p1F0Jjfc088901@fire.js.berklix.net> References: <20110212170526.00004cab@unknown> <201102150019.p1F0Jjfc088901@fire.js.berklix.net> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.18.7; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org Subject: Re: memstick.img is bloated with 7% 2K blocks of nulls X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gljennjohn@googlemail.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Feb 2011 09:12:43 -0000 On Tue, 15 Feb 2011 01:19:45 +0100 "Julian H. Stacey" wrote: > Could author phk@FreeBSD.ORG cc'd (or someone else if they are clear) > please explain what cmdline is ? > Possibly commit an appended // comment after "int cmdline = 0;" > (in line 76 of 8.1 & current src/sbin/mdconfig/mdconfig.c) wgat it's for ? > > (cmdline seems in most places to maybe be an enum { 1 > 2 3 } for { a d l } alternate forms of command mdconfig, > ... & yet case 'd': sets cmdline = 3 not 2 ? > (& 't' & 'f' sets cmdline=2 ; not 1. Puzzling. > It's simply a state machine to ensure that mutually exclusive options aren't used together. See the manpage; it's pretty clear from it that only certain combinations of options are allowed. -- Gary Jennejohn From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 12:51:48 2011 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 3D5F51065694 for ; Tue, 15 Feb 2011 12:51:48 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8A48FC16 for ; Tue, 15 Feb 2011 12:51:48 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id A23BA46B06; Tue, 15 Feb 2011 07:51:47 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.10]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id C1EDE8A01D; Tue, 15 Feb 2011 07:51:46 -0500 (EST) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 15 Feb 2011 07:41:35 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201102150741.35265.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 15 Feb 2011 07:51:46 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=0.5 required=4.2 tests=BAYES_00,MAY_BE_FORGED, RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: Garrett Cooper Subject: Re: [PATCH] fix impossible case with waitpid(2) in truss 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, 15 Feb 2011 12:51:48 -0000 On Monday, February 14, 2011 11:12:02 pm Garrett Cooper wrote: > Hi, > waitpid(2) returns a value in the set { -1, 0, } (-1 in the > event of an ERROR, 0 when WNOHANG is specified, when the process > exits according to wait(2)); it never returns a value < -1. > If someone could commit this patch it would be appreciated. > Thanks, > -Garrett I went with '< 0' to match the style used for ptrace() invocations in other parts of truss. All four calls to waitpid() in truss were broken in this fashion. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 12:51:50 2011 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 54C1F106566B for ; Tue, 15 Feb 2011 12:51:50 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 251E38FC19 for ; Tue, 15 Feb 2011 12:51:50 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id CC41A46B09; Tue, 15 Feb 2011 07:51:49 -0500 (EST) Received: from jhbbsd.localnet (unknown [209.249.190.10]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id EC22F8A02A; Tue, 15 Feb 2011 07:51:48 -0500 (EST) From: John Baldwin To: "beezarliu" Date: Tue, 15 Feb 2011 07:50:31 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: <201102141718415933573@yahoo.com.cn> <201102140939.17486.jhb@freebsd.org> <201102151112522035530@yahoo.com.cn> In-Reply-To: <201102151112522035530@yahoo.com.cn> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102150750.31797.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 15 Feb 2011 07:51:49 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=0.5 required=4.2 tests=BAYES_00,MAY_BE_FORGED, RDNS_DYNAMIC autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: "freebsd-hackers@freebsd.org" Subject: Re: map share memory to kernel space 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, 15 Feb 2011 12:51:50 -0000 On Monday, February 14, 2011 10:12:59 pm beezarliu wrote: > On 2011-02-14 22:56:28, John Baldwin wrote: > >On Monday, February 14, 2011 4:18:50 am beezarliu wrote: > >> Hackers, > >> > >> I want to access a userland share memory in a kernel thread. > >> So I tried to map the share memory to the kernel space. > >> The basic idea is to map the shm_object into kernel_map > >> when the share memory is created. > >> > >> Using the following patch, I found the vm_object in kernel_map, > >> and the vm_object in the address space of userland process are the same. > >> But their content in the kernel and userland address mapped are different. > >> > >> It's very strang since they are exactly the same vm_object. > >> Do I miss something, please help. > > > >Hmm, this is a bit of code I use for something similar to map a VM object into > >the kernel. It does not use vm_page_grab() directly though: > > > Initially, I wanted to allocate all the pages needed when the share memory is created, > in order to reduce page fault at the time it's used. > This seems to be an extra step. :( > > John, thank you very much! I think vm_map_wire() will find pages for you when it wires the object. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 14:12:06 2011 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 3467D1065672; Tue, 15 Feb 2011 14:12:06 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 967BB8FC0A; Tue, 15 Feb 2011 14:12:05 +0000 (UTC) Received: by wwf26 with SMTP id 26so211594wwf.31 for ; Tue, 15 Feb 2011 06:12:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=cMH43oHxOim1+sNRsd4hDzBzbMyLZ2MeXQCD99chhf0=; b=EQ14AwNyc/oKIbo1BJtd4Kw4DsuVS/XFh/hNElHpbkIQY7pROcv/Hh6QZ+hQsjlGUl NJk8XLz45Wms3JXXuid7DuAwOZJK9NmGYb4HhrxEbJxbLykHUf3QGJlFvwRxwkcfdt6L 3quZcxXa7iK0ig1f1mRMYUwqBq6TtZxIXGLmY= 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=k3NkejvXIFyt5hwh5LQY5UeldjpS4bci7cBClgNXxN/wNcejfKGhwk8HDhsz0Azfx5 fz6K43oiY5QSz/pcINMFxJbWJfzhPlLJ49mmBzb1DPHQk5XfyqJ/6xOM1XwhfZM5i7Kx 7HxyBWXYZMxbcuCE+9XBkyc3Ojf94IyVDoLjc= MIME-Version: 1.0 Received: by 10.216.63.138 with SMTP id a10mr1822852wed.27.1297779124453; Tue, 15 Feb 2011 06:12:04 -0800 (PST) Received: by 10.216.71.200 with HTTP; Tue, 15 Feb 2011 06:12:04 -0800 (PST) In-Reply-To: <201102150741.35265.jhb@freebsd.org> References: <201102150741.35265.jhb@freebsd.org> Date: Tue, 15 Feb 2011 06:12:04 -0800 Message-ID: From: Garrett Cooper To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] fix impossible case with waitpid(2) in truss 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, 15 Feb 2011 14:12:06 -0000 On Tue, Feb 15, 2011 at 4:41 AM, John Baldwin wrote: > On Monday, February 14, 2011 11:12:02 pm Garrett Cooper wrote: >> Hi, >> =A0 =A0 waitpid(2) returns a value in the set { -1, 0, } (-1 in th= e >> event of an ERROR, 0 when WNOHANG is specified, when the process >> exits according to wait(2)); it never returns a value < -1. >> =A0 =A0 If someone could commit this patch it would be appreciated. >> Thanks, >> -Garrett > > I went with '< 0' to match the style used for ptrace() invocations in oth= er > parts of truss. =A0All four calls to waitpid() in truss were broken in th= is > fashion. Oops. I just spotted the one issue because I was looking for a reasonable example for how to do ptrace as I needed to clean off some related cobwebs for $JOB. Thanks for finding the rest of the issues! -Garrett From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 18:12:46 2011 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 114EE106566B for ; Tue, 15 Feb 2011 18:12:46 +0000 (UTC) (envelope-from drbaud@yahoo.com) Received: from web120708.mail.ne1.yahoo.com (web120708.mail.ne1.yahoo.com [98.138.82.215]) by mx1.freebsd.org (Postfix) with SMTP id CB0D48FC12 for ; Tue, 15 Feb 2011 18:12:45 +0000 (UTC) Received: (qmail 41209 invoked by uid 60001); 15 Feb 2011 17:46:05 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1297791965; bh=1Lu/IHNJmvNxwgROEtuOiNQReD1rBj5VYXGSAkVOQ1M=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=MsZTtQRuIgdJjsxVm6TDBksZFcHzLt0uyctEIAne7KL8qRuHs3JJd5+1ZyQ63VYo9HUXQEOZN5ruYKNCUgcjsLwLPjJ+rctDZa5Uqb+6/IUJvLNIoW3sg2iYN10JigAbqvJmyiUndbwsTyRWK9sHXKh9JRFgMA0OsOGAQTrX2t8= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=bLQoLc84WyP3GSAJZsqWwkQmlZOjzCq2u8mfoC9N9M35uluGVo3xOnlEZs0eC0PTRFh1yjOuh1JxXOVgiyp4AJ3FjvcTeYsyTHt/rO38yEx+sWHO09VgzHVqLyUIqhqmDnEutuVk0k7AlpC3J7vhb/Ukn4x98IqpVdx11i/mCAQ=; Message-ID: <628608.40948.qm@web120708.mail.ne1.yahoo.com> X-YMail-OSG: FC07_iYVM1nz67.H.BY6HkzaLPihi4Q.dWv8P9fTxcrhHE4 q6g__olzNvuvShYFv1tnBFDEq2uwSpLe3LlWVHfdUNlyN5krJV5AtqR7Z.C6 yCfMHSG6k3fhGtei2clgcm85d1i8xI9_v6ln3lOawP12cvV1TLY4dKyOHj8Q GhrQtKNIprtYS4DFXtJ1APg78t5RZe5HdtHHneBgKNT080XrfCyk9E17JBgX Opht3I9PJu0OOPski3rxhCpxg6kZkQMW3gmRk55G1UUFavrETYvw5A4KeFbA pDTboP5OQR2QL8XHV8cBbeyUk Received: from [64.238.244.146] by web120708.mail.ne1.yahoo.com via HTTP; Tue, 15 Feb 2011 09:46:05 PST X-Mailer: YahooMailRC/555 YahooMailWebService/0.8.108.291010 Date: Tue, 15 Feb 2011 09:46:05 -0800 (PST) From: "Dr. Baud" To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailman-Approved-At: Tue, 15 Feb 2011 18:28:20 +0000 Subject: spontaneous reboot - ptrace 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, 15 Feb 2011 18:12:46 -0000 I've an interesting anomaly I'd appreciate some help with.=0A=0AAs a re= sult of looking at a threading problem I modified gcore =0Ato dump all memo= ry segments associated with a process;=0Abasically comment out the "Ignore"= conditional in readmap().=0A The result is that the box spontaneously r= eboots sometime=0ABetween 40 and 50 seconds into the dump; this is an appli= cation=0Athat is indeed a memory hog. I commented out the actual=0Awrite to= disk and the result is the same. I=E2=80=99ve even disabled the=0Awatchdog= to no avail.=0A=0A This is a vanilla 8.1 install:=0A=0AFreeBSD pollyann= a 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49 UTC =0A2010=0A = root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64=0A=0A r= unning on fairly vanilla hardware:=0A=0ACPU: Intel(R) Xeon(TM) CPU 3.20GHz = (3212.93-MHz K8-class CPU)=0A Origin =3D "GenuineIntel" Id =3D 0xf49 Fam= ily =3D f Model =3D 4 Stepping =3D 9=0A Features=3D0xbfebfbff=0A Features2=3D0x641d=0A AMD Features=3D0x20000800=0A = AMD Features2=3D0x1=0A TSC: P-state invariant=0A=0A =0A Any thou= ghts on how to proceed?=0A =0A Dr.=0A=0A=0A From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 18:30:55 2011 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 4B459106566B; Tue, 15 Feb 2011 18:30:55 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id 9445D8FC0A; Tue, 15 Feb 2011 18:30:54 +0000 (UTC) Received: from park.js.berklix.net (p5B22D05E.dip.t-dialin.net [91.34.208.94]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p1FIUoYH002532; Tue, 15 Feb 2011 18:30:51 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p1FIUg9e042758; Tue, 15 Feb 2011 19:30:42 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id p1FIUWGx098299; Tue, 15 Feb 2011 19:30:37 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201102151830.p1FIUWGx098299@fire.js.berklix.net> To: gljennjohn@googlemail.com From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Tue, 15 Feb 2011 09:45:22 +0100." <20110215094522.383e5c47@ernst.jennejohn.org> Date: Tue, 15 Feb 2011 19:30:32 +0100 Sender: jhs@berklix.com Cc: hackers@freebsd.org, phk@freebsd.org Subject: Re: memstick.img is bloated with 7% 2K blocks of nulls 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, 15 Feb 2011 18:30:55 -0000 Gary Jennejohn wrote: > On Tue, 15 Feb 2011 01:19:45 +0100 > "Julian H. Stacey" wrote: > > > Could author phk@FreeBSD.ORG cc'd (or someone else if they are clear) > > please explain what cmdline is ? > > Possibly commit an appended // comment after "int cmdline = 0;" > > (in line 76 of 8.1 & current src/sbin/mdconfig/mdconfig.c) wgat it's for ? > > > > (cmdline seems in most places to maybe be an enum { 1 > > 2 3 } for { a d l } alternate forms of command mdconfig, > > ... & yet case 'd': sets cmdline = 3 not 2 ? > > (& 't' & 'f' sets cmdline=2 ; not 1. Puzzling. > > > > It's simply a state machine to ensure that mutually exclusive options > aren't used together. I'd wondered that, but > > ... & yet case 'd': sets cmdline = 3 not 2 ? ie both case 'd': & case 'l': cmdline = 3; which implies: Either a mistake in the code there, Or cmdline not a state table of 1,2,3 for the 3 alternate invocations 'a', 'd', 'l' shown in man mdconfig & usage(). > See the manpage; it's pretty clear from it that > only certain combinations of options are allowed. Agreed. But cmdline doesnt seem to be [just] doing that, ay least not doing case a d l = 1 2 3, else cmdline usage would be about as in my diff appended. So is cmdline is doing something else ? What ? *** mdconfig.c Tue Feb 15 18:05:56 2011 --- mdconfig_jhs.c Tue Feb 15 19:05:59 2011 *************** *** 74,79 **** --- 74,86 ---- int ch, fd, i, vflag; char *p; int cmdline = 0; + /* JHS: Assume cmdline is to indicate 1 of the 3 states shown in usage() ?, eg: + * 1 "usage: mdconfig -a -t type [-n] [-o [no]option] ... [-f file]\n" + * " [-s size] [-S sectorsize] [-u unit]\n" + * " [-x sectors/track] [-y heads/cyl]\n" + * 2 " mdconfig -d -u unit [-o [no]force]\n" + * 3 " mdconfig -l [-v] [-n] [-u unit]\n"); + */ char *mdunit; bzero(&mdio, sizeof(mdio)); *************** *** 98,104 **** usage(); action = DETACH; mdio.md_options = MD_AUTOUNIT; ! cmdline = 3; break; case 'l': if (cmdline != 0) --- 105,111 ---- usage(); action = DETACH; mdio.md_options = MD_AUTOUNIT; ! cmdline = 2; // JHS: was 3 break; case 'l': if (cmdline != 0) *************** *** 128,134 **** } else { usage(); } ! cmdline=2; break; case 'f': if (cmdline == 0) { --- 135,141 ---- } else { usage(); } ! // JHS: cmdline=2; break; case 'f': if (cmdline == 0) { *************** *** 139,147 **** /* Imply ``-t vnode'' */ mdio.md_type = MD_VNODE; mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; ! cmdline = 2; } ! if (cmdline != 2) usage(); if (realpath(optarg, mdio.md_file) == NULL) { err(1, "could not find full path for %s", --- 146,154 ---- /* Imply ``-t vnode'' */ mdio.md_type = MD_VNODE; mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; ! // JHS: cmdline = 2; } ! if (cmdline != 1) // JHS: was 2 usage(); if (realpath(optarg, mdio.md_file) == NULL) { err(1, "could not find full path for %s", *************** *** 200,206 **** errx(1, "Unknown option: %s.", optarg); break; case 'S': ! if (cmdline != 2) usage(); mdio.md_sectorsize = strtoul(optarg, &p, 0); break; --- 207,213 ---- errx(1, "Unknown option: %s.", optarg); break; case 'S': ! if (cmdline != 1) // JHS: Was 2 usage(); mdio.md_sectorsize = strtoul(optarg, &p, 0); break; *************** *** 214,222 **** /* Imply ``-t swap'' */ mdio.md_type = MD_SWAP; mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; ! cmdline = 2; } ! if (cmdline != 2) usage(); mdio.md_mediasize = (off_t)strtoumax(optarg, &p, 0); if (p == NULL || *p == '\0') --- 221,229 ---- /* Imply ``-t swap'' */ mdio.md_type = MD_SWAP; mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS; ! cmdline = 1; // JHS: Was 2 } ! if (cmdline != 1) // JHS: Was 2 usage(); mdio.md_mediasize = (off_t)strtoumax(optarg, &p, 0); if (p == NULL || *p == '\0') *************** *** 236,243 **** errx(1, "Unknown suffix on -s argument"); break; case 'u': ! if (cmdline != 2 && cmdline != 3) ! usage(); if (!strncmp(optarg, "/dev/", 5)) optarg += 5; if (!strncmp(optarg, MD_NAME, sizeof(MD_NAME) - 1)) --- 243,250 ---- errx(1, "Unknown suffix on -s argument"); break; case 'u': ! // JHS: if (cmdline != 2 && cmdline != 3) ! // JHS: usage(); if (!strncmp(optarg, "/dev/", 5)) optarg += 5; if (!strncmp(optarg, MD_NAME, sizeof(MD_NAME) - 1)) *************** *** 254,265 **** vflag = OPT_VERBOSE; break; case 'x': ! if (cmdline != 2) usage(); mdio.md_fwsectors = strtoul(optarg, &p, 0); break; case 'y': ! if (cmdline != 2) usage(); mdio.md_fwheads = strtoul(optarg, &p, 0); break; --- 261,272 ---- vflag = OPT_VERBOSE; break; case 'x': ! if (cmdline != 1) // JHS: was 2 usage(); mdio.md_fwsectors = strtoul(optarg, &p, 0); break; case 'y': ! if (cmdline != 1) // JHS: was 2 usage(); mdio.md_fwheads = strtoul(optarg, &p, 0); break; *************** *** 275,285 **** fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); if (fd < 0) err(1, "open(/dev/%s)", MDCTL_NAME); ! if (cmdline == 2 && (mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP)) if (mdio.md_mediasize == 0) errx(1, "must specify -s for -t malloc or -t swap"); ! if (cmdline == 2 && mdio.md_type == MD_VNODE) if (mdio.md_file[0] == '\0') errx(1, "must specify -f for -t vnode"); if (mdio.md_type == MD_VNODE && --- 282,292 ---- fd = open("/dev/" MDCTL_NAME, O_RDWR, 0); if (fd < 0) err(1, "open(/dev/%s)", MDCTL_NAME); ! if (cmdline == 1 // JHS: was 2 && (mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP)) if (mdio.md_mediasize == 0) errx(1, "must specify -s for -t malloc or -t swap"); ! if (cmdline == 1 && mdio.md_type == MD_VNODE) // JHS: was 2 if (mdio.md_file[0] == '\0') errx(1, "must specify -f for -t vnode"); if (mdio.md_type == MD_VNODE && *************** *** 303,309 **** return (md_query(mdunit)); } } else if (action == ATTACH) { ! if (cmdline < 2) usage(); i = ioctl(fd, MDIOCATTACH, &mdio); if (i < 0) --- 310,316 ---- return (md_query(mdunit)); } } else if (action == ATTACH) { ! if (cmdline != 1) // JHS: was < 2 usage(); i = ioctl(fd, MDIOCATTACH, &mdio); if (i < 0) Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail plain text; Not quoted-printable, Not HTML, Not base 64. Reply below text sections not at top, to avoid breaking cumulative context. From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 18:37:42 2011 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 34EAA1065673 for ; Tue, 15 Feb 2011 18:37:42 +0000 (UTC) (envelope-from erdgeist@erdgeist.org) Received: from elektropost.org (elektropost.org [217.13.206.130]) by mx1.freebsd.org (Postfix) with ESMTP id 75B1F8FC15 for ; Tue, 15 Feb 2011 18:37:40 +0000 (UTC) Received: (qmail 644 invoked from network); 15 Feb 2011 18:37:38 -0000 Received: from elektropost.org (HELO elektropost.org) (erdgeist@erdgeist.org) by elektropost.org with CAMELLIA256-SHA encrypted SMTP; 15 Feb 2011 18:37:38 -0000 Message-ID: <4D5AC7F1.7020501@erdgeist.org> Date: Tue, 15 Feb 2011 19:37:37 +0100 From: Dirk Engling User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.14) Gecko/20110207 Thunderbird/3.1.8 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Detecting listening servers in multi-ip jails 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, 15 Feb 2011 18:37:42 -0000 Hello, until jails could be bound to several ip addresses, my convenience feature in ezjail to check for and warn about listening services in the host system and other jails worked simply by asking: listeners_ip=`sockstat -4 -l | grep "${ip}:[[:digit:]]"` listeners_all=`sockstat -4 -l | grep "*:[[:digit:]]"` Now where ip adresses are not rewritten on listen() calls anymore, services in jails can bind to 0.0.0.0 as well and will match the latter, although they don't really cause the trouble I want to warn users about (unless, of course the jail really is bound to the same ip address and the service then binds to 0.0.0.0). Now I can, using "nc -z", test if the service really listens. That allows me to filter and only report those services that actually respond. However, this is far from clean. Are there other ways to relibly test for listening services on any port for a given ip address? Thanks in advance, erdgeist From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 18:42:51 2011 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 9165E106564A for ; Tue, 15 Feb 2011 18:42:51 +0000 (UTC) (envelope-from bruce@cran.org.uk) Received: from muon.cran.org.uk (unknown [IPv6:2a01:348:0:15:5d59:5c40:0:1]) by mx1.freebsd.org (Postfix) with ESMTP id 219B68FC13 for ; Tue, 15 Feb 2011 18:42:51 +0000 (UTC) Received: from muon.cran.org.uk (localhost [127.0.0.1]) by muon.cran.org.uk (Postfix) with ESMTP id 57263E839A; Tue, 15 Feb 2011 18:42:48 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=cran.org.uk; h=date:from :to:cc:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; s=mail; bh=TEiNZs/+9iWw eavWZRgAAQIADWo=; b=qPl8+myyrRiMaycyQ7srkaTSznesHP9pqQ3WFYRJCA0i jzoHBvZCb1Rn/40DVckpTDTOfSfCpa65j/wyAWpVfWPE8vbMtxUOxW6EHM0iAUeA pbf9uc/iVt24AfRnuhpR+gko+Q2p/Bn0ZAQlHW4ImNFuxHAbOpRj2dKrxP0hfmE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=cran.org.uk; h=date:from:to :cc:subject:message-id:in-reply-to:references:mime-version :content-type:content-transfer-encoding; q=dns; s=mail; b=adzPzw 8imnMxlo1gflNcLgnyIGsNXmw03i62qjQFQuJsb0mpJJqm+SM89/sf18zdjYdKPR cfkP9yJMAAu4xI7v/eCEYhzx0jqCdaTWYv17qxifGO09UbXNd9VW1size6Qteyn8 eBfDBydJfW7qqFK4LIlb5hfH+DMt9rQGRucMk= Received: from unknown (client-86-31-199-149.oxfd.adsl.virginmedia.com [86.31.199.149]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by muon.cran.org.uk (Postfix) with ESMTPSA id 0B14BE8395; Tue, 15 Feb 2011 18:42:47 +0000 (GMT) Date: Tue, 15 Feb 2011 18:42:39 +0000 From: Bruce Cran To: "Julian H. Stacey" Message-ID: <20110215184239.00007395@unknown> In-Reply-To: <201102150319.p1F3JAo4090377@fire.js.berklix.net> References: <4D59275F.60002@gmx.de> <201102150319.p1F3JAo4090377@fire.js.berklix.net> X-Mailer: Claws Mail 3.7.8cvs9 (GTK+ 2.16.6; i586-pc-mingw32msvc) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 15 Feb 2011 18:42:51 -0000 On Tue, 15 Feb 2011 04:19:10 +0100 "Julian H. Stacey" wrote: > Again you fail to post a precise complete URL for free open anonymous > reference. One might wonder your involvment with open.org/ISO/IEEE. It seems registration is required for the SUS, but you can get POSIX.1-2008 free at http://pubs.opengroup.org/onlinepubs/9699919799/ . -- Bruce Cran From owner-freebsd-hackers@FreeBSD.ORG Tue Feb 15 20:01:06 2011 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 F0C75106566B for ; Tue, 15 Feb 2011 20:01:06 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 67BD68FC17 for ; Tue, 15 Feb 2011 20:01:05 +0000 (UTC) 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 p1FK12nl037326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Feb 2011 22:01:02 +0200 (EET) (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.4/8.14.4) with ESMTP id p1FK12Xr088053; Tue, 15 Feb 2011 22:01:02 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p1FK11B0088052; Tue, 15 Feb 2011 22:01:01 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 15 Feb 2011 22:01:01 +0200 From: Kostik Belousov To: "Dr. Baud" Message-ID: <20110215200101.GE78089@deviant.kiev.zoral.com.ua> References: <628608.40948.qm@web120708.mail.ne1.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xgtqT0tr7NoD/uy/" Content-Disposition: inline In-Reply-To: <628608.40948.qm@web120708.mail.ne1.yahoo.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: spontaneous reboot - ptrace 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, 15 Feb 2011 20:01:07 -0000 --xgtqT0tr7NoD/uy/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Feb 15, 2011 at 09:46:05AM -0800, Dr. Baud wrote: > I've an interesting anomaly I'd appreciate some help with. >=20 > As a result of looking at a threading problem I modified gcore=20 > to dump all memory segments associated with a process; > basically comment out the "Ignore" conditional in readmap(). > The result is that the box spontaneously reboots sometime > Between 40 and 50 seconds into the dump; this is an application > that is indeed a memory hog. I commented out the actual > write to disk and the result is the same. I???ve even disabled the > watchdog to no avail. >=20 > This is a vanilla 8.1 install: >=20 > FreeBSD pollyanna 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:36:49= UTC=20 > 2010 > root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >=20 > running on fairly vanilla hardware: >=20 > CPU: Intel(R) Xeon(TM) CPU 3.20GHz (3212.93-MHz K8-class CPU) > Origin =3D "GenuineIntel" Id =3D 0xf49 Family =3D f Model =3D 4 Ste= pping =3D 9 > Features=3D0xbfebfbff MOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE> > Features2=3D0x641d > AMD Features=3D0x20000800 > AMD Features2=3D0x1 > TSC: P-state invariant >=20 > =20 > Any thoughts on how to proceed? First, do you have a console output during the run ? Is it possible that machine paniced ? If not, were there any kernel messages before reboot ? Second, what is the process you are dumping ? Can you show at least the procstat -v output for the process ? --xgtqT0tr7NoD/uy/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1a230ACgkQC3+MBN1Mb4gz2wCgqCUROYg5ZhMA8uB5Jut9iID6 pvYAoLEusSihA+4MWPgnZdmsEuBHFpRs =0aRP -----END PGP SIGNATURE----- --xgtqT0tr7NoD/uy/-- From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 16 16:47:02 2011 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 8CF3C106566B for ; Wed, 16 Feb 2011 16:47:02 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by mx1.freebsd.org (Postfix) with SMTP id D4F678FC16 for ; Wed, 16 Feb 2011 16:47:01 +0000 (UTC) Received: (qmail invoked by alias); 16 Feb 2011 16:46:59 -0000 Received: from g225208061.adsl.alicedsl.de (EHLO [192.168.0.4]) [92.225.208.61] by mail.gmx.net (mp011) with SMTP; 16 Feb 2011 17:46:59 +0100 X-Authenticated: #428038 X-Provags-ID: V01U2FsdGVkX1+ry3QlfgOrK4C8J3fw483Zj9u4bwnHLbr037jhvG U/EDRNJ4/oXRaT Message-ID: <4D5BFF82.3040705@gmx.de> Date: Wed, 16 Feb 2011 17:46:58 +0100 From: Matthias Andree User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Mnenhy/0.8.3 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <201102150319.p1F3JAo4090377@fire.js.berklix.net> In-Reply-To: <201102150319.p1F3JAo4090377@fire.js.berklix.net> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 16 Feb 2011 16:47:02 -0000 Am 15.02.2011 04:19, schrieb Julian H. Stacey: >> and the SUS is available free of charge, that's > > Again you fail to post a precise complete URL for free open anonymous > reference. One might wonder your involvment with open.org/ISO/IEEE. I don't care to do the searching for you, nor discuss any of this, in particular because you are distracting from your actual getopt(3) concern with random sidesteps. And that's already one more reason that I've given than you've deserved. Let's stick to the technical discussion. >> language, 2nd edition, then getopt() isn't even in my printed book's index. > > Yet again: The point is to find the latest specification > of C language "const" Before considering latest getopt(). No it isn't, that is another of your distractions. The explanations about const are all there and you haven't yet clarified your concern about const-ness of the argv pointers in said getopt argument. I don't care about policies, standardization, affiliations, unless you document the technical concern that you see in the const in getopt()'s "char * const argv[]" argument. And before that happens I'm not even interested in a pseudo-technical discussion. Try comp.lang.c for a change. -- Matthias Andree From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 16 18:31:24 2011 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 4D8EE1065674 for ; Wed, 16 Feb 2011 18:31:24 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id A93258FC1D for ; Wed, 16 Feb 2011 18:31:23 +0000 (UTC) Received: from park.js.berklix.net (p5B22F2A2.dip.t-dialin.net [91.34.242.162]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id p1GIVFrM022289; Wed, 16 Feb 2011 18:31:16 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by park.js.berklix.net (8.13.8/8.13.8) with ESMTP id p1GIVK0X048199; Wed, 16 Feb 2011 19:31:21 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.3/8.14.3) with ESMTP id p1GIVATQ097902; Wed, 16 Feb 2011 19:31:15 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201102161831.p1GIVATQ097902@fire.js.berklix.net> To: Bruce Cran From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Tue, 15 Feb 2011 18:42:39 GMT." <20110215184239.00007395@unknown> Date: Wed, 16 Feb 2011 19:31:10 +0100 Sender: jhs@berklix.com Cc: freebsd-hackers@freebsd.org Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 16 Feb 2011 18:31:24 -0000 Bruce Cran wrote: > It seems registration is required for the SUS, but you can get > POSIX.1-2008 free at http://pubs.opengroup.org/onlinepubs/9699919799/ . Thanks Bruce. I browsed it but couldn't find a C spec. Opengroup.org server restricted the URL to a constant: http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html Hoping for full URLs (or more) I tried: http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?reload=true&punumber=4694974 It needed a login. I created one. IEEE harvested my address then responded: "Full text access is unavailable with your individual subscription...." Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Mail plain text; Not quoted-printable, Not HTML, Not base 64. Reply below text sections not at top, to avoid breaking cumulative context. From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 16 18:41:08 2011 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 3167C106564A for ; Wed, 16 Feb 2011 18:41:08 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by mx1.freebsd.org (Postfix) with SMTP id 768EB8FC12 for ; Wed, 16 Feb 2011 18:41:06 +0000 (UTC) Received: (qmail invoked by alias); 16 Feb 2011 18:41:06 -0000 Received: from g225208061.adsl.alicedsl.de (EHLO [192.168.0.4]) [92.225.208.61] by mail.gmx.net (mp049) with SMTP; 16 Feb 2011 19:41:06 +0100 X-Authenticated: #428038 X-Provags-ID: V01U2FsdGVkX1+lyjAUiTClzg3qooD0Ua743j8BLdCDqMFdw/e30G PFm4amPbPpq4tp Message-ID: <4D5C1A3E.20509@gmx.de> Date: Wed, 16 Feb 2011 19:41:02 +0100 From: Matthias Andree User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Mnenhy/0.8.3 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <201102161831.p1GIVATQ097902@fire.js.berklix.net> In-Reply-To: <201102161831.p1GIVATQ097902@fire.js.berklix.net> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 16 Feb 2011 18:41:08 -0000 Am 16.02.2011 19:31, schrieb Julian H. Stacey: > Bruce Cran wrote: >> It seems registration is required for the SUS, but you can get >> POSIX.1-2008 free at http://pubs.opengroup.org/onlinepubs/9699919799/ . > > Thanks Bruce. > I browsed it but couldn't find a C spec. > Opengroup.org server restricted the URL to a constant: > http://pubs.opengroup.org/onlinepubs/9699919799/nframe.html Depends on your browser features - you need a frame-capable browser for the URL that Bruce posted. But POSIX.1-2008 is the same as the Single Unix Specification v4 or IEEE Std 1003.1-2008. Neither gives you the C specification. > Hoping for full URLs (or more) I tried: > http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?reload=true&punumber=4694974 > It needed a login. I created one. IEEE harvested my address then responded: > "Full text access is unavailable with your individual subscription...." IEEE does, quite obviously, not have ISO standards. -- Matthias Andree From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 16 19:02:39 2011 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 3B1B4106566B for ; Wed, 16 Feb 2011 19:02:39 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob.rzone.de (mo-p00-ob.rzone.de [81.169.146.160]) by mx1.freebsd.org (Postfix) with ESMTP id C81468FC1B for ; Wed, 16 Feb 2011 19:02:37 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/afgnrylsiWawcSl4p2Q= X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (ip-109-45-86-241.web.vodafone.de [109.45.86.241]) by post.strato.de (cohen mo20) (RZmta 25.5) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id z06fe1n1GImuzI for ; Wed, 16 Feb 2011 20:02:35 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Wed, 16 Feb 2011 20:02:33 +0100 Date: Wed, 16 Feb 2011 20:02:33 +0100 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org Message-ID: <20110216190233.GB19686@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org References: <201102161831.p1GIVATQ097902@fire.js.berklix.net> <4D5C1A3E.20509@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D5C1A3E.20509@gmx.de> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 16 Feb 2011 19:02:39 -0000 On Wed, Feb 16, 2011 at 07:41:02PM +0100, Matthias Andree wrote: > But POSIX.1-2008 is the same as the Single > Unix Specification v4 or IEEE Std 1003.1-2008. Minor correction, it is SUS v3 Issue 7. Joerg From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 16 19:26:08 2011 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 F3CD5106566B for ; Wed, 16 Feb 2011 19:26:07 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by mx1.freebsd.org (Postfix) with SMTP id 4A5BB8FC1E for ; Wed, 16 Feb 2011 19:26:06 +0000 (UTC) Received: (qmail invoked by alias); 16 Feb 2011 19:26:05 -0000 Received: from g225208061.adsl.alicedsl.de (EHLO [192.168.0.4]) [92.225.208.61] by mail.gmx.net (mp067) with SMTP; 16 Feb 2011 20:26:05 +0100 X-Authenticated: #428038 X-Provags-ID: V01U2FsdGVkX19JEAJw0LhJfFwXJE+IoN2AqcFM4qAXBKOCopp/Iz hpncy3Lqi5AAqa Message-ID: <4D5C24CC.9070400@gmx.de> Date: Wed, 16 Feb 2011 20:26:04 +0100 From: Matthias Andree User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Mnenhy/0.8.3 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <201102161831.p1GIVATQ097902@fire.js.berklix.net> <4D5C1A3E.20509@gmx.de> <20110216190233.GB19686@britannica.bec.de> In-Reply-To: <20110216190233.GB19686@britannica.bec.de> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 16 Feb 2011 19:26:08 -0000 Am 16.02.2011 20:02, schrieb Joerg Sonnenberger: > On Wed, Feb 16, 2011 at 07:41:02PM +0100, Matthias Andree wrote: >> But POSIX.1-2008 is the same as the Single >> Unix Specification v4 or IEEE Std 1003.1-2008. > > Minor correction, it is SUS v3 Issue 7. No it isn't. See http://www.unix.org/version4/ieee_std.html -- Matthias Andree From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 16 20:13:44 2011 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 7215B1065672 for ; Wed, 16 Feb 2011 20:13:44 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from mo-p00-ob.rzone.de (mo-p00-ob.rzone.de [81.169.146.161]) by mx1.freebsd.org (Postfix) with ESMTP id 0AAB18FC13 for ; Wed, 16 Feb 2011 20:13:43 +0000 (UTC) X-RZG-AUTH: :JiIXek6mfvEEUpFQdo7Fj1/zg48CFjWjQv0cW+St/nW/afgnrylsiWawcSl4p2Q= X-RZG-CLASS-ID: mo00 Received: from britannica.bec.de (ip-109-45-86-241.web.vodafone.de [109.45.86.241]) by post.strato.de (mrclete mo42) (RZmta 25.5) with (DHE-RSA-AES128-SHA encrypted) ESMTPA id J07435n1GJ0EcG for ; Wed, 16 Feb 2011 21:13:41 +0100 (MET) Received: by britannica.bec.de (sSMTP sendmail emulation); Wed, 16 Feb 2011 21:13:40 +0100 Date: Wed, 16 Feb 2011 21:13:40 +0100 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org Message-ID: <20110216201340.GA23013@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org References: <201102161831.p1GIVATQ097902@fire.js.berklix.net> <4D5C1A3E.20509@gmx.de> <20110216190233.GB19686@britannica.bec.de> <4D5C24CC.9070400@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4D5C24CC.9070400@gmx.de> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 16 Feb 2011 20:13:44 -0000 On Wed, Feb 16, 2011 at 08:26:04PM +0100, Matthias Andree wrote: > Am 16.02.2011 20:02, schrieb Joerg Sonnenberger: > > On Wed, Feb 16, 2011 at 07:41:02PM +0100, Matthias Andree wrote: > >> But POSIX.1-2008 is the same as the Single > >> Unix Specification v4 or IEEE Std 1003.1-2008. > > > > Minor correction, it is SUS v3 Issue 7. > > No it isn't. See http://www.unix.org/version4/ieee_std.html "POSIX.1-2008 is simultaneously IEEE Std 1003.1â„¢-2008 and The Open Group technical Standard Base Specifications, Issue 7." Let's agree on that :) http://pubs.opengroup.org/onlinepubs/9699919799/mindex.html Joerg From owner-freebsd-hackers@FreeBSD.ORG Wed Feb 16 21:08:18 2011 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 A1A111065673 for ; Wed, 16 Feb 2011 21:08:18 +0000 (UTC) (envelope-from matthias.andree@gmx.de) Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.22]) by mx1.freebsd.org (Postfix) with SMTP id ED2BC8FC16 for ; Wed, 16 Feb 2011 21:08:17 +0000 (UTC) Received: (qmail invoked by alias); 16 Feb 2011 21:08:16 -0000 Received: from g225208061.adsl.alicedsl.de (EHLO [192.168.0.4]) [92.225.208.61] by mail.gmx.net (mp014) with SMTP; 16 Feb 2011 22:08:16 +0100 X-Authenticated: #428038 X-Provags-ID: V01U2FsdGVkX1+Y84J0nxuYvykrIjWZMQUKPUxAfIxyt9qwVLBnV9 LI2BnyhdkXIYoV Message-ID: <4D5C3CBE.6060801@gmx.de> Date: Wed, 16 Feb 2011 22:08:14 +0100 From: Matthias Andree User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Mnenhy/0.8.3 Thunderbird/3.1.7 MIME-Version: 1.0 To: freebsd-hackers@freebsd.org References: <201102161831.p1GIVATQ097902@fire.js.berklix.net> <4D5C1A3E.20509@gmx.de> <20110216190233.GB19686@britannica.bec.de> <4D5C24CC.9070400@gmx.de> <20110216201340.GA23013@britannica.bec.de> In-Reply-To: <20110216201340.GA23013@britannica.bec.de> X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Y-GMX-Trusted: 0 Subject: Re: man 3 getopt char * const argv[] - is const wrong ? 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, 16 Feb 2011 21:08:18 -0000 Am 16.02.2011 21:13, schrieb Joerg Sonnenberger: > On Wed, Feb 16, 2011 at 08:26:04PM +0100, Matthias Andree wrote: >> Am 16.02.2011 20:02, schrieb Joerg Sonnenberger: >>> On Wed, Feb 16, 2011 at 07:41:02PM +0100, Matthias Andree wrote: >>>> But POSIX.1-2008 is the same as the Single >>>> Unix Specification v4 or IEEE Std 1003.1-2008. >>> >>> Minor correction, it is SUS v3 Issue 7. >> >> No it isn't. See http://www.unix.org/version4/ieee_std.html > > "POSIX.1-2008 is simultaneously IEEE Std 1003.1â„¢-2008 and The Open Group > technical Standard Base Specifications, Issue 7." > > Let's agree on that :) > > http://pubs.opengroup.org/onlinepubs/9699919799/mindex.html Fine. :) Note that "The Open Group Technical Standard Base Specifications" isn't the same as the "Single Unix Specification". -- Matthias Andree From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 17 10:17:43 2011 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 79F221065672 for ; Thu, 17 Feb 2011 10:17:43 +0000 (UTC) (envelope-from mats.w.lindberg@gmail.com) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3EFA48FC16 for ; Thu, 17 Feb 2011 10:17:42 +0000 (UTC) Received: by iyb26 with SMTP id 26so2248982iyb.13 for ; Thu, 17 Feb 2011 02:17:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=y/BxvsTz5PkafYtMEQso2REyZalNbs12OUNolUtGFD8=; b=pJBjIcwv0GvWSPFAJOnzRld6+7P4Vd11svIvCU8dGVDDJVx4+c3Sp2M6wC5WKlqW/w SiW5g3JZRECgO2AtRpGXxLkHumLROw5rrgjtHCmWBiQpmOSure3VtEFsXoy+q22MhoE3 T0pNsFrs5O4sZC7gzmdUyPo9+TqvJiKWnQYuA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=D4C0LC2/6Pwp8iRfsnMns1gpH1VoBczkqB5rPYtWLLAQmElHeaIOpF7G4JMCj1xUD1 tK4lsB1Nel5i5F6tkkM8JJ22AMVkVivJoQRPpNlbDRmFR81KB3QyJ/DENe4u9OXhYP7t rzJ44O0/R7VJjLMiUZyMTyez5avVDGLBCo/N0= MIME-Version: 1.0 Received: by 10.231.31.13 with SMTP id w13mr1373109ibc.143.1297936206991; Thu, 17 Feb 2011 01:50:06 -0800 (PST) Received: by 10.231.13.73 with HTTP; Thu, 17 Feb 2011 01:50:06 -0800 (PST) Date: Thu, 17 Feb 2011 10:50:06 +0100 Message-ID: From: Mats Lindberg To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: sched_setscheduler() behaviour changed?? 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, 17 Feb 2011 10:17:43 -0000 All, I have been using a small program /rt) that utilize the sched_setscheduler() syscall to set the scheduling policy of a process to SCHED_RR. Been running it FBSD 5.x and 6.x. Now when migrating to FBSD 8.1 I get EPERM back at me. used to be able to run it like e.g. > ./rt -sr -p2 -- prog which started in SCHED_RR policy with priority 2. now in FBSD 8.1 I get EPERM But If I do > rtprio 10 ./rt -sr -p2 -- prog it I dont get EPERM. I'm always root when doing this. My problem is that I have customers that need to run their old 5.x 6.x applications 'as is' in 8.1 whithout changing anything. Does anyone know if there is a workaround? sysctl? kernel hint? kernel config? reverting to 4BSD scheduler? regards Mats From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 08:06:46 2011 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 36C68106566B for ; Fri, 18 Feb 2011 08:06:46 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id AF8338FC15 for ; Fri, 18 Feb 2011 08:06:45 +0000 (UTC) Received: from ur.gsoft.com.au (Ur.gsoft.com.au [203.31.81.44]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p1I86grc098438 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Fri, 18 Feb 2011 18:36:42 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <53A394ED-7C2E-4E4B-A9A7-CB5F1B27DBE3@gsoft.com.au> Date: Fri, 18 Feb 2011 18:36:42 +1030 Content-Transfer-Encoding: quoted-printable Message-Id: <5DEC612A-2097-4F2D-A304-77ACA753EF35@gsoft.com.au> References: <53A394ED-7C2E-4E4B-A9A7-CB5F1B27DBE3@gsoft.com.au> To: "Daniel O'Connor" X-Mailer: Apple Mail (2.1082) X-Spam-Score: -2.51 () ALL_TRUSTED,BAYES_00,T_RP_MATCHES_RCVD X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: freebsd-hackers Hackers Subject: Re: Scheduler question 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, 18 Feb 2011 08:06:46 -0000 On 04/02/2011, at 13:26, Daniel O'Connor wrote: > I only have about 10 milliseconds of buffering (96kbyte FIFO, = 8Mbyte/sec) in the hardware, however I have about 128Mb of USB requests = queued up to libusb. hps@ informed me that libusb will only queue = 16kbyte (2msec) in the kernel at one time although I have increased = this. We have upped the hardware FIFO size to 768kb, which is 91msec at = 8Mb/sec, although due to the fact we only start reading out when it's = 1/6th full the effective buffer is 75msec. It does seem much more resilient to CPU load, however heavy disk = activity on the same drive still stalls it for too long :( Given the large buffering in the program it does seem very odd that it = would stall for long enough unless both threads are slept while one is = waiting for disk IO (which seems like a bug to me). BTW I have changed to -current (without WITNESS). -- Daniel O'Connor software and network engineer for Genesis Software - http://www.gsoft.com.au "The nice thing about standards is that there are so many of them to choose from." -- Andrew Tanenbaum GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 09:00:25 2011 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 EDB4E106564A for ; Fri, 18 Feb 2011 09:00:25 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 627678FC08 for ; Fri, 18 Feb 2011 09:00:24 +0000 (UTC) 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 p1I90J60023316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Feb 2011 11:00:19 +0200 (EET) (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.4/8.14.4) with ESMTP id p1I90J9j006938; Fri, 18 Feb 2011 11:00:19 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p1I90Jwe006937; Fri, 18 Feb 2011 11:00:19 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 18 Feb 2011 11:00:19 +0200 From: Kostik Belousov To: Mats Lindberg Message-ID: <20110218090019.GZ78089@deviant.kiev.zoral.com.ua> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="S5Qg+bAg9m7PUrmf" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: sched_setscheduler() behaviour changed?? 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, 18 Feb 2011 09:00:26 -0000 --S5Qg+bAg9m7PUrmf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 17, 2011 at 10:50:06AM +0100, Mats Lindberg wrote: > All, > I have been using a small program /rt) that utilize the sched_setschedule= r() > syscall to set the scheduling policy of a process to SCHED_RR. Been runni= ng > it FBSD 5.x and 6.x. Now when migrating to FBSD 8.1 I get EPERM back at m= e. > used to be able to run it like e.g. > > ./rt -sr -p2 -- prog >=20 > which started in SCHED_RR policy with priority 2. >=20 > now in FBSD 8.1 I get EPERM >=20 > But If I do > > rtprio 10 ./rt -sr -p2 -- prog >=20 > it I dont get EPERM. >=20 > I'm always root when doing this. >=20 > My problem is that I have customers that need to run their old 5.x 6.x > applications 'as is' in 8.1 whithout changing anything. >=20 > Does anyone know if there is a workaround? > sysctl? kernel hint? kernel config? reverting to 4BSD scheduler? If you want help from the list, you should provide some data to diagnose the issue. Obviously, we cannot read the sources of your rt utility. At least, you can provide ktrace/kdump output for start. --S5Qg+bAg9m7PUrmf Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1eNSMACgkQC3+MBN1Mb4gpMwCfdG/9y5M9NfMpKhx+AfBo3fbb PzcAniCBAUKW2lWYzH1mo0MhpCMxg8Kd =E6J1 -----END PGP SIGNATURE----- --S5Qg+bAg9m7PUrmf-- From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 11:13:01 2011 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 D19D71065670 for ; Fri, 18 Feb 2011 11:13:01 +0000 (UTC) (envelope-from samflanker@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 5ABBF8FC20 for ; Fri, 18 Feb 2011 11:13:00 +0000 (UTC) Received: by fxm19 with SMTP id 19so285949fxm.13 for ; Fri, 18 Feb 2011 03:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=Z3LzLgLHpjHzP96JRkvUm+ZK59ys0E4qgaphCKJAJX8=; b=Et6PjZm5gAwwFEwjh1Q6zY/4Pu+T2Vm07Dmc1HTa4M3sZ2vpMq2UYpFSGFRjZxxi8c bfCiso1rtAaQDYkYxXiDywGwvKuMayPY33/BogYk7kIDvkHeCHwIR79dmgVqA+9vCaH2 X4ZYzQGHUTazN9PZ9Bvfow/6MYWMvq/ifJAK4= 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=VtuUSl79zBZNiffIws8b7kY8rYv1/kMkyWgj8F/q1mn+45Y/CEWAxT5tg3OyOBIQa1 Hzh79TUUEOGEbgwlqr9Vuf6vvgStEaG1JMrtUTFoKVMZmzRZ18xw6WH2ff1E1g8O2JiZ YvpMQ62EUUJd3sIbGil6fZ2THgEklhTM2MEjI= Received: by 10.223.96.12 with SMTP id f12mr804432fan.79.1298027579820; Fri, 18 Feb 2011 03:12:59 -0800 (PST) Received: from localhost.localdomain ([213.152.137.45]) by mx.google.com with ESMTPS id e17sm475973fak.10.2011.02.18.03.12.57 (version=SSLv3 cipher=OTHER); Fri, 18 Feb 2011 03:12:57 -0800 (PST) Message-ID: <4D5E5476.5010107@gmail.com> Date: Fri, 18 Feb 2011 14:13:58 +0300 From: venom User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Thunderbird/3.1.7 MIME-Version: 1.0 To: John Baldwin References: <4D553027.5040606@gmail.com> <201102111531.00915.jhb@freebsd.org> In-Reply-To: <201102111531.00915.jhb@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: problem with build mcelog 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, 18 Feb 2011 11:13:01 -0000 On 02/11/2011 11:31 PM, John Baldwin wrote: > On Friday, February 11, 2011 7:48:39 am venom wrote: >> Hello. >> >> i am trying build mcelog >> >> >> FreeBSD XXXX 8.1-RELEASE-p2 FreeBSD 8.1-RELEASE-p2 #0: Fri Jan 14 04:15:56 >> UTC 2011 root@freebsd:/usr/obj/usr/src/sys/GENERIC amd64 >> >> >> # fetch >> http://ftp2.pl.freebsd.org/pub/FreeBSD/distfiles/mcelog-1.0pre2.tar.gz >> # tar -xf mcelog-1.0pre2.tar.gz >> # cd mcelog-1.0pre2 >> # fetch http://people.freebsd.org/~jhb/mcelog/mcelog.patch >> # fetch http://people.freebsd.org/~jhb/mcelog/memstream.c > Oops, I just updated mcelog.patch and it should work fine now. > |--- //depot/vendor/mcelog/tsc.c 2010-03-05 20:24:22.000000000 0000 |+++ //depot/projects/mcelog/tsc.c 2010-03-05 21:09:24.000000000 0000 -------------------------- Patching file tsc.c using Plan A... Hunk #1 succeeded at 15. Hunk #2 succeeded at 52. Hunk #3 succeeded at 75. Hunk #4 succeeded at 156. done 12:12:46 ~/temp/MCE/mcelog-1.0pre2 # gmake FREEBSD=yes Makefile:92: .depend: No such file or directory cc -MM -I. p4.c k8.c mcelog.c dmi.c tsc.c core2.c bitfield.c intel.c nehalem.c dunnington.c tulsa.c config.c memutil.c msg.c eventloop.c leaky-bucket.c memdb.c server.c client.c cache.c rbtree.c memstream.c > .depend.X && mv .depend.X .depend cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o mcelog.o mcelog.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o p4.o p4.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o k8.o k8.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o dmi.o dmi.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o tsc.o tsc.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o core2.o core2.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o bitfield.o bitfield.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o intel.o intel.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o nehalem.o nehalem.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o dunnington.o dunnington.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o tulsa.o tulsa.c cc -c -g -Os -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wstrict-prototypes -Wformat-security -Wmissing-declarations -Wdeclaration-after-statement -o config.o config.c config.c:135: error: static declaration of 'getline' follows non-static declaration /usr/include/stdio.h:370: error: previous declaration of 'getline' was here gmake: *** [config.o] Error 1 # -- Vladimir Laskov From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 11:20:06 2011 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 7C047106564A for ; Fri, 18 Feb 2011 11:20:06 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 481E48FC1F for ; Fri, 18 Feb 2011 11:20:06 +0000 (UTC) Received: by pxi1 with SMTP id 1so572904pxi.13 for ; Fri, 18 Feb 2011 03:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=fc7OJoLx5pVMHK157o8TP80O7HruHeVf1qPi8PkQ3zA=; b=MGOouZFld9lNNfstIfToq5R12Pf35MC0IkuCn2RXnnIYOeGIP0JpJKNmVD9P89agPq 6S8l1owYtbkzgDwp1N7DgpDYkFCvh0Rvbz7rB1SdwIP/nHzKGdX6mt+jrbxQl/23b2ff zWRmILT8JY7rtiIQ3+J7FDPbWBWo0yt5d3Q2s= 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; b=e1lhFIfAjAKv92jEXo2qzVnTJtEOPeKCeOFLYx7p4E7KF/keoj3heDzCkkXgQFj0aX We8CWi/PzSY5X6Qbwfqxp5CpJAudTr1zaq8JB/WjahwNlNCju6K6ZJCQBLzXkPjjUBhZ Vo0wzXTUrre449IanbMhSrEnHhVQWkqKRhJG4= MIME-Version: 1.0 Received: by 10.142.217.14 with SMTP id p14mr466344wfg.56.1298028005650; Fri, 18 Feb 2011 03:20:05 -0800 (PST) Received: by 10.142.217.5 with HTTP; Fri, 18 Feb 2011 03:20:05 -0800 (PST) In-Reply-To: References: Date: Fri, 18 Feb 2011 14:20:05 +0300 Message-ID: From: Sergey Kandaurov To: Mats Lindberg Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers@freebsd.org Subject: Re: sched_setscheduler() behaviour changed?? 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, 18 Feb 2011 11:20:06 -0000 On 17 February 2011 12:50, Mats Lindberg wrote: > All, > I have been using a small program /rt) that utilize the sched_setscheduler() > syscall to set the scheduling policy of a process to SCHED_RR. Been running > it FBSD 5.x and 6.x. Now when migrating to FBSD 8.1 I get EPERM back at me. > used to be able to run it like e.g. >> ./rt -sr -p2 -- prog > > which started in SCHED_RR policy with priority 2. > > now in FBSD 8.1 I get EPERM > > But If I do >> rtprio 10 ./rt -sr -p2 -- prog > > it I dont get EPERM. > > I'm always root when doing this. > > My problem is that I have customers that need to run their old 5.x 6.x > applications 'as is' in 8.1 whithout changing anything. > [just thinking aloud] Perhaps, you might have stumbled upon the change in sched_setscheduler() restricting permission to superuser: src/sys/posix4/p1003_1b.c#rev1.24.2.1 MFC revision 1.27. Don't allow non-root user to set a scheduler policy. @@ -195,6 +195,10 @@ int sched_setscheduler(struct thread *td struct thread *targettd; struct proc *targetp; + /* Don't allow non root user to set a scheduler policy */ + if (suser(td) != 0) + return (EPERM); + e = copyin(uap->param, &sched_param, sizeof(sched_param)); if (e) return (e); -- wbr, pluknet From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 12:11:09 2011 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 B93D3106564A; Fri, 18 Feb 2011 12:11:09 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-pz0-f54.google.com (mail-pz0-f54.google.com [209.85.210.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8407C8FC14; Fri, 18 Feb 2011 12:11:09 +0000 (UTC) Received: by pzk32 with SMTP id 32so580358pzk.13 for ; Fri, 18 Feb 2011 04:11:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7ELHEuIIC+C9hUeKyeyuUJwM2bunDYEgX9sGQGNXL44=; b=jD/xPikzb7tBJvrwk5JLGGM64grdFgy3IiINc4kGWga5m4rbu01SVjQsVucWRGUcRi Bq4qI2/kn0UZNNGn53STBiczDdMgKFbmw9JyK9QWw+DLbCM4MXHvNjg+isHXwo8inZCl gH1IAxFc8URkj7nBBs9Su75tQSIX6AxHsx4XM= 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=eqJJlbBp+ujDVP0Spf4X6JCPoRlhrUKcYk8EhTg7ghaS7jQ+N2X32vPNYWuosaam1t U+T9WUagmnYzakUeLiTfKo7wSWnTeiSQrhPllcKTpFeUFK3zgKp+716V1mlourBiZqFW rTb4trlhB7InMBZOTdswKH1rpfDU1OAMIJDuw= MIME-Version: 1.0 Received: by 10.142.200.14 with SMTP id x14mr489566wff.380.1298031067774; Fri, 18 Feb 2011 04:11:07 -0800 (PST) Received: by 10.142.217.5 with HTTP; Fri, 18 Feb 2011 04:11:07 -0800 (PST) In-Reply-To: <4D5E5476.5010107@gmail.com> References: <4D553027.5040606@gmail.com> <201102111531.00915.jhb@freebsd.org> <4D5E5476.5010107@gmail.com> Date: Fri, 18 Feb 2011 15:11:07 +0300 Message-ID: From: Sergey Kandaurov To: venom Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: problem with build mcelog 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, 18 Feb 2011 12:11:09 -0000 On 18 February 2011 14:13, venom wrote: > On 02/11/2011 11:31 PM, John Baldwin wrote: >> >> On Friday, February 11, 2011 7:48:39 am venom wrote: >>> >>> Hello. >>> >>> i am trying build mcelog >>> >>> >>> FreeBSD XXXX 8.1-RELEASE-p2 FreeBSD 8.1-RELEASE-p2 #0: Fri Jan 14 >>> 04:15:56 >>> UTC 2011 root@freebsd:/usr/obj/usr/src/sys/GENERIC amd64 >>> >>> >>> # fetch >>> http://ftp2.pl.freebsd.org/pub/FreeBSD/distfiles/mcelog-1.0pre2.tar.gz >>> # tar -xf mcelog-1.0pre2.tar.gz >>> # cd mcelog-1.0pre2 >>> # fetch http://people.freebsd.org/~jhb/mcelog/mcelog.patch >>> # fetch http://people.freebsd.org/~jhb/mcelog/memstream.c >> >> Oops, I just updated mcelog.patch and it should work fine now. >> > > |--- //depot/vendor/mcelog/tsc.c =A0 =A02010-03-05 20:24:22.000000000 000= 0 > |+++ //depot/projects/mcelog/tsc.c =A0 =A02010-03-05 21:09:24.000000000 0= 000 > -------------------------- > Patching file tsc.c using Plan A... > Hunk #1 succeeded at 15. > Hunk #2 succeeded at 52. > Hunk #3 succeeded at 75. > Hunk #4 succeeded at 156. > done > 12:12:46 ~/temp/MCE/mcelog-1.0pre2 > # gmake FREEBSD=3Dyes > Makefile:92: .depend: No such file or directory > cc -MM -I. p4.c k8.c mcelog.c dmi.c tsc.c core2.c bitfield.c intel.c > nehalem.c dunnington.c tulsa.c config.c memutil.c msg.c eventloop.c > leaky-bucket.c memdb.c server.c client.c cache.c rbtree.c memstream.c > > .depend.X && mv .depend.X .depend > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o mcelog.o mcelo= g.c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o p4.o p4.c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o k8.o k8.c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o dmi.o dmi.c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o tsc.o tsc.c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o core2.o core2.= c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o bitfield.o > bitfield.c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o intel.o intel.= c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o nehalem.o neha= lem.c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o dunnington.o > dunnington.c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o tulsa.o tulsa.= c > cc -c -g -Os =A0-Wall -Wextra -Wno-missing-field-initializers > -Wno-unused-parameter -Wstrict-prototypes -Wformat-security > -Wmissing-declarations -Wdeclaration-after-statement =A0-o config.o confi= g.c > config.c:135: error: static declaration of 'getline' follows non-static > declaration > /usr/include/stdio.h:370: error: previous declaration of 'getline' was he= re > gmake: *** [config.o] Error 1 > A local getline() needs the FreeBSD version check. %%% --- config.c.olg 2011-02-18 14:57:52.000000000 +0300 +++ config.c 2011-02-18 15:07:59.000000000 +0300 @@ -18,6 +18,9 @@ Author: Andi Kleen */ #define _GNU_SOURCE 1 +#ifdef __FreeBSD__ +# include +#endif #include #include #include @@ -126,7 +129,7 @@ return s; } -#ifdef __FreeBSD__ +#if (defined __FreeBSD__) && (__FreeBSD_version < 800067) /* * Newer versions do have getline(), so this should use a version test * at some point. %%% --=20 wbr, pluknet From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 11:58:07 2011 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 0A99E106564A for ; Fri, 18 Feb 2011 11:58:07 +0000 (UTC) (envelope-from drbaud@yahoo.com) Received: from web120719.mail.ne1.yahoo.com (web120719.mail.ne1.yahoo.com [98.138.83.126]) by mx1.freebsd.org (Postfix) with SMTP id C36D78FC0A for ; Fri, 18 Feb 2011 11:58:06 +0000 (UTC) Received: (qmail 37789 invoked by uid 60001); 18 Feb 2011 11:58:06 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1298030286; bh=eHHdBDFGY9vKRibTn136Y0ERA9Spche+CVFQfe331Tc=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=CHRMj2RUevXWaKIQQzMA11wWb8rrJKHzZx8CXKylWvALP8zWm/KssNgWWIVA65p1MIu/wF8RgdCaa5By0V2y5qTGUUn7wEtxk5A6/CXdOQUEPMSQoPaoOwE2FOAO4mUMnDtodfXFkkUEG4oKvDOp9BB2zQU8OrdIgRTciW9Bxpg= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type; b=TDuwPKwJqVEbRr8zETCBhODXWxrBbCKi5cEkUrM1LPh0bMeQK13pCuc/0n4sYhsaCbH7DUE036nvY65MySGkQLVv+2ut327IU/fNh5enUqfnYZbuhfEZ7EQgWrI0ZLSrEcTc5Efjxc2DljyLI6PNTtw0Q/81pW1QMGNDvPZZGJE=; Message-ID: <137445.33642.qm@web120719.mail.ne1.yahoo.com> X-YMail-OSG: 7mPrgIIVM1n6zp9dndF5ay4.zR7uWYQf.xPdGGDdo36QK1j 4CP6qIJsDcF6es79.Wt_J3yai.mPyFsktvskIBzH8TuQJEIlZ22b7TfOKyaS EyD3rGFP0VivybsC2iN0UnnloxGYZXnJRCeGFeQ5iFGq4qGBpBO69xLXFPrR eWjKOWgSlDIMQnneW9fdl3jbwiofd8B4IhmBaOWYsR6er247b4JMsa_Y6dLX pGc49_5iTRx6NiHnZD.mFZ_p2KFa9ndAF4ge3fRFDn.8vBuHC7n73h5J5X.e ptuF0AYR8jsktr5MO Received: from [64.238.244.146] by web120719.mail.ne1.yahoo.com via HTTP; Fri, 18 Feb 2011 03:58:05 PST X-Mailer: YahooMailRC/555 YahooMailWebService/0.8.109.292656 Date: Fri, 18 Feb 2011 03:58:05 -0800 (PST) From: "Dr. Baud" To: freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailman-Approved-At: Fri, 18 Feb 2011 12:13:17 +0000 Subject: spontaneous reboot - ptrace 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, 18 Feb 2011 11:58:07 -0000 > First, do you have a console output during the run ? Is it possible > that machine paniced ? If not, were there any kernel messages before> > reboot ? > > Second, what is the process you are dumping ? Can you show at least > the procstat -v output for the process ? Sorry for this late response but my earlier response appears to have been consumed by the email reflector. I'm getting an NMI. And the trouble appears to be when trying to read via ptrace memory segments of type KVME_TYPE_DEVICE. The app in quesion allocates a large number of large memory buffers and maps them into virtual address space. Not all segments cause the NMI however. Small sampling of the virtual memory map. PID START END PRT RES PRES REF SHD FL TP PATH 931 0x400000 0x1773000 r-x 4239 5053 2 1 CN vn /mnt/dia g/problemchild 931 0x1872000 0x2ef2000 rw- 416 0 1 0 C- vn /mnt/dia g/problemchld 931 0x2ef2000 0x6700000 rw- 11765 0 1 0 C- df 931 0x801872000 0x8018a2000 r-x 48 0 57 28 CN vn /libexec /ld-elf.so.1 931 0x8018a2000 0x8018b3000 rw- 15 0 1 0 C- df 931 0x8018b3000 0x801924000 rw- 113 0 1698 0 -- dv 931 0x801924000 0x801925000 rw- 1 0 1698 0 -- dv 931 0x801925000 0x801926000 rw- 1 0 1698 0 -- dv 931 0x801926000 0x801927000 rw- 1 0 1698 0 -- dv 931 0x801927000 0x801928000 rw- 1 0 1698 0 -- dv 931 0x801928000 0x80192a000 rw- 2 0 1698 0 -- dv 931 0x80192a000 0x80192b000 rw- 1 0 1698 0 -- dv 931 0x80192b000 0x80192c000 rw- 1 0 1698 0 -- dv 931 0x80192c000 0x80192d000 rw- 1 0 1698 0 -- dv 931 0x80192d000 0x80192e000 rw- 1 0 1698 0 -- dv 931 0x80192e000 0x801930000 rw- 2 0 1698 0 -- dv 931 0x801930000 0x801932000 rw- 2 0 1698 0 -- dv 931 0x801932000 0x801993000 rw- 97 0 1698 0 -- dv 931 0x801993000 0x8019a0000 rw- 13 0 1698 0 -- dv 931 0x8019a0000 0x8019a1000 rw- 1 0 1698 0 -- dv .... 931 0x802ab7000 0x802bb7000 --- 0 0 1 0 CN df 931 0x0x802bb70 0x0x802bd6000 rw- 17 0 1 0 C- vn /lib/lib c.so.7 931 0x802bd6000 0x802bf1000 rw- 18 0 1 0 C- df 931 0x802bf1000 0x802bfd000 r-x 9 14 2 1 CN vn /lib/lib gcc_s.so.1 931 0x802bfd000 0x802cfc000 --- 0 0 1 0 CN df 931 0x802cfc000 0x802cfe000 rw- 2 0 1 0 CN vn /lib/lib gcc_s.so.1 931 0x802cfe000 0x802cff000 rw- 1 0 1698 0 -- dv 931 0x802cff000 0x802d00000 rw- 1 0 1698 0 -- dv 931 0x802d00000 0x802e00000 rw- 132 0 1 0 C- df 931 0x802e00000 0x802f00000 rw- 109 0 1 0 C- df 931 0x802f00000 0x802f91000 rw- 145 0 1698 0 -- dv 931 0x802f91000 0x802fb2000 rw- 33 0 1698 0 -- dv 931 0x802fb2000 0x802fd3000 rw- 33 0 1698 0 -- dv 931 0x802fd3000 0x802ff5000 rw- 34 0 1698 0 -- dv 931 0x802ff5000 0x802ff6000 rw- 1 0 1698 0 -- dv From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 12:21:42 2011 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 AAFC9106564A for ; Fri, 18 Feb 2011 12:21:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 4239E8FC19 for ; Fri, 18 Feb 2011 12:21:40 +0000 (UTC) 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 p1ICLahf038868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 18 Feb 2011 14:21:36 +0200 (EET) (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.4/8.14.4) with ESMTP id p1ICLaQJ007883; Fri, 18 Feb 2011 14:21:36 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p1ICLai7007882; Fri, 18 Feb 2011 14:21:36 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 18 Feb 2011 14:21:36 +0200 From: Kostik Belousov To: "Dr. Baud" Message-ID: <20110218122136.GA78089@deviant.kiev.zoral.com.ua> References: <137445.33642.qm@web120719.mail.ne1.yahoo.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Bu1yJv+wdE57ohW6" Content-Disposition: inline In-Reply-To: <137445.33642.qm@web120719.mail.ne1.yahoo.com> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: spontaneous reboot - ptrace 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, 18 Feb 2011 12:21:42 -0000 --Bu1yJv+wdE57ohW6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 18, 2011 at 03:58:05AM -0800, Dr. Baud wrote: >=20 >=20 > > First, do you have a console output during the run ? Is it possible > > that machine paniced ? If not, were there any kernel messages before> > > reboot ? > > > > Second, what is the process you are dumping ? Can you show at least > > the procstat -v output for the process ? >=20 > Sorry for this late response but my earlier response appears to have = been=20 > consumed by the email reflector. >=20 > I'm getting an NMI. And the trouble appears to be when trying to > read via ptrace memory segments of type KVME_TYPE_DEVICE. The app in > quesion allocates a large number of large memory buffers and maps them > into virtual address space. Not all segments cause the NMI however. > Small sampling of the virtual memory map. You did not provided exact console output on the panic, despite requested. What is the device that was mmaped ? Obviously, this is your problem. Can you gather all required information ? >=20 > PID START END PRT RES PRES REF SHD FL TP P= ATH > 931 0x400000 0x1773000 r-x 4239 5053 2 1 CN vn /= mnt/dia > g/problemchild > 931 0x1872000 0x2ef2000 rw- 416 0 1 0 C- vn /= mnt/dia > g/problemchld > 931 0x2ef2000 0x6700000 rw- 11765 0 1 0 C- df > 931 0x801872000 0x8018a2000 r-x 48 0 57 28 CN vn /= libexec > /ld-elf.so.1 > 931 0x8018a2000 0x8018b3000 rw- 15 0 1 0 C- df > 931 0x8018b3000 0x801924000 rw- 113 0 1698 0 -- dv > 931 0x801924000 0x801925000 rw- 1 0 1698 0 -- dv > 931 0x801925000 0x801926000 rw- 1 0 1698 0 -- dv > 931 0x801926000 0x801927000 rw- 1 0 1698 0 -- dv > 931 0x801927000 0x801928000 rw- 1 0 1698 0 -- dv > 931 0x801928000 0x80192a000 rw- 2 0 1698 0 -- dv > 931 0x80192a000 0x80192b000 rw- 1 0 1698 0 -- dv > 931 0x80192b000 0x80192c000 rw- 1 0 1698 0 -- dv > 931 0x80192c000 0x80192d000 rw- 1 0 1698 0 -- dv > 931 0x80192d000 0x80192e000 rw- 1 0 1698 0 -- dv > 931 0x80192e000 0x801930000 rw- 2 0 1698 0 -- dv > 931 0x801930000 0x801932000 rw- 2 0 1698 0 -- dv > 931 0x801932000 0x801993000 rw- 97 0 1698 0 -- dv > 931 0x801993000 0x8019a0000 rw- 13 0 1698 0 -- dv > 931 0x8019a0000 0x8019a1000 rw- 1 0 1698 0 -- dv >=20 > .... >=20 > 931 0x802ab7000 0x802bb7000 --- 0 0 1 0 CN df > 931 0x0x802bb70 0x0x802bd6000 rw- 17 0 1 0 C- vn /= lib/lib > c.so.7 > 931 0x802bd6000 0x802bf1000 rw- 18 0 1 0 C- df > 931 0x802bf1000 0x802bfd000 r-x 9 14 2 1 CN vn /= lib/lib > gcc_s.so.1 > 931 0x802bfd000 0x802cfc000 --- 0 0 1 0 CN df > 931 0x802cfc000 0x802cfe000 rw- 2 0 1 0 CN vn /= lib/lib > gcc_s.so.1 > 931 0x802cfe000 0x802cff000 rw- 1 0 1698 0 -- dv > 931 0x802cff000 0x802d00000 rw- 1 0 1698 0 -- dv > 931 0x802d00000 0x802e00000 rw- 132 0 1 0 C- df > 931 0x802e00000 0x802f00000 rw- 109 0 1 0 C- df > 931 0x802f00000 0x802f91000 rw- 145 0 1698 0 -- dv > 931 0x802f91000 0x802fb2000 rw- 33 0 1698 0 -- dv > 931 0x802fb2000 0x802fd3000 rw- 33 0 1698 0 -- dv > 931 0x802fd3000 0x802ff5000 rw- 34 0 1698 0 -- dv > 931 0x802ff5000 0x802ff6000 rw- 1 0 1698 0 -- dv >=20 >=20 > =20 > _______________________________________________ > 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" --Bu1yJv+wdE57ohW6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1eZE8ACgkQC3+MBN1Mb4hwWgCg2r32Aks0g5+3+3jrIPHQ8fya THoAoPNcBa+auCGVDGCIxSNFsVjsO7aE =MiZg -----END PGP SIGNATURE----- --Bu1yJv+wdE57ohW6-- From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 13:39:26 2011 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 3C4E4106566C for ; Fri, 18 Feb 2011 13:39:26 +0000 (UTC) (envelope-from mats.w.lindberg@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id F1CBA8FC0C for ; Fri, 18 Feb 2011 13:39:25 +0000 (UTC) Received: by iwn39 with SMTP id 39so3697508iwn.13 for ; Fri, 18 Feb 2011 05:39:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=dNwKpz2655WjyYymddzqVTWWGm8D9yci/Ipq+iRyYtY=; b=BjS6bpPxJWoNTofSN7GNN4kStdVeTVB6uSfHSjv+HurHbF1dflNZXXyAcKLw/HW1g+ U+vi5R8i23TzrVK3hDoZVtKIh8edJfjodTu2vnDkmdwvUPLDXADf0pZj0zhGlbSkTD4Y VZs6rQERHC3mLdxMN7a9PKhnt0RlzLfcmNBoU= 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; b=TVzUuED78n2UlrtZZFPJQmE4IpomrNZoB+H9RUOcY1vHZLpeiv45ARC49yQ7d0J7u+ MoSbo3OOBWUUmMSyFVAal1r4cCKgs6J7bSYvf4UOtRUIRoaSckXmdBqjAsACtTCtsYU3 s7gejPFTh5tdAZyP7sAeYQ+XCu/VDSXb/PvdY= MIME-Version: 1.0 Received: by 10.231.206.1 with SMTP id fs1mr506903ibb.193.1298036365270; Fri, 18 Feb 2011 05:39:25 -0800 (PST) Received: by 10.231.13.73 with HTTP; Fri, 18 Feb 2011 05:39:17 -0800 (PST) In-Reply-To: References: Date: Fri, 18 Feb 2011 14:39:17 +0100 Message-ID: From: Mats Lindberg To: Sergey Kandaurov Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: sched_setscheduler() behaviour changed?? 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, 18 Feb 2011 13:39:26 -0000 Sergey, thanks for your comment - however it was my own mistake in rt.c ... static void setSchedPolicy( int policy ) { struct sched_param schedParam = { 0 }; TRY(sched_getparam(0, &schedParam),-1); switch ( policy ) { case SCHED_RR: case SCHED_FIFO: schedParam.sched_priority = MAX(1,schedParam.sched_priority); break; default:; } TRY(sched_setscheduler(0,policy,&schedParam),-1); } ... the sched_getparam() is called in SCHED_OTHER policy, where I would get a negative or at least acceptable prio value in FBSD 5.x and 6.x in FBSD 8.1 I got 63 which of course gives me EPERM cause I'm out of range. Again thanks 2011/2/18 Sergey Kandaurov > On 17 February 2011 12:50, Mats Lindberg > wrote: > > All, > > I have been using a small program /rt) that utilize the > sched_setscheduler() > > syscall to set the scheduling policy of a process to SCHED_RR. Been > running > > it FBSD 5.x and 6.x. Now when migrating to FBSD 8.1 I get EPERM back at > me. > > used to be able to run it like e.g. > >> ./rt -sr -p2 -- prog > > > > which started in SCHED_RR policy with priority 2. > > > > now in FBSD 8.1 I get EPERM > > > > But If I do > >> rtprio 10 ./rt -sr -p2 -- prog > > > > it I dont get EPERM. > > > > I'm always root when doing this. > > > > My problem is that I have customers that need to run their old 5.x 6.x > > applications 'as is' in 8.1 whithout changing anything. > > > > [just thinking aloud] > > Perhaps, you might have stumbled upon the change in > sched_setscheduler() restricting permission to superuser: > > src/sys/posix4/p1003_1b.c#rev1.24.2.1 > MFC revision 1.27. > Don't allow non-root user to set a scheduler policy. > > @@ -195,6 +195,10 @@ int sched_setscheduler(struct thread *td > struct thread *targettd; > struct proc *targetp; > > + /* Don't allow non root user to set a scheduler policy */ > + if (suser(td) != 0) > + return (EPERM); > + > e = copyin(uap->param, &sched_param, sizeof(sched_param)); > if (e) > return (e); > > > -- > wbr, > pluknet > From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 14:37:55 2011 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 9F5E1106566C for ; Fri, 18 Feb 2011 14:37:55 +0000 (UTC) (envelope-from onwahe@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 57F478FC16 for ; Fri, 18 Feb 2011 14:37:55 +0000 (UTC) Received: by qwj9 with SMTP id 9so3280581qwj.13 for ; Fri, 18 Feb 2011 06:37:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=nHIGJoKaQv7mk85FNzxorcciRf3uJYRTYKCVvLi73qQ=; b=QNoBxR8HYTmHSqN/YLXUhkFZO7fnSzp5vbtlMc0w9sTQu9U/T9VOZkL/+ROBdHIsXa BC8Rwsti+xufJV4rh2tUF0hGz8cNsHYFeDrytNhJX4AVLMWWqGkbHatQ9gMV7d4Oyx7x yJtTwJMyatASqqPDcV1Un18JwIV91JepNvY4g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=ixxLV8B0TGoFVvXqVC9P2f9zZBvkrHg9MU8cqrP3sxsSfKeOIOgyKEzcM0gb//etS1 kjHU8ah8F4GXZZLq5p6JJ8EE/8NNnKgRCYXcozNv7byDwAL3k775YqBpbezVfCYeamXK 9cum6gv5Xi2v+DYIp09BwpomNLa85CE10r29Y= MIME-Version: 1.0 Received: by 10.224.61.18 with SMTP id r18mr641693qah.160.1298038247994; Fri, 18 Feb 2011 06:10:47 -0800 (PST) Received: by 10.224.2.83 with HTTP; Fri, 18 Feb 2011 06:10:47 -0800 (PST) Date: Fri, 18 Feb 2011 15:10:47 +0100 Message-ID: From: Svatopluk Kraus To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: ichsmb - correct locking strategy? 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, 18 Feb 2011 14:37:55 -0000 Hi, I try to figure out locking strategy in FreeBSD and found 'ichsmb' device. There is a mutex which protects smb bus (ichsmb device). For example in ichsmb_readw() in sys/dev/ichsmb/ichsmb.c, the mutex is locked and a command is written to bus, then unbounded (but with timeout) sleep is done (mutex is unlocked during sleep). After sleep a word is read from bus and the mutex is unlocked. 1. If an use of the device IS NOT serialized by layers around then more calls to this function (or others) can be started or even done before the first one is finished. The mutex don't protect sms bus. 2. If an use of the device IS serialized by layers around then the mutex is useless. Moreover, I don't mension interrupt routine which uses the mutex and smb bus too. Am I right? Or did I miss something? Svata From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 14:39:20 2011 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 512C4106564A for ; Fri, 18 Feb 2011 14:39:20 +0000 (UTC) (envelope-from onwahe@gmail.com) Received: from mail-qy0-f175.google.com (mail-qy0-f175.google.com [209.85.216.175]) by mx1.freebsd.org (Postfix) with ESMTP id 0649B8FC0C for ; Fri, 18 Feb 2011 14:39:19 +0000 (UTC) Received: by qyk36 with SMTP id 36so386841qyk.13 for ; Fri, 18 Feb 2011 06:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=yC3gdUtSwTB/ic++eCC8EObNaE60ixH+NKk9f0wGZ7o=; b=lnCzAZYf8WKWP1uuOUz8cgQn0fxMKo4ogBWwQUG3rP3acQLfBieGlXKK/etA2suu7/ lJIgn7D83odSi/K5DeqY83HPoVc7DZbijURkwujU//TUkP5VsdVx0tZ8iuB9HEgKhy+R KwlR9ovrki3EBNy8uR/uT9vyKHuAJhT3j/SxA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=sZ7JVBT65Tq66AnVDEoL5V0pTZQ7V04hxVoYVhd8uuVPJ6cNqrwh2BkRgEXe0Rv9q7 YYKOjKn4W6bWOGdwLm6A2qj7AUJANqZu2VIwn/zXWHt5HFFuMavJPcCu9FZcDVzWVVnh xhB8U6+LDI9oorjh9WyoufkD12/3EWxJtNIVU= MIME-Version: 1.0 Received: by 10.224.60.205 with SMTP id q13mr641377qah.60.1298038107027; Fri, 18 Feb 2011 06:08:27 -0800 (PST) Received: by 10.224.2.83 with HTTP; Fri, 18 Feb 2011 06:08:26 -0800 (PST) Date: Fri, 18 Feb 2011 15:08:26 +0100 Message-ID: From: Svatopluk Kraus To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Subject: Sleepable locks with priority propagation? 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, 18 Feb 2011 14:39:20 -0000 Hi, I deal with devices (i2c bus, flash memory), which are quite slow, i.e. some or mostly all operations on it are quite slow. One must wait for it for rather long time. Use of DELAY() is too expensive and an inactive (so called unbound) wait isn't permited with mutexes. So, no priority propagation locking primitive could be exploited. Typical simple operation (which must be locked) is following: HW_LOCK write request (fast) wait for processing (quite slow) read response (fast) HW_UNLOCK Here, use of mutex with mtx_sleep() is impossible, as mutex is unlocked during (unbound) sleep and somebody can start new operation. An response which is read after sleep could be incorrect. Well, I deal with a hardware, so all sleeps on it could be infinite. It's driver writer responsibility to ensure that all situations which can lead to infinite waits are treated correctly and can't happen. The waits (if no error happen on hardware, what must be treat anyway) could be rather long (but with known limits from specification). Long but not unbounded. I lack of a locking primitive with priority propagation on which inactive waits are permited. I'm not too much familiar with locking implementation strategy in FreeBSD, but am I one and only who needs such a lock? Or such lock is not permitted for really good reasons? Well, I know that only KASSERT in mtx_init() (mutex can't be made SLEEPABLE) and witness in mtx_sleep() (can't sleep on UNSLEEPABLE locks) quard the whole stuff. But should I hack it and use mutex as a locking primitive I need? (Of course, I will always use it with timeout.) Thanks for any response, Svata From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 15:09:53 2011 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 12488106566B for ; Fri, 18 Feb 2011 15:09:53 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe07.c2i.net [212.247.154.194]) by mx1.freebsd.org (Postfix) with ESMTP id 970198FC12 for ; Fri, 18 Feb 2011 15:09:52 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=118a5bn0tGnRZbUa9ClBty6BTuM1bA5mUZqmf2RHYp4= c=1 sm=1 a=S3ytCs0_FN4A:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=3-hUZXpmbMEYFK163soA:9 a=ulRtBdmsBNSqMspa6v9x3TJfJasA:4 a=wPNLvfGTeEIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe07.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 89889148; Fri, 18 Feb 2011 16:09:51 +0100 From: Hans Petter Selasky To: freebsd-hackers@freebsd.org Date: Fri, 18 Feb 2011 16:09:39 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: In-Reply-To: X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201102181609.39955.hselasky@c2i.net> Cc: Svatopluk Kraus Subject: Re: ichsmb - correct locking strategy? 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, 18 Feb 2011 15:09:53 -0000 On Friday 18 February 2011 15:10:47 Svatopluk Kraus wrote: > Hi, > > I try to figure out locking strategy in FreeBSD and found 'ichsmb' > device. There is a mutex which protects smb bus (ichsmb device). For > example in ichsmb_readw() in sys/dev/ichsmb/ichsmb.c, the mutex is > locked and a command is written to bus, then unbounded (but with > timeout) sleep is done (mutex is unlocked during sleep). After sleep a > word is read from bus and the mutex is unlocked. > > 1. If an use of the device IS NOT serialized by layers around then > more calls to this function (or others) can be started or even done > before the first one is finished. The mutex don't protect sms bus. > > 2. If an use of the device IS serialized by layers around then the > mutex is useless. > > Moreover, I don't mension interrupt routine which uses the mutex and > smb bus too. > > Am I right? Or did I miss something? man sx ? struct sx ? --HPS From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 20:58:14 2011 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 05FC0106564A; Fri, 18 Feb 2011 20:58:14 +0000 (UTC) (envelope-from nox@jelal.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id 54D668FC0C; Fri, 18 Feb 2011 20:58:13 +0000 (UTC) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 070A21E00244; Fri, 18 Feb 2011 21:58:11 +0100 (CET) Received: from triton8.kn-bremen.de (noident@localhost [127.0.0.1]) by triton8.kn-bremen.de (8.14.4/8.14.3) with ESMTP id p1IKthH9045600; Fri, 18 Feb 2011 21:55:43 +0100 (CET) (envelope-from nox@triton8.kn-bremen.de) Received: (from nox@localhost) by triton8.kn-bremen.de (8.14.4/8.14.3/Submit) id p1IKtgYx045599; Fri, 18 Feb 2011 21:55:42 +0100 (CET) (envelope-from nox) From: Juergen Lock Date: Fri, 18 Feb 2011 21:55:42 +0100 To: Juergen Lock Message-ID: <20110218205542.GA45210@triton8.kn-bremen.de> References: <20110129201000.GA10774@triton8.kn-bremen.de> <20110129205105.GI2518@deviant.kiev.zoral.com.ua> <20110129235448.GA15788@triton8.kn-bremen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110129235448.GA15788@triton8.kn-bremen.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Fri, 18 Feb 2011 21:13:00 +0000 Cc: "J.R. Oldroyd" , freebsd-hackers@freebsd.org, Andrew Gallatin , freebsd-emulation@freebsd.org, Kostik Belousov , Alexander Leidinger Subject: Re: Can vm_mmap()/vm_map_remove() be called with giant held? (linuxolator dvb patches) 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, 18 Feb 2011 20:58:14 -0000 I have finally got back to this and did the style and vm_map_remove() return value handling fixes, updated the patches in-place: http://people.freebsd.org/~nox/dvb/linux-dvb.patch (for head) http://people.freebsd.org/~nox/dvb/linux-dvb-8.patch (for 8.) On Sun, Jan 30, 2011 at 12:54:48AM +0100, Juergen Lock wrote: > On Sat, Jan 29, 2011 at 10:51:05PM +0200, Kostik Belousov wrote: > > On Sat, Jan 29, 2011 at 09:10:00PM +0100, Juergen Lock wrote: > > > Hi! > > > > > > I was kinda hoping to be able to post a correct patch in public but > > > getting an answer to ${Subject} seems to be more difficult than I > > > thought... :) So, does anyone here know? copyout_map() and > > You do not need Giant locked for vm_map* functions. > > > The question was more do I need to drop it first before calling them... > > > > copyout_unmap() are copied from ksyms_map() from sys/dev/ksyms/ksyms.c > > > - should there maybe be global versions instead of two static copies > > > each, and what would be good names? And giant is taken by linux_ioctl() > > Would you make a patch for this ? > > > Heh if you want me to... Where should they go and are my name choices ok? > I haven't done this yet so people can keep patching linux.ko in-place without having to build a new kernel too... > > > in the same source file before calling the parts I added. So here > > > comes the patch, it is to add support for dvb ioctls to the linuxolator > > > as discussed on -emulation earlier in this thread: > > > > > > http://lists.freebsd.org/pipermail/freebsd-multimedia/2011-January/011575.html > > > > > > (patch also at: > > > > > > http://people.freebsd.org/~nox/dvb/linux-dvb.patch > > > > > > and a version for 8, which is what I tested with w_scan on dvb-s2 > > > and dvb-t, and Andrew Gallatin also tested it with SageTV: > > > > > > http://people.freebsd.org/~nox/dvb/linux-dvb-8.patch > > > > > > ) > > > > > > + /* > > > + * Map somewhere after heap in process memory. > > > + */ > > > + PROC_LOCK(td->td_proc); > > > + *addr = round_page((vm_offset_t)vms->vm_daddr + > > > + lim_max(td->td_proc, RLIMIT_DATA)); > > > + PROC_UNLOCK(td->td_proc); > > Are you sure that this is needed ? Why not leave the address selection > > to the VM ? > > > I don't know, maybe sys/dev/ksyms/ksyms.c has a reason? How would I leave the address selection to the VM? Just trying to initialize *addr to (vm_offset_t)NULL there caused the patch to stop working. Thanx, :) Juergen Here is the new version for head: Index: src/sys/compat/linux/linux_ioctl.c =================================================================== RCS file: /home/scvs/src/sys/compat/linux/linux_ioctl.c,v retrieving revision 1.167 diff -u -p -r1.167 linux_ioctl.c --- src/sys/compat/linux/linux_ioctl.c 30 Dec 2010 02:18:04 -0000 1.167 +++ src/sys/compat/linux/linux_ioctl.c 18 Feb 2011 20:10:32 -0000 @@ -59,6 +59,14 @@ __FBSDID("$FreeBSD: src/sys/compat/linux #include #include #include +#include +#include +#include + +#include +#include +#include +#include #include #include @@ -83,6 +91,9 @@ __FBSDID("$FreeBSD: src/sys/compat/linux #include #include +#include +#include + CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); static linux_ioctl_function_t linux_ioctl_cdrom; @@ -97,6 +108,7 @@ static linux_ioctl_function_t linux_ioct static linux_ioctl_function_t linux_ioctl_drm; static linux_ioctl_function_t linux_ioctl_sg; static linux_ioctl_function_t linux_ioctl_v4l; +static linux_ioctl_function_t linux_ioctl_dvb; static linux_ioctl_function_t linux_ioctl_special; static linux_ioctl_function_t linux_ioctl_fbsd_usb; @@ -124,6 +136,8 @@ static struct linux_ioctl_handler sg_han { linux_ioctl_sg, LINUX_IOCTL_SG_MIN, LINUX_IOCTL_SG_MAX }; static struct linux_ioctl_handler video_handler = { linux_ioctl_v4l, LINUX_IOCTL_VIDEO_MIN, LINUX_IOCTL_VIDEO_MAX }; +static struct linux_ioctl_handler dvb_handler = +{ linux_ioctl_dvb, LINUX_IOCTL_DVB_MIN, LINUX_IOCTL_DVB_MAX }; static struct linux_ioctl_handler fbsd_usb = { linux_ioctl_fbsd_usb, FBSD_LUSB_MIN, FBSD_LUSB_MAX }; @@ -139,6 +153,7 @@ DATA_SET(linux_ioctl_handler_set, privat DATA_SET(linux_ioctl_handler_set, drm_handler); DATA_SET(linux_ioctl_handler_set, sg_handler); DATA_SET(linux_ioctl_handler_set, video_handler); +DATA_SET(linux_ioctl_handler_set, dvb_handler); DATA_SET(linux_ioctl_handler_set, fbsd_usb); struct handler_element @@ -2989,6 +3004,255 @@ linux_ioctl_special(struct thread *td, s } /* + * Map some anonymous memory in user space of size sz, rounded up to the page + * boundary. + */ +static int +copyout_map(struct thread *td, vm_offset_t *addr, size_t sz) +{ + struct vmspace *vms; + int error; + vm_size_t size; + + vms = td->td_proc->p_vmspace; + + /* + * Map somewhere after heap in process memory. + */ + PROC_LOCK(td->td_proc); + *addr = round_page((vm_offset_t)vms->vm_daddr + + lim_max(td->td_proc, RLIMIT_DATA)); + PROC_UNLOCK(td->td_proc); + + /* Round size up to page boundary. */ + size = (vm_size_t)round_page(sz); + + error = vm_mmap(&vms->vm_map, addr, size, PROT_READ | PROT_WRITE, + VM_PROT_ALL, MAP_PRIVATE | MAP_ANON, OBJT_DEFAULT, NULL, 0); + + return (error); +} + +/* + * Unmap memory in user space. + */ +static int +copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz) +{ + int error; + vm_map_t map; + vm_size_t size; + + map = &td->td_proc->p_vmspace->vm_map; + size = (vm_size_t) round_page(sz); + + error = vm_map_remove(map, addr, addr + size); + + return (error); +} + +static int +linux_to_bsd_dtv_properties(struct l_dtv_properties *lvps, struct dtv_properties *vps) +{ + + vps->num = lvps->num; + vps->props = PTRIN(lvps->props); /* possible pointer size conversion */ + return (0); +} + +static int +linux_to_bsd_dtv_property(struct l_dtv_property *lvp, struct dtv_property *vp) +{ + + /* + * Everything until u.buffer.reserved2 is fixed size so + * just memcpy it. + */ + memcpy(vp, lvp, offsetof(struct l_dtv_property, u.buffer.reserved2)); + /* + * The pointer may be garbage since it's part of a union, + * currently no Linux code uses it so just set it to NULL. + */ + vp->u.buffer.reserved2 = NULL; + vp->result = lvp->result; + return (0); +} + +static int +bsd_to_linux_dtv_property(struct dtv_property *vp, struct l_dtv_property *lvp) +{ + + /* + * Everything until u.buffer.reserved2 is fixed size so + * just memcpy it. + */ + memcpy(lvp, vp, offsetof(struct l_dtv_property, u.buffer.reserved2)); + /* + * The pointer may be garbage since it's part of a union, + * currently no Linux code uses it so just set it to NULL. + */ + lvp->u.buffer.reserved2 = PTROUT(NULL); + lvp->result = vp->result; + return (0); +} + +static int +linux_ioctl_dvb(struct thread *td, struct linux_ioctl_args *args) +{ + struct file *fp; + int error, i; + struct l_dtv_properties l_vps; + struct dtv_properties vps; + struct l_dtv_property *l_vp, *l_p; + struct dtv_property *vp, *p; + size_t l_propsiz, propsiz; + vm_offset_t uvp; + + l_vp = NULL; + vp = NULL; + + switch (args->cmd & 0xffff) { + case LINUX_AUDIO_STOP: + case LINUX_AUDIO_PLAY: + case LINUX_AUDIO_PAUSE: + case LINUX_AUDIO_CONTINUE: + case LINUX_AUDIO_SELECT_SOURCE: + case LINUX_AUDIO_SET_MUTE: + case LINUX_AUDIO_SET_AV_SYNC: + case LINUX_AUDIO_SET_BYPASS_MODE: + case LINUX_AUDIO_CHANNEL_SELECT: + case LINUX_AUDIO_CLEAR_BUFFER: + case LINUX_AUDIO_SET_ID: + case LINUX_AUDIO_SET_STREAMTYPE: + case LINUX_AUDIO_SET_EXT_ID: + case LINUX_AUDIO_BILINGUAL_CHANNEL_SELECT: + case LINUX_DMX_START: + case LINUX_DMX_STOP: + case LINUX_DMX_SET_BUFFER_SIZE: + case LINUX_NET_REMOVE_IF: + case LINUX_FE_DISEQC_RESET_OVERLOAD: + case LINUX_FE_DISEQC_SEND_BURST: + case LINUX_FE_SET_TONE: + case LINUX_FE_SET_VOLTAGE: + case LINUX_FE_ENABLE_HIGH_LNB_VOLTAGE: + case LINUX_FE_DISHNETWORK_SEND_LEGACY_CMD: + case LINUX_FE_SET_FRONTEND_TUNE_MODE: + case LINUX_CA_RESET: + if ((args->cmd & IOC_DIRMASK) != LINUX_IOC_VOID) + return ENOIOCTL; + args->cmd = (args->cmd & 0xffff) | IOC_VOID; + break; + + case LINUX_DMX_REMOVE_PID: + /* overlaps with LINUX_NET_ADD_IF */ + if ((args->cmd & IOC_DIRMASK) == LINUX_IOC_INOUT) + goto net_add_if; + /* FALLTHRU */ + case LINUX_AUDIO_SET_MIXER: + case LINUX_AUDIO_SET_ATTRIBUTES: + case LINUX_AUDIO_SET_KARAOKE: + case LINUX_DMX_SET_FILTER: + case LINUX_DMX_SET_PES_FILTER: + case LINUX_DMX_SET_SOURCE: + case LINUX_DMX_ADD_PID: + case LINUX_FE_DISEQC_SEND_MASTER_CMD: + case LINUX_FE_SET_FRONTEND: + case LINUX_CA_SEND_MSG: + case LINUX_CA_SET_DESCR: + case LINUX_CA_SET_PID: + args->cmd = (args->cmd & ~IOC_DIRMASK) | IOC_IN; + break; + + case LINUX_AUDIO_GET_STATUS: + case LINUX_AUDIO_GET_CAPABILITIES: + case LINUX_AUDIO_GET_PTS: + case LINUX_DMX_GET_PES_PIDS: + case LINUX_DMX_GET_CAPS: + case LINUX_FE_GET_INFO: + case LINUX_FE_DISEQC_RECV_SLAVE_REPLY: + case LINUX_FE_READ_STATUS: + case LINUX_FE_READ_BER: + case LINUX_FE_READ_SIGNAL_STRENGTH: + case LINUX_FE_READ_SNR: + case LINUX_FE_READ_UNCORRECTED_BLOCKS: + case LINUX_FE_GET_FRONTEND: + case LINUX_FE_GET_EVENT: + case LINUX_CA_GET_CAP: + case LINUX_CA_GET_SLOT_INFO: + case LINUX_CA_GET_DESCR_INFO: + case LINUX_CA_GET_MSG: + args->cmd = (args->cmd & ~IOC_DIRMASK) | IOC_OUT; + break; + + case LINUX_DMX_GET_STC: + case LINUX_NET_GET_IF: + net_add_if: + args->cmd = (args->cmd & ~IOC_DIRMASK) | IOC_INOUT; + break; + + case LINUX_FE_SET_PROPERTY: + case LINUX_FE_GET_PROPERTY: + error = copyin((void *)args->arg, &l_vps, sizeof(l_vps)); + if (error) + return (error); + linux_to_bsd_dtv_properties(&l_vps, &vps); + if ((vps.num == 0) || vps.num > DTV_IOCTL_MAX_MSGS) + return EINVAL; + + l_propsiz = vps.num * sizeof(*l_vp); + propsiz = vps.num * sizeof(*vp); + l_vp = malloc(l_propsiz, M_LINUX, M_WAITOK); + vp = malloc(propsiz, M_LINUX, M_WAITOK); + error = copyin((void *)vps.props, l_vp, l_propsiz); + if (error) + goto out2; + for (i = vps.num, l_p = l_vp, p = vp; i--; ++l_p, ++p) + linux_to_bsd_dtv_property(l_p, p); + + error = copyout_map(td, &uvp, propsiz); + if (error) + goto out2; + copyout(vp, (void *)uvp, propsiz); + + if ((error = fget(td, args->fd, &fp)) != 0) { + (void)copyout_unmap(td, uvp, propsiz); + goto out2; + } + vps.props = (void *)uvp; + if ((args->cmd & 0xffff) == LINUX_FE_SET_PROPERTY) + error = fo_ioctl(fp, FE_SET_PROPERTY, &vps, td->td_ucred, td); + else + error = fo_ioctl(fp, FE_GET_PROPERTY, &vps, td->td_ucred, td); + if (error) { + (void)copyout_unmap(td, uvp, propsiz); + goto out; + } + error = copyin((void *)uvp, vp, propsiz); + (void)copyout_unmap(td, uvp, propsiz); + if (error) + goto out; + for (i = vps.num, l_p = l_vp, p = vp; i--; ++l_p, ++p) + bsd_to_linux_dtv_property(p, l_p); + linux_to_bsd_dtv_properties(&l_vps, &vps); + copyout(l_vp, (void *)vps.props, l_propsiz); + + out: + fdrop(fp, td); + out2: + if (l_vp) + free(l_vp, M_LINUX); + if (vp) + free(vp, M_LINUX); + return (error); + + default: return (ENOIOCTL); + } + + error = ioctl(td, (struct ioctl_args *)args); + return (error); +} + +/* * Support for emulators/linux-libusb. This port uses FBSD_LUSB* macros * instead of USB* ones. This lets us to provide correct values for cmd. * 0xffffffe0 -- 0xffffffff range seemed to be the least collision-prone. Index: src/sys/compat/linux/linux_ioctl.h =================================================================== RCS file: /home/scvs/src/sys/compat/linux/linux_ioctl.h,v retrieving revision 1.32 diff -u -p -r1.32 linux_ioctl.h --- src/sys/compat/linux/linux_ioctl.h 30 Dec 2010 02:18:04 -0000 1.32 +++ src/sys/compat/linux/linux_ioctl.h 18 Jan 2011 17:48:27 -0000 @@ -32,6 +32,17 @@ #define _LINUX_IOCTL_H_ /* + * ioctl + * + * XXX comments in Linux' indicate these + * could be arch-dependant... + */ +#define LINUX_IOC_VOID 0 +#define LINUX_IOC_IN 0x40000000 +#define LINUX_IOC_OUT 0x80000000 +#define LINUX_IOC_INOUT (LINUX_IOC_IN|LINUX_IOC_OUT) + +/* * disk */ #define LINUX_BLKROSET 0x125d @@ -613,6 +624,83 @@ int linux_ifname(struct ifnet *, char #define LINUX_IOCTL_VIDEO_MAX LINUX_VIDIOCSVBIFMT /* + * DVB (osd.h and video.h not handled) + */ +#define LINUX_AUDIO_STOP 0x6f01 /* 0x00006f01 */ +#define LINUX_AUDIO_PLAY 0x6f02 /* 0x00006f02 */ +#define LINUX_AUDIO_PAUSE 0x6f03 /* 0x00006f03 */ +#define LINUX_AUDIO_CONTINUE 0x6f04 /* 0x00006f04 */ +#define LINUX_AUDIO_SELECT_SOURCE 0x6f05 /* 0x00006f05 */ +#define LINUX_AUDIO_SET_MUTE 0x6f06 /* 0x00006f06 */ +#define LINUX_AUDIO_SET_AV_SYNC 0x6f07 /* 0x00006f07 */ +#define LINUX_AUDIO_SET_BYPASS_MODE 0x6f08 /* 0x00006f08 */ +#define LINUX_AUDIO_CHANNEL_SELECT 0x6f09 /* 0x00006f09 */ +#define LINUX_AUDIO_GET_STATUS 0x6f0a /* 0x80206f0a */ +#define LINUX_AUDIO_GET_CAPABILITIES 0x6f0b /* 0x80046f0b */ +#define LINUX_AUDIO_CLEAR_BUFFER 0x6f0c /* 0x00006f0c */ +#define LINUX_AUDIO_SET_ID 0x6f0d /* 0x00006f0d */ +#define LINUX_AUDIO_SET_MIXER 0x6f0e /* 0x40086f0e */ +#define LINUX_AUDIO_SET_STREAMTYPE 0x6f0f /* 0x00006f0f */ +#define LINUX_AUDIO_SET_EXT_ID 0x6f10 /* 0x00006f10 */ +#define LINUX_AUDIO_SET_ATTRIBUTES 0x6f11 /* 0x40026f11 */ +#define LINUX_AUDIO_SET_KARAOKE 0x6f12 /* 0x400c6f12 */ +#define LINUX_AUDIO_GET_PTS 0x6f13 /* 0x80086f13 */ +#define LINUX_AUDIO_BILINGUAL_CHANNEL_SELECT 0x6f14 /* 0x00006f14 */ +#define LINUX_DMX_START 0x6f29 /* 0x00006f29 */ +#define LINUX_DMX_STOP 0x6f2a /* 0x00006f2a */ +#define LINUX_DMX_SET_FILTER 0x6f2b /* 0x403c6f2b */ +#define LINUX_DMX_SET_PES_FILTER 0x6f2c /* 0x40146f2c */ +#define LINUX_DMX_SET_BUFFER_SIZE 0x6f2d /* 0x00006f2d */ +#define LINUX_DMX_GET_PES_PIDS 0x6f2f /* 0x800a6f2f */ +#define LINUX_DMX_GET_CAPS 0x6f30 /* 0x80086f30 */ +#define LINUX_DMX_SET_SOURCE 0x6f31 /* 0x40046f31 */ +#define LINUX_DMX_GET_STC 0x6f32 /* 0xc0106f32 */ +#define LINUX_DMX_ADD_PID 0x6f33 /* 0x40026f33 */ +#define LINUX_DMX_REMOVE_PID 0x6f34 /* 0x40026f34 */ +#define LINUX_FE_GET_INFO 0x6f3d /* 0x80a86f3d */ +#define LINUX_FE_DISEQC_RESET_OVERLOAD 0x6f3e /* 0x00006f3e */ +#define LINUX_FE_DISEQC_SEND_MASTER_CMD 0x6f3f /* 0x40076f3f */ +#define LINUX_FE_DISEQC_RECV_SLAVE_REPLY 0x6f40 /* 0x800c6f40 */ +#define LINUX_FE_DISEQC_SEND_BURST 0x6f41 /* 0x00006f41 */ +#define LINUX_FE_SET_TONE 0x6f42 /* 0x00006f42 */ +#define LINUX_FE_SET_VOLTAGE 0x6f43 /* 0x00006f43 */ +#define LINUX_FE_ENABLE_HIGH_LNB_VOLTAGE 0x6f44 /* 0x00006f44 */ +#define LINUX_FE_READ_STATUS 0x6f45 /* 0x80046f45 */ +#define LINUX_FE_READ_BER 0x6f46 /* 0x80046f46 */ +#define LINUX_FE_READ_SIGNAL_STRENGTH 0x6f47 /* 0x80026f47 */ +#define LINUX_FE_READ_SNR 0x6f48 /* 0x80026f48 */ +#define LINUX_FE_READ_UNCORRECTED_BLOCKS 0x6f49 /* 0x80046f49 */ +#define LINUX_FE_SET_FRONTEND 0x6f4c /* 0x40246f4c */ +#define LINUX_FE_GET_FRONTEND 0x6f4d /* 0x80246f4d */ +#define LINUX_FE_GET_EVENT 0x6f4e /* 0x80286f4e */ +#define LINUX_FE_DISHNETWORK_SEND_LEGACY_CMD 0x6f50 /* 0x00006f50 */ +#define LINUX_FE_SET_FRONTEND_TUNE_MODE 0x6f51 /* 0x00006f51 */ +#define LINUX_FE_SET_PROPERTY 0x6f52 /* 0x40086f52 */ +#define LINUX_FE_GET_PROPERTY 0x6f53 /* 0x80086f53 */ +#define LINUX_CA_RESET 0x6f80 /* 0x00006f80 */ +#define LINUX_CA_GET_CAP 0x6f81 /* 0x80106f81 */ +#define LINUX_CA_GET_SLOT_INFO 0x6f82 /* 0x800c6f82 */ +#define LINUX_CA_GET_DESCR_INFO 0x6f83 /* 0x80086f83 */ +#define LINUX_CA_GET_MSG 0x6f84 /* 0x810c6f84 */ +#define LINUX_CA_SEND_MSG 0x6f85 /* 0x410c6f85 */ +#define LINUX_CA_SET_DESCR 0x6f86 /* 0x40106f86 */ +#define LINUX_CA_SET_PID 0x6f87 /* 0x40086f87 */ + +/* + * DVB net.h + * (LINUX_NET_ADD_IF and LINUX___NET_ADD_IF_OLD overlap with + * LINUX_DMX_REMOVE_PID) + */ +#define LINUX_NET_ADD_IF 0x6f34 /* 0xc0066f34 */ +#define LINUX_NET_REMOVE_IF 0x6f35 /* 0x00006f35 */ +#define LINUX_NET_GET_IF 0x6f36 /* 0xc0066f36 */ +#define LINUX___NET_ADD_IF_OLD 0x6f34 /* 0xc0046f34 */ +#define LINUX___NET_GET_IF_OLD 0x6f36 /* 0xc0046f36 */ + +#define LINUX_IOCTL_DVB_MIN LINUX_AUDIO_STOP +#define LINUX_IOCTL_DVB_MAX LINUX_CA_SET_PID + +/* * Our libusb(8) calls emulated within linux(4). */ #define FBSD_LUSB_DEVICEENUMERATE 0xffff Index: src/sys/compat/linux/linux_dvb.h @@ -0,0 +1,63 @@ +/* + * Extracted from , which is: + * + * Copyright (C) 2000 Marcus Metzler + * Ralph Metzler + * Holger Waechtler + * Andre Draszik + * for convergence integrated media GmbH + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef __LINUX_DVB_H +#define __LINUX_DVB_H + +#include + +struct dtv_property { + uint32_t cmd; + uint32_t reserved[3]; + union { + uint32_t data; + struct { + uint8_t data[32]; + uint32_t len; + uint32_t reserved1[3]; + void *reserved2; + } buffer; + } u; + int result; +} __attribute__ ((packed)); + +/* num of properties cannot exceed DTV_IOCTL_MAX_MSGS per ioctl */ +#define DTV_IOCTL_MAX_MSGS 64 + +struct dtv_properties { + uint32_t num; + struct dtv_property *props; +}; + +#define FE_SET_PROPERTY _IOW('o', 82, struct dtv_properties) +/* + * This is broken on linux as well but they workaround it in the driver. + * Since this is impossible to do on FreeBSD fix the header instead. + * Detailed and discussion : + * http://lists.freebsd.org/pipermail/freebsd-multimedia/2010-April/010958.html + */ +#define FE_GET_PROPERTY _IOW('o', 83, struct dtv_properties) + +#endif /*__LINUX_DVB_H*/ Index: src/sys/compat/linux/linux_dvb_compat.h @@ -0,0 +1,26 @@ +#ifndef __LINUX_DVB_COMPAT_H +#define __LINUX_DVB_COMPAT_H + +#include + +struct l_dtv_property { + uint32_t cmd; + uint32_t reserved[3]; + union { + uint32_t data; + struct { + uint8_t data[32]; + uint32_t len; + uint32_t reserved1[3]; + l_uintptr_t reserved2; + } buffer; + } u; + l_int result; +} __attribute__ ((packed)); + +struct l_dtv_properties { + uint32_t num; + l_uintptr_t props; +}; + +#endif /*__LINUX_DVB_H*/ From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 19 12:46:56 2011 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 0CDA01065672; Sat, 19 Feb 2011 12:46:56 +0000 (UTC) (envelope-from prvs=10311e3df6=killing@multiplay.co.uk) Received: from mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) by mx1.freebsd.org (Postfix) with ESMTP id 746428FC08; Sat, 19 Feb 2011 12:46:55 +0000 (UTC) X-MDAV-Processed: mail1.multiplay.co.uk, Sat, 19 Feb 2011 12:36:29 +0000 X-Spam-Processed: mail1.multiplay.co.uk, Sat, 19 Feb 2011 12:36:29 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail1.multiplay.co.uk X-Spam-Level: X-Spam-Status: No, score=-5.0 required=6.0 tests=USER_IN_WHITELIST shortcircuit=ham autolearn=disabled version=3.2.5 Received: from r2d2 ([188.220.16.49]) by mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) (MDaemon PRO v10.0.4) with ESMTP id md50012257628.msg; Sat, 19 Feb 2011 12:36:28 +0000 X-MDRemoteIP: 188.220.16.49 X-Return-Path: prvs=10311e3df6=killing@multiplay.co.uk X-Envelope-From: killing@multiplay.co.uk Message-ID: <8332E9240ECA403480B48D21FA3A8694@multiplay.co.uk> From: "Steven Hartland" To: , Date: Sat, 19 Feb 2011 12:36:57 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Cc: Subject: machdep.hlt_cpus not safe with ULE? 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, 19 Feb 2011 12:46:56 -0000 I'm trying to debug a possibly failing CPU, so I thought it would be easy just disable the cores using machdep.hlt_cpus and see if we see the panic's we've been seeing. The problem is it seems ULE doesnt properly support machdep.hlt_cpus and still schedules processes onto the halted cpus which obviously causes problems. Can anyone confirm this behaviour? Should machdep.hlt_cpus and I assume the logical counterpart never be used with ULE? Regards Steve ================================================ This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337 or return the E.mail to postmaster@multiplay.co.uk. From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 19 13:35:34 2011 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 2025D106564A for ; Sat, 19 Feb 2011 13:35:34 +0000 (UTC) (envelope-from gljennjohn@googlemail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id A3C538FC12 for ; Sat, 19 Feb 2011 13:35:33 +0000 (UTC) Received: by fxm19 with SMTP id 19so1255863fxm.13 for ; Sat, 19 Feb 2011 05:35:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:in-reply-to :references:reply-to:x-mailer:mime-version:content-type :content-transfer-encoding; bh=6Lq3TBrFHc9ZfdYL8VSAGMNxvack6eN91u3dMoQt+6k=; b=KsDl2LkJL1nqNYFkNTSWF+KbxGner7Nnt9JhAs1dZ7NoSLHHnPIAw1oB8ri4mSWOGM Q2I1TyMcbOmGAiqTSB5z3Ik8b0MVJbNgUeB3MAB8exVXRjo8TVKlpkAJfZlJ1NrfSjPT t5CSJwt7YTvy6H+DdBdLYCNlYt2sFMJP+qm6A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:reply-to :x-mailer:mime-version:content-type:content-transfer-encoding; b=AMEQTVxgw32pCmF3QLaWJqDYjJjxCIYc3d5ynfvwuErocDi/UE8S4eJqmqqaaYaMYn DPd9WMfP9+y/JsvlaoBHX5MO8o2CtWAnlFs2qZHw+uJiVzpKvoJgRp48moBibKIl4HqK 5y5H1nmGFLTz26PkSfDkGjeiMBZp6ENU5q4qc= Received: by 10.223.96.195 with SMTP id i3mr2442168fan.77.1298122532221; Sat, 19 Feb 2011 05:35:32 -0800 (PST) Received: from ernst.jennejohn.org (p578E384B.dip.t-dialin.net [87.142.56.75]) by mx.google.com with ESMTPS id n3sm1561522faa.5.2011.02.19.05.35.31 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 19 Feb 2011 05:35:31 -0800 (PST) Date: Sat, 19 Feb 2011 14:35:30 +0100 From: Gary Jennejohn To: "Steven Hartland" Message-ID: <20110219143530.45d0f958@ernst.jennejohn.org> In-Reply-To: <8332E9240ECA403480B48D21FA3A8694@multiplay.co.uk> References: <8332E9240ECA403480B48D21FA3A8694@multiplay.co.uk> X-Mailer: Claws Mail 3.7.8 (GTK+ 2.18.7; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org Subject: Re: machdep.hlt_cpus not safe with ULE? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: gljennjohn@googlemail.com List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Feb 2011 13:35:34 -0000 On Sat, 19 Feb 2011 12:36:57 -0000 "Steven Hartland" wrote: > I'm trying to debug a possibly failing CPU, so I thought it would > be easy just disable the cores using machdep.hlt_cpus and see if > we see the panic's we've been seeing. > > The problem is it seems ULE doesnt properly support machdep.hlt_cpus > and still schedules processes onto the halted cpus which obviously > causes problems. > > Can anyone confirm this behaviour? Should machdep.hlt_cpus and I assume > the logical counterpart never be used with ULE? > Looking at the kernel source it appears that only sched_4bsd.c makes use of hlt_cpus_mask. -- Gary Jennejohn From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 19 14:24:52 2011 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 CEDF51065698; Sat, 19 Feb 2011 14:24:52 +0000 (UTC) (envelope-from prvs=10311e3df6=killing@multiplay.co.uk) Received: from mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) by mx1.freebsd.org (Postfix) with ESMTP id 4019E8FC13; Sat, 19 Feb 2011 14:24:52 +0000 (UTC) X-MDAV-Processed: mail1.multiplay.co.uk, Sat, 19 Feb 2011 14:24:34 +0000 X-Spam-Processed: mail1.multiplay.co.uk, Sat, 19 Feb 2011 14:24:34 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail1.multiplay.co.uk X-Spam-Level: X-Spam-Status: No, score=-5.0 required=6.0 tests=USER_IN_WHITELIST shortcircuit=ham autolearn=disabled version=3.2.5 Received: from r2d2 ([188.220.16.49]) by mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) (MDaemon PRO v10.0.4) with ESMTP id md50012258207.msg; Sat, 19 Feb 2011 14:24:32 +0000 X-MDRemoteIP: 188.220.16.49 X-Return-Path: prvs=10311e3df6=killing@multiplay.co.uk X-Envelope-From: killing@multiplay.co.uk Message-ID: <482E22A771C8471C8D3F31ACFBAE817B@multiplay.co.uk> From: "Steven Hartland" To: References: <8332E9240ECA403480B48D21FA3A8694@multiplay.co.uk> <20110219143530.45d0f958@ernst.jennejohn.org> Date: Sat, 19 Feb 2011 14:24:59 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Cc: freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org Subject: Re: machdep.hlt_cpus not safe with ULE? 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, 19 Feb 2011 14:24:52 -0000 ----- Original Message ----- From: "Gary Jennejohn" > > Looking at the kernel source it appears that only sched_4bsd.c makes use > of hlt_cpus_mask. Given ULE is default do these need to be either removed totally or at least conditionally based on the scheduler choice as currently they are quite dangerous to a systems health? Regards Steve ================================================ This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337 or return the E.mail to postmaster@multiplay.co.uk. From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 19 14:32:35 2011 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 2ACF6106564A for ; Sat, 19 Feb 2011 14:32:35 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from gw02.mail.saunalahti.fi (gw02.mail.saunalahti.fi [195.197.172.116]) by mx1.freebsd.org (Postfix) with ESMTP id A62F28FC12 for ; Sat, 19 Feb 2011 14:32:34 +0000 (UTC) Received: from a91-153-123-205.elisa-laajakaista.fi (a91-153-123-205.elisa-laajakaista.fi [91.153.123.205]) by gw02.mail.saunalahti.fi (Postfix) with SMTP id 6A2C4139683; Sat, 19 Feb 2011 16:32:30 +0200 (EET) Date: Sat, 19 Feb 2011 16:32:30 +0200 From: Jaakko Heinonen To: freebsd-hackers@FreeBSD.org Message-ID: <20110219143230.GA1539@a91-153-123-205.elisa-laajakaista.fi> References: <20110114122454.GA4805@jh> <20110119083407.GA51372@crodrigues.org> <20110119151210.GA2182@a91-153-123-205.elisa-laajakaista.fi> <20110125172340.GA1535@a91-153-123-205.elisa-laajakaista.fi> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110125172340.GA1535@a91-153-123-205.elisa-laajakaista.fi> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: Craig Rodrigues Subject: Re: [patch] nmount ro, rw and negated option handling 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, 19 Feb 2011 14:32:35 -0000 On 2011-01-25, Jaakko Heinonen wrote: > Another related bug is in vfs_domount_update(): if VFS_MOUNT() succeeds > but vfs_export() fails, old mount flags and options are restored. I > think this shouldn't happen when VFS_MOUNT() has been already > successfully completed and this is the final reason why FFS fs_ronly and > the MNT_RDONLY flag get out of sync. Does the patch below look sane? > > %%% > Index: sys/kern/vfs_mount.c > =================================================================== > --- sys/kern/vfs_mount.c (revision 217792) > +++ sys/kern/vfs_mount.c (working copy) I have committed an updated version as r218852. Unless there are objections, I plan to commit something like this next: Recognize "ro", "rdonly", "norw", "rw" and "noro" as equal options in vfs_equalopts(). This allows vfs_sanitizeopts() to filter redundant occurrences of these options. It was possible that for example both "ro" and "rw" options became active concurrently. PR: kern/133614 %%% Index: sys/kern/vfs_mount.c =================================================================== --- sys/kern/vfs_mount.c (revision 218446) +++ sys/kern/vfs_mount.c (working copy) @@ -175,6 +175,27 @@ vfs_deleteopt(struct vfsoptlist *opts, c } } +static int +vfs_isopt_ro(const char *opt) +{ + + if (strcmp(opt, "ro") == 0 || strcmp(opt, "rdonly") == 0 || + strcmp(opt, "norw") == 0) + return (1); + else + return (0); +} + +static int +vfs_isopt_rw(const char *opt) +{ + + if (strcmp(opt, "rw") == 0 || strcmp(opt, "noro") == 0) + return (1); + else + return (0); +} + /* * Check if options are equal (with or without the "no" prefix). */ @@ -203,6 +224,11 @@ vfs_equalopts(const char *opt1, const ch if (strncmp(opt2, "no", 2) == 0 && strcmp(opt1, opt2 + 2) == 0) return (1); } + /* "ro" / "rdonly" / "norw" / "rw" / "noro" */ + if ((vfs_isopt_ro(opt1) || vfs_isopt_rw(opt1)) && + (vfs_isopt_ro(opt2) || vfs_isopt_rw(opt2))) + return (1); + return (0); } %%% -- Jaakko From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 19 16:00:18 2011 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 8DE2E106566C; Sat, 19 Feb 2011 16:00:18 +0000 (UTC) (envelope-from prvs=10311e3df6=killing@multiplay.co.uk) Received: from mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) by mx1.freebsd.org (Postfix) with ESMTP id EEB0F8FC1B; Sat, 19 Feb 2011 16:00:09 +0000 (UTC) X-MDAV-Processed: mail1.multiplay.co.uk, Sat, 19 Feb 2011 15:59:52 +0000 X-Spam-Processed: mail1.multiplay.co.uk, Sat, 19 Feb 2011 15:59:52 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail1.multiplay.co.uk X-Spam-Level: X-Spam-Status: No, score=-5.0 required=6.0 tests=USER_IN_WHITELIST shortcircuit=ham autolearn=disabled version=3.2.5 Received: from r2d2 ([188.220.16.49]) by mail1.multiplay.co.uk (mail1.multiplay.co.uk [85.236.96.23]) (MDaemon PRO v10.0.4) with ESMTP id md50012258726.msg; Sat, 19 Feb 2011 15:59:50 +0000 X-MDRemoteIP: 188.220.16.49 X-Return-Path: prvs=10311e3df6=killing@multiplay.co.uk X-Envelope-From: killing@multiplay.co.uk Message-ID: From: "Steven Hartland" To: "Steven Hartland" , References: <8332E9240ECA403480B48D21FA3A8694@multiplay.co.uk><20110219143530.45d0f958@ernst.jennejohn.org> <482E22A771C8471C8D3F31ACFBAE817B@multiplay.co.uk> Date: Sat, 19 Feb 2011 16:00:19 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Cc: freebsd-hackers@freebsd.org, freebsd-stable@freebsd.org Subject: Re: machdep.hlt_cpus not safe with ULE? 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, 19 Feb 2011 16:00:18 -0000 For reference I've found that an alternative is to set the following in loader.conf:- hint.lapic.2.disabled=1 hint.lapic.3.disabled=1 2 and 3 here are the apic numbers displayed by dmesg on boot for the cpu's Obviously this requires a reboot so no perfect for all uses but it does work for what we're testing. ================================================ This e.mail is private and confidential between Multiplay (UK) Ltd. and the person or entity to whom it is addressed. In the event of misdirection, the recipient is prohibited from using, copying, printing or otherwise disseminating it or any information contained in it. In the event of misdirection, illegible or incomplete transmission please telephone +44 845 868 1337 or return the E.mail to postmaster@multiplay.co.uk. From owner-freebsd-hackers@FreeBSD.ORG Sat Feb 19 17:57:49 2011 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 4B99E106566B; Sat, 19 Feb 2011 17:57:49 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id D6BA58FC0A; Sat, 19 Feb 2011 17:57:48 +0000 (UTC) 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 p1JHviLp062100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 19 Feb 2011 19:57:44 +0200 (EET) (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.4/8.14.4) with ESMTP id p1JHviAT028572; Sat, 19 Feb 2011 19:57:44 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id p1JHvi10028571; Sat, 19 Feb 2011 19:57:44 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 19 Feb 2011 19:57:44 +0200 From: Kostik Belousov To: Juergen Lock Message-ID: <20110219175744.GH78089@deviant.kiev.zoral.com.ua> References: <20110129201000.GA10774@triton8.kn-bremen.de> <20110129205105.GI2518@deviant.kiev.zoral.com.ua> <20110129235448.GA15788@triton8.kn-bremen.de> <20110218205542.GA45210@triton8.kn-bremen.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EUpy5YnDgVCdz9yy" Content-Disposition: inline In-Reply-To: <20110218205542.GA45210@triton8.kn-bremen.de> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org, freebsd-emulation@freebsd.org Subject: Re: Can vm_mmap()/vm_map_remove() be called with giant held? (linuxolator dvb patches) 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, 19 Feb 2011 17:57:49 -0000 --EUpy5YnDgVCdz9yy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 18, 2011 at 09:55:42PM +0100, Juergen Lock wrote: > I have finally got back to this and did the style and vm_map_remove() > return value handling fixes, updated the patches in-place: >=20 > http://people.freebsd.org/~nox/dvb/linux-dvb.patch >=20 > (for head) >=20 > http://people.freebsd.org/~nox/dvb/linux-dvb-8.patch >=20 > (for 8.) >=20 > On Sun, Jan 30, 2011 at 12:54:48AM +0100, Juergen Lock wrote: > > On Sat, Jan 29, 2011 at 10:51:05PM +0200, Kostik Belousov wrote: > > > On Sat, Jan 29, 2011 at 09:10:00PM +0100, Juergen Lock wrote: > > > > Hi! > > > >=20 > > > > I was kinda hoping to be able to post a correct patch in public but > > > > getting an answer to ${Subject} seems to be more difficult than I > > > > thought... :) So, does anyone here know? copyout_map() and > > > You do not need Giant locked for vm_map* functions. > > >=20 > > The question was more do I need to drop it first before calling them... > >=20 > > > > copyout_unmap() are copied from ksyms_map() from sys/dev/ksyms/ksym= s.c > > > > - should there maybe be global versions instead of two static copies > > > > each, and what would be good names? And giant is taken by linux_io= ctl() > > > Would you make a patch for this ? > > >=20 > > Heh if you want me to... Where should they go and are my name choices= ok? > >=20 > I haven't done this yet so people can keep patching linux.ko in-place > without having to build a new kernel too... Separate build of linux.ko is not quite supported action. I would greatly prefer to have the move of these two functions before the rest of the patch comes in. Together with conversion of other users. I propose to put it into vm/vm_glue.c. >=20 > > > > in the same source file before calling the parts I added. So here > > > > comes the patch, it is to add support for dvb ioctls to the linuxol= ator > > > > as discussed on -emulation earlier in this thread: > > > >=20 > > > > http://lists.freebsd.org/pipermail/freebsd-multimedia/2011-January= /011575.html > > > >=20 > > > > (patch also at: > > > >=20 > > > > http://people.freebsd.org/~nox/dvb/linux-dvb.patch > > > >=20 > > > > and a version for 8, which is what I tested with w_scan on dvb-s2 > > > > and dvb-t, and Andrew Gallatin also tested it with SageTV: > > > >=20 > > > > http://people.freebsd.org/~nox/dvb/linux-dvb-8.patch > > > >=20 > > > > ) > > > >=20 >=20 > > > > + /* > > > > + * Map somewhere after heap in process memory. > > > > + */ > > > > + PROC_LOCK(td->td_proc); > > > > + *addr =3D round_page((vm_offset_t)vms->vm_daddr + > > > > + lim_max(td->td_proc, RLIMIT_DATA)); > > > > + PROC_UNLOCK(td->td_proc); > > > Are you sure that this is needed ? Why not leave the address selection > > > to the VM ? > > >=20 > > I don't know, maybe sys/dev/ksyms/ksyms.c has a reason? >=20 > How would I leave the address selection to the VM? Just trying > to initialize *addr to (vm_offset_t)NULL there caused the patch to > stop working. I believe you should do *addr =3D 0; vm_mmap(map, addr); --EUpy5YnDgVCdz9yy Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (FreeBSD) iEYEARECAAYFAk1gBJgACgkQC3+MBN1Mb4g3WgCg5pyzNe1TeXXxZeYx4p5+xgDH UQgAoIYBzrFWs/OufIfUq1jD2SWILgD6 =U3c4 -----END PGP SIGNATURE----- --EUpy5YnDgVCdz9yy--