From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 25 17:55:50 2008 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 B25F4106564A for ; Tue, 25 Nov 2008 17:55:50 +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 4D7E38FC14 for ; Tue, 25 Nov 2008 17:55:50 +0000 (UTC) (envelope-from max@love2party.net) Received: from vampire.homelinux.org (dslb-088-066-058-162.pools.arcor-ip.net [88.66.58.162]) by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis) id 0MKwh2-1L528a2edj-0004g3; Tue, 25 Nov 2008 18:55:48 +0100 Received: (qmail 89587 invoked from network); 25 Nov 2008 17:55:46 -0000 Received: from fbsd8.laiers.local (192.168.4.151) by router.laiers.local with SMTP; 25 Nov 2008 17:55:46 -0000 From: Max Laier Organization: FreeBSD To: freebsd-hackers@freebsd.org, Alexej Sokolov Date: Tue, 25 Nov 2008 18:55:44 +0100 User-Agent: KMail/1.10.1 (FreeBSD/8.0-CURRENT; KDE/4.1.1; i386; ; ) References: <20081125173750.GA4131@debian.samsung.router> In-Reply-To: <20081125173750.GA4131@debian.samsung.router> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200811251855.44853.max@love2party.net> X-Provags-ID: V01U2FsdGVkX1+Xf/s30l84MahS9LLOOqdT0yEYPQEx3d/Qofl zltRoOgIDCEXSPjZgCxC8rL1TbSRrKxbsmRfG/FESEY7LfNWoo LICOkik40D5GbfoVllPiA== Cc: Subject: Re: copy, copyin, copyout 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, 25 Nov 2008 17:55:50 -0000 On Tuesday 25 November 2008 18:37:50 Alexej Sokolov wrote: > Hello, > could anyone please explain to me the difference between functions: > copystr() and copyinstr() ? > > For i386 copyinstr is implemented in assembler. I can not read > the assembler code very well. > > I tried to allocate a memory in space of user process using vm_map_find > and then with copystr() I could copy data between user and kernel > memory. copystr() seemed to be able to do the same what copyinstr do. You might get lucky with copystr() if the user page is already resident, but if you page fault copystr() will kill the kernel. copyinstr() handles page faults. -- /"\ Best regards, | mlaier@freebsd.org \ / Max Laier | ICQ #67774661 X http://pf4freebsd.love2party.net/ | mlaier@EFnet / \ ASCII Ribbon Campaign | Against HTML Mail and News