Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 2002 13:02:13 -0800
From:      Farooq Mela <fmela0@sm.socccd.cc.ca.us>
To:        freebsd-hackers@freebsd.org
Subject:   Recv() to a mmap'ed file?
Message-ID:  <3C8E6CD5.67F23CF2@sm.socccd.cc.ca.us>

next in thread | raw e-mail | index | archive | help
Hi -hackers,

In trying to increase throughput in a file transfer application I am
working on, I wondered if it was possible to do something like (code
of course edited for brevity):

/* file_fd points to a regular file which is filled with SIZE nul
bytes */
map_addr = mmap(NULL, size, PROT_WRITE, MAP_PRIVATE, file_fd, 0);
rv = recv(sockfd, map_addr, size, MSG_WAITALL);

Rather than the usual recv() to a fixed size buffer, write() to the
file descriptor, loop, etc.  However when I try to do this recv gives
me back an EFAULT (bad address).  Is there a limitation of the
architecture which does not allows us to recv() to an mmap'ed area of
a file, or is it just something which hasn't been implemented?

Thanks.
-- 
Farooq

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C8E6CD5.67F23CF2>