From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 2 23:43:19 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4249C106564A; Sun, 2 Aug 2009 23:43:19 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id A7AC78FC18; Sun, 2 Aug 2009 23:43:18 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id 2729DEB4F84; Mon, 3 Aug 2009 02:23:03 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id ED0464509B; Mon, 3 Aug 2009 02:23:02 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CrnxSH7F1Ux4; Mon, 3 Aug 2009 02:23:02 +0300 (EEST) Received: from kobe.laptop (adsl48-68.kln.forthnet.gr [77.49.175.68]) by mail.ceid.upatras.gr (Postfix) with ESMTP id B13ED45088; Mon, 3 Aug 2009 02:23:02 +0300 (EEST) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n72NN1w6092270 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Aug 2009 02:23:01 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n72NMxOt092263; Mon, 3 Aug 2009 02:22:59 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) From: Giorgos Keramidas To: Kostik Belousov References: <2e566b9e0907202134h5568a06bl33a8d95ac9c7f845@mail.gmail.com> <20090721131735.GA18929@freebsd.org> <2e566b9e0907211818k1a52ef7am5c681a6f4ffc868c@mail.gmail.com> <864ot5jy3f.fsf@ds4.des.no> <20090722141756.GQ55190@deviant.kiev.zoral.com.ua> <3cb459ed0907220823q2376f545x44c0972a989a4b72@mail.gmail.com> <20090722160547.GU55190@deviant.kiev.zoral.com.ua> Date: Mon, 03 Aug 2009 02:22:45 +0300 In-Reply-To: <20090722160547.GU55190@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Wed, 22 Jul 2009 19:05:47 +0300") Message-ID: <877hxlx0l6.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Cc: Dag-Erling Sm??rgrav , Roman Divacky , hackers@freebsd.org, Alexander Churanov , "Shaowei Wang \(wsw\)" Subject: Re: llvm/clang a tool chain or just a compiler for 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: Sun, 02 Aug 2009 23:43:19 -0000 --=-=-= On Wed, 22 Jul 2009 19:05:47 +0300, Kostik Belousov wrote: >> I know some ports using "USE_GCC" knob of /usr/ports/Mk/bsd.gcc.mk . >> Is this the same as you suggest? > > No. And this was actually not my idea. > > The proposal is to have portmgr-selected and approved version of gcc, > installed from port and used to build ports. The base (g)cc is used > only to build base. > > Such divorce seems to be beneficial both to base compiler, and for > ports. ISTR this is what pkgsrc does. It isn't a very bad idea, and it may give ports/ a bit of freedom about the version of the compiler they can use for special OPTIONS= items like SSE instruction optimizations and so on. --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (FreeBSD) iEYEARECAAYFAkp2H9MACgkQ1g+UGjGGA7ZhzACcDSFJCXpF5ubSCk8cwF62W/by bWMAn3GYSCd93ZyQCsVIepHhDn7yEgaR =gCEW -----END PGP SIGNATURE----- --=-=-=-- From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 01:56:39 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 83D0B1065680 for ; Mon, 3 Aug 2009 01:56:39 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from poseidon.ceid.upatras.gr (poseidon.ceid.upatras.gr [150.140.141.169]) by mx1.freebsd.org (Postfix) with ESMTP id 9861C8FC0C for ; Mon, 3 Aug 2009 01:56:38 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from mail.ceid.upatras.gr (unknown [10.1.0.143]) by poseidon.ceid.upatras.gr (Postfix) with ESMTP id DFFB5EB51F8; Mon, 3 Aug 2009 04:32:09 +0300 (EEST) Received: from localhost (europa.ceid.upatras.gr [127.0.0.1]) by mail.ceid.upatras.gr (Postfix) with ESMTP id B96C34509B; Mon, 3 Aug 2009 04:32:09 +0300 (EEST) X-Virus-Scanned: amavisd-new at ceid.upatras.gr Received: from mail.ceid.upatras.gr ([127.0.0.1]) by localhost (europa.ceid.upatras.gr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LCNI7qcx2p+u; Mon, 3 Aug 2009 04:32:09 +0300 (EEST) Received: from kobe.laptop (adsl48-68.kln.forthnet.gr [77.49.175.68]) by mail.ceid.upatras.gr (Postfix) with ESMTP id 4E23345088; Mon, 3 Aug 2009 04:32:09 +0300 (EEST) Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n731W8Vf071154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 3 Aug 2009 04:32:08 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n731W72R071141; Mon, 3 Aug 2009 04:32:07 +0300 (EEST) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: Alfred Perlstein References: <20090726231534.GI21885@elvis.mu.org> Date: Mon, 03 Aug 2009 04:32:07 +0300 Message-ID: <87vdl5vg14.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: hackers@freebsd.org Subject: Re: distributed scm+freebsd svn? 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, 03 Aug 2009 01:56:39 -0000 On Sun, 26 Jul 2009 16:15:34 -0700, Alfred Perlstein wrote: > Hello hackers, > > Does anyone here use one of the distributed SCMs to manage > contributions to FreeBSD in an easy manner? Hi Alfred, Yes, I do that. > Any pointers to a setup you have? > > I thought "git" was supposed to make this easy, but going over the > docs leaves me with a lot of questions. Git is a wonderful system but it's "UI" and documentation often make me want to scream bad things. My own suggestion is to go with Mercurial, because it's command set looks a *lot* like CVS or Subversion, it's often as fast or even faster than Git, and it doesn't seem as 'confusing' as Git. More details below... > I'm hoping to be able to basically: > sync into my "distributed repo". > allow a third party access to it. > easily commit upstream back into svn from a branch > in my distributed scm. I use a local Mercurial repository for my own patches. It seems to support most of the things I want to do, i.e.: * Keep a clean `/hg/bsd/head' workspace and pull full changesets into that from our svn repository * Support incremental updates of `/hg/bsd/head'. * Easily clone my `/hg/bsd/head' to one or more `feature' branches. * Allow others to pull from `head' as a read-only source over http or ssh. The /head branch has a huge history that I don't really want to keep around in every clone. So I started my conversion from 2007-12-31 and I keep updating it with the `hg convert ...' command wrapped in a small shell script: $ cat -n /hg/bsd/pull-head.sh 1 #!/bin/sh 2 3 set -e 4 hg convert \ 5 --config convert.svn.startrev='175021' \ 6 --config convert.svn.trunk='head' \ 7 --config convert.svn.branches='' \ 8 --config convert.svn.tags='' \ 9 file:///home/svn/base/ \ 10 /hg/bsd/head You can use the webdav http://svn.freebsd.org/base/ or an SSH tunneled URI to access to Subversion repository, but I keep a local mirror of the Subversion repository too, so I prefer that. Typical Mercurial-based Workflow ================================ 1. Pull subversion commits into the 'head' workspace. 2. Pull these changes from 'head' to my working tree. 3. Merge the changes with the local patches of the working tree. 4. Extract one or more patches for committing to Subversion 5. Rinse, leather, repeat... Pulling the latest commits from Subversion ------------------------------------------ The first step is the easiest bit. I just run `/hg/bsd/pull-head.sh'. This requires an installed copy of the Python bindings of Subversion [devel/py-subversion] and the `convert' extension enabled in my ~/.hgrc file with: [extensions] convert = A sample run of `pull-head.sh' looks like this: keramida@kobe:/hg/bsd$ time ./pull-head.sh scanning source... sorting... converting... 1 Many network stack subsystems use a single global data structure to hold 0 Add padding to struct inpcb, missed during our padding sweep earlier in 3.306 real 1.809 user 0.619 sys keramida@kobe:/hg/bsd$ This is reasonably fast, but it does come with an important caveat. It's not terribly important for my own work, but it *may* be for yours: The Python bindings of Subversion do not support svn:keywords, so all our manually configured '$FreeBSD$' stuff is unexpanded in the converted tree. Mergemaster may cause various levels of "fun" and "amusement" if you mix, match and alternate between svn-based and mercurial-based workspaces often! At this point, after "pull-head.sh" has finished running, the most recent commit in the head/.hg/ workspace state is the last commit by rwatson: keramida@kobe:/hg/bsd/head$ hg log --limit 1 changeset: 12589:8ce7c7a0b804 branch: head tag: tip user: rwatson date: Sun Aug 02 22:47:08 2009 +0000 summary: Add padding to struct inpcb, missed during our padding sweep earlier in keramida@kobe:/hg/bsd/head$ This clone/workspace is my 'clean' slate, and it only contains an `.hg' data store. No checkout or other workspace contents: keramida@kobe:/hg/bsd/head$ ls -la total 6 drwxr-xr-x 3 keramida users - 512 Nov 10 2008 . drwxr-xr-x 8 keramida users - 512 Aug 3 02:36 .. drwxr-xr-x 3 keramida users - 512 Aug 3 02:36 .hg keramida@kobe:/hg/bsd/head$ du -sh . 243M . keramida@kobe:/hg/bsd/head$ It does however contains separate changesets for each subversion commit, so I can browse the (local only now) history with a fair amount of speed. Pulling these changes in my personal workspace ---------------------------------------------- The second step is to pull the latest versions in my personal workspace at `/hg/bsd/src': keramida@kobe:/home/keramida$ cd /hg/bsd/src 1) keramida@kobe:/hg/bsd/src$ hg incoming --style compact ../head comparing with /hg/bsd/head searching for changes 12588 6b04ed36e454 2009-08-02 19:43 +0000 rwatson Many network stack subsystems use a single global data structure to hold 12589[tip] 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson Add padding to struct inpcb, missed during our padding sweep earlier in 2) keramida@kobe:/hg/bsd/src$ hg pull ../head pulling from /hg/bsd/head searching for changes adding changesets adding manifests adding file changes added 2 changesets with 16 changes to 16 files (+1 heads) (run 'hg heads' to see heads, 'hg merge' to merge) keramida@kobe:/hg/bsd/src$ Comments: --------- (1) Just look at what would be pulled from 'head' but don't actually make any changes to the local workspace or branch/data store. (2) Pull the changes, creating a 'fork' in the history of the local workspace at the place where the changes were grafted on top of the previous svn-based changeset. At this point the history of my personal workspace has "forked". The subversion changesets have been grafted on top of the previous svn commit. This is easier to show with a picture/graph of the local history, so here it is (from the 'graphlog' extension of Mercurial): keramida@kobe:/hg/bsd/src$ hg glog --limit 5 o 12785[tip] 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson | Add padding to struct inpcb, missed during our padding sweep earlier in | o 12784:12782 6b04ed36e454 2009-08-02 19:43 +0000 rwatson | Many network stack subsystems use a single global data structure to hold | | @ 12783:12762,12782 c50060fec1db 2009-08-02 21:06 +0300 keramida |/| Merge from head | | o | 12782 8e4fc85e5aa3 2009-08-02 16:59 +0000 julian | | Stop uuidgen(2) from crashing in vimage kerenels. | | o | 12781 bf9c3383d680 2009-08-02 14:28 +0000 attilio | | Make the newbus subsystem Giant free by adding the new newbus sxlock. | | keramida@kobe:/hg/bsd/src$ The last time I pulled from Subversion was after 16:59 UTC (this is the buildworld I am still running in the background). My current workspace contains a checkout of revision 12783/c50060fec1db (hence the '@' in the relevant node of the history graph). Merging the New Changesets -------------------------- To prepare for my next `merge with head', I first look at the two 'heads' of the history. My last successful merge and the new 'head' created by importing from Subversion: keramida@kobe:/hg/bsd/src$ hg heads --style compact 12785[tip] 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson Add padding to struct inpcb, missed during our padding sweep earlier in 12783:12762,12782 c50060fec1db 2009-08-02 21:06 +0300 keramida Merge from head keramida@kobe:/hg/bsd/src$ Then I verify that I do *not* have local uncommitted stuff: keramida@kobe:/hg/bsd/src$ hg status keramida@kobe:/hg/bsd/src$ This takes a few seconds, but I don't want to throw away any changes I may have been working on without noticing. Since this is a clean checkout of revision 12783:c50060fec1db, I don't necessarily need the next step, but it's safe to do it. I check out a clean copy of the local merge head: keramida@kobe:/hg/bsd/src$ time hg update --clean c50060fec1db 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 4.684 real 1.691 user 2.558 sys Being a clean checkout already and having the filesystem cache 'hot' from the last pull I just did, this is often fast enough. Finally a merge of the 'remote' Subversion based commits I just pulled: keramida@kobe:/hg/bsd/src$ hg merge merging sys/netinet/in_gif.c merging sys/netinet/ip_var.h 14 files updated, 2 files merged, 0 files removed, 0 files unresolved (branch merge, don't forget to commit) You have new mail in /home/keramida/Mailbox keramida@kobe:/hg/bsd/src$ hg commit -m 'Merge from head' keramida@kobe:/hg/bsd/src$ That's all. Now I have my own local changes 'merged' with the latest changeset from Subversion. There are no conflicts to resolve manually, because the subversion changesets I pulled do not affect any of the files with local-only changes, so this merge was relatively pain-free, quite fast and most importantly required no manual input at all :) Looking at the history with graphlog again, shows something like this: keramida@kobe:/hg/bsd/src$ hg glog --limit 5 @ 12786[tip]:12783,12785 368efb2b98b9 2009-08-03 03:00 +0300 keramida |\ Merge from head | | | o 12785 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson | | Add padding to struct inpcb, missed during our padding sweep earlier in | | | o 12784:12782 6b04ed36e454 2009-08-02 19:43 +0000 rwatson | | Many network stack subsystems use a single global data structure to hold | | o | 12783:12762,12782 c50060fec1db 2009-08-02 21:06 +0300 keramida |\| Merge from head | | | o 12782 8e4fc85e5aa3 2009-08-02 16:59 +0000 julian | | Stop uuidgen(2) from crashing in vimage kerenels. | | keramida@kobe:/hg/bsd/src$ Merging with 'head' often means that you can then publish this workspace so others can pull from it, and publish their own patches for the same workspace. How often you merge with each other is up to you. In the Greek documentation project we often merge after many days or several weeks. With projects that have a higher local change rate merging every day might be nicer (and result in far fewer conflicts). Extracting Patches from the Local Workspace =========================================== Keeping local changes means you may eventually want to push those changes towards the /head of Subversion. You'll have to extract patches for one or more file then. Since you have the tools to look at the local history, you can use "hg diff" with the last subversion commit, i.e. with the history shown above: keramida@kobe:/hg/bsd/src$ hg glog --limit 5 @ 12786[tip]:12783,12785 368efb2b98b9 2009-08-03 03:00 +0300 keramida |\ Merge from head | | | o 12785 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson | | Add padding to struct inpcb, missed during our padding sweep earlier in | | | o 12784:12782 6b04ed36e454 2009-08-02 19:43 +0000 rwatson | | Many network stack subsystems use a single global data structure to hold | | o | 12783:12762,12782 c50060fec1db 2009-08-02 21:06 +0300 keramida |\| Merge from head : : You can run "hg diff" between changesets 12785 and 12786 (tip): keramida@kobe:/hg/bsd/src$ hg diff -r 12785:tip | diffstat -p1 contrib/mg/Makefile | 29 + contrib/mg/README | 74 ++ contrib/mg/autoexec.c | 111 ++++ ... snip ... usr.bin/yacc/reader.c | 2 usr.sbin/chown/chgrp.1 | 10 usr.sbin/chown/chown.8 | 12 usr.sbin/chown/chown.c | 17 76 files changed, 18355 insertions(+), 44 deletions(-) keramida@kobe:/hg/bsd/src$ My own local workspace includes an import of OpenBSD's mg(1) editor. This shows as a single patch in the diff command I used above, along with *every* other file that differs in my local 'branch' of FreeBSD head. Let's assume, for example's sake, that you don't really care about mg(1) patches, and you want to look at everything else. The --include and --exclude options of "hg diff" help a lot there (short names -I and -X): keramida@kobe:/hg/bsd/src$ hg diff -r 12785:tip -X contrib/mg -X usr.bin/mg | diffstat -p1 contrib/top/top.X | 5 - contrib/top/top.c | 2 etc/Makefile | 6 + etc/mtree/BSD.games.dist | 16 +++ etc/mtree/BSD.usr.dist | 2 etc/mtree/BSD.var.dist | 2 libexec/rtld-elf/rtld.c | 2 share/mk/bsd.own.mk | 2 sys/amd64/conf/KOBE | 185 ++++++++++++++++++++++++++++++++++++++ sys/boot/common/interp.c | 2 sys/boot/common/interp_forth.c | 2 sys/conf/newvers.sh | 26 +++++ sys/i386/conf/KOBE | 195 +++++++++++++++++++++++++++++++++++++++++ usr.bin/Makefile | 5 + usr.bin/truss/amd64-fbsd.c | 4 usr.bin/truss/amd64-fbsd32.c | 3 usr.bin/truss/amd64-linux32.c | 4 usr.bin/truss/i386-fbsd.c | 4 usr.bin/truss/i386-linux.c | 4 usr.bin/truss/ia64-fbsd.c | 4 usr.bin/truss/powerpc-fbsd.c | 4 usr.bin/truss/sparc64-fbsd.c | 4 usr.bin/yacc/reader.c | 2 usr.sbin/chown/chgrp.1 | 10 +- usr.sbin/chown/chown.8 | 12 +- usr.sbin/chown/chown.c | 17 ++- 26 files changed, 480 insertions(+), 44 deletions(-) keramida@kobe:/hg/bsd/src$ If you want to commit *all* the local changes as a single patch to Subversion, you can keep refining the --exclude/--include patterns until the final patch looks and smells "right". If you know the directories that you want to diff, i.e. you want to commit all the local `usr.sbin/chown' changes in one subversion changeset, you can use a directory with "hg diff" too (which works quite unsurprisingly like "svn diff"): keramida@kobe:/hg/bsd/src$ hg diff -r 12785:tip usr.sbin/chown | diffstat -p1 usr.sbin/chown/chgrp.1 | 10 +++++++--- usr.sbin/chown/chown.8 | 12 ++++++++---- usr.sbin/chown/chown.c | 17 +++++++++++------ 3 files changed, 26 insertions(+), 13 deletions(-) keramida@kobe:/hg/bsd/src$ Extracting Local Changesets as Patches ====================================== Another option is to extract only the very specific local commit that affected a file, i.e. my local `usr.sbin/chown/chown.c' changes. First you'd have to look at the local history of the file: keramida@kobe:/hg/bsd/src$ hg log --style compact usr.sbin/chown/chown.c 12010:11998,12009 7f4fa839afed 2009-06-20 00:50 +0300 keramida Merge from head 12002 96e04082ef3f 2009-06-19 15:58 +0000 brooks In preparation for raising NGROUPS and NGROUPS_MAX, change base 7782 141cd5ffef80 2009-01-22 07:18 +0200 keramida Add a new -x option to chown and chgrp, to inhibit file system 0 dd5ed0412a8b 2007-12-31 22:03 +0000 jhb Actually declare the kern.features sysctl node. keramida@kobe:/hg/bsd/src$ >From this output it's obvious my local changes were made on 2009-01-22 07:18 +0200, and they are available as changeset 7782:141cd5ffef80. You can extract this changeset only with "hg export": keramida@kobe:/hg/bsd/src$ hg export 141cd5ffef80 # HG changeset patch # User Giorgos Keramidas # Date 1232601528 -7200 # Branch head # Node ID 141cd5ffef80ff979627d8898500c92984287426 # Parent e8506b2ac7aefbfb875f0def0de8dd6441885a40 Add a new -x option to chown and chgrp, to inhibit file system mount point traversal. The -x option is documented, like -v, as a non-standard option in the COMPATIBILITY manpage sections. diff -r e8506b2ac7ae -r 141cd5ffef80 usr.sbin/chown/chgrp.1 --- a/usr.sbin/chown/chgrp.1 Wed Jan 21 21:31:33 2009 +0200 +++ b/usr.sbin/chown/chgrp.1 Thu Jan 22 07:18:48 2009 +0200 @@ -31,7 +31,7 @@ .\" @(#)chgrp.1 8.3 (Berkeley) 3/31/94 .\" $FreeBSD$ .\" -.Dd April 25, 2003 +.Dd January 22, 2009 .Dt CHGRP 1 .Os .Sh NAME @@ -39,7 +39,7 @@ .Nd change group .Sh SYNOPSIS .Nm -.Op Fl fhv +.Op Fl fhvx .Oo .Fl R ... snip ... This patch is _directly_ usable with `patch -p1' in a checkout of /head from Subversion, but it *may* require a bit of `svn merge' work if you have fast-forwarded chown/chgrp to its latest 'head' version. It is not a diff of the *latest* chown/chgrp from /head but a _precise_ copy of the past changeset, as it was committed. More... ======= * You can browse the 'clean' head/ copy I am using at http://hg.hellug.gr/freebsd/head/ Note: this only has the head history since 2007-12-31. For older head commits, you will have to use a new "convert" run and it will change all the commit/changeset hashes even if their patch data is identical. * You can find a compressed 'bundle' file called 'head.hg' in my home directory at freefall. This can be used to 'seed' the initial copy of your local 'head', eg. by pulling directly from the bundle: % cd /var/tmp % scp freefall.freebsd.org:'~keramida/head.hg' . % cd ~ % mkdir -p ~/work/freebsd/head % hg init ~/work/freebsd/head % cd ~/work/freebsd/head % hg pull /var/tmp/head.hg * If you plan to use the incremental conversion script I described earlier in this message, you will also need a "SHA map" file that maps Subversion changesets to Mercurial changeset hashes. This is also available at freefall as `~keramida/head.shamap' and you have to copy it to your `head/.hg/shamap' file. Then either run the "hg convert" extension manually or use a small shell wrapper like the one I pasted here. * For more information about some of the extensions I've mentioned it is always a good idea to check the Mercurial Wiki at: http://www.selenic.com/mercurial/ I hope all this helps a bit... If you need more help with publishing local workspaces over http and/or extracting patches (these are often two of the points where help is necessary and welcome), please feel free to ask. I've been using this sort of workflow for local changesets quite some time and I know enough about Mercurial to help where needed. From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 08:44:44 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C34FC1065673 for ; Mon, 3 Aug 2009 08:44:44 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 4F4CE8FC1E for ; Mon, 3 Aug 2009 08:44:43 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so2177931bwz.43 for ; Mon, 03 Aug 2009 01:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=XArBq8fuNWsXuZOJcZWtKOJtJj7hwcM/R5iIqi4qZRg=; b=KuA7XKoR9hsED+JX2l/LyrSJvt8CefDZUFER/QfBBicRatxfauUHHiM10Pjqm3fEHQ +haf8PYaoniJiF2OKtfyEECqW6VtZdf8ZrvNO6w+AG4iK/p6U3lMPJwhZhw8sXLYayD+ VTPzIPTOUiqCqdirXNWRYWMbUCuNQjFtwOWkI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=ciW8/DAACb7hGnqyEQYidb+NQuKtPy9SUvSN3OW93GHbgwqMV+EpjwRIEJWgN1noxN ZuHdFcRRmViVEOCJUhelpnjRj0DN6iB/mFaWRLGohgxVUGZV/BxYinoI62zkpouVcN9O Zo2tNTs7whxMrcUaj9/JZ4dRqpenZK/n8uTV8= MIME-Version: 1.0 Received: by 10.204.102.14 with SMTP id e14mr574747bko.183.1249287566294; Mon, 03 Aug 2009 01:19:26 -0700 (PDT) Date: Mon, 3 Aug 2009 08:19:26 +0000 Message-ID: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> From: Maslan To: FreeBSD Hackers Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: sosend() and mbuf 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, 03 Aug 2009 08:44:45 -0000 Hello Guys, I can't find useful information on sosend(), I would like to send some plain text through sosend() Here is what i got so far, I don't know how to use mbuf with sosend() to achieve this. ret = socreate(PF_INET, &s, SOCK_STREAM, IPPROTO_TCP, curthread->td_ucred, curthread); printf("socreate -> %d\n", ret); bzero(&sa, sizeof(sa)); sa.sin_len = sizeof(sa); sa.sin_family = AF_INET; sa.sin_port = htons(8888); sa.sin_addr.s_addr = INADDR_ANY; sobind(s, (struct sockaddr *)&sa, curthread); printf("sobind -> %d\n", ret); ret = solisten(s, 4, curthread); printf("solisten -> %d\n", ret); ret = soaccept(s, (struct sockaddr**)&psa); printf("soaccept -> %d\n", ret); tsleep(curthread, PDROP, "kHTTP tsleep", 10*hz); /* iovec */ aiov.iov_base = buf; aiov.iov_len = strlen(buf); /* auio */ auio.uio_iov = &aiov; auio.uio_iovcnt = 1; auio.uio_offset = 0; auio.uio_resid = strlen(buf); auio.uio_rw = UIO_WRITE; auio.uio_segflg = UIO_SYSSPACE; auio.uio_td = curthread; --------> ret = sosend(s, (struct sockaddr*)&sa, &auio, 0, 0, 0, curthread); printf("sosend -> %d\n", ret); ret = soclose(s); printf("soclose -> %d\n", ret); Thanks a lot From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 14:08:34 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1E8D21065670 for ; Mon, 3 Aug 2009 14:08:34 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id D7C0E8FC12 for ; Mon, 3 Aug 2009 14:08:33 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 23DB76D418; Mon, 3 Aug 2009 14:08:33 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 02BE6844DC; Mon, 3 Aug 2009 16:08:32 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> Date: Mon, 03 Aug 2009 16:08:32 +0200 In-Reply-To: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> (Maslan's message of "Mon, 3 Aug 2009 08:19:26 +0000") Message-ID: <864ospvvkv.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 03 Aug 2009 14:08:34 -0000 Maslan writes: > I can't find useful information on sosend(), I would like to send some > plain text through sosend() > Here is what i got so far, I don't know how to use mbuf with sosend() > to achieve this. You need to stick your "plain text" in an mbuf. See 'man 9 socket' and 'man 9 mbuf' for details. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 14:28:39 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 77231106564A; Mon, 3 Aug 2009 14:28:39 +0000 (UTC) (envelope-from linda.messerschmidt@gmail.com) Received: from mail-qy0-f191.google.com (mail-qy0-f191.google.com [209.85.221.191]) by mx1.freebsd.org (Postfix) with ESMTP id 17D7C8FC12; Mon, 3 Aug 2009 14:28:38 +0000 (UTC) (envelope-from linda.messerschmidt@gmail.com) Received: by qyk29 with SMTP id 29so4464266qyk.3 for ; Mon, 03 Aug 2009 07:28:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=/iqLjUfphs98rNeJSXJctDlNm1K5My9rzCqcAFY8fxo=; b=SP938Ym/cl9hnjBx6XE0xwiXQLg44PfTxltZskKAuvyCGsbp91dcPxDxL4LHeseMvL hl+yplH5eKFuU5Ks3wGuyABKVePuGMdfHvQkFdaek8Ka8MbBNCmexwjIPJWDnR33KjeV GiqR9ZPkYJUM5jiz5UC8kzYYZ35yGIiJ4Q4Yc= 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:content-transfer-encoding; b=c67lSlRB1Jx8UWkO5HvaohGIFOXMH8lLurGuxzWDA4prIK2C/b9wet4YHDfd2t6M+5 10d04nLJtXTC2SdDrb8gMvpkpWDSZ5iVvTDfv/0hbUnjDQMsfiOX8qy5dnEUOkFJXCex wGUkE2RBmyTZM9a1Pg3ajKmc/DH69dLJMJLt4= MIME-Version: 1.0 Received: by 10.229.100.14 with SMTP id w14mr1049808qcn.48.1249309718095; Mon, 03 Aug 2009 07:28:38 -0700 (PDT) In-Reply-To: <3bbf2fe10908011834j68045a32wd84f52a8321932e6@mail.gmail.com> References: <237c27100908010841g5abd3183w479121b2ba7b0c91@mail.gmail.com> <3bbf2fe10908011014r2fda9245xc7c5f71fcc544d10@mail.gmail.com> <237c27100908011427j587a6c94lc3762d7ce73c3f31@mail.gmail.com> <3bbf2fe10908011834j68045a32wd84f52a8321932e6@mail.gmail.com> Date: Mon, 3 Aug 2009 10:28:38 -0400 Message-ID: <237c27100908030728x78d50667g864fb7fc6fed7e43@mail.gmail.com> From: Linda Messerschmidt To: freebsd-hackers@freebsd.org, attilio@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Subject: Re: Where have all the vnodes gone? 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, 03 Aug 2009 14:28:39 -0000 Sorry, I did not mean to reply off-list. (I had asked if the kernel options suggested were appropriate for a production system.) On Sat, Aug 1, 2009 at 9:34 PM, Attilio Rao wrote: > Penalties in term of overhead are pretty huge. That would probably mean not putting it on that box. Don't get me in trouble! :) > Did it happen in a production kernel? Yes, very much so. > For what I know, somebody could reproduce a vnodes leak randomly, you > seem to be the only one who can reproduce it easilly and it would be > very important to analyze the situation. I will see if I can reproduce the behavior on a test box with these options. If it really is the rsync stuff we're doing, that should be possible. From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 19:52:06 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F8471065672 for ; Mon, 3 Aug 2009 19:52:06 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 1375F8FC14 for ; Mon, 3 Aug 2009 19:52:05 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id DC66B6D41C; Mon, 3 Aug 2009 19:52:04 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id BAA15844DC; Mon, 3 Aug 2009 21:52:04 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> Date: Mon, 03 Aug 2009 21:52:04 +0200 In-Reply-To: <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> (Maslan's message of "Mon, 3 Aug 2009 17:43:14 +0000") Message-ID: <86eirs65gb.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: hackers@freebsd.org Subject: Re: sosend() and mbuf 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, 03 Aug 2009 19:52:06 -0000 [please cc: the list] Maslan writes: > man 9 sosend: > Data may be sent directly from kernel or user memory via the uio > argument, or as an mbuf chain via top, avoid- ing a data copy. > Only one of the uio or top pointers may be non-NULL Hmm, I missed that part. It never occurred to me to *not* use mbufs. I guess the question is: what is your question? Does your code work? If it doesn't, where and how does it fail? If it does, why are you asking? In any case, 'man 9 sosend' answers the "I can't find useful information on sosend()" part of your email. If you still have questions after reading that, try looking at existing kernel code that uses sosend(9) with iovecs (or with mbufs, if you decide to go that route). DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 20:25:13 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 223BC106566B for ; Mon, 3 Aug 2009 20:25:13 +0000 (UTC) (envelope-from aavzz@yandex.ru) Received: from forward6.yandex.ru (forward6.yandex.ru [77.88.60.125]) by mx1.freebsd.org (Postfix) with ESMTP id D176F8FC17 for ; Mon, 3 Aug 2009 20:25:12 +0000 (UTC) (envelope-from aavzz@yandex.ru) Received: from smtp9.yandex.ru (smtp9.yandex.ru [77.88.61.35]) by forward6.yandex.ru (Yandex) with ESMTP id 5C2B0DC8095 for ; Tue, 4 Aug 2009 00:13:21 +0400 (MSD) Received: from [192.168.1.2] (ppp92-100-96-20.pppoe.avangarddsl.ru [92.100.96.20]) by smtp9.yandex.ru (Yandex) with ESMTPA id 2ABC8158805A for ; Tue, 4 Aug 2009 00:13:21 +0400 (MSD) From: Alex Zimnitsky To: freebsd-hackers@freebsd.org Content-Type: text/plain Date: Mon, 03 Aug 2009 23:56:43 +0400 Message-Id: <1249329403.2928.11.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 7bit X-Yandex-TimeMark: 1249330401 X-Yandex-Spam: 1 X-Yandex-Front: smtp9.yandex.ru Subject: sys/cdefs.h not included automatically 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, 03 Aug 2009 20:25:13 -0000 Hello, freebsd-hackers my system is 7.2-RELEASE there is a which is included in a lot of headers, but a few of them instead of including it, generate "#error this file needs sys/cdefs.h". seems like an omission, but if it's intentional I'm curious why it is so. thanks a lot, Alex From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 21:25:30 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 096C3106564A for ; Mon, 3 Aug 2009 21:25:30 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 8528F8FC08 for ; Mon, 3 Aug 2009 21:25:29 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so2566815bwz.43 for ; Mon, 03 Aug 2009 14:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=C1xzl5ZzV/j1rXlLhunYQHB4S52D6U1kxJGvztKURrM=; b=BtvleoWxEMCZL/JaBCtKteR45exk6wPBvVLfkVpBkeJuHxoV31t9moez0p38iKPVzS ZsQUDJ8WNqHggXK1kMQ3ZTTxW23mpJKwprd/AfQKAfuAt5c5d2pRnz9gECii0qbLCOtK QUwPicfJxcLKZCvYAv/lG25n6HH9IRUGLC704= 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=Tg0hEvWG824JW3rIc4CUQLcCOqW05EA9faEzMfBrHn/TkZGYiHzRqJWH85KLVN6gMK khWWoNYXptpK09Nxg1LwdgxIJ+NDDNvY8ZpGZuM/XCQX7836O8LzNJJpRvskMyADa1vk nY1Rnkn/IBtIyPNud47emMyCCURSe7lDLaXuw= MIME-Version: 1.0 Received: by 10.204.67.146 with SMTP id r18mr235553bki.88.1249334728318; Mon, 03 Aug 2009 14:25:28 -0700 (PDT) In-Reply-To: <86eirs65gb.fsf@ds4.des.no> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> Date: Mon, 3 Aug 2009 21:25:27 +0000 Message-ID: <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> From: Maslan To: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 03 Aug 2009 21:25:30 -0000 No my code doesn't work, I thought it may be because that soaccept() -which is not found in man 9- is non-blocking, so i've to put my code in a thread. Now i got another problem, when I open a text file from this thread, the kernel crashes, I'm sure that its the thread. kthread_create((void *)thread_main, NULL, NULL, RFNOWAIT, 0, "thread"); void thread_main(){ struct thread *td =3D curthread; int ret; int fd; ret =3D f_open("/path/to/file.txt", &fd); printf("%d\n", ret); tsleep(td, PDROP, "test tsleep", 10*hz); f_close(fd); kthread_exit(0); } int f_open(char *filename, int *fd){ struct thread *td =3D curthread; int ret =3D kern_open(td, filename, UIO_SYSSPACE, O_RDONLY, FREAD); if(!ret){ *fd =3D td->td_retval[0]; return 1; } return 0; } I've to finish up this problem to go back for the first one. Can you figure out what's wrong with this code, it works when I call thread_main() rather than kthread_create((void *)thread_main, ..... Thanks a lot 2009/8/3 Dag-Erling Sm=F8rgrav : > [please cc: the list] > > Maslan writes: >> man 9 sosend: >> Data may be sent directly from kernel or user memory via the uio >> argument, or as an mbuf chain via top, avoid- ing a data copy. >> Only one of the uio or top pointers may be non-NULL > > Hmm, I missed that part. It never occurred to me to *not* use mbufs. > > I guess the question is: what is your question? Does your code work? > If it doesn't, where and how does it fail? If it does, why are you > asking? > > In any case, 'man 9 sosend' answers the "I can't find useful information > on sosend()" part of your email. If you still have questions after > reading that, try looking at existing kernel code that uses sosend(9) > with iovecs (or with mbufs, if you decide to go that route). > > DES > -- > Dag-Erling Sm=F8rgrav - des@des.no > From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 22:01:51 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CF49D106566C for ; Mon, 3 Aug 2009 22:01:51 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 90EAD8FC15 for ; Mon, 3 Aug 2009 22:01:51 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 98AA56D418; Mon, 3 Aug 2009 22:01:50 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 6FD36844C4; Tue, 4 Aug 2009 00:01:50 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> Date: Tue, 04 Aug 2009 00:01:50 +0200 In-Reply-To: <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> (Maslan's message of "Mon, 3 Aug 2009 21:25:27 +0000") Message-ID: <86k51k4kvl.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 03 Aug 2009 22:01:52 -0000 Maslan writes: > Now i got another problem, when I open a text file from this thread, > the kernel crashes, I'm sure that its the thread. If the kernel crashed, I assume you have a dump and a backtrace and can tell us *where* it crashed? One thing that springs to mind is that kern_open() will dereference td->td_proc, and AFAIK kthread_create() does not associate the thread with a process. > kthread_create((void *)thread_main, NULL, NULL, RFNOWAIT, 0, > "thread"); There is no kthread_create() in head. I assume you're working on 7? You shouldn't. The cast is incorrect. I assume you put it there to silence the warning telling you that your code was wrong. This will create a new thread in process 0, which is probably not what you want (although it should work). It would be better to create a separate process for your code and create the thread there. You can do both in a single function call using kproc_kthread_add(). You don't show the part of your code where you call sched_add() to actually start the thread. > void thread_main(){ There are at least two problems here: 1) thread_main() is supposed to take a void * argument, and 2) you disabled or ignored the compiler warnings that told you this was wrong. > f_close(fd); You didn't include the definition of f_close(), so I can't tell if there's anything wrong with it. > int f_open(char *filename, int *fd){ > struct thread *td =3D curthread; > int ret =3D kern_open(td, filename, UIO_SYSSPACE, O_RDONLY, FREAD); > if(!ret){ > *fd =3D td->td_retval[0]; > return 1; > } > return 0; > } This is overly complicated. There is no reason to conditionalize the assignment to *fd; just do it and return ret. FREAD is not a valid argument to kern_open(). Well, technically, it's with the expected range, but it doesn't do what you think it does. This doesn't really matter, though, because the mode argument is not used when opening an existing file. That's all the help I can give until you provide a stack trace from the crash and the complete code, not just selected excerpts. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 22:03:41 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F32741065689 for ; Mon, 3 Aug 2009 22:03:41 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id B40278FC24 for ; Mon, 3 Aug 2009 22:03:41 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 19F416D41E; Mon, 3 Aug 2009 22:03:41 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id EF6CE844C4; Tue, 4 Aug 2009 00:03:40 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> Date: Tue, 04 Aug 2009 00:03:40 +0200 In-Reply-To: <86k51k4kvl.fsf@ds4.des.no> ("Dag-Erling =?utf-8?Q?Sm=C3=B8rg?= =?utf-8?Q?rav=22's?= message of "Tue, 04 Aug 2009 00:01:50 +0200") Message-ID: <86fxc84ksj.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 03 Aug 2009 22:03:42 -0000 Dag-Erling Sm=C3=B8rgrav writes: > One thing that springs to mind is that kern_open() will dereference > td->td_proc, and AFAIK kthread_create() does not associate the thread > with a process. This is wrong, and contradicts what I wrote further down. Just ignore it. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 23:05:08 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 01B0E106564A for ; Mon, 3 Aug 2009 23:05:08 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-fx0-f224.google.com (mail-fx0-f224.google.com [209.85.220.224]) by mx1.freebsd.org (Postfix) with ESMTP id 7A26F8FC0A for ; Mon, 3 Aug 2009 23:05:07 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by fxm24 with SMTP id 24so2989749fxm.36 for ; Mon, 03 Aug 2009 16:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=UDOB8fG9WhAiflgcbF7bylvDx9eFaHeOuB1UMcudUYU=; b=U8BDcicQLVVUmlk/tw7jp3KMV0X2zYW2nk8gTuwX5twUGcLJKYqHjV1PpQAndL9nWS pPxitNmjhOFb/ij8gKd9HmVoEo6my4R3vdkXaDrAplwfVXOhFlyPV0c++fOCsER7wNR1 ua3NEy2ONWuIR20a9FxJr40zOUrgdKVYhOCN4= 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=jDQ0vV8fj9lEZf40h3paa7p53qO8snT14cVtpckgalQYmcYu4blzuOxHYs2ZYamiOR m5caFPWozza8h/ZMeAEuoGiZwcfmzzXf0gp2Y6kJBqMBX5eq8fq5+GfEVAohlTTAgBD+ zalZPVIagnrxwTH7P1N9fLOS0MSZIjWvZZFqs= MIME-Version: 1.0 Received: by 10.204.100.11 with SMTP id w11mr8716947bkn.32.1249340317104; Mon, 03 Aug 2009 15:58:37 -0700 (PDT) In-Reply-To: <86fxc84ksj.fsf@ds4.des.no> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> Date: Mon, 3 Aug 2009 22:58:37 +0000 Message-ID: <319cceca0908031558h1bd779b1pac3c9454986f5488@mail.gmail.com> From: Maslan To: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= Content-Type: multipart/mixed; boundary=00163646be02cdfa00047044b5ba X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 03 Aug 2009 23:05:08 -0000 --00163646be02cdfa00047044b5ba Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I'm running out 7.2-RELEASE-p2 Here is my bt GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you ar= e welcome to change it and/or distribute copies of it under certain condition= s. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-marcel-freebsd"... Unread portion of the kernel message buffer: loaded. Fatal trap 12: page fault while in kernel mode cpuid =3D 1; apic id =3D 01 fault virtual address =3D 0x10 fault code =3D supervisor read, page not present instruction pointer =3D 0x20:0xc085935b stack pointer =3D 0x28:0xe6cd3a28 frame pointer =3D 0x28:0xe6cd3aa4 code segment =3D base 0x0, limit 0xfffff, type 0x1b =3D DPL 0, pres 1, def32 1, gran 1 processor eflags =3D interrupt enabled, resume, IOPL =3D 0 current process =3D 1354 (test) trap number =3D 12 panic: page fault cpuid =3D 1 Uptime: 4m45s Physical memory: 1001 MB Dumping 119 MB: 104 88 72 56 40 24 8 Reading symbols from /boot/kernel/snd_hda.ko...Reading symbols from /boot/kernel/snd_hda.ko.symbols...done. done. Loaded symbols for /boot/kernel/snd_hda.ko Reading symbols from /boot/kernel/sound.ko...Reading symbols from /boot/kernel/sound.ko.symbols...done. done. Loaded symbols for /boot/kernel/sound.ko Reading symbols from /boot/kernel/if_wpi.ko...Reading symbols from /boot/kernel/if_wpi.ko.symbols...done. done. Loaded symbols for /boot/kernel/if_wpi.ko Reading symbols from /boot/kernel/wpifw.ko...Reading symbols from /boot/kernel/wpifw.ko.symbols...done. done. Loaded symbols for /boot/kernel/wpifw.ko Reading symbols from /boot/kernel/acpi.ko...Reading symbols from /boot/kernel/acpi.ko.symbols...done. done. Loaded symbols for /boot/kernel/acpi.ko Reading symbols from /boot/kernel/i915.ko...Reading symbols from /boot/kernel/i915.ko.symbols...done. done. Loaded symbols for /boot/kernel/i915.ko Reading symbols from /boot/kernel/drm.ko...Reading symbols from /boot/kernel/drm.ko.symbols...done. done. Loaded symbols for /boot/kernel/drm.ko Reading symbols from ./test.ko...done. Loaded symbols for ./test.ko #0 doadump () at pcpu.h:196 196 pcpu.h: No such file or directory. in pcpu.h (kgdb) bt #0 doadump () at pcpu.h:196 #1 0xc07e25c7 in boot (howto=3D260) at /usr/src/sys/kern/kern_shutdown.c:4= 18 #2 0xc07e2899 in panic (fmt=3DVariable "fmt" is not available. ) at /usr/src/sys/kern/kern_shutdown.c:574 #3 0xc0ae3efc in trap_fatal (frame=3D0xe6cd39e8, eva=3D16) at /usr/src/sys/i386/i386/trap.c:939 #4 0xc0ae4180 in trap_pfault (frame=3D0xe6cd39e8, usermode=3D0, eva=3D16) at /usr/src/sys/i386/i386/trap.c:852 #5 0xc0ae4b2c in trap (frame=3D0xe6cd39e8) at /usr/src/sys/i386/i386/trap.= c:530 #6 0xc0ac923b in calltrap () at /usr/src/sys/i386/i386/exception.s:159 #7 0xc085935b in namei (ndp=3D0xe6cd3bc8) at /usr/src/sys/kern/vfs_lookup.= c:191 #8 0xc08706d7 in vn_open_cred (ndp=3D0xe6cd3bc8, flagp=3D0xe6cd3cc4, cmode= =3D1, cred=3D0xc408fc00, fp=3D0xc4b5b344) at /usr/src/sys/kern/vfs_vnops.c:18= 8 #9 0xc08709a3 in vn_open (ndp=3D0xe6cd3bc8, flagp=3D0xe6cd3cc4, cmode=3D1, fp=3D0xc4b5b344) at /usr/src/sys/kern/vfs_vnops.c:94 #10 0xc086e0d3 in kern_open (td=3D0xc499dd20, path=3D0xc4c7a978 "/root/test= .txt", pathseg=3DUIO_SYSSPACE, flags=3D1, mode=3D1) at /usr/src/sys/kern/vfs_syscalls.c:1042 #11 0xc4c7a805 in f_open () from ./test.ko #12 0xc4c7a8a1 in thread_main () from ./test.ko #13 0xc07bd079 in fork_exit (callout=3D0xc4c7a880 , arg=3D0x0, frame=3D0xe6cd3d38) at /usr/src/sys/kern/kern_fork.c:810 #14 0xc0ac92b0 in fork_trampoline () at /usr/src/sys/i386/i386/exception.s:= 264 On Mon, Aug 3, 2009 at 10:03 PM, Dag-Erling Sm=F8rgrav wrote: > Dag-Erling Sm=F8rgrav writes: >> One thing that springs to mind is that kern_open() will dereference >> td->td_proc, and AFAIK kthread_create() does not associate the thread >> with a process. > > This is wrong, and contradicts what I wrote further down. Just ignore > it. > > DES > -- > Dag-Erling Sm=F8rgrav - des@des.no > --00163646be02cdfa00047044b5ba-- From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 3 23:50:58 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73E3C1065675 for ; Mon, 3 Aug 2009 23:50:58 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by mx1.freebsd.org (Postfix) with ESMTP id 08EF48FC19 for ; Mon, 3 Aug 2009 23:50:57 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-045-255.pools.arcor-ip.net [88.66.45.255]) by mrelayeu.kundenserver.de (node=mrelayeu4) with ESMTP (Nemesis) id 0ML21M-1MY76h1B0j-0000x7; Tue, 04 Aug 2009 01:38:22 +0200 Received: (qmail 77490 invoked from network); 3 Aug 2009 23:38:15 -0000 Received: from kvm.laiers.local (HELO kvm.localnet) (192.168.4.200) by router.laiers.local with SMTP; 3 Aug 2009 23:38:15 -0000 From: Max Laier Organization: FreeBSD To: freebsd-hackers@freebsd.org Date: Tue, 4 Aug 2009 01:38:13 +0200 User-Agent: KMail/1.11.4 (Linux/2.6.30-ARCH; KDE/4.2.4; x86_64; ; ) References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> In-Reply-To: <86fxc84ksj.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200908040138.14743.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1+xoCsLYgUP7gE64XN0/oHvvyvKKtbE9+IG6H8 5SXFL+VYkJTjiM5XX1/FnmiOe7v5uHpD0ysJ7GgTCR5uCQPYGm ncO/lewKQcXcDy1VN2CBQ== Cc: Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?= , Maslan Subject: Re: sosend() and mbuf 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, 03 Aug 2009 23:50:58 -0000 On Tuesday 04 August 2009 00:03:40 Dag-Erling Sm=C3=B8rgrav wrote: > Dag-Erling Sm=C3=B8rgrav writes: > > One thing that springs to mind is that kern_open() will dereference > > td->td_proc, and AFAIK kthread_create() does not associate the thread > > with a process. > > This is wrong, and contradicts what I wrote further down. Just ignore > it. IIRC, kernel threads don't have root. =2D-=20 /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 05:26:36 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2D1FA106564A for ; Tue, 4 Aug 2009 05:26:36 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id B4D958FC18 for ; Tue, 4 Aug 2009 05:26:35 +0000 (UTC) (envelope-from unixmania@gmail.com) Received: by fxm6 with SMTP id 6so1741643fxm.43 for ; Mon, 03 Aug 2009 22:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=lzSl0p5hC74DvyukIj6aeuaxx2ZgoEO2vm45zrScgn0=; b=He+Jku0v4BtjhVZO9Mq+hACryo6ttrf0DfYCEV7laDasJAQF6PygW+cCAkMeUullnu 0PepEE6IqJv40B27LoYxxl66PD4z/Mzb0Qz+5TMyDjeqZUQ33nKsV7Gv8ytwrIy/x/eB 2v6eXzmVuD2OcpoZzEj5pB4/MK2ZYA+cKkC04= 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=H1TosC5UmxxJg5FjpCWciLzu20NO8/tQzIV/Z1TClxDEb8qtTW1y+kJdVVKHApqh+w lqY9wYBwegcSkL1pH9xFZRuhuYD7ORfic4abNrH4j0lfyGHkkxzawnsnS10/99xKbOxr CjrKeP2f32JVJyf2P+IP+RiILxSpyEes4AsNY= MIME-Version: 1.0 Received: by 10.239.160.84 with SMTP id b20mr619932hbd.149.1249363594604; Mon, 03 Aug 2009 22:26:34 -0700 (PDT) In-Reply-To: <1249329403.2928.11.camel@localhost.localdomain> References: <1249329403.2928.11.camel@localhost.localdomain> Date: Tue, 4 Aug 2009 02:26:34 -0300 Message-ID: From: "Carlos A. M. dos Santos" To: Alex Zimnitsky Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: sys/cdefs.h not included automatically 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, 04 Aug 2009 05:26:36 -0000 On Mon, Aug 3, 2009 at 4:56 PM, Alex Zimnitsky wrote: > Hello, freebsd-hackers > > my system is 7.2-RELEASE > > there is a which is included in a lot of headers, but a > few of them instead of including it, generate "#error this file needs > sys/cdefs.h". > > seems like an omission, but if it's intentional I'm curious why it is > so. Those files are not intended to be directly included by user programs. You usually include them indirectly. See, for instance, pthread.h and stddef.h. -- My preferred quotation of Robert Louis Stevenson is "You cannot make an omelette without breaking eggs". Not because I like the omelettes, but because I like the sound of eggs being broken. From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 09:27:07 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E77781065674 for ; Tue, 4 Aug 2009 09:27:07 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id 7698C8FC0A for ; Tue, 4 Aug 2009 09:27:07 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by fxm6 with SMTP id 6so1823721fxm.43 for ; Tue, 04 Aug 2009 02:27:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=odhsg175utUGVg8sp75fDUmoO5wOMTW1SrirpPUuP+A=; b=xeX4ct+vX7VMIrhgqJyFj4N0eH8+WLvGcXzFMNq6R1n+3zbms+WHlGv2aXYXLwi465 of8QlbBwzl+LGQjAv50unmxYtt9/lb/UR7d7FyR+T0XvqdOfdqVmtK/J9ayEkcl/JpSR sbuflCf3Y3K3UU9d0su6Zv16Qkke6j+DXo9Pg= 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=PrCcNUnq8v1+C0jeIcr/RKnhE558DX879YCfpKFILa06wFhbRnKkorzkVP5N//CN8g TdKLX3KKiocT7Wrm7LcVoCwwphe+Lmu8aenCOr/EZeMfwO1g27PrcikzNAkc9c/zgvP+ uhMmWzyI6YC8G//a9DOrqMvlpp136JkXTAcv0= MIME-Version: 1.0 Received: by 10.204.71.68 with SMTP id g4mr6960247bkj.135.1249378026479; Tue, 04 Aug 2009 02:27:06 -0700 (PDT) In-Reply-To: <200908040138.14743.max@love2party.net> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> Date: Tue, 4 Aug 2009 09:27:06 +0000 Message-ID: <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> From: Maslan To: Max Laier Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 09:27:08 -0000 man kthread says: The kthread_create() function is used to create a kernel thread. The new thread shares its address space with process 0, the swapper process, a= nd runs in kernel mode only. However, when i checked the pid & tid of the new created thread it was not the same as the parent nor as the proc0 & thread0 simple printf() gives: swap procid=3D0, threadid=3D0 procid=3D1680, threadid=3D100089 procid=3D1681, threadid=3D100090 <--- created by kthread_create() 2009/8/3 Max Laier : > On Tuesday 04 August 2009 00:03:40 Dag-Erling Sm=F8rgrav wrote: >> Dag-Erling Sm=F8rgrav writes: >> > One thing that springs to mind is that kern_open() will dereference >> > td->td_proc, and AFAIK kthread_create() does not associate the thread >> > with a process. >> >> This is wrong, and contradicts what I wrote further down. Just ignore >> it. > > IIRC, kernel threads don't have root. > > -- > /"\ Best regards, | mlaier@freebsd.org > \ / Max Laier | ICQ #67774661 > X http://pf4freebsd.love2party.net/ | mlaier@EFnet > / \ ASCII Ribbon Campaign | Against HTML Mail and News > > From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 09:30:37 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 444B31065678 for ; Tue, 4 Aug 2009 09:30:37 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 09DB98FC19 for ; Tue, 4 Aug 2009 09:30:37 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 72F841CEB9; Tue, 4 Aug 2009 11:30:36 +0200 (CEST) Date: Tue, 4 Aug 2009 11:30:36 +0200 From: Ed Schouten To: Maslan Message-ID: <20090804093036.GN1292@hoeg.nl> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JlQgkxKsF3TswZob" Content-Disposition: inline In-Reply-To: <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Max Laier , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 09:30:37 -0000 --JlQgkxKsF3TswZob Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, * Maslan wrote: > man kthread says: > The kthread_create() function is used to create a kernel thread. The new > thread shares its address space with process 0, the swapper process,= and ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > runs in kernel mode only. >=20 > However, when i checked the pid & tid of the new created thread it was > not the same as the parent nor as the proc0 & thread0 I am not sure, but sharing another process's address space doesn't have to imply it shares the same pid, right? --=20 Ed Schouten WWW: http://80386.nl/ --JlQgkxKsF3TswZob Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkp3/7wACgkQ52SDGA2eCwVvIACcCrlRhfMPbKzfx33X0h2iTwae 4yIAnjpQwlkGJ6fz2ttXWgWcBbI2qlPy =Ypn2 -----END PGP SIGNATURE----- --JlQgkxKsF3TswZob-- From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 09:40:00 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52E5710656B6 for ; Tue, 4 Aug 2009 09:40:00 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id CA8408FC20 for ; Tue, 4 Aug 2009 09:39:59 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so2810387bwz.43 for ; Tue, 04 Aug 2009 02:39:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=/X3ZHBOgVRUrjF86nrqyXVa8/k6XZoiihF0n8TtaMgQ=; b=sugD2vpiuFFXZgm3a+I8N5oDvu0ItuGEtiYUEMjqV0c9HJJcdqgsj5SKEZOQbppAym kVqlNObxQPoNvPzFeB0kpWjDweLDvIz8cq8Mdq2GD8EzDd/4F4CI/Q1naEWZlPGEWhrn xBjBN9S4m1lgw8nCxdgJWq2ZIpI45XJo/uuM0= 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=cM9BwSF7U8wLhJKml7BUewQ/3E2MIeZCSHkSsL1TktIf5QUvhLPqG77OHh5tdSANr5 bgpJ/njUf1EPa4zWqG8RU9+3IA/E4dPf0tdEhtXKRZU4bAYiIZq6BqPfs8ZY6T1mRa+3 RhKIvEUvjPQ2lqgLRKL8dBlZ/e/7pJbtEPerk= MIME-Version: 1.0 Received: by 10.204.66.17 with SMTP id l17mr2187028bki.51.1249378798721; Tue, 04 Aug 2009 02:39:58 -0700 (PDT) In-Reply-To: <20090804093036.GN1292@hoeg.nl> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> Date: Tue, 4 Aug 2009 09:39:58 +0000 Message-ID: <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> From: Maslan To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 09:40:02 -0000 I'm getting crazy, I don't know why kern_open() works in the module's main thread, but when I use it in another thread created by kthread_create() it crashes the kernel ??? On Tue, Aug 4, 2009 at 9:30 AM, Ed Schouten wrote: > Hi, > > * Maslan wrote: >> man kthread says: >> The kthread_create() function is used to create a kernel thread. The new >> thread shares its address space with process 0, the swapper process, and > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> runs in kernel mode only. >> >> However, when i checked the pid & tid of the new created thread it was >> not the same as the parent nor as the proc0 & thread0 > > I am not sure, but sharing another process's address space doesn't have > to imply it shares the same pid, right? > > -- > Ed Schouten > WWW: http://80386.nl/ > From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 09:41:42 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DA75B1065670 for ; Tue, 4 Aug 2009 09:41:42 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id 9EAB28FC15 for ; Tue, 4 Aug 2009 09:41:42 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 1986D1CEB2; Tue, 4 Aug 2009 11:41:42 +0200 (CEST) Date: Tue, 4 Aug 2009 11:41:42 +0200 From: Ed Schouten To: Maslan Message-ID: <20090804094142.GO1292@hoeg.nl> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="TgCXP+xznsSrEyty" Content-Disposition: inline In-Reply-To: <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 09:41:43 -0000 --TgCXP+xznsSrEyty Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Maslan wrote: > I'm getting crazy, >=20 > I don't know why kern_open() works in the module's main thread, but > when I use it in another thread created by kthread_create() it crashes > the kernel ??? Is it possible to call kern_open() from within a kernel thread anyway? kern_open() depends on a file descriptor table, right? --=20 Ed Schouten WWW: http://80386.nl/ --TgCXP+xznsSrEyty Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkp4AlYACgkQ52SDGA2eCwUY6gCbBcIIe97Fd16IydKdQq7hsdu2 MygAnjT3tOpUAac2pCbTd0/cZqivdhME =+i9g -----END PGP SIGNATURE----- --TgCXP+xznsSrEyty-- From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 09:52:53 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ED20106566C for ; Tue, 4 Aug 2009 09:52:53 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-fx0-f224.google.com (mail-fx0-f224.google.com [209.85.220.224]) by mx1.freebsd.org (Postfix) with ESMTP id 93A058FC12 for ; Tue, 4 Aug 2009 09:52:52 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by fxm24 with SMTP id 24so3208946fxm.36 for ; Tue, 04 Aug 2009 02:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=4hCc7nKltg/N6j6jJVEcwPqfJCP+42zna3k3Ene3cps=; b=knoA22za7/oJOQg3cj/WZtRzX/Sh+8Zg1kD55n7TT56P+q8SVrM+NqKa8ItaLzpgMa zmzDBEGSzpPMVcUzlscG7iHlZMAHXIJG3uGLP3xa0nEeGey4olZxCCupG0cHRF0zFJ5g KBWTQZoRZ4iQGImW4Dt33D0hA6J8Nvxt60sRQ= 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=JHUYL2egZmOhX6M+Ksqx8aOOYYOupnkvst0y/M9ACJlsqhl+XWjvwWD2zPQVp3S3fE VTy98PKBWtYmPtZIbEhxkjLgQXMZ3i+oKyhgeHeG2t5OIF6Rkyn7xSL0iWFeHVHap0Rw E8rq7DJdeFeLpGF6MabEHk8qpjstWtxh+3sGQ= MIME-Version: 1.0 Received: by 10.204.122.200 with SMTP id m8mr1096938bkr.176.1249379568716; Tue, 04 Aug 2009 02:52:48 -0700 (PDT) In-Reply-To: <20090804094142.GO1292@hoeg.nl> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> Date: Tue, 4 Aug 2009 09:52:48 +0000 Message-ID: <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> From: Maslan To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 09:52:53 -0000 > Is it possible to call kern_open() from within a kernel thread anyway? I think yes, It worked on the parent thread before creating a new kthread. See OpenKETA source, its using the same approach. > kern_open() depends on a file descriptor table, right? Yes, it returns a fd in the curthread->td_retval[0], which i should use within the same thread to deal with this file. From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 09:56:51 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 21DED106566B for ; Tue, 4 Aug 2009 09:56:51 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: from palm.hoeg.nl (mx0.hoeg.nl [IPv6:2001:7b8:613:100::211]) by mx1.freebsd.org (Postfix) with ESMTP id D95F08FC14 for ; Tue, 4 Aug 2009 09:56:50 +0000 (UTC) (envelope-from ed@hoeg.nl) Received: by palm.hoeg.nl (Postfix, from userid 1000) id 4F7251CEB2; Tue, 4 Aug 2009 11:56:50 +0200 (CEST) Date: Tue, 4 Aug 2009 11:56:50 +0200 From: Ed Schouten To: Maslan Message-ID: <20090804095650.GP1292@hoeg.nl> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="iFtobK8oO579scb0" Content-Disposition: inline In-Reply-To: <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 09:56:51 -0000 --iFtobK8oO579scb0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Maslan wrote: > > Is it possible to call kern_open() from within a kernel thread anyway? > I think yes, It worked on the parent thread before creating a new kthread. > See OpenKETA source, its using the same approach. > > kern_open() depends on a file descriptor table, right? > Yes, it returns a fd in the curthread->td_retval[0], which i should > use within the same thread to deal with this file. Didn't someone (Jeff Roberson?) develop some nice in-kernel API for accessing files some years ago? Why not use that? --=20 Ed Schouten WWW: http://80386.nl/ --iFtobK8oO579scb0 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iEYEARECAAYFAkp4BeIACgkQ52SDGA2eCwWragCfVTbU06SSmeNPwjzE696vL082 ALYAnicAMU9a8zM5yJIS19hsqxtieqel =IkLo -----END PGP SIGNATURE----- --iFtobK8oO579scb0-- From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 09:59:03 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA1A9106566C for ; Tue, 4 Aug 2009 09:59:03 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 4C1448FC14 for ; Tue, 4 Aug 2009 09:59:02 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so2818106bwz.43 for ; Tue, 04 Aug 2009 02:59:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=//HyqItquI0Vs1Kmws74AqHqoZ6xHPJkewtDtZlN7XU=; b=A06juPz4V5ydzgqZR/30g4FJ6uf15HkFg0Lf1/X/Cv2fk4lmYZU6SmS2vgf0aGcRCw B2wKZoMsvTwWZkUFGb/FyXnVpkEETEFYvaaidDBBdbNSkSNGoEX6D9UyL0F8ld7YmAjH yB424+RhTFU8ieGeF8KDP8MN2I/UlFGs4mB9k= 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=bapbEsQsyinxfjcCjVqH5tyFza3ZY59s3TNY8yRhwnOtu1GUtxpnRq2/GMJVhmroqi y+D+zpTb52LSTDRtaM/DgaHsGJbslyXyPtHrfkd5NWn73nTiPUDyylFohBNV+N6wV16w N/pd2Ew02PGg4HUFVQl9rn5VLC22Wg3GMjL6o= MIME-Version: 1.0 Received: by 10.204.54.4 with SMTP id o4mr10352342bkg.208.1249379941938; Tue, 04 Aug 2009 02:59:01 -0700 (PDT) In-Reply-To: <20090804095650.GP1292@hoeg.nl> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> <20090804095650.GP1292@hoeg.nl> Date: Tue, 4 Aug 2009 09:59:01 +0000 Message-ID: <319cceca0908040259q4537db80uc2ce9696f30bfc12@mail.gmail.com> From: Maslan To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 09:59:04 -0000 yes kio http://people.freebsd.org/~pjd/misc/kernio/ However, It's outdated. On Tue, Aug 4, 2009 at 9:56 AM, Ed Schouten wrote: > * Maslan wrote: >> > Is it possible to call kern_open() from within a kernel thread anyway? >> I think yes, It worked on the parent thread before creating a new kthread. >> See OpenKETA source, its using the same approach. >> > kern_open() depends on a file descriptor table, right? >> Yes, it returns a fd in the curthread->td_retval[0], which i should >> use within the same thread to deal with this file. > > Didn't someone (Jeff Roberson?) develop some nice in-kernel API for > accessing files some years ago? Why not use that? > > -- > Ed Schouten > WWW: http://80386.nl/ > From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 10:19:14 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B79C0106564A for ; Tue, 4 Aug 2009 10:19:14 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 384758FC15 for ; Tue, 4 Aug 2009 10:19:13 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so2826769bwz.43 for ; Tue, 04 Aug 2009 03:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Cb1MFQur8Nbt8Zt8Q9CGOZSTPmyxKUrTgP7oNSZd2is=; b=rf53Go1BfJUfCq9qu61ppe5b+4+LHRuEBiiTPqLF93pWYI4t6GEYZtlrpf4eVxQapm 0lwG03vBpoOYZVVcpJiZ6u1y+T4qIyp7cIsTIw9hoiQfwupmfjVinaX7UqQ7JfFvbii1 xH1QRoQq3xThlkUc6mPPnHqn666G0Rwnx0+sE= 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=NAv17G8DOHWSc8pQApzCvDuhyGslKMyKqQXb1cZRrfXckjzFRDt60AWSrnDwkw6M4f 4FhrcVZKVCl4Co+ywJs4jMDaHZbiQpCj/wvz8a1X4Ep+ED6izjYRagcqwe0ChFdQlKKU rON4WCvW7CKR5xRzGpSuuN4aDI0AZx3nijj8A= MIME-Version: 1.0 Received: by 10.204.54.4 with SMTP id o4mr10386534bkg.208.1249381152989; Tue, 04 Aug 2009 03:19:12 -0700 (PDT) In-Reply-To: <319cceca0908040259q4537db80uc2ce9696f30bfc12@mail.gmail.com> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> <20090804095650.GP1292@hoeg.nl> <319cceca0908040259q4537db80uc2ce9696f30bfc12@mail.gmail.com> Date: Tue, 4 Aug 2009 10:19:12 +0000 Message-ID: <319cceca0908040319x35bc8bcy7a869dd230419a50@mail.gmail.com> From: Maslan To: Ed Schouten Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 10:19:15 -0000 OpenKETA has its own kthread_create() with a little modification from kthread_create(), it associates the new thread with curthread not with the thread0. See /usr/sys/kern/kern_kthread.c: kthread_create() error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags, pages, &p2); OpenKETA:kthread_create() error = fork1(curthread, RFFDG | RFPROC | RFSTOPPED | flags, pages, &p2); I'll give it a try and see if it works. BUT i still can't understand why kern_open() don't work, except in the original thread. On Tue, Aug 4, 2009 at 9:59 AM, Maslan wrote: > yes kio http://people.freebsd.org/~pjd/misc/kernio/ > However, It's outdated. > > On Tue, Aug 4, 2009 at 9:56 AM, Ed Schouten wrote: >> * Maslan wrote: >>> > Is it possible to call kern_open() from within a kernel thread anyway? >>> I think yes, It worked on the parent thread before creating a new kthread. >>> See OpenKETA source, its using the same approach. >>> > kern_open() depends on a file descriptor table, right? >>> Yes, it returns a fd in the curthread->td_retval[0], which i should >>> use within the same thread to deal with this file. >> >> Didn't someone (Jeff Roberson?) develop some nice in-kernel API for >> accessing files some years ago? Why not use that? >> >> -- >> Ed Schouten >> WWW: http://80386.nl/ >> > From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 11:37:01 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BFBCB1065704 for ; Tue, 4 Aug 2009 11:37:01 +0000 (UTC) (envelope-from aavzz@yandex.ru) Received: from forward3.yandex.ru (forward3.yandex.ru [77.88.46.8]) by mx1.freebsd.org (Postfix) with ESMTP id 771558FC0A for ; Tue, 4 Aug 2009 11:37:01 +0000 (UTC) (envelope-from aavzz@yandex.ru) Received: from smtp4.yandex.ru (smtp4.yandex.ru [77.88.46.104]) by forward3.yandex.ru (Yandex) with ESMTP id 962BB119102D for ; Tue, 4 Aug 2009 15:36:59 +0400 (MSD) Received: from [192.168.1.2] (ppp92-100-96-20.pppoe.avangarddsl.ru [92.100.96.20]) by smtp4.yandex.ru (Yandex) with ESMTPA id 58A7DD300E7 for ; Tue, 4 Aug 2009 15:36:59 +0400 (MSD) From: Alex Zimnitsky To: freebsd-hackers@freebsd.org In-Reply-To: References: <1249329403.2928.11.camel@localhost.localdomain> Content-Type: text/plain; charset=UTF-8 Date: Tue, 04 Aug 2009 15:20:20 +0400 Message-Id: <1249384820.2928.22.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 (2.22.3.1-1.fc9) Content-Transfer-Encoding: 8bit X-Yandex-TimeMark: 1249385819 X-Yandex-Spam: 1 X-Yandex-Front: smtp4.yandex.ru Subject: Re: sys/cdefs.h not included automatically 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, 04 Aug 2009 11:37:02 -0000 04/08/2009 в 02:26 -0300, Carlos A. M. dos Santos: > On Mon, Aug 3, 2009 at 4:56 PM, Alex Zimnitsky wrote: > > Hello, freebsd-hackers > > > > my system is 7.2-RELEASE > > > > there is a which is included in a lot of headers, but a > > few of them instead of including it, generate "#error this file needs > > sys/cdefs.h". > > > > seems like an omission, but if it's intentional I'm curious why it is > > so. > > Those files are not intended to be directly included by user programs. > You usually include them indirectly. See, for instance, pthread.h and > stddef.h. > OK, the reason of my asking was configure script in a 3rd party application (namely apr-1.3.6) that generated strange warning about sys/syslimits.h being good enoung for gcc but not for gcc -E. it seems, they have a bug in checking for the presence of limits.h and sys/syslimits.h and include them in a non-uniform manner later. going to send them a patch Alex From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 11:38:29 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B8FCD10656BD for ; Tue, 4 Aug 2009 11:38:29 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id A5C248FC1B for ; Tue, 4 Aug 2009 11:38:29 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: by elvis.mu.org (Postfix, from userid 1192) id 62C281A3CCB; Tue, 4 Aug 2009 04:38:29 -0700 (PDT) Date: Tue, 4 Aug 2009 04:38:29 -0700 From: Alfred Perlstein To: Giorgos Keramidas Message-ID: <20090804113829.GL47463@elvis.mu.org> References: <20090726231534.GI21885@elvis.mu.org> <87vdl5vg14.fsf@kobe.laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87vdl5vg14.fsf@kobe.laptop> User-Agent: Mutt/1.4.2.3i Cc: hackers@freebsd.org Subject: Re: distributed scm+freebsd svn? 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, 04 Aug 2009 11:38:30 -0000 This is amazing! Have you considered an article for publication based on your experiences? Perhaps a handbook article? This will be very helpful going forward. (Although, I do kind of wish it was a "instructions fits on the back of a napkin" kind of operation.) :) thanks again! -Alfred * Giorgos Keramidas [090802 18:32] wrote: > On Sun, 26 Jul 2009 16:15:34 -0700, Alfred Perlstein wrote: > > Hello hackers, > > > > Does anyone here use one of the distributed SCMs to manage > > contributions to FreeBSD in an easy manner? > > Hi Alfred, > Yes, I do that. > > > Any pointers to a setup you have? > > > > I thought "git" was supposed to make this easy, but going over the > > docs leaves me with a lot of questions. > > Git is a wonderful system but it's "UI" and documentation often make me > want to scream bad things. My own suggestion is to go with Mercurial, > because it's command set looks a *lot* like CVS or Subversion, it's often > as fast or even faster than Git, and it doesn't seem as 'confusing' as Git. > > More details below... > > > I'm hoping to be able to basically: > > sync into my "distributed repo". > > allow a third party access to it. > > easily commit upstream back into svn from a branch > > in my distributed scm. > > I use a local Mercurial repository for my own patches. It seems to > support most of the things I want to do, i.e.: > > * Keep a clean `/hg/bsd/head' workspace and pull full changesets into > that from our svn repository > > * Support incremental updates of `/hg/bsd/head'. > > * Easily clone my `/hg/bsd/head' to one or more `feature' branches. > > * Allow others to pull from `head' as a read-only source over http or > ssh. > > The /head branch has a huge history that I don't really want to keep > around in every clone. So I started my conversion from 2007-12-31 and I > keep updating it with the `hg convert ...' command wrapped in a small > shell script: > > $ cat -n /hg/bsd/pull-head.sh > 1 #!/bin/sh > 2 > 3 set -e > 4 hg convert \ > 5 --config convert.svn.startrev='175021' \ > 6 --config convert.svn.trunk='head' \ > 7 --config convert.svn.branches='' \ > 8 --config convert.svn.tags='' \ > 9 file:///home/svn/base/ \ > 10 /hg/bsd/head > > You can use the webdav http://svn.freebsd.org/base/ or an SSH tunneled > URI to access to Subversion repository, but I keep a local mirror of the > Subversion repository too, so I prefer that. > > > Typical Mercurial-based Workflow > ================================ > > 1. Pull subversion commits into the 'head' workspace. > > 2. Pull these changes from 'head' to my working tree. > > 3. Merge the changes with the local patches of the working tree. > > 4. Extract one or more patches for committing to Subversion > > 5. Rinse, leather, repeat... > > Pulling the latest commits from Subversion > ------------------------------------------ > > The first step is the easiest bit. I just run `/hg/bsd/pull-head.sh'. > > This requires an installed copy of the Python bindings of Subversion > [devel/py-subversion] and the `convert' extension enabled in my ~/.hgrc > file with: > > [extensions] > convert = > > A sample run of `pull-head.sh' looks like this: > > keramida@kobe:/hg/bsd$ time ./pull-head.sh > scanning source... > sorting... > converting... > 1 Many network stack subsystems use a single global data structure to hold > 0 Add padding to struct inpcb, missed during our padding sweep earlier in > 3.306 real 1.809 user 0.619 sys > keramida@kobe:/hg/bsd$ > > This is reasonably fast, but it does come with an important caveat. > It's not terribly important for my own work, but it *may* be for yours: > > The Python bindings of Subversion do not support svn:keywords, so > all our manually configured '$FreeBSD$' stuff is unexpanded in the > converted tree. Mergemaster may cause various levels of "fun" and > "amusement" if you mix, match and alternate between svn-based and > mercurial-based workspaces often! > > At this point, after "pull-head.sh" has finished running, the most > recent commit in the head/.hg/ workspace state is the last commit by > rwatson: > > keramida@kobe:/hg/bsd/head$ hg log --limit 1 > changeset: 12589:8ce7c7a0b804 > branch: head > tag: tip > user: rwatson > date: Sun Aug 02 22:47:08 2009 +0000 > summary: Add padding to struct inpcb, missed during our padding sweep earlier in > > keramida@kobe:/hg/bsd/head$ > > This clone/workspace is my 'clean' slate, and it only contains an `.hg' > data store. No checkout or other workspace contents: > > keramida@kobe:/hg/bsd/head$ ls -la > total 6 > drwxr-xr-x 3 keramida users - 512 Nov 10 2008 . > drwxr-xr-x 8 keramida users - 512 Aug 3 02:36 .. > drwxr-xr-x 3 keramida users - 512 Aug 3 02:36 .hg > keramida@kobe:/hg/bsd/head$ du -sh . > 243M . > keramida@kobe:/hg/bsd/head$ > > It does however contains separate changesets for each subversion commit, > so I can browse the (local only now) history with a fair amount of speed. > > > Pulling these changes in my personal workspace > ---------------------------------------------- > > The second step is to pull the latest versions in my personal workspace > at `/hg/bsd/src': > > keramida@kobe:/home/keramida$ cd /hg/bsd/src > 1) keramida@kobe:/hg/bsd/src$ hg incoming --style compact ../head > comparing with /hg/bsd/head > searching for changes > 12588 6b04ed36e454 2009-08-02 19:43 +0000 rwatson > Many network stack subsystems use a single global data structure to > hold > > 12589[tip] 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson > Add padding to struct inpcb, missed during our padding sweep earlier > in > > 2) keramida@kobe:/hg/bsd/src$ hg pull ../head > pulling from /hg/bsd/head > searching for changes > adding changesets > adding manifests > adding file changes > added 2 changesets with 16 changes to 16 files (+1 heads) > (run 'hg heads' to see heads, 'hg merge' to merge) > keramida@kobe:/hg/bsd/src$ > > Comments: > --------- > > (1) Just look at what would be pulled from 'head' but don't actually > make any changes to the local workspace or branch/data store. > > (2) Pull the changes, creating a 'fork' in the history of the local > workspace at the place where the changes were grafted on top of > the previous svn-based changeset. > > At this point the history of my personal workspace has "forked". The > subversion changesets have been grafted on top of the previous svn > commit. This is easier to show with a picture/graph of the local > history, so here it is (from the 'graphlog' extension of Mercurial): > > keramida@kobe:/hg/bsd/src$ hg glog --limit 5 > o 12785[tip] 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson > | Add padding to struct inpcb, missed during our padding sweep earlier in > | > o 12784:12782 6b04ed36e454 2009-08-02 19:43 +0000 rwatson > | Many network stack subsystems use a single global data structure to hold > | > | @ 12783:12762,12782 c50060fec1db 2009-08-02 21:06 +0300 keramida > |/| Merge from head > | | > o | 12782 8e4fc85e5aa3 2009-08-02 16:59 +0000 julian > | | Stop uuidgen(2) from crashing in vimage kerenels. > | | > o | 12781 bf9c3383d680 2009-08-02 14:28 +0000 attilio > | | Make the newbus subsystem Giant free by adding the new newbus sxlock. > | | > keramida@kobe:/hg/bsd/src$ > > The last time I pulled from Subversion was after 16:59 UTC (this is the > buildworld I am still running in the background). My current workspace > contains a checkout of revision 12783/c50060fec1db (hence the '@' in the > relevant node of the history graph). > > Merging the New Changesets > -------------------------- > > To prepare for my next `merge with head', I first look at the two > 'heads' of the history. My last successful merge and the new 'head' > created by importing from Subversion: > > keramida@kobe:/hg/bsd/src$ hg heads --style compact > 12785[tip] 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson > Add padding to struct inpcb, missed during our padding sweep earlier in > > 12783:12762,12782 c50060fec1db 2009-08-02 21:06 +0300 keramida > Merge from head > > keramida@kobe:/hg/bsd/src$ > > Then I verify that I do *not* have local uncommitted stuff: > > keramida@kobe:/hg/bsd/src$ hg status > keramida@kobe:/hg/bsd/src$ > > This takes a few seconds, but I don't want to throw away any changes I > may have been working on without noticing. > > Since this is a clean checkout of revision 12783:c50060fec1db, I don't > necessarily need the next step, but it's safe to do it. I check out a > clean copy of the local merge head: > > keramida@kobe:/hg/bsd/src$ time hg update --clean c50060fec1db > 0 files updated, 0 files merged, 0 files removed, 0 files unresolved > 4.684 real 1.691 user 2.558 sys > > Being a clean checkout already and having the filesystem cache 'hot' > from the last pull I just did, this is often fast enough. > > Finally a merge of the 'remote' Subversion based commits I just pulled: > > keramida@kobe:/hg/bsd/src$ hg merge > merging sys/netinet/in_gif.c > merging sys/netinet/ip_var.h > 14 files updated, 2 files merged, 0 files removed, 0 files unresolved > (branch merge, don't forget to commit) > You have new mail in /home/keramida/Mailbox > keramida@kobe:/hg/bsd/src$ hg commit -m 'Merge from head' > keramida@kobe:/hg/bsd/src$ > > That's all. Now I have my own local changes 'merged' with the latest > changeset from Subversion. There are no conflicts to resolve manually, > because the subversion changesets I pulled do not affect any of the > files with local-only changes, so this merge was relatively pain-free, > quite fast and most importantly required no manual input at all :) > > Looking at the history with graphlog again, shows something like this: > > keramida@kobe:/hg/bsd/src$ hg glog --limit 5 > @ 12786[tip]:12783,12785 368efb2b98b9 2009-08-03 03:00 +0300 keramida > |\ Merge from head > | | > | o 12785 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson > | | Add padding to struct inpcb, missed during our padding sweep earlier in > | | > | o 12784:12782 6b04ed36e454 2009-08-02 19:43 +0000 rwatson > | | Many network stack subsystems use a single global data structure to hold > | | > o | 12783:12762,12782 c50060fec1db 2009-08-02 21:06 +0300 keramida > |\| Merge from head > | | > | o 12782 8e4fc85e5aa3 2009-08-02 16:59 +0000 julian > | | Stop uuidgen(2) from crashing in vimage kerenels. > | | > keramida@kobe:/hg/bsd/src$ > > Merging with 'head' often means that you can then publish this workspace > so others can pull from it, and publish their own patches for the same > workspace. How often you merge with each other is up to you. In the > Greek documentation project we often merge after many days or several > weeks. With projects that have a higher local change rate merging every > day might be nicer (and result in far fewer conflicts). > > > Extracting Patches from the Local Workspace > =========================================== > > Keeping local changes means you may eventually want to push those > changes towards the /head of Subversion. You'll have to extract patches > for one or more file then. Since you have the tools to look at the > local history, you can use "hg diff" with the last subversion commit, > i.e. with the history shown above: > > keramida@kobe:/hg/bsd/src$ hg glog --limit 5 > @ 12786[tip]:12783,12785 368efb2b98b9 2009-08-03 03:00 +0300 keramida > |\ Merge from head > | | > | o 12785 8ce7c7a0b804 2009-08-02 22:47 +0000 rwatson > | | Add padding to struct inpcb, missed during our padding sweep earlier in > | | > | o 12784:12782 6b04ed36e454 2009-08-02 19:43 +0000 rwatson > | | Many network stack subsystems use a single global data structure to hold > | | > o | 12783:12762,12782 c50060fec1db 2009-08-02 21:06 +0300 keramida > |\| Merge from head > : : > > You can run "hg diff" between changesets 12785 and 12786 (tip): > > keramida@kobe:/hg/bsd/src$ hg diff -r 12785:tip | diffstat -p1 > contrib/mg/Makefile | 29 + > contrib/mg/README | 74 ++ > contrib/mg/autoexec.c | 111 ++++ > ... snip ... > usr.bin/yacc/reader.c | 2 > usr.sbin/chown/chgrp.1 | 10 > usr.sbin/chown/chown.8 | 12 > usr.sbin/chown/chown.c | 17 > 76 files changed, 18355 insertions(+), 44 deletions(-) > keramida@kobe:/hg/bsd/src$ > > My own local workspace includes an import of OpenBSD's mg(1) editor. > This shows as a single patch in the diff command I used above, along > with *every* other file that differs in my local 'branch' of FreeBSD > head. Let's assume, for example's sake, that you don't really care > about mg(1) patches, and you want to look at everything else. The > --include and --exclude options of "hg diff" help a lot there (short > names -I and -X): > > keramida@kobe:/hg/bsd/src$ hg diff -r 12785:tip -X contrib/mg -X usr.bin/mg | diffstat -p1 > contrib/top/top.X | 5 - > contrib/top/top.c | 2 > etc/Makefile | 6 + > etc/mtree/BSD.games.dist | 16 +++ > etc/mtree/BSD.usr.dist | 2 > etc/mtree/BSD.var.dist | 2 > libexec/rtld-elf/rtld.c | 2 > share/mk/bsd.own.mk | 2 > sys/amd64/conf/KOBE | 185 ++++++++++++++++++++++++++++++++++++++ > sys/boot/common/interp.c | 2 > sys/boot/common/interp_forth.c | 2 > sys/conf/newvers.sh | 26 +++++ > sys/i386/conf/KOBE | 195 +++++++++++++++++++++++++++++++++++++++++ > usr.bin/Makefile | 5 + > usr.bin/truss/amd64-fbsd.c | 4 > usr.bin/truss/amd64-fbsd32.c | 3 > usr.bin/truss/amd64-linux32.c | 4 > usr.bin/truss/i386-fbsd.c | 4 > usr.bin/truss/i386-linux.c | 4 > usr.bin/truss/ia64-fbsd.c | 4 > usr.bin/truss/powerpc-fbsd.c | 4 > usr.bin/truss/sparc64-fbsd.c | 4 > usr.bin/yacc/reader.c | 2 > usr.sbin/chown/chgrp.1 | 10 +- > usr.sbin/chown/chown.8 | 12 +- > usr.sbin/chown/chown.c | 17 ++- > 26 files changed, 480 insertions(+), 44 deletions(-) > keramida@kobe:/hg/bsd/src$ > > If you want to commit *all* the local changes as a single patch to > Subversion, you can keep refining the --exclude/--include patterns until > the final patch looks and smells "right". > > If you know the directories that you want to diff, i.e. you want to > commit all the local `usr.sbin/chown' changes in one subversion > changeset, you can use a directory with "hg diff" too (which works quite > unsurprisingly like "svn diff"): > > keramida@kobe:/hg/bsd/src$ hg diff -r 12785:tip usr.sbin/chown | diffstat -p1 > usr.sbin/chown/chgrp.1 | 10 +++++++--- > usr.sbin/chown/chown.8 | 12 ++++++++---- > usr.sbin/chown/chown.c | 17 +++++++++++------ > 3 files changed, 26 insertions(+), 13 deletions(-) > keramida@kobe:/hg/bsd/src$ > > Extracting Local Changesets as Patches > ====================================== > > Another option is to extract only the very specific local commit that > affected a file, i.e. my local `usr.sbin/chown/chown.c' changes. First > you'd have to look at the local history of the file: > > keramida@kobe:/hg/bsd/src$ hg log --style compact usr.sbin/chown/chown.c > 12010:11998,12009 7f4fa839afed 2009-06-20 00:50 +0300 keramida > Merge from head > > 12002 96e04082ef3f 2009-06-19 15:58 +0000 brooks > In preparation for raising NGROUPS and NGROUPS_MAX, change base > > 7782 141cd5ffef80 2009-01-22 07:18 +0200 keramida > Add a new -x option to chown and chgrp, to inhibit file system > > 0 dd5ed0412a8b 2007-12-31 22:03 +0000 jhb > Actually declare the kern.features sysctl node. > > keramida@kobe:/hg/bsd/src$ > > >From this output it's obvious my local changes were made on 2009-01-22 > 07:18 +0200, and they are available as changeset 7782:141cd5ffef80. You > can extract this changeset only with "hg export": > > keramida@kobe:/hg/bsd/src$ hg export 141cd5ffef80 > # HG changeset patch > # User Giorgos Keramidas > # Date 1232601528 -7200 > # Branch head > # Node ID 141cd5ffef80ff979627d8898500c92984287426 > # Parent e8506b2ac7aefbfb875f0def0de8dd6441885a40 > Add a new -x option to chown and chgrp, to inhibit file system > mount point traversal. The -x option is documented, like -v, as > a non-standard option in the COMPATIBILITY manpage sections. > > diff -r e8506b2ac7ae -r 141cd5ffef80 usr.sbin/chown/chgrp.1 > --- a/usr.sbin/chown/chgrp.1 Wed Jan 21 21:31:33 2009 +0200 > +++ b/usr.sbin/chown/chgrp.1 Thu Jan 22 07:18:48 2009 +0200 > @@ -31,7 +31,7 @@ > .\" @(#)chgrp.1 8.3 (Berkeley) 3/31/94 > .\" $FreeBSD$ > .\" > -.Dd April 25, 2003 > +.Dd January 22, 2009 > .Dt CHGRP 1 > .Os > .Sh NAME > @@ -39,7 +39,7 @@ > .Nd change group > .Sh SYNOPSIS > .Nm > -.Op Fl fhv > +.Op Fl fhvx > .Oo > .Fl R > ... snip ... > > This patch is _directly_ usable with `patch -p1' in a checkout of /head > from Subversion, but it *may* require a bit of `svn merge' work if you > have fast-forwarded chown/chgrp to its latest 'head' version. It is not > a diff of the *latest* chown/chgrp from /head but a _precise_ copy of > the past changeset, as it was committed. > > More... > ======= > > * You can browse the 'clean' head/ copy I am using at > > http://hg.hellug.gr/freebsd/head/ > > Note: this only has the head history since 2007-12-31. For older head > commits, you will have to use a new "convert" run and it will change > all the commit/changeset hashes even if their patch data is identical. > > * You can find a compressed 'bundle' file called 'head.hg' in my home > directory at freefall. This can be used to 'seed' the initial copy > of your local 'head', eg. by pulling directly from the bundle: > > % cd /var/tmp > % scp freefall.freebsd.org:'~keramida/head.hg' . > > % cd ~ > % mkdir -p ~/work/freebsd/head > % hg init ~/work/freebsd/head > % cd ~/work/freebsd/head > % hg pull /var/tmp/head.hg > > * If you plan to use the incremental conversion script I described > earlier in this message, you will also need a "SHA map" file that > maps Subversion changesets to Mercurial changeset hashes. This is > also available at freefall as `~keramida/head.shamap' and you have > to copy it to your `head/.hg/shamap' file. Then either run the "hg > convert" extension manually or use a small shell wrapper like the > one I pasted here. > > * For more information about some of the extensions I've mentioned it > is always a good idea to check the Mercurial Wiki at: > > http://www.selenic.com/mercurial/ > > I hope all this helps a bit... > > If you need more help with publishing local workspaces over http and/or > extracting patches (these are often two of the points where help is > necessary and welcome), please feel free to ask. I've been using this > sort of workflow for local changesets quite some time and I know enough > about Mercurial to help where needed. -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250 .- FreeBSD committer From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 12:13:43 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1E481065675 for ; Tue, 4 Aug 2009 12:13:43 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 526708FC20 for ; Tue, 4 Aug 2009 12:13:42 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lstewart-laptop.caia.swin.edu.au (c149.al.cl.cam.ac.uk [128.232.110.149]) (authenticated bits=0) by lauren.room52.net (8.14.3/8.14.3) with ESMTP id n74Bo6ox007759 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 4 Aug 2009 21:50:09 +1000 (EST) (envelope-from lstewart@freebsd.org) Message-ID: <4A78206B.9010500@freebsd.org> Date: Tue, 04 Aug 2009 12:50:03 +0100 From: Lawrence Stewart User-Agent: Thunderbird 2.0.0.22 (X11/20090722) MIME-Version: 1.0 To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> <20090804095650.GP1292@hoeg.nl> <319cceca0908040259q4537db80uc2ce9696f30bfc12@mail.gmail.com> In-Reply-To: <319cceca0908040259q4537db80uc2ce9696f30bfc12@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_SOFTFAIL autolearn=disabled version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on lauren.room52.net Cc: Ed Schouten , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 12:13:44 -0000 Maslan wrote: > yes kio http://people.freebsd.org/~pjd/misc/kernio/ > However, It's outdated. No, man 9 ALQ is your friend. Works a treat. Cheers, Lawrence From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 16:36:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28F101065676 for ; Tue, 4 Aug 2009 16:36:50 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id DCBD98FC13 for ; Tue, 4 Aug 2009 16:36:49 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id E562B6D418; Tue, 4 Aug 2009 16:36:48 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id AF50C844CC; Tue, 4 Aug 2009 18:36:48 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <319cceca0908031558h1bd779b1pac3c9454986f5488@mail.gmail.com> Date: Tue, 04 Aug 2009 18:36:48 +0200 In-Reply-To: <319cceca0908031558h1bd779b1pac3c9454986f5488@mail.gmail.com> (Maslan's message of "Mon, 3 Aug 2009 22:58:37 +0000") Message-ID: <86y6pz359b.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 16:36:50 -0000 Maslan writes: > Fatal trap 12: page fault while in kernel mode > cpuid =3D 1; apic id =3D 01 > fault virtual address =3D 0x10 > fault code =3D supervisor read, page not present > instruction pointer =3D 0x20:0xc085935b > [...] > #7 0xc085935b in namei (ndp=3D0xe6cd3bc8) at /usr/src/sys/kern/vfs_looku= p.c:191 > #8 0xc08706d7 in vn_open_cred (ndp=3D0xe6cd3bc8, flagp=3D0xe6cd3cc4, cmo= de=3D1, > cred=3D0xc408fc00, fp=3D0xc4b5b344) at /usr/src/sys/kern/vfs_vnops.c:= 188 > #9 0xc08709a3 in vn_open (ndp=3D0xe6cd3bc8, flagp=3D0xe6cd3cc4, cmode=3D= 1, > fp=3D0xc4b5b344) at /usr/src/sys/kern/vfs_vnops.c:94 > #10 0xc086e0d3 in kern_open (td=3D0xc499dd20, path=3D0xc4c7a978 "/root/te= st.txt", > pathseg=3DUIO_SYSSPACE, flags=3D1, mode=3D1) > at /usr/src/sys/kern/vfs_syscalls.c:1042 > #11 0xc4c7a805 in f_open () from ./test.ko > #12 0xc4c7a8a1 in thread_main () from ./test.ko > #13 0xc07bd079 in fork_exit (callout=3D0xc4c7a880 , arg=3D0x= 0, > frame=3D0xe6cd3d38) at /usr/src/sys/kern/kern_fork.c:810 > #14 0xc0ac92b0 in fork_trampoline () at /usr/src/sys/i386/i386/exception.= s:264 Depending on the exact FreeBSD version you're working on, line 191 in sys/kern/vfs_lookup.c is either 188 /* 189 * Get starting point for the translation. 190 */ * 191 FILEDESC_SLOCK(fdp); 192 ndp->ni_rootdir =3D fdp->fd_rdir; 193 ndp->ni_topdir =3D fdp->fd_jdir; or 187 /* 188 * Get starting point for the translation. 189 */ 190 FILEDESC_SLOCK(fdp); * 191 ndp->ni_rootdir =3D fdp->fd_rdir; 192 ndp->ni_topdir =3D fdp->fd_jdir; Either way, the problem is not ndp (which we know is valid), but fdp, which is dereferenced either by FILEDESC_SLOCK(), which evaluates to sx_slock(&fdp->fd_sx), or in the assignment. You're calling namei() (indirectly) from a thread assigned to proc0, and I'm pretty sure proc0 has a valid filedesc table (see proc0_init() in sys/kern/init_main.c), but all the same, I suspect that creating a separate process as I suggested earlier will fix the panic. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 16:37:22 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1AE931065677 for ; Tue, 4 Aug 2009 16:37:22 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outN.internet-mail-service.net (outn.internet-mail-service.net [216.240.47.237]) by mx1.freebsd.org (Postfix) with ESMTP id F090D8FC15 for ; Tue, 4 Aug 2009 16:37:21 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 9B43DA300F; Tue, 4 Aug 2009 09:37:21 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 354282D601A; Tue, 4 Aug 2009 09:37:21 -0700 (PDT) Message-ID: <4A7863D5.3000701@elischer.org> Date: Tue, 04 Aug 2009 09:37:41 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> In-Reply-To: <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Ed Schouten , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 16:37:22 -0000 Maslan wrote: >> Is it possible to call kern_open() from within a kernel thread anyway? > I think yes, It worked on the parent thread before creating a new kthread. > See OpenKETA source, its using the same approach. I wouldn't count on that.. >> kern_open() depends on a file descriptor table, right? > Yes, it returns a fd in the curthread->td_retval[0], which i should > use within the same thread to deal with this file. and kernel threads have not file descriptors (I think) so.... it would crash... isn't that what you are seeing? > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 16:37:54 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D1A491065674 for ; Tue, 4 Aug 2009 16:37:54 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 94CB48FC1C for ; Tue, 4 Aug 2009 16:37:54 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id C94B16D418; Tue, 4 Aug 2009 16:37:53 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id AC3D3844CC; Tue, 4 Aug 2009 18:37:53 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Max Laier References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> Date: Tue, 04 Aug 2009 18:37:53 +0200 In-Reply-To: <200908040138.14743.max@love2party.net> (Max Laier's message of "Tue, 4 Aug 2009 01:38:13 +0200") Message-ID: <86tz0n357i.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, Maslan Subject: Re: sosend() and mbuf 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, 04 Aug 2009 16:37:55 -0000 Max Laier writes: > IIRC, kernel threads don't have root. You mean proc0->fdp->fd_rdir is NULL? That shouldn't make any difference, the kernel panics before it dereferences fd_rdir. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 16:40:15 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61B0510656CD for ; Tue, 4 Aug 2009 16:40:15 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outL.internet-mail-service.net (outl.internet-mail-service.net [216.240.47.235]) by mx1.freebsd.org (Postfix) with ESMTP id 3EF6A8FC2E for ; Tue, 4 Aug 2009 16:40:15 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 054F8A300F; Tue, 4 Aug 2009 09:40:15 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 810222D6011; Tue, 4 Aug 2009 09:40:14 -0700 (PDT) Message-ID: <4A786482.4060609@elischer.org> Date: Tue, 04 Aug 2009 09:40:34 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> <20090804095650.GP1292@hoeg.nl> <319cceca0908040259q4537db80uc2ce9696f30bfc12@mail.gmail.com> <319cceca0908040319x35bc8bcy7a869dd230419a50@mail.gmail.com> In-Reply-To: <319cceca0908040319x35bc8bcy7a869dd230419a50@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Ed Schouten , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 16:40:16 -0000 Maslan wrote: > OpenKETA has its own kthread_create() with a little modification from > kthread_create(), it associates the new thread with curthread not with > the thread0. hey that's horrible... (overiding a kernel symbol) > > See /usr/sys/kern/kern_kthread.c: kthread_create() > error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags, > pages, &p2); > OpenKETA:kthread_create() > error = fork1(curthread, RFFDG | RFPROC | RFSTOPPED | flags, > pages, &p2); in 8.0 you can do this.. (see man kthread) > > I'll give it a try and see if it works. > BUT i still can't understand why kern_open() don't work, except in the > original thread. > > On Tue, Aug 4, 2009 at 9:59 AM, Maslan wrote: >> yes kio http://people.freebsd.org/~pjd/misc/kernio/ >> However, It's outdated. >> >> On Tue, Aug 4, 2009 at 9:56 AM, Ed Schouten wrote: >>> * Maslan wrote: >>>>> Is it possible to call kern_open() from within a kernel thread anyway? >>>> I think yes, It worked on the parent thread before creating a new kthread. >>>> See OpenKETA source, its using the same approach. >>>>> kern_open() depends on a file descriptor table, right? >>>> Yes, it returns a fd in the curthread->td_retval[0], which i should >>>> use within the same thread to deal with this file. >>> Didn't someone (Jeff Roberson?) develop some nice in-kernel API for >>> accessing files some years ago? Why not use that? >>> >>> -- >>> Ed Schouten >>> WWW: http://80386.nl/ >>> > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 16:46:37 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8B00106568A for ; Tue, 4 Aug 2009 16:46:37 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outX.internet-mail-service.net (outx.internet-mail-service.net [216.240.47.247]) by mx1.freebsd.org (Postfix) with ESMTP id CBC398FC18 for ; Tue, 4 Aug 2009 16:46:37 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id E26669E446; Tue, 4 Aug 2009 09:33:51 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 23DE02D600F; Tue, 4 Aug 2009 09:33:51 -0700 (PDT) Message-ID: <4A786302.3090709@elischer.org> Date: Tue, 04 Aug 2009 09:34:10 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> In-Reply-To: <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Ed Schouten , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 16:46:38 -0000 Maslan wrote: > I'm getting crazy, > > I don't know why kern_open() works in the module's main thread, but > when I use it in another thread created by kthread_create() it crashes > the kernel ??? > kernel threads may not have a file descriptor table. so kern_open may not work on kernel processes.. (just speculating) > > On Tue, Aug 4, 2009 at 9:30 AM, Ed Schouten wrote: >> Hi, >> >> * Maslan wrote: >>> man kthread says: >>> The kthread_create() function is used to create a kernel thread. The new >>> thread shares its address space with process 0, the swapper process, and >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >>> runs in kernel mode only. >>> >>> However, when i checked the pid & tid of the new created thread it was >>> not the same as the parent nor as the proc0 & thread0 >> I am not sure, but sharing another process's address space doesn't have >> to imply it shares the same pid, right? >> >> -- >> Ed Schouten >> WWW: http://80386.nl/ >> > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 16:46:38 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06317106568E for ; Tue, 4 Aug 2009 16:46:38 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outV.internet-mail-service.net (outv.internet-mail-service.net [216.240.47.245]) by mx1.freebsd.org (Postfix) with ESMTP id DDD948FC1A for ; Tue, 4 Aug 2009 16:46:37 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 48BE4961D8; Tue, 4 Aug 2009 09:31:50 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 9FE1C2D6019; Tue, 4 Aug 2009 09:31:49 -0700 (PDT) Message-ID: <4A786289.8010400@elischer.org> Date: Tue, 04 Aug 2009 09:32:09 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Ed Schouten References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> In-Reply-To: <20090804093036.GN1292@hoeg.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Maslan , FreeBSD Hackers , Max Laier Subject: Re: sosend() and mbuf 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, 04 Aug 2009 16:46:38 -0000 Ed Schouten wrote: > Hi, > > * Maslan wrote: >> man kthread says: >> The kthread_create() function is used to create a kernel thread. The new >> thread shares its address space with process 0, the swapper process, and > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> runs in kernel mode only. >> >> However, when i checked the pid & tid of the new created thread it was >> not the same as the parent nor as the proc0 & thread0 > > I am not sure, but sharing another process's address space doesn't have > to imply it shares the same pid, right? > there was a change where kthread_create now actually produces new THREADS in 8.0 but prior to that it produced new processes.. I THOUGHT that change happenned between 6 and 7 but maybe it was between 7 and 8.. do you have a kproc man page? on 8.0, see: man kproc man kthread on 7.0 I think these will show nothing and you should do: man kthread_create From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 16:57:26 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE012106566C for ; Tue, 4 Aug 2009 16:57:26 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id AF40C8FC1A for ; Tue, 4 Aug 2009 16:57:26 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id C24236D418; Tue, 4 Aug 2009 16:57:25 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 97CB384495; Tue, 4 Aug 2009 18:57:25 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Ed Schouten References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> Date: Tue, 04 Aug 2009 18:57:25 +0200 In-Reply-To: <20090804093036.GN1292@hoeg.nl> (Ed Schouten's message of "Tue, 4 Aug 2009 11:30:36 +0200") Message-ID: <86ab2f34ay.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Maslan , FreeBSD Hackers , Max Laier Subject: Re: sosend() and mbuf 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, 04 Aug 2009 16:57:27 -0000 Ed Schouten writes: > Maslan writes: > > However, when i checked the pid & tid of the new created thread it > > was not the same as the parent nor as the proc0 & thread0 > I am not sure, but sharing another process's address space doesn't have > to imply it shares the same pid, right? The man page explicitly states that if no process is specified, the new thread is assigned to proc0, which has a valid filedesc table, valid creds etc., so this shouldn't be a problem. However, he's getting a different PID, which shouldn't happen. Either the man page is wrong, or things were different in 7. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 17:00:27 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E371065676 for ; Tue, 4 Aug 2009 17:00:27 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id 266BA8FC2B for ; Tue, 4 Aug 2009 17:00:27 +0000 (UTC) (envelope-from des@des.no) Received: from ds4.des.no (des.no [84.49.246.2]) by smtp.des.no (Postfix) with ESMTP id 4FB2F6D41C; Tue, 4 Aug 2009 17:00:26 +0000 (UTC) Received: by ds4.des.no (Postfix, from userid 1001) id 2AF9E844CC; Tue, 4 Aug 2009 19:00:26 +0200 (CEST) From: =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= To: Julian Elischer References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> <4A7863D5.3000701@elischer.org> Date: Tue, 04 Aug 2009 19:00:26 +0200 In-Reply-To: <4A7863D5.3000701@elischer.org> (Julian Elischer's message of "Tue, 04 Aug 2009 09:37:41 -0700") Message-ID: <8663d3345x.fsf@ds4.des.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Cc: Maslan , FreeBSD Hackers , Ed Schouten Subject: Re: sosend() and mbuf 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, 04 Aug 2009 17:00:27 -0000 Julian Elischer writes: > and kernel threads have not file descriptors (I think) so.... it > would crash... Threads don't have filedesc tables. Processes have filedesc tables. In theory, his thread is associated with proc0, which *does* have a properly initialized filedesc table. DES --=20 Dag-Erling Sm=C3=B8rgrav - des@des.no From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 17:03:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 72CDC106566C for ; Tue, 4 Aug 2009 17:03:57 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id EA51F8FC33 for ; Tue, 4 Aug 2009 17:03:56 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so3039442bwz.43 for ; Tue, 04 Aug 2009 10:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=7dGw2PlB1AljHORBGImgd8+j/rRFrEXBoWYNNELPJGg=; b=Xp/YB80UBCzMQi2ebRqVu1QL/JdadkY2XHYhWiuuDq/XaYDw35JiRqxaETe0WxgUnr s8alyPyWg6ueYEoihZGNRo0Jt0fn8c1aKCX0kPRYqS5OwHEWon+ecYPguUd6+KpZYr+T 3Tpx2xw7TRWYc1tfHew5lNcZF1JSJPyQ4GfFI= 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=SHJPW6OPnkXWPIkDMans21hNopDV4KAJ4Aiud77RFFTNekNpcNHj82+OWRST/7Z+OJ NBZoZs677YjDj1u8HpqL12qDdfCrFEBC9kPHtlYBIA5inWoVh3bdsahw0u3JaxiVNYXY Y8SqcGM7Ks4X6+nTrwv961joO5ryVdy/bgkq8= MIME-Version: 1.0 Received: by 10.204.97.204 with SMTP id m12mr1004308bkn.185.1249405434588; Tue, 04 Aug 2009 10:03:54 -0700 (PDT) In-Reply-To: <4A786302.3090709@elischer.org> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <4A786302.3090709@elischer.org> Date: Tue, 4 Aug 2009 17:03:54 +0000 Message-ID: <319cceca0908041003o4c313bf6qff57a1f0b752b537@mail.gmail.com> From: Maslan To: Julian Elischer Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Ed Schouten , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 17:03:57 -0000 > kernel threads may not have a file descriptor table. > so kern_open may not work on kernel processes.. > (just speculating) But the module's main thread belogs to proc, why this process could use kern_open() and proc0 don't From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 17:09:06 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 14285106564A for ; Tue, 4 Aug 2009 17:09:06 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 583458FC12 for ; Tue, 4 Aug 2009 17:09:04 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by bwz2 with SMTP id 2so3042213bwz.43 for ; Tue, 04 Aug 2009 10:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=h8b6G/IwdfO/d35WcpNtpmCXtx952x+5kAFDpzMeFmY=; b=TsEjTyTHM4pwVbD5hm/H/T0dMjyRI9nScdUKbWRWdJnoGINQ4LdQpH54uRUTQ0c9H/ B6XUpDRoOoY0WXUxafpVx6vO+yISXfTvNCYwBrw38quRkjvMeVbntPuOPiw7pvhkXiQR Fr/baCBSlm1wzzea5FAJFeGmtb5UedBe0su98= 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=AukE6YhKi1JLGTU21AElR47Pp/ni19yfceB5lbV7mo7Z2Z8i+wAs1k6I7o7B5+Q0HX UTZLkRqZ9IMh2OWriLL4YUARO2uUXFFPG7Dt3zlmmZHq3zTAmAhaVdy3DeFtVj+rIOdL Gd63yX50VG6WyK4vQR9XShAXocFXrNE4wyp14= MIME-Version: 1.0 Received: by 10.204.121.131 with SMTP id h3mr1438171bkr.172.1249405744238; Tue, 04 Aug 2009 10:09:04 -0700 (PDT) In-Reply-To: <319cceca0908041003o4c313bf6qff57a1f0b752b537@mail.gmail.com> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <4A786302.3090709@elischer.org> <319cceca0908041003o4c313bf6qff57a1f0b752b537@mail.gmail.com> Date: Tue, 4 Aug 2009 17:09:00 +0000 Message-ID: <319cceca0908041008p2de4452duc55467abbb121e16@mail.gmail.com> From: Maslan To: Julian Elischer Content-Type: multipart/mixed; boundary=001636c5a4af90df38047053f1a0 Cc: Ed Schouten , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 17:09:06 -0000 --001636c5a4af90df38047053f1a0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Guys, Here is the code, just scroll down and change kthread_create2() to kthread_create() and it will crash NOTE: i'm still working on the socket part, u can commend it. Something wrong with proc0, and I can't figure it out --001636c5a4af90df38047053f1a0 Content-Type: application/octet-stream; name="khttp.c" Content-Disposition: attachment; filename="khttp.c" Content-Transfer-Encoding: base64 X-Attachment-Id: f_fxyvvpoo0 I2luY2x1ZGUgPHN5cy9wYXJhbS5oPgojaW5jbHVkZSA8c3lzL2tlcm5lbC5oPgojaW5jbHVkZSA8 c3lzL21vZHVsZS5oPgojaW5jbHVkZSA8c3lzL3N5c3RtLmg+CiNpbmNsdWRlIDxzeXMvbWFsbG9j Lmg+IAkvKiBtYWxsb2MsIGZyZWUgKi8KI2luY2x1ZGUgPHN5cy9zeXNjYWxsc3Vici5oPgkvKiBr ZXJuX3h4eCAqLwojaW5jbHVkZSA8c3lzL2ZjbnRsLmg+CQkvKiBPX1JET05MWSwgRlJFQUQgKi8K I2luY2x1ZGUgPHN5cy9wcm9jLmg+CQkvKiBjdXJ0aHJlYWQgKi8KI2luY2x1ZGUgPHN5cy9zdGF0 Lmg+CQkvKiBzdHJ1Y3Qgc3RhdCAqLwojaW5jbHVkZSA8c3lzL3NvY2tldC5oPgkJLyogc3RydWN0 IHNvY2tldCwgc29ja2FkZHIgKi8KI2luY2x1ZGUgPHN5cy9zb2NrZXR2YXIuaD4JLyogc294eHgg Ki8KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4JCS8qIElQUFJPVE9fVENQICovCiNpbmNsdWRlIDxz eXMvbWJ1Zi5oPgkJLyogbWJ1ZiAqLwojaW5jbHVkZSA8c3lzL2t0aHJlYWQuaD4JLyoga3RocmVh ZF9jcmVhdGUgKi8KI2luY2x1ZGUgPHN5cy91bmlzdGQuaD4JCS8qIFJGTk9XQUlUICovCiNpbmNs dWRlIDxtYWNoaW5lL3N0ZGFyZy5oPgkvKiB2YWxpc3QgKi8KI2luY2x1ZGUgPHN5cy9zY2hlZC5o PgkJLyogc2NoZWRfYWRkICovCiNpbmNsdWRlIDxzeXMvbXV0ZXguaD4JCS8qIG10eF94eHggKi8K Ck1BTExPQ19ERUZJTkUoTV9LRVJOLCAia0hUVFAiLCAia0hUVFAgbWVtb3J5Iik7CgovKiBwcm90 b3R5cGVzICovCnZvaWQga2h0dHBfbWFpbih2b2lkKTsKdm9pZCogbWVtX2FsbG9jKGludCk7CnZv aWQgbWVtX2ZyZWUodm9pZCAqKTsKaW50IGZfb3BlbihjaGFyICosIGludCAqKTsKaW50IGZfY2xv c2UoaW50KTsKaW50IGZfZ2V0c2l6ZShpbnQpOwppbnQgZl9yZWFkKGludCwgY2hhciAqLCBpbnQp OwppbnQga3RocmVhZF9jcmVhdGUyKHZvaWQgKCpmdW5jKSh2b2lkICopLCB2b2lkICosIHN0cnVj dCBwcm9jICoqLCBpbnQsIGludCwgY29uc3QgY2hhciAqLCAuLi4pOwoKc3RhdGljIGludCB0c3Rh dGU7CiNkZWZpbmUgVF9TVEFSVCAwCiNkZWZpbmUgVF9TVE9QIDEKI2RlZmluZSBUX0VYSVQgMgog CnZvaWQga2h0dHBfbWFpbigpewoJc3RydWN0IHRocmVhZCAqdGQgPSBjdXJ0aHJlYWQ7CglpbnQg cmV0OwoJaW50IGZkLCBzaXplOwoJY2hhciAqYnVmID0gTlVMTDsKCXN0cnVjdCBzb2NrZXQgKnMs ICpoZWFkLCAqYzsKCXN0cnVjdCBzb2NrYWRkcl9pbiBzYSwgKmNhOwoJc3RydWN0IGlvdmVjIGFp b3Y7CglzdHJ1Y3QgdWlvIGF1aW87CgljaGFyIGJ1ZjJbXSA9ICJsb2wiOwoKCgkvKiBGaWxlcyAq LwoKCXJldCA9IGZfb3BlbigiL3Zhci9raHR0cC9pbmRleC5odG1sIiwgJmZkKTsKCglzaXplID0g Zl9nZXRzaXplKGZkKTsKCWJ1ZiA9IG1lbV9hbGxvYyhzaXplb2YoY2hhcikqc2l6ZSk7CglmX3Jl YWQoZmQsIGJ1Ziwgc2l6ZSk7CglidWZbc2l6ZS0xXSA9IDB4MDsKCXByaW50ZigiJXNcbiIsIGJ1 Zik7CgltZW1fZnJlZShidWYpOwoJZl9jbG9zZShmZCk7CgoKCS8qIFNvY2tldHMgKi8KCglyZXQg PSBzb2NyZWF0ZShQRl9JTkVULCAmcywgU09DS19TVFJFQU0sIElQUFJPVE9fVENQLCB0ZC0+dGRf dWNyZWQsIHRkKTsKCXByaW50Zigic29jcmVhdGUgLT4gJWQsIHJldHZhbCAtPiAlZFxuIiwgcmV0 LCB0ZC0+dGRfcmV0dmFsWzBdKTsKCgliemVybygmc2EsIHNpemVvZihzYSkpOwoJc2Euc2luX2xl biA9IHNpemVvZihzYSk7CglzYS5zaW5fZmFtaWx5ID0gQUZfSU5FVDsKCXNhLnNpbl9wb3J0ID0g aHRvbnMoODg4OCk7CglzYS5zaW5fYWRkci5zX2FkZHIgPSBJTkFERFJfQU5ZOwoJc29iaW5kKHMs IChzdHJ1Y3Qgc29ja2FkZHIgKikmc2EsIHRkKTsKCXByaW50Zigic29iaW5kIC0+ICVkLCByZXR2 YWwgLT4gJWRcbiIsIHJldCwgdGQtPnRkX3JldHZhbFswXSk7CgoJcmV0ID0gc29saXN0ZW4ocywg NCwgdGQpOwoJcHJpbnRmKCJzb2xpc3RlbiAtPiAlZCwgcmV0dmFsIC0+ICVkXG4iLCByZXQsIHRk LT50ZF9yZXR2YWxbMF0pOwoKCWlmICgocy0+c29fb3B0aW9ucyAmIFNPX0FDQ0VQVENPTk4pID09 IDApCgkJcHJpbnRmKCJFUlJPUlxuIik7IAoKCWlmICghKHMtPnNvX29wdGlvbnMgJiBTT19BQ0NF UFRDT05OKSkKCQlwcmludGYoIk5PVCBBQ0NFUFRJTkdcbiIpOwoKCWhlYWQgPSBzOwoKCS8qIE1h aW4gTG9vcCAqLwoJZm9yKDs7KXsKCQl0c2xlZXAodGQsIFBEUk9QLCAia0hUVFAgdHNsZWVwIiwg Mipoeik7CgkJaWYodHN0YXRlID09IFRfU1RPUCkgYnJlYWs7CgkKCQlBQ0NFUFRfTE9DSygpOwoJ CWMgPSBUQUlMUV9GSVJTVCgmaGVhZC0+c29fY29tcCk7CgkJaWYoYyA9PSBOVUxMKXsKCQkJQUND RVBUX1VOTE9DSygpOwoJCQljb250aW51ZTsKCQl9CgkJVEFJTFFfUkVNT1ZFKCZoZWFkLT5zb19j b21wLCBjLCBzb19saXN0KTsKCQloZWFkLT5zb19xbGVuLS07CgkJcHJpbnRmKCJjID0gMHgleFxu IiwgKGludCljKTsKCQlBQ0NFUFRfVU5MT0NLKCk7CgkJcmV0ID0gc29hY2NlcHQoYywgKHN0cnVj dCBzb2NrYWRkcioqKSZjYSk7CgkJcHJpbnRmKCJzb2FjY2VwdCAtPiAlZCwgcmV0dmFsIC0+ICVk XG4iLCByZXQsIHRkLT50ZF9yZXR2YWxbMF0pOwoKCQkvKiBpb3ZlYyAqLwoJCWFpb3YuaW92X2Jh c2UgPSBidWY7CgkJYWlvdi5pb3ZfbGVuID0gc3RybGVuKGJ1ZjIpOwoJCS8qIGF1aW8gKi8KCQlh dWlvLnVpb19pb3YgPSAmYWlvdjsKCQlhdWlvLnVpb19pb3ZjbnQgPSAxOwoJCWF1aW8udWlvX29m ZnNldCA9IDA7CgkJYXVpby51aW9fcmVzaWQgPSBzdHJsZW4oYnVmMik7CgkJYXVpby51aW9fcncg PSBVSU9fV1JJVEU7CgkJYXVpby51aW9fc2VnZmxnID0gVUlPX1NZU1NQQUNFOwoJCWF1aW8udWlv X3RkID0gdGQ7CgoJCS8vcmV0ID0gc29zZW5kKHMsIChzdHJ1Y3Qgc29ja2FkZHIqKSZjbGllbnQs ICZhdWlvLCBOVUxMLCBOVUxMLCAwLCB0ZCk7IAoJCS8vcHJpbnRmKCJzb3NlbmQgLT4gJWQsIHJl dHZhbCAtPiAlZFxuIiwgcmV0LCB0ZC0+dGRfcmV0dmFsWzBdKTsKCX0KCXJldCA9IHNvY2xvc2Uo cyk7CglwcmludGYoInNvY2xvc2UgLT4gJWQsIHJldHZhbCAtPiAlZFxuIiwgcmV0LCB0ZC0+dGRf cmV0dmFsWzBdKTsKCgl0c3RhdGUgPSBUX0VYSVQ7CglrdGhyZWFkX2V4aXQoMCk7Cn0KCnZvaWQq IG1lbV9hbGxvYyhpbnQgc2l6ZSl7CglyZXR1cm4gbWFsbG9jKHNpemUsIE1fS0VSTiwgTV9OT1dB SVQpOwp9Cgp2b2lkIG1lbV9mcmVlKHZvaWQgKmJ1Zil7CglmcmVlKGJ1ZiwgTV9LRVJOKTsKfQoK aW50IGZfb3BlbihjaGFyICpmaWxlbmFtZSwgaW50ICpmZCl7CglzdHJ1Y3QgdGhyZWFkICp0ZCA9 IGN1cnRocmVhZDsKCWludCByZXQgPSBrZXJuX29wZW4odGQsIGZpbGVuYW1lLCBVSU9fU1lTU1BB Q0UsIE9fUkRPTkxZLCBGUkVBRCk7CglpZighcmV0KXsKCQkqZmQgPSB0ZC0+dGRfcmV0dmFsWzBd OwoJCXJldHVybiAxOwoJfQoJcmV0dXJuIDA7Cn0KCmludCBmX2Nsb3NlKGludCBmZCl7CglzdHJ1 Y3QgdGhyZWFkICp0ZCA9IGN1cnRocmVhZDsKCWludCByZXQgPSBrZXJuX2Nsb3NlKHRkLCBmZCk7 CglpZighcmV0KQoJCXJldHVybiAxOwoJcmV0dXJuIDA7Cn0KCmludCBmX2dldHNpemUoaW50IGZk KXsKCXN0cnVjdCB0aHJlYWQgKnRkID0gY3VydGhyZWFkOwoJc3RydWN0IHN0YXQgc3Q7CglpbnQg cmV0ID0ga2Vybl9mc3RhdCh0ZCwgZmQsICZzdCk7CglpZighcmV0KQoJCXJldHVybiBzdC5zdF9z aXplOwoJcmV0dXJuIDA7Cn0KCmludCBmX3JlYWQoaW50IGZkLCBjaGFyICpidWYsIGludCBzaXpl KXsKCXN0cnVjdCB0aHJlYWQgKnRkID0gY3VydGhyZWFkOwoJaW50IHJldDsKCXN0cnVjdCBpb3Zl YyBhaW92OwoJc3RydWN0IHVpbyBhdWlvOwoKCS8qIGlvdmVjICovCglhaW92Lmlvdl9iYXNlID0g YnVmOwoJYWlvdi5pb3ZfbGVuID0gc2l6ZTsKCS8qIGF1aW8gKi8KCWF1aW8udWlvX2lvdiA9ICZh aW92OwoJYXVpby51aW9faW92Y250ID0gMTsKCWF1aW8udWlvX29mZnNldCA9IDA7CglhdWlvLnVp b19yZXNpZCA9IHNpemU7CglhdWlvLnVpb19ydyA9IFVJT19SRUFEOwoJYXVpby51aW9fc2VnZmxn ID0gVUlPX1NZU1NQQUNFOwoJYXVpby51aW9fdGQgPSB0ZDsKCglyZXQgPSBrZXJuX3JlYWR2KHRk LCBmZCwgJmF1aW8pOwoJaWYoIXJldCkKCQlyZXR1cm4gMTsKCXJldHVybiAwOwp9CgppbnQKa3Ro cmVhZF9jcmVhdGUyKHZvaWQgKCpmdW5jKSh2b2lkICopLCB2b2lkICphcmcsCiAgICBzdHJ1Y3Qg cHJvYyAqKm5ld3BwLCBpbnQgZmxhZ3MsIGludCBwYWdlcywgY29uc3QgY2hhciAqZm10LCAuLi4p CnsKCWludCBlcnJvcjsKCXZhX2xpc3QgYXA7CglzdHJ1Y3QgdGhyZWFkICp0ZDsKCXN0cnVjdCBw cm9jICpwMjsKCglpZiAoIXByb2MwLnBfc3RhdHMpCgkJcGFuaWMoImt0aHJlYWRfY3JlYXRlIGNh bGxlZCB0b28gc29vbiIpOwoKCWVycm9yID0gZm9yazEoY3VydGhyZWFkLCBSRkZERyB8IFJGUFJP QyB8IFJGU1RPUFBFRCB8IGZsYWdzLAoJICAgIHBhZ2VzLCAmcDIpOwoJaWYgKGVycm9yKQoJCXJl dHVybiBlcnJvcjsKCgkvKiBzYXZlIGEgZ2xvYmFsIGRlc2NyaXB0b3IsIGlmIGRlc2lyZWQgKi8K CWlmIChuZXdwcCAhPSBOVUxMKQoJCSpuZXdwcCA9IHAyOwoKCS8qIHRoaXMgaXMgYSBub24tc3dh cHBlZCBzeXN0ZW0gcHJvY2VzcyAqLwoJUFJPQ19MT0NLKHAyKTsKCXAyLT5wX2ZsYWcgfD0gUF9T WVNURU0gfCBQX0tUSFJFQUQ7CgltdHhfbG9jaygmcDItPnBfc2lnYWN0cy0+cHNfbXR4KTsKCXAy LT5wX3NpZ2FjdHMtPnBzX2ZsYWcgfD0gUFNfTk9DTERXQUlUOwoJbXR4X3VubG9jaygmcDItPnBf c2lnYWN0cy0+cHNfbXR4KTsKCVBST0NfVU5MT0NLKHAyKTsKCgkvKiBzZXQgdXAgYXJnMCBmb3Ig J3BzJywgZXQgYWwgKi8KCXZhX3N0YXJ0KGFwLCBmbXQpOwoJdnNucHJpbnRmKHAyLT5wX2NvbW0s IHNpemVvZihwMi0+cF9jb21tKSwgZm10LCBhcCk7Cgl2YV9lbmQoYXApOwoKCS8qIGNhbGwgdGhl IHByb2Nlc3NlcycgbWFpbigpLi4uICovCgl0ZCA9IEZJUlNUX1RIUkVBRF9JTl9QUk9DKHAyKTsK CWNwdV9zZXRfZm9ya19oYW5kbGVyKHRkLCBmdW5jLCBhcmcpOwoJVERfU0VUX0NBTl9SVU4odGQp OwoKCS8qIERlbGF5IHB1dHRpbmcgaXQgb24gdGhlIHJ1biBxdWV1ZSB1bnRpbCBub3cuICovCglp ZiAoIShmbGFncyAmIFJGU1RPUFBFRCkpIHsKCQl0aHJlYWRfbG9jayh0ZCk7CgkJc2NoZWRfYWRk KHRkLCBTUlFfQk9SSU5HKTsgCgkJdGhyZWFkX3VubG9jayh0ZCk7Cgl9CgoJcmV0dXJuIDA7Cn0K CnN0YXRpYyBpbnQgaGFuZGxlcihtb2R1bGVfdCBtb2QsIGludCBvcCwgdm9pZCAqYXJnKXsKCWlu dCBlcnIgPSAwOwoJc3dpdGNoKG9wKXsKCQljYXNlIE1PRF9MT0FEOgoJCQl0c3RhdGUgPSBUX1NU QVJUOwoJCQlwcmludGYoImtIVFRQIGxvYWRlZC5cbiIpOwoJCQlrdGhyZWFkX2NyZWF0ZTIoKHZv aWQgKilraHR0cF9tYWluLCBOVUxMLCBOVUxMLCBSRk5PV0FJVCwgMCwgImtIVFRQIik7CgkJCWJy ZWFrOwoJCWNhc2UgTU9EX1VOTE9BRDoKCQkJdHN0YXRlID0gVF9TVE9QOwoJCQlmb3IoOzspewoJ CQkJaWYodHN0YXRlID09IFRfRVhJVCkgYnJlYWs7CgkJCQl0c2xlZXAoY3VydGhyZWFkLCBQRFJP UCwgImtIVFRQIHRzbGVlcCIsIDIqaHopOwoJCQl9CgkJCXByaW50Zigia0hUVFAgdW5sb2FkZWQu XG4iKTsKCQkJYnJlYWs7CgkJZGVmYXVsdDoKCQkJZXJyID0gRU9QTk9UU1VQUDsKCQkJYnJlYWs7 Cgl9CglyZXR1cm4oZXJyKTsKfQoKc3RhdGljIG1vZHVsZWRhdGFfdCBtb2RfZGF0YT0gewoJImto dHRwIiwKCWhhbmRsZXIsCgkwCn07CgpNT0RVTEVfVkVSU0lPTihraHR0cCwgMSk7CkRFQ0xBUkVf TU9EVUxFKGt0dHAsIG1vZF9kYXRhLCBTSV9TVUJfS0xELCBTSV9PUkRFUl9BTlkpOwo= --001636c5a4af90df38047053f1a0-- From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 17:09:34 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0B2D1065680 for ; Tue, 4 Aug 2009 17:09:34 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outV.internet-mail-service.net (outv.internet-mail-service.net [216.240.47.245]) by mx1.freebsd.org (Postfix) with ESMTP id BE6FF8FC13 for ; Tue, 4 Aug 2009 17:09:34 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id AF6AEC317; Tue, 4 Aug 2009 10:09:34 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id F1D0E2D6006; Tue, 4 Aug 2009 10:09:33 -0700 (PDT) Message-ID: <4A786B61.6060702@elischer.org> Date: Tue, 04 Aug 2009 10:09:53 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: =?UTF-8?B?RGFnLUVybGluZyBTbcO4cmdyYXY=?= References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <20090804094142.GO1292@hoeg.nl> <319cceca0908040252w105d3dfdge9dec3c8b6d28607@mail.gmail.com> <4A7863D5.3000701@elischer.org> <8663d3345x.fsf@ds4.des.no> In-Reply-To: <8663d3345x.fsf@ds4.des.no> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Maslan , FreeBSD Hackers , Ed Schouten Subject: Re: sosend() and mbuf 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, 04 Aug 2009 17:09:35 -0000 Dag-Erling Smørgrav wrote: > Julian Elischer writes: >> and kernel threads have not file descriptors (I think) so.... it >> would crash... > > Threads don't have filedesc tables. Processes have filedesc tables. In > theory, his thread is associated with proc0, which *does* have a > properly initialized filedesc table. > > DES unless he is in 7.x in which case he's getting a separate process to boot, which has no file descriptor table. From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 17:20:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E4D8710656AB for ; Tue, 4 Aug 2009 17:20:57 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outL.internet-mail-service.net (outl.internet-mail-service.net [216.240.47.235]) by mx1.freebsd.org (Postfix) with ESMTP id C5E6D8FC1A for ; Tue, 4 Aug 2009 17:20:57 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id D333B961D8; Tue, 4 Aug 2009 10:20:57 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 0F8172D601A; Tue, 4 Aug 2009 10:20:57 -0700 (PDT) Message-ID: <4A786E0C.8020201@elischer.org> Date: Tue, 04 Aug 2009 10:21:16 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86k51k4kvl.fsf@ds4.des.no> <86fxc84ksj.fsf@ds4.des.no> <200908040138.14743.max@love2party.net> <319cceca0908040227hf9a0f92jbf05b11e9f974994@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <319cceca0908040239k2accd7fen402db4c91687a267@mail.gmail.com> <4A786302.3090709@elischer.org> <319cceca0908041003o4c313bf6qff57a1f0b752b537@mail.gmail.com> <319cceca0908041008p2de4452duc55467abbb121e16@mail.gmail.com> In-Reply-To: <319cceca0908041008p2de4452duc55467abbb121e16@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Ed Schouten , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 17:20:58 -0000 Maslan wrote: > Guys, > > Here is the code, just scroll down and change kthread_create2() to > kthread_create() and it will crash > > NOTE: i'm still working on the socket part, u can commend it. > > Something wrong with proc0, and I can't figure it out > > > ------------------------------------------------------------------------ > > _______________________________________________ > 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" The problem is that you are NOT on proc0 You have created your own kernel process and is DOES NOT have a file descriptor table. in 8.x this is all changed. using kthread_create2 creates a kernel thread attached to YOUR USER PROCESS. and YOU DO have a file descriptor table, as does proc0 as a special case of kernel process. From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 20:45:38 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2BA851065673 for ; Tue, 4 Aug 2009 20:45:38 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 013548FC17 for ; Tue, 4 Aug 2009 20:45:37 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from smoochies.rachie.is-a-geek.net (mailhub.lan.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id E0C2D7E818 for ; Tue, 4 Aug 2009 12:45:36 -0800 (AKDT) From: Mel Flynn To: freebsd-hackers@freebsd.org Date: Tue, 4 Aug 2009 12:45:35 -0800 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA2; KDE/4.2.4; i386; ; ) MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908041245.35926.mel.flynn+fbsd.hackers@mailing.thruhere.net> Subject: Spot the error 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, 04 Aug 2009 20:45:38 -0000 Hi, granted it took me less then a minute to figure it out, but the error is kind of not helping: % mount -t msdofs /dev/label/camera ~/camera mount: /dev/label/camera : Operation not supported by device I would expect something along the lines of "unknown file system type". Is this fixable? -- Mel From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 21:01:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6087D106564A for ; Tue, 4 Aug 2009 21:01:57 +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 20EC58FC08 for ; Tue, 4 Aug 2009 21:01:57 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id C748646B0D; Tue, 4 Aug 2009 17:01:56 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 0B8028A0A8; Tue, 4 Aug 2009 17:01:56 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Tue, 4 Aug 2009 08:08:04 -0400 User-Agent: KMail/1.9.7 References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> In-Reply-To: <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200908040808.05074.jhb@freebsd.org> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 04 Aug 2009 17:01:56 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.0 required=4.2 tests=AWL,BAYES_00, DATE_IN_PAST_06_12,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Maslan , Dag-Erling =?iso-8859-1?q?Sm=F8rgrav?= Subject: Re: sosend() and mbuf 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, 04 Aug 2009 21:01:57 -0000 On Monday 03 August 2009 5:25:27 pm Maslan wrote: > No my code doesn't work, I thought it may be because that soaccept() > -which is not found in man 9- is non-blocking, so i've to put my code > in a thread. > Now i got another problem, when I open a text file from this thread, > the kernel crashes, I'm sure that its the thread. > > kthread_create((void *)thread_main, NULL, NULL, RFNOWAIT, 0, "thread"); > > void thread_main(){ > struct thread *td = curthread; > int ret; > int fd; > ret = f_open("/path/to/file.txt", &fd); > printf("%d\n", ret); > tsleep(td, PDROP, "test tsleep", 10*hz); > f_close(fd); > kthread_exit(0); > } > > int f_open(char *filename, int *fd){ > struct thread *td = curthread; > int ret = kern_open(td, filename, UIO_SYSSPACE, O_RDONLY, FREAD); > if(!ret){ > *fd = td->td_retval[0]; > return 1; > } > return 0; > } kthread's / kproc's do not have a valid file descriptor table. I think you are probably not going to be happy trying to stuff a full httpd in the kernel, btw. I think instead you should look at creative ways of exposing certain bits of what you need to userland instead where possible. Alternatively, you could use a caching accelerator of some sort that maps known URLs to specific vnodes so you can reply to those directly, but when you miss in your cache you wake up a userland process which processes the URL and opens a file and you can then save the vnode from that file handle in your cache. However, stuffing httpd into the kernel may not buy you an appreciable amount of gain relative to the expense of making it work. BTW, kern_open() "works" in your module handler because the module handler runs in the kernel half of the thread from the kldload command. And when you do "kern_open()" you are actually opening a new file descriptor in the kldload process. This is quite a bad, bad idea to be indiscriminately screwing with user process' file descriptors behind their back. A brief search in the archives should cover how to initalize the necessary vnode references for a kproc's file descriptor table so that namei() works (and then you can use vn_open(), but _not_ kern_open()). I answered that question just last week in another thread ("Driver development question" on drivers@). However, in general the kernel is not nearly as friendly an environment as userland, and it can be quite saner and easier to debug if you export certain bits of the kernel to userland to accelerate portions of your application than moving the application into the kernel in my experience. -- John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 21:37:30 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28F4E106570A for ; Tue, 4 Aug 2009 21:37:29 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: from mail.garage.freebsd.pl (chello087206049004.chello.pl [87.206.49.4]) by mx1.freebsd.org (Postfix) with ESMTP id 2835E8FC12 for ; Tue, 4 Aug 2009 21:37:28 +0000 (UTC) (envelope-from pjd@garage.freebsd.pl) Received: by mail.garage.freebsd.pl (Postfix, from userid 65534) id 114B945B36; Tue, 4 Aug 2009 23:04:49 +0200 (CEST) Received: from localhost (chello087206049004.chello.pl [87.206.49.4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.garage.freebsd.pl (Postfix) with ESMTP id 05C3945684; Tue, 4 Aug 2009 23:04:39 +0200 (CEST) Date: Tue, 4 Aug 2009 23:04:57 +0200 From: Pawel Jakub Dawidek To: Maslan Message-ID: <20090804210457.GF2181@garage.freebsd.pl> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Zi0sgQQBxRFxMTsj" Content-Disposition: inline In-Reply-To: <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> User-Agent: Mutt/1.4.2.3i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 8.0-CURRENT i386 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on mail.garage.freebsd.pl X-Spam-Level: X-Spam-Status: No, score=-0.6 required=4.5 tests=BAYES_00,RCVD_IN_SORBS_DUL autolearn=no version=3.0.4 Cc: Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?= , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 21:37:30 -0000 --Zi0sgQQBxRFxMTsj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 03, 2009 at 09:25:27PM +0000, Maslan wrote: > No my code doesn't work, I thought it may be because that soaccept() > -which is not found in man 9- is non-blocking, so i've to put my code > in a thread. > Now i got another problem, when I open a text file from this thread, > the kernel crashes, I'm sure that its the thread. >=20 > kthread_create((void *)thread_main, NULL, NULL, RFNOWAIT, 0, "thread"); >=20 > void thread_main(){ > struct thread *td =3D curthread; > int ret; > int fd; > ret =3D f_open("/path/to/file.txt", &fd); > printf("%d\n", ret); > tsleep(td, PDROP, "test tsleep", 10*hz); > f_close(fd); > kthread_exit(0); > } >=20 > int f_open(char *filename, int *fd){ > struct thread *td =3D curthread; > int ret =3D kern_open(td, filename, UIO_SYSSPACE, O_RDONLY, FREAD); > if(!ret){ > *fd =3D td->td_retval[0]; > return 1; > } > return 0; > } >=20 > I've to finish up this problem to go back for the first one. > Can you figure out what's wrong with this code, it works when I call > thread_main() rather than kthread_create((void *)thread_main, ..... When you did kern_open() without creating kernel thread, it worked, because kern_open() used file descriptor table from your current (userland) process. In FreeBSD 7.x kthread_create() creates a process without file descriptor table, so you can't use kern_open() and actually you shouldn't do this either. Take a look at sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c, where you can find functions to do what you want. I guess you already considered doing all this in userland?:) --=20 Pawel Jakub Dawidek http://www.wheel.pl pjd@FreeBSD.org http://www.FreeBSD.org FreeBSD committer Am I Evil? Yes, I Am! --Zi0sgQQBxRFxMTsj Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.4 (FreeBSD) iD8DBQFKeKJ5ForvXbEpPzQRAoEoAJsEUEFVHoo7LUjhPz1m04KB5LDuPgCg+J38 aVvIaYP47XokZiqx7Ry2iqA= =8DQI -----END PGP SIGNATURE----- --Zi0sgQQBxRFxMTsj-- From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 21:43:25 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 023BF1065789 for ; Tue, 4 Aug 2009 21:43:25 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id BB63B8FC16 for ; Tue, 4 Aug 2009 21:43:24 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from [IPv6:2001:7b8:3a7:0:c1b0:9656:a47:318] (unknown [IPv6:2001:7b8:3a7:0:c1b0:9656:a47:318]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 200295C42; Tue, 4 Aug 2009 23:43:23 +0200 (CEST) Message-ID: <4A78AB7C.3040406@andric.com> Date: Tue, 04 Aug 2009 23:43:24 +0200 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3pre) Gecko/20090801 Shredder/3.0b4pre MIME-Version: 1.0 To: Mel Flynn References: <200908041245.35926.mel.flynn+fbsd.hackers@mailing.thruhere.net> In-Reply-To: <200908041245.35926.mel.flynn+fbsd.hackers@mailing.thruhere.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Spot the error 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, 04 Aug 2009 21:43:26 -0000 On 2009-08-04 22:45, Mel Flynn wrote: > % mount -t msdofs /dev/label/camera ~/camera > mount: /dev/label/camera : Operation not supported by device > > I would expect something along the lines of "unknown file system type". Is > this fixable? Yes, just use "msdosfs" instead. ;) That said, it looks like ENODEV is returned by vfs_domount(), whenever the fs type is not found in the list of supported filesystems: [...] if (fsflags & MNT_ROOTFS) vfsp = vfs_byname(fstype); else vfsp = vfs_byname_kld(fstype, td, &error); if (vfsp == NULL) return (ENODEV); [...] Note that in the case when vfs_byname_kld() gets called, the error it returns is silently thrown away. What a pity. :) In any case, you could paint a lot of bikesheds about which error code from errno.h would be most suited for this situation, unfortunately. And there isn't a special "unknown file system" error code, either... From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 22:37:00 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1908A1065670; Tue, 4 Aug 2009 22:37:00 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: from mail-fx0-f210.google.com (mail-fx0-f210.google.com [209.85.220.210]) by mx1.freebsd.org (Postfix) with ESMTP id 7040C8FC0C; Tue, 4 Aug 2009 22:36:59 +0000 (UTC) (envelope-from maslanbsd@gmail.com) Received: by fxm6 with SMTP id 6so2214060fxm.43 for ; Tue, 04 Aug 2009 15:36:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6/+ckhG3Ggh67At+ihJgl/+j2bz5AX5D1QpDF4fdTR4=; b=OI2Q4AUgjwlI1Jjpl/GpNrAe1iFWjOnMsVQPnnjVrUlke9OMMROB3IDeH71el1OjxP fWW4EgS+Aeh/urDNYyIw8tHZbvGhRpHxXQRiU0EjyJAvxNUUI47/m5rpBkZkOFDshNNF Z2qOcqVYwgKy3oMUtlLjrJMBp90xUjN4CkpF0= 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=Ki2WQRp3wGXL3af5z2+/wu+OWgC3cGqyVYSZclU6OAsEFXC5p5sUFen5zch6liH0vU FQiQQ5VZGqOqwcRyCJJaqcjWqJPrCRXhV++1TZ6TPcx0VHimwE72uBfxixy8mT4VGER7 zVDCU6AVwhf1FhZBSMXA08rHU12wlkMe7Ln1A= MIME-Version: 1.0 Received: by 10.204.118.207 with SMTP id w15mr182950bkq.126.1249425418403; Tue, 04 Aug 2009 15:36:58 -0700 (PDT) In-Reply-To: <20090804210457.GF2181@garage.freebsd.pl> References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> <20090804210457.GF2181@garage.freebsd.pl> Date: Wed, 5 Aug 2009 01:36:58 +0300 Message-ID: <319cceca0908041536g71e416dao13864b7b220fb89a@mail.gmail.com> From: Maslan To: Pawel Jakub Dawidek Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 22:37:00 -0000 > When you did kern_open() without creating kernel thread, it worked, > because kern_open() used file descriptor table from your current > (userland) process. In FreeBSD 7.x kthread_create() creates a process > without file descriptor table, so you can't use kern_open() and actually > you shouldn't do this either. I understood now. Thanks > Take a look at sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c, > where you can find functions to do what you want. > > I guess you already considered doing all this in userland?:) I'm not deploying this http server for any production, i just want to study its performance compared to a userland http server. And to experience FreeBSD kernel hacking. I'm still trying to figure out, how to play with soreceive() now. But Thanks a lot, It's now clearer for me. From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 4 23:04:10 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 705111065673 for ; Tue, 4 Aug 2009 23:04:10 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outP.internet-mail-service.net (outp.internet-mail-service.net [216.240.47.239]) by mx1.freebsd.org (Postfix) with ESMTP id 516A48FC12 for ; Tue, 4 Aug 2009 23:04:10 +0000 (UTC) (envelope-from julian@elischer.org) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 69F74B9857; Tue, 4 Aug 2009 16:04:10 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 6C6322D6006; Tue, 4 Aug 2009 16:04:09 -0700 (PDT) Message-ID: <4A78BE7D.1010902@elischer.org> Date: Tue, 04 Aug 2009 16:04:29 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Maslan References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <864ospvvkv.fsf@ds4.des.no> <319cceca0908031043x6bfe5771wa73553dce922756a@mail.gmail.com> <86eirs65gb.fsf@ds4.des.no> <319cceca0908031425r3516de29q34807cdf2c7489ed@mail.gmail.com> <20090804210457.GF2181@garage.freebsd.pl> <319cceca0908041536g71e416dao13864b7b220fb89a@mail.gmail.com> In-Reply-To: <319cceca0908041536g71e416dao13864b7b220fb89a@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: =?ISO-8859-1?Q?Dag-Erling_Sm?=, =?ISO-8859-1?Q?=F8rgrav?= , Pawel Jakub Dawidek , FreeBSD Hackers Subject: Re: sosend() and mbuf 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, 04 Aug 2009 23:04:10 -0000 Maslan wrote: >> When you did kern_open() without creating kernel thread, it worked, >> because kern_open() used file descriptor table from your current >> (userland) process. In FreeBSD 7.x kthread_create() creates a process >> without file descriptor table, so you can't use kern_open() and actually >> you shouldn't do this either. > I understood now. Thanks > >> Take a look at sys/cddl/compat/opensolaris/kern/opensolaris_kobj.c, >> where you can find functions to do what you want. >> >> I guess you already considered doing all this in userland?:) > > I'm not deploying this http server for any production, i just want to > study its performance compared to a userland http server. > And to experience FreeBSD kernel hacking. > > I'm still trying to figure out, how to play with soreceive() now. > But Thanks a lot, It's now clearer for me. > _______________________________________________ > 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" have a look at the netgraph modules. There is a module called ksocket that allows other netgraph modules to use sockets. more than one person has implemented an in-kernel http server in a netgraph module. From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 5 00:15:51 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44EEA106564A for ; Wed, 5 Aug 2009 00:15:51 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 13EC48FC14 for ; Wed, 5 Aug 2009 00:15:50 +0000 (UTC) (envelope-from mel.flynn+fbsd.hackers@mailing.thruhere.net) Received: from smoochies.rachie.is-a-geek.net (mailhub.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 008E77E818; Tue, 4 Aug 2009 16:15:49 -0800 (AKDT) From: Mel Flynn To: freebsd-hackers@freebsd.org Date: Tue, 4 Aug 2009 16:15:48 -0800 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA2; KDE/4.2.4; i386; ; ) References: <200908041245.35926.mel.flynn+fbsd.hackers@mailing.thruhere.net> <4A78AB7C.3040406@andric.com> In-Reply-To: <4A78AB7C.3040406@andric.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908041615.49128.mel.flynn+fbsd.hackers@mailing.thruhere.net> Cc: Dimitry Andric Subject: Re: Spot the error 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, 05 Aug 2009 00:15:51 -0000 On Tuesday 04 August 2009 13:43:24 Dimitry Andric wrote: > On 2009-08-04 22:45, Mel Flynn wrote: > > % mount -t msdofs /dev/label/camera ~/camera > > mount: /dev/label/camera : Operation not supported by device > > > > I would expect something along the lines of "unknown file system type". > > Is this fixable? > > Yes, just use "msdosfs" instead. ;) That said, it looks like ENODEV is > returned by vfs_domount(), whenever the fs type is not found in the > list of supported filesystems: > > [...] > if (fsflags & MNT_ROOTFS) > vfsp = vfs_byname(fstype); > else > vfsp = vfs_byname_kld(fstype, td, &error); > if (vfsp == NULL) > return (ENODEV); > [...] > > Note that in the case when vfs_byname_kld() gets called, the error it > returns is silently thrown away. What a pity. :) > > In any case, you could paint a lot of bikesheds about which error code > from errno.h would be most suited for this situation, unfortunately. I would expect "Unable to load fs: " + ENOENT. I was asking if this was fixable, cause it looked like the code has been abstracted to the point that specific errors were hard, but maybe I missed something. -- Mel From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 5 13:50:19 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C0DB91065670 for ; Wed, 5 Aug 2009 13:50:19 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from tensor.andric.com (cl-327.ede-01.nl.sixxs.net [IPv6:2001:7b8:2ff:146::2]) by mx1.freebsd.org (Postfix) with ESMTP id 85E0F8FC12 for ; Wed, 5 Aug 2009 13:50:19 +0000 (UTC) (envelope-from dimitry@andric.com) Received: from [IPv6:2001:7b8:3a7:0:7ca7:35a:1442:752b] (unknown [IPv6:2001:7b8:3a7:0:7ca7:35a:1442:752b]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 99F2B5C59; Wed, 5 Aug 2009 15:50:18 +0200 (CEST) Message-ID: <4A798E1B.9010109@andric.com> Date: Wed, 05 Aug 2009 15:50:19 +0200 From: Dimitry Andric User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.1.3pre) Gecko/20090801 Shredder/3.0b4pre MIME-Version: 1.0 To: Mel Flynn References: <200908041245.35926.mel.flynn+fbsd.hackers@mailing.thruhere.net> <4A78AB7C.3040406@andric.com> <200908041615.49128.mel.flynn+fbsd.hackers@mailing.thruhere.net> In-Reply-To: <200908041615.49128.mel.flynn+fbsd.hackers@mailing.thruhere.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Spot the error 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, 05 Aug 2009 13:50:20 -0000 On 2009-08-05 02:15, Mel Flynn wrote: > I would expect "Unable to load fs: " + ENOENT. I was asking if this was > fixable, cause it looked like the code has been abstracted to the point that > specific errors were hard, but maybe I missed something. It does not seem easily fixable. The problem is that the mount command simply prints out the error of the system call, and doesn't have any idea which of the (many) parameters was wrong. You could change the returned error in this particular case to ENOENT, of course, but that might be considered even more confusing. Like, "What do you mean, that SCSI disk doesn't exist? It's right there in /dev!" One could also argue for EINVAL, but there's the bikeshed again... :) From owner-freebsd-hackers@FreeBSD.ORG Wed Aug 5 20:36:47 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF68D106566C for ; Wed, 5 Aug 2009 20:36:47 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 9DF598FC15 for ; Wed, 5 Aug 2009 20:36:47 +0000 (UTC) Received: by elvis.mu.org (Postfix, from userid 1192) id 54DFD1A3D39; Wed, 5 Aug 2009 13:36:47 -0700 (PDT) Date: Wed, 5 Aug 2009 13:36:47 -0700 From: Alfred Perlstein To: Dimitry Andric Message-ID: <20090805203647.GX47463@elvis.mu.org> References: <200908041245.35926.mel.flynn+fbsd.hackers@mailing.thruhere.net> <4A78AB7C.3040406@andric.com> <200908041615.49128.mel.flynn+fbsd.hackers@mailing.thruhere.net> <4A798E1B.9010109@andric.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A798E1B.9010109@andric.com> User-Agent: Mutt/1.4.2.3i Cc: freebsd-hackers@freebsd.org, Mel Flynn Subject: Re: Spot the error 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, 05 Aug 2009 20:36:48 -0000 * Dimitry Andric [090805 06:51] wrote: > On 2009-08-05 02:15, Mel Flynn wrote: > > I would expect "Unable to load fs: " + ENOENT. I was asking if this was > > fixable, cause it looked like the code has been abstracted to the point that > > specific errors were hard, but maybe I missed something. > > It does not seem easily fixable. The problem is that the mount command > simply prints out the error of the system call, and doesn't have any > idea which of the (many) parameters was wrong. > > You could change the returned error in this particular case to ENOENT, > of course, but that might be considered even more confusing. Like, > "What do you mean, that SCSI disk doesn't exist? It's right there in > /dev!" > > One could also argue for EINVAL, but there's the bikeshed again... :) mount 9 could be augmented to preflight/postflight the vfs type name through the provide a better error. -- - Alfred Perlstein .- AMA, VMOA #5191, 03 vmax, 92 gs500, 85 ch250 .- FreeBSD committer From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 6 12:38:23 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CEC06106564A for ; Thu, 6 Aug 2009 12:38:23 +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 9EAB98FC1F for ; Thu, 6 Aug 2009 12:38:23 +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 3800C46B17; Thu, 6 Aug 2009 08:38:23 -0400 (EDT) Received: from jhbbsd.hudson-trading.com (unknown [209.249.190.8]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 0777A8A0AA; Thu, 6 Aug 2009 08:38:22 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Date: Thu, 6 Aug 2009 08:18:22 -0400 User-Agent: KMail/1.9.7 References: <319cceca0908030119i3432a495ya60aa431dab0e1b1@mail.gmail.com> <20090804093036.GN1292@hoeg.nl> <86ab2f34ay.fsf@ds4.des.no> In-Reply-To: <86ab2f34ay.fsf@ds4.des.no> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200908060818.23158.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Thu, 06 Aug 2009 08:38:22 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-2.5 required=4.2 tests=AWL,BAYES_00,RDNS_NONE autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?= , Maslan , Max Laier , Ed Schouten Subject: Re: sosend() and mbuf 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, 06 Aug 2009 12:38:24 -0000 On Tuesday 04 August 2009 12:57:25 pm Dag-Erling Sm=C3=B8rgrav wrote: > Ed Schouten writes: > > Maslan writes: > > > However, when i checked the pid & tid of the new created thread it > > > was not the same as the parent nor as the proc0 & thread0 > > I am not sure, but sharing another process's address space doesn't have > > to imply it shares the same pid, right? >=20 > The man page explicitly states that if no process is specified, the new > thread is assigned to proc0, which has a valid filedesc table, valid > creds etc., so this shouldn't be a problem. However, he's getting a > different PID, which shouldn't happen. Either the man page is wrong, or > things were different in 7. proc0 does not have a fully valid file descriptor table. It has a structur= e,=20 but fd_[cjr]dir are not initialized to point at anything. File descriptors= =20 are a property of userland processes, not of kernel processes. However,=20 fd_[cjr]dir need to be valid to perform any namei() lookup even if one is=20 simply going to do a vn_open() on the resulting vnode (which is more=20 approprate for kernel code to do, if it is to open a file at all). =2D-=20 John Baldwin From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 6 18:15:20 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A12AB106564A for ; Thu, 6 Aug 2009 18:15:20 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 3205F8FC17 for ; Thu, 6 Aug 2009 18:15:19 +0000 (UTC) Received: (qmail 23558 invoked by uid 399); 6 Aug 2009 18:15:17 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 6 Aug 2009 18:15:17 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4A7B1DB0.1040602@FreeBSD.org> Date: Thu, 06 Aug 2009 11:15:12 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.22 (X11/20090729) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org X-Enigmail-Version: 0.95.7 OpenPGP: id=D5B2F0FB Content-Type: multipart/mixed; boundary="------------000003020807060309050608" Subject: Problem in bin/sh stripping the * character through ${expansion%} 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, 06 Aug 2009 18:15:20 -0000 This is a multi-part message in MIME format. --------------000003020807060309050608 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Howdy, I came across this problem during a recent portmaster update. When trying to strip off the * character using variable expansion in bin/sh it doesn't work. Other "special" characters do work if they are properly escaped. The attached mini-script clearly shows the problem: $ sh sh-strip-problem var before stripping: foo\* var after stripping: foo\* var before stripping: foo\$ var after stripping: foo\ In contrast, bash does the right thing: bash sh-strip-problem var before stripping: foo\* var after stripping: foo\ var before stripping: foo\$ var after stripping: foo\ Should I go ahead and file a PR on this? Doug -- This .signature sanitized for your protection --------------000003020807060309050608 Content-Type: text/plain; name="sh-strip-problem" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="sh-strip-problem" var='foo\*' echo "var before stripping: $var" var=${var%\*} echo "var after stripping: $var" echo '' var='foo\$' echo "var before stripping: $var" var=${var%\$} echo "var after stripping: $var" exit 0 --------------000003020807060309050608-- From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 6 18:38:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04926106566C; Thu, 6 Aug 2009 18:38:50 +0000 (UTC) (envelope-from johans@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id B1E8E8FC15; Thu, 6 Aug 2009 18:38:49 +0000 (UTC) Received: by mx1.stack.nl (Postfix, from userid 65534) id 8D6AC35A860; Thu, 6 Aug 2009 20:38:48 +0200 (CEST) X-Spam-DCC: CTc-dcc1: scanner01.stack.nl 1030; Body=1 Fuz1=1 Fuz2=1 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on scanner01.stack.nl X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Relay-Country: _RELAYCOUNTRY_ Received: from mud.stack.nl (mud.stack.nl [IPv6:2001:610:1108:5011:230:48ff:fe12:2794]) by mx1.stack.nl (Postfix) with ESMTP id C3B5135A859; Thu, 6 Aug 2009 20:38:46 +0200 (CEST) Received: by mud.stack.nl (Postfix, from userid 801) id 7A0A611453; Thu, 6 Aug 2009 20:38:46 +0200 (CEST) Date: Thu, 6 Aug 2009 20:38:46 +0200 From: Johan van Selst To: Doug Barton Message-ID: <20090806183846.GA68029@mud.stack.nl> References: <4A7B1DB0.1040602@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs" Content-Disposition: inline In-Reply-To: <4A7B1DB0.1040602@FreeBSD.org> User-Agent: Mutt/1.5.19 (2009-01-14) Cc: freebsd-hackers@freebsd.org Subject: Re: Problem in bin/sh stripping the * character through ${expansion%} 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, 06 Aug 2009 18:38:50 -0000 --82I3+IH0IqGh5yIs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Doug Barton wrote: > I came across this problem during a recent portmaster update. When > trying to strip off the * character using variable expansion in bin/sh > it doesn't work. Other "special" characters do work if they are > properly escaped. Your script does var=${var%\*} When I tried it myself, I automatically typed quotes, which does work var="${var%\*}" Alternatively you could use (with or without quotes) var="${var%[*]}" Still, I don't see a reason why your variant shouldn't work as well.. Regards, Johan --82I3+IH0IqGh5yIs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- iEYEAREIAAYFAkp7IzYACgkQaOElK32lxTsw/gCghk8rSF8E9/zmmMtl5A+Onnwg 7dYAn0PIB42NH47BX6bm/6oIromzEilm =/nb/ -----END PGP SIGNATURE----- --82I3+IH0IqGh5yIs-- From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 6 18:45:57 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 46D8B1065674; Thu, 6 Aug 2009 18:45:57 +0000 (UTC) (envelope-from johans@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 004168FC17; Thu, 6 Aug 2009 18:45:56 +0000 (UTC) Received: by mx1.stack.nl (Postfix, from userid 65534) id CD608375B55; Thu, 6 Aug 2009 20:45:55 +0200 (CEST) X-Spam-DCC: CTc-dcc1: scanner01.stack.nl 1030; Body=1 Fuz1=1 Fuz2=1 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on scanner01.stack.nl X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.2.5 X-Spam-Relay-Country: _RELAYCOUNTRY_ Received: from mud.stack.nl (mud.stack.nl [IPv6:2001:610:1108:5011:230:48ff:fe12:2794]) by mx1.stack.nl (Postfix) with ESMTP id F3140375B27; Thu, 6 Aug 2009 20:45:53 +0200 (CEST) Received: by mud.stack.nl (Postfix, from userid 801) id C343211453; Thu, 6 Aug 2009 20:45:53 +0200 (CEST) Date: Thu, 6 Aug 2009 20:45:53 +0200 From: Johan van Selst To: Doug Barton Message-ID: <20090806184553.GA68649@mud.stack.nl> References: <4A7B1DB0.1040602@FreeBSD.org> <20090806183846.GA68029@mud.stack.nl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI" Content-Disposition: inline In-Reply-To: <20090806183846.GA68029@mud.stack.nl> User-Agent: Mutt/1.5.19 (2009-01-14) Cc: freebsd-hackers@freebsd.org Subject: Re: Problem in bin/sh stripping the * character through ${expansion%} 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, 06 Aug 2009 18:45:57 -0000 --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Johan van Selst wrote: > When I tried it myself, I automatically typed quotes, which does work > var="${var%\*}" Really should learn to read better: this in fact procudes 'foo' rather than 'foo\' in the given example case. Again, not like bash. Johan --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- iEYEAREIAAYFAkp7JOEACgkQaOElK32lxTve4ACdHk4H+cfNV/aPabu0Dy1QndpF oeAAoJPmylhOxJLCVVZi6GyFvn632fGb =e0lz -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI-- From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 6 19:46:17 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6582106564A for ; Thu, 6 Aug 2009 19:46:17 +0000 (UTC) (envelope-from rea-fbsd@codelabs.ru) Received: from 0.mx.codelabs.ru (0.mx.codelabs.ru [144.206.177.45]) by mx1.freebsd.org (Postfix) with ESMTP id 5A1328FC18 for ; Thu, 6 Aug 2009 19:46:17 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; q=dns; c=simple; s=one; d=codelabs.ru; h=Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To:Sender; b=Y8Ba8EL4nwU8J6fnH8qfZJFRP4kn1wc0o22zEr4GD22ZLqHRIKGso7MV+KVHHAWcg8CSV2GHI83IyvWhdXDc9MW2ARFigVFGyq9W1/e7Vdschd/SQxdEypn3ImmyZqCQqRuNa1UZYcD3LMES3w/7gQL9tiVUQCKuf/e1yHuYXp4=; Received: from phoenix.codelabs.ru (ppp91-77-10-19.pppoe.mtu-net.ru [91.77.10.19]) by 0.mx.codelabs.ru with esmtpsa (TLSv1:AES256-SHA:256) id 1MZ8bx-00010C-IQ; Thu, 06 Aug 2009 23:26:49 +0400 Date: Fri, 7 Aug 2009 03:26:50 +0400 From: Eygene Ryabinkin To: Doug Barton Message-ID: References: <4A7B1DB0.1040602@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A7B1DB0.1040602@FreeBSD.org> Sender: rea-fbsd@codelabs.ru Cc: freebsd-hackers@freebsd.org Subject: Re: Problem in bin/sh stripping the * character through ${expansion%} X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: rea-fbsd@codelabs.ru List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Aug 2009 19:46:17 -0000 Doug, good day. Thu, Aug 06, 2009 at 11:15:12AM -0700, Doug Barton wrote: > I came across this problem during a recent portmaster update. When > trying to strip off the * character using variable expansion in bin/sh > it doesn't work. Other "special" characters do work if they are > properly escaped. > > The attached mini-script clearly shows the problem: > > $ sh sh-strip-problem > var before stripping: foo\* > var after stripping: foo\* > > var before stripping: foo\$ > var after stripping: foo\ According to the sh(1), it is not a problem. Namely, - \* being unquoted at all will produce a lone '*'; - '*' when treated as the smallest pattern, will result in a stripping of a zero-length string -- it is the smallest pattern in the case of '*' that matches anything. In order to strip the trailing star you should use ----- var=${var%[*]} ----- This gives you the pattern of '[*]' that is properly treated as the single star -- it's a weird way to escape the star in the patterns. Other characters work, but only because they produce no patterns. In principle, you can try \? that will remove any trailing character no matter what, since it is the second character that will produce the pattern. > In contrast, bash does the right thing: > > bash sh-strip-problem > var before stripping: foo\* > var after stripping: foo\ > > var before stripping: foo\$ > var after stripping: foo\ I will try to look at the XCU to understand what is the POSIX way of doing the things. -- Eygene _ ___ _.--. # \`.|\..----...-'` `-._.-'_.-'` # Remember that it is hard / ' ` , __.--' # to read the on-line manual )/' _/ \ `-_, / # while single-stepping the kernel. `-'" `"\_ ,_.-;_.-\_ ', fsc/as # _.-'_./ {_.' ; / # -- FreeBSD Developers handbook {_.-``-' {_/ # From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 7 17:36:58 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 31237106564A for ; Fri, 7 Aug 2009 17:36:58 +0000 (UTC) (envelope-from cronfy@sprinthost.ru) Received: from odin.from.sh (odin.from.sh [80.93.50.112]) by mx1.freebsd.org (Postfix) with ESMTP id D9B3A8FC19 for ; Fri, 7 Aug 2009 17:36:57 +0000 (UTC) Received: from odin.from.sh ([80.93.50.112]) by odin.from.sh with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69 (FreeBSD)) (envelope-from ) id 1MZT8G-00063k-MG for freebsd-hackers@freebsd.org; Fri, 07 Aug 2009 21:21:32 +0400 Received: from [89.223.116.161] (helo=[10.10.10.126]) by odin.from.sh with esmtpa (Exim 4.69 (FreeBSD)) (envelope-from ) id 1MZT8A-0005zH-EX for freebsd-hackers@freebsd.org; Fri, 07 Aug 2009 21:21:26 +0400 Message-ID: <4A7C6229.2040600@sprinthost.ru> Date: Fri, 07 Aug 2009 21:19:37 +0400 From: cronfy User-Agent: Thunderbird 2.0.0.22 (X11/20090608) MIME-Version: 1.0 To: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Was system rebooted by power fail or by kernel panic? 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, 07 Aug 2009 17:36:58 -0000 Hello! Is there a way to find out was system rebooted by power fail or by kernel panic? The problem is that there is no free space on devices to store kernel core dump (swap is smaller than physical memory, no more dump devices exist). Will FreeBSD report about panic somehow if it cannot create core dump? Thanks in advance. From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 7 17:57:42 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E5941065670 for ; Fri, 7 Aug 2009 17:57:42 +0000 (UTC) (envelope-from max@love2party.net) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by mx1.freebsd.org (Postfix) with ESMTP id 14D308FC25 for ; Fri, 7 Aug 2009 17:57:42 +0000 (UTC) Received: from vampire.homelinux.org (dslb-088-066-060-011.pools.arcor-ip.net [88.66.60.11]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MKsym-1MZThE0qYs-000XVn; Fri, 07 Aug 2009 19:57:40 +0200 Received: (qmail 83084 invoked from network); 7 Aug 2009 17:57:39 -0000 Received: from kvm.laiers.local (HELO kvm.localnet) (192.168.4.200) by router.laiers.local with SMTP; 7 Aug 2009 17:57:39 -0000 From: Max Laier Organization: FreeBSD To: freebsd-hackers@freebsd.org Date: Fri, 7 Aug 2009 19:57:38 +0200 User-Agent: KMail/1.12.0 (Linux/2.6.30-ARCH; KDE/4.3.0; x86_64; ; ) References: <4A7C6229.2040600@sprinthost.ru> In-Reply-To: <4A7C6229.2040600@sprinthost.ru> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <200908071957.39199.max@love2party.net> X-Provags-ID: V01U2FsdGVkX18Snh3xXtUbF0c+4GhW4LmgGmJnRE7u4LVS6tG ozO4tCnMTG6n5H3d5cQcbeaSZrUt2UG8UhdcBJ1EGznIyQokN9 EqGo2o2ul6ZxffjsZGiSw== Cc: cronfy Subject: Re: Was system rebooted by power fail or by kernel panic? 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, 07 Aug 2009 17:57:42 -0000 On Friday 07 August 2009 19:19:37 cronfy wrote: > Hello! > > Is there a way to find out was system rebooted by power fail or by > kernel panic? > > The problem is that there is no free space on devices to store kernel > core dump (swap is smaller than physical memory, no more dump devices > exist). Will FreeBSD report about panic somehow if it cannot create core > dump? You can try textdumps: http://www.freebsd.org/cgi/man.cgi?query=textdump&manpath=FreeBSD+8-current -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 7 20:56:51 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D67411065676 for ; Fri, 7 Aug 2009 20:56:51 +0000 (UTC) (envelope-from psteele@webmail.maxiscale.com) Received: from k2smtpout01-01.prod.mesa1.secureserver.net (k2smtpout01-01.prod.mesa1.secureserver.net [64.202.189.88]) by mx1.freebsd.org (Postfix) with SMTP id ABF408FC30 for ; Fri, 7 Aug 2009 20:56:51 +0000 (UTC) Received: (qmail 3160 invoked from network); 7 Aug 2009 20:29:53 -0000 Received: from unknown (HELO owa.webmail.maxiscale.com) (72.167.52.135) by k2smtpout01-01.prod.mesa1.secureserver.net (64.202.189.88) with ESMTP; 07 Aug 2009 20:29:53 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Fri, 7 Aug 2009 13:35:30 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How to signal a time zone change? Thread-Index: AcoXndG5Rl+9fbL3RQSfrIrpGQBoYQ== From: "Peter Steele" To: X-Mailman-Approved-At: Fri, 07 Aug 2009 21:01:44 +0000 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: How to signal a time zone change? 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, 07 Aug 2009 20:56:52 -0000 We have a suite of applications with a Java GUI controlling everything. One of the actions the user can perform is to set the time zone. We do this through our Java application and update the /etc/localtime as required. We also make an API call to tell the JVM that the time zone as changed, and from the perspective of the Java app, the time zone is changed correctly (the timestamps for example in our log files reflect the change). Likewise, after the user performs this action, running "date" on one of our systems shows that the time zone has been changed as requested.=20 =20 The problem is with our C applications. They continue to operate with the old time zone, so things like timestamps in log files are not in sync with the timestamps in the Java app log files. If we stop and restart the C apps they pick up the time zone change. However, we don't want to take this extreme approach. We want the Java app to signal to the C applications that the time zone has changed. However, I've experimented with the various time zone related calls and I cannot figure out what call is needed to make the C applications pick up the time zone change. I've tried setting the environment variable TZ to the new time zone and this doesn't seem to work, and I've tried calling tzset() and tzsetwall(). In each case after I make these calls the function "localtime()" does not return the same time base as the Java application. =20 Based on what I've read, I would think that the following steps would do the trick on the C side after the Java app changes time zone and updates /etc/localtime: =20 time_t date =3D time(NULL); unsetenv("TZ"); tzset(); printf("time zone is %s/%s", tzname[0], tzname[1]); struct tm* locTime =3D localtime(&date); printf("%02d:%02d:%02d", locTime->tm_hour, locTime->tm_min, locTime->tm_sec); =20 The time printed in this example however is still based on the old time zone. The tzname variable that is set by tzset() still shows for example EDT even if I have just changed the time zone to PDT. If I stop and restart the C app, the time is correct, and tzname is then PDT instead of EDT. =20 I'm very puzzled on what I'm supposed to do to kick start the time zone change in C. We do not want to have to restart our C apps for something as trivial as this. I posted this originally to the questions list but didn't get much traction. I'm hoping someone on this list can point me in the right direction. =20 From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 7 21:06:03 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 159991065677 for ; Fri, 7 Aug 2009 21:06:03 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outM.internet-mail-service.net (outm.internet-mail-service.net [216.240.47.236]) by mx1.freebsd.org (Postfix) with ESMTP id F261D8FC19 for ; Fri, 7 Aug 2009 21:06:02 +0000 (UTC) Received: from idiom.com (mx0.idiom.com [216.240.32.160]) by out.internet-mail-service.net (Postfix) with ESMTP id 820D2D1FDD; Fri, 7 Aug 2009 14:06:02 -0700 (PDT) X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 9AD0C2D6004; Fri, 7 Aug 2009 14:06:01 -0700 (PDT) Message-ID: <4A7C9738.10103@elischer.org> Date: Fri, 07 Aug 2009 14:06:00 -0700 From: Julian Elischer User-Agent: Thunderbird 2.0.0.22 (Macintosh/20090605) MIME-Version: 1.0 To: Peter Steele References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: How to signal a time zone change? 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, 07 Aug 2009 21:06:03 -0000 Peter Steele wrote: > We have a suite of applications with a Java GUI controlling everything. > One of the actions the user can perform is to set the time zone. We do > this through our Java application and update the /etc/localtime as > required. We also make an API call to tell the JVM that the time zone as > changed, and from the perspective of the Java app, the time zone is > changed correctly (the timestamps for example in our log files reflect > the change). Likewise, after the user performs this action, running > "date" on one of our systems shows that the time zone has been changed > as requested. > > > > The problem is with our C applications. They continue to operate with > the old time zone, so things like timestamps in log files are not in > sync with the timestamps in the Java app log files. If we stop and > restart the C apps they pick up the time zone change. However, we don't > want to take this extreme approach. We want the Java app to signal to > the C applications that the time zone has changed. However, I've > experimented with the various time zone related calls and I cannot > figure out what call is needed to make the C applications pick up the > time zone change. I've tried setting the environment variable TZ to the > new time zone and this doesn't seem to work, and I've tried calling You need to signal your app in some way.. Assuming you have source for the app then you can monitor /etc/localtime (or /etc) for change with kevent. > > > _______________________________________________ > 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 Fri Aug 7 21:14:42 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81036106566B for ; Fri, 7 Aug 2009 21:14:42 +0000 (UTC) (envelope-from psteele@webmail.maxiscale.com) Received: from k2smtpout01-01.prod.mesa1.secureserver.net (k2smtpout01-01.prod.mesa1.secureserver.net [64.202.189.88]) by mx1.freebsd.org (Postfix) with SMTP id 40AD68FC0A for ; Fri, 7 Aug 2009 21:14:42 +0000 (UTC) Received: (qmail 18169 invoked from network); 7 Aug 2009 21:14:42 -0000 Received: from unknown (HELO owa.webmail.maxiscale.com) (72.167.52.135) by k2smtpout01-01.prod.mesa1.secureserver.net (64.202.189.88) with ESMTP; 07 Aug 2009 21:14:42 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Date: Fri, 7 Aug 2009 14:20:18 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How to signal a time zone change? Thread-Index: AcoXo6gPJ4J8K2XaQaW7axiI+bcOPwAAAunQ References: <4A7C9738.10103@elischer.org> From: "Peter Steele" To: "Julian Elischer" X-Mailman-Approved-At: Fri, 07 Aug 2009 21:17:00 +0000 Cc: freebsd-hackers@freebsd.org Subject: RE: How to signal a time zone change? 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, 07 Aug 2009 21:14:42 -0000 >You need to signal your app in some way.. Assuming you have source for the app then you can monitor /etc/localtime (or /etc) for change with kevent. Signaling our C apps aren't the problem. We have an IPC framework in place and we can easily tell the C apps when the user has changed the time zone via the GUI. The problem is I can't figure out what C calls are needed to instantiate the time zone change. Based on the documentation, I would think that tzset() would do the trick once /etc/localtime has been updated by the Java app, but this does not work. The only way I've discovered that works is to restart our C apps and we want to avoid that. From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 7 22:02:40 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6DF82106566B for ; Fri, 7 Aug 2009 22:02:40 +0000 (UTC) (envelope-from psteele@webmail.maxiscale.com) Received: from k2smtpout02-01.prod.mesa1.secureserver.net (k2smtpout02-01.prod.mesa1.secureserver.net [64.202.189.90]) by mx1.freebsd.org (Postfix) with SMTP id 435438FC0A for ; Fri, 7 Aug 2009 22:02:39 +0000 (UTC) Received: (qmail 29619 invoked from network); 7 Aug 2009 22:02:39 -0000 Received: from unknown (HELO owa.webmail.maxiscale.com) (72.167.52.135) by k2smtpout02-01.prod.mesa1.secureserver.net (64.202.189.90) with ESMTP; 07 Aug 2009 22:02:39 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Date: Fri, 7 Aug 2009 15:08:16 -0700 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: How to signal a time zone change? Thread-Index: AcoXph/GqNTPNP7zSx+NKsjIee2nlwABBC/g References: <4A7C9738.10103@elischer.org> From: "Peter Steele" To: X-Mailman-Approved-At: Fri, 07 Aug 2009 22:07:35 +0000 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: RE: How to signal a time zone change? 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, 07 Aug 2009 22:02:41 -0000 >What's the value of the TZ environment variable for the C apps? You may need to have them read the new value from somewhere, and then rerun tzset(). The default value of the TZ environment variable is null. I just tried passing the explicitly time zone value to the C app and setting TZ to that value and that seemed to work. I would think that that I should be able to retrieve that value from /etc/localtime as the docs imply. Guess not. If I have to pass the time zone to the C app, then I guess that's what I'll do... =20 From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 8 10:52:48 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2648D106566B; Sat, 8 Aug 2009 10:52:48 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.16.84]) by mx1.freebsd.org (Postfix) with ESMTP id D6B448FC08; Sat, 8 Aug 2009 10:52:47 +0000 (UTC) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by kabab.cs.huji.ac.il with esmtp id 1MZiog-000GRx-V9; Sat, 08 Aug 2009 13:06:22 +0300 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: freebsd-scsi@freebsd.org, freebsd-current@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 08 Aug 2009 13:06:22 +0300 From: Danny Braniss Message-ID: Cc: freebsd-hackers@freebsd.org Subject: request test drivers for iscsi_initiator 2.2.3 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, 08 Aug 2009 10:52:48 -0000 This new version: o - has some bug fixes. o - has full header/data digest support, thanks to Daisuke Aoyama . o - the limit for the number of sessions is now 64, but can be raised - eventually via a sysctl call. o - the number of LUNs is unlimited, but things might get hairy over 128. o - now compiles & works under -current (8.0). The tag option is supported, but by default is set very low (0), if someone knows of a way to figure the optimal value I'll gladly add it. If it works for you, please let me know the model/make of the target so I can update the list. cheers, danny From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 8 10:52:50 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E32C1065670; Sat, 8 Aug 2009 10:52:50 +0000 (UTC) (envelope-from danny@cs.huji.ac.il) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.16.84]) by mx1.freebsd.org (Postfix) with ESMTP id BCA848FC15; Sat, 8 Aug 2009 10:52:49 +0000 (UTC) Received: from pampa.cs.huji.ac.il ([132.65.80.32]) by kabab.cs.huji.ac.il with esmtp id 1MZitq-000GUu-FA; Sat, 08 Aug 2009 13:11:42 +0300 X-Mailer: exmh version 2.7.2 01/07/2005 with nmh-1.2 To: freebsd-scsi@freebsd.org, freebsd-current@freebsd.org, freebsd-hackers@freebsd.org Comments: In-reply-to Danny Braniss message dated "Sat, 08 Aug 2009 13:06:22 +0300." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 08 Aug 2009 13:11:41 +0300 From: Danny Braniss Message-ID: Cc: Subject: Re: request test drivers for iscsi_initiator 2.2.3 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, 08 Aug 2009 10:52:50 -0000 wups, forgot a small little detail: ftp://ftp.cs.huji.ac.il/users/danny/freebsd/iscsi-2.2.3.tar.gz danny From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 8 15:46:08 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 620F5106564A; Sat, 8 Aug 2009 15:46:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id B53F68FC32; Sat, 8 Aug 2009 15:46:07 +0000 (UTC) Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 251030757; Sat, 08 Aug 2009 17:46:02 +0300 Message-ID: <4A7D8F72.8090905@FreeBSD.org> Date: Sat, 08 Aug 2009 17:45:06 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: Danny Braniss References: <1249741381.00149226.1249729205@10.7.7.3> <4A7D8D7A.5030303@mavhome.dp.ua> In-Reply-To: <4A7D8D7A.5030303@mavhome.dp.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-scsi@freebsd.org, freebsd-current@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: request test drivers for iscsi_initiator 2.2.3 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, 08 Aug 2009 15:46:08 -0000 Alexander Motin wrote: > Danny Braniss wrote: >> wups, forgot a small little detail: >> ftp://ftp.cs.huji.ac.il/users/danny/freebsd/iscsi-2.2.3.tar.gz > > Is there reason why > cpi->transport = XPORT_ISCSI; > covered by > #if defined(KNOB_VALID_ADDRESS) > ? Sorry, wrong question. But those who will test on CURRENT should take care about it. -- Alexander Motin From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 8 15:37:37 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C89B6106566B; Sat, 8 Aug 2009 15:37:37 +0000 (UTC) (envelope-from mav@mavhome.dp.ua) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id E57CB8FC33; Sat, 8 Aug 2009 15:37:36 +0000 (UTC) Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 251030557; Sat, 08 Aug 2009 17:37:32 +0300 Message-ID: <4A7D8D7A.5030303@mavhome.dp.ua> Date: Sat, 08 Aug 2009 17:36:42 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 Newsgroups: lucky.freebsd.current,lucky.freebsd.hackers,lucky.freebsd.scsi To: Danny Braniss References: <1249741381.00149226.1249729205@10.7.7.3> In-Reply-To: <1249741381.00149226.1249729205@10.7.7.3> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Mailman-Approved-At: Sat, 08 Aug 2009 17:16:47 +0000 Cc: freebsd-scsi@freebsd.org, freebsd-current@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: request test drivers for iscsi_initiator 2.2.3 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, 08 Aug 2009 15:37:38 -0000 Hi. Danny Braniss wrote: > wups, forgot a small little detail: > ftp://ftp.cs.huji.ac.il/users/danny/freebsd/iscsi-2.2.3.tar.gz Is there reason why cpi->transport = XPORT_ISCSI; covered by #if defined(KNOB_VALID_ADDRESS) ? -- Alexander Motin From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 8 18:42:06 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8A2C7106566B for ; Sat, 8 Aug 2009 18:42:06 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id 3FF0C8FC1F for ; Sat, 8 Aug 2009 18:42:06 +0000 (UTC) Received: (qmail 14372 invoked by uid 399); 8 Aug 2009 18:42:04 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 8 Aug 2009 18:42:04 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4A7DC6F6.4010802@FreeBSD.org> Date: Sat, 08 Aug 2009 11:41:58 -0700 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.22 (X11/20090729) MIME-Version: 1.0 To: rea-fbsd@codelabs.ru References: <4A7B1DB0.1040602@FreeBSD.org> In-Reply-To: X-Enigmail-Version: 0.95.7 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org Subject: Re: Problem in bin/sh stripping the * character through ${expansion%} 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, 08 Aug 2009 18:42:06 -0000 Eygene Ryabinkin wrote: > Doug, good day. > > Thu, Aug 06, 2009 at 11:15:12AM -0700, Doug Barton wrote: >> I came across this problem during a recent portmaster update. When >> trying to strip off the * character using variable expansion in bin/sh >> it doesn't work. Other "special" characters do work if they are >> properly escaped. >> >> The attached mini-script clearly shows the problem: >> >> $ sh sh-strip-problem >> var before stripping: foo\* >> var after stripping: foo\* >> >> var before stripping: foo\$ >> var after stripping: foo\ > > According to the sh(1), it is not a problem. Namely, > - \* being unquoted at all will produce a lone '*'; Bzzzt! :) Backslash A backslash preserves the literal meaning of the following char- acter, with the exception of the newline character (`\n'). A backslash preceding a newline is treated as a line continuation. > - '*' when treated as the smallest pattern, will result in a stripping > of a zero-length string -- it is the smallest pattern in the case of > '*' that matches anything. I agree with you if I had done ${var%*}, but the backslash should be preventing the * from being interpreted as part of the variable expansion. > In order to strip the trailing star you should use > ----- > var=${var%[*]} > ----- > This gives you the pattern of '[*]' that is properly treated as the > single star -- it's a weird way to escape the star in the patterns. That's creative, and better than the kludge I worked up for portmaster, thanks. > I will try to look at the XCU to understand what is the POSIX > way of doing the things. Great, thanks. Doug -- This .signature sanitized for your protection