Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Nov 2008 19:26:27 +0100
From:      Alexej Sokolov <bsd.quest@googlemail.com>
To:        freebsd-hackers@freebsd.org
Subject:   Re: copy, copyin, copyout
Message-ID:  <20081125182627.GA4223@debian.samsung.router>
In-Reply-To: <200811251855.44853.max@love2party.net>
References:  <20081125173750.GA4131@debian.samsung.router> <200811251855.44853.max@love2party.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Nov 25, 2008 at 06:55:21PM +0100, Max Laier wrote:
> 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.
Thanks a lot! I was lucky because I wired allocated pages before. 

 
> 
> -- 
> /"\  Best regards,                      | mlaier@freebsd.org
> \ /  Max Laier                          | ICQ #67774661
>  X   http://pf4freebsd.love2party.net/  | mlaier@EFnet
> / \  ASCII Ribbon Campaign              | Against HTML Mail and News

-- 
Alexej Sokolov <bsd.quest@googlemail.com>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081125182627.GA4223>