cp(1) and mmap - FreeBSD
This is a discussion on cp(1) and mmap - FreeBSD ; Hi all,
it looks like there is no fallback in cp(1) when mmaping the source file
fails. I'm mounting SMB shares via smbnetfs (which in turn uses fuse) and
it seems not to support mmaping files. Shouldn't cp just fallback ...
-
cp(1) and mmap
Hi all,
it looks like there is no fallback in cp(1) when mmaping the source file
fails. I'm mounting SMB shares via smbnetfs (which in turn uses fuse) and
it seems not to support mmaping files. Shouldn't cp just fallback to a
normal read()/write() loop in this case?
harti
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/lis...reebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
-
Re: cp(1) and mmap
on 28/05/2008 12:02 Harti Brandt said the following:
>
> Hi all,
>
> it looks like there is no fallback in cp(1) when mmaping the source file
> fails. I'm mounting SMB shares via smbnetfs (which in turn uses fuse)
> and it seems not to support mmaping files. Shouldn't cp just fallback to
> a normal read()/write() loop in this case?
I would think that it should.
This topic was brought up several times, but no resolution so far.
I think that I've even seen patches.
--
Andriy Gapon
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/lis...reebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
-
Re: cp(1) and mmap
Maxim Sobolev wrote:
>> I also think we should use mmap for larger files, mmapping and writing
>> them out in several chunks.
>
> I believe that even better way is to extend sendfile(2) to allow both
> sockets and file descriptors to be used as the destination and use that
> interface instead of mmap/read/write. Linux for example allows that.
Sounds like a good idea. Linux's sendfile documents this behavior:
"sendfile() copies data between one file descriptor and another.",
but then mentions it is not currently implemented:
"Presently (Linux 2.6.9): in_fd, must correspond to a file which
supports mmap()-like operations (i.e., it cannot be a socket); and
out_fd must refer to a socket."
Solaris documents it and supports it:
"The in_fd argument should be a file descriptor to a regular file
opened for reading. See open(2). The out_fd argument should be a file
descriptor to a regular file opened for writing or to a connected
AF_INET or AF_INET6 socket of SOCK_STREAM type."
I will look at it after fixing the more pressing cp(1) bug.
Diomidis
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/lis...reebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
-
Re: cp(1) and mmap
Diomidis Spinellis wrote:
> Andriy Gapon wrote:
>> on 28/05/2008 12:02 Harti Brandt said the following:
>>> Hi all,
>>>
>>> it looks like there is no fallback in cp(1) when mmaping the source file
>>> fails. I'm mounting SMB shares via smbnetfs (which in turn uses fuse)
>>> and it seems not to support mmaping files. Shouldn't cp just fallback to
>>> a normal read()/write() loop in this case?
>>
>> I would think that it should.
>> This topic was brought up several times, but no resolution so far.
>> I think that I've even seen patches.
>>
>
> I've not seen the patches, but the fix is trivial (see the attached
> patch). If there are no objections, I can commit it.
Fix committed in 184342. Sorry for the long delay.
- dds
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/lis...reebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"
-
Re: cp(1) and mmap
Diomidis Spinellis wrote:
> Diomidis Spinellis wrote:
>> Andriy Gapon wrote:
>>> on 28/05/2008 12:02 Harti Brandt said the following:
>>>> Hi all,
>>>>
>>>> it looks like there is no fallback in cp(1) when mmaping the source
>>>> file
>>>> fails. I'm mounting SMB shares via smbnetfs (which in turn uses fuse)
>>>> and it seems not to support mmaping files. Shouldn't cp just
>>>> fallback to
>>>> a normal read()/write() loop in this case?
>>>
>>> I would think that it should.
>>> This topic was brought up several times, but no resolution so far.
>>> I think that I've even seen patches.
>>>
>>
>> I've not seen the patches, but the fix is trivial (see the attached
>> patch). If there are no objections, I can commit it.
>
> Fix committed in 184342. Sorry for the long delay.
>
No problem. Thanks. I had this still in my inbox and was several times
about to commit it, but was distracted each time. Thanks, this helps alot.
harti
> - dds
>
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/lis...reebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org"