<div dir="ltr">I agree with Sebastian. <div><br></div><div>Using read write in a loop can only serve as a makeshift measure. </div><div><br></div><div>If we have consensus here, then I can work on getting sendfile backed up in libbsd. (though, I have some serious background reading to do before I am able to do it, but I think I can. ) </div><div><br></div><div>Thanks and Regards,</div><div>Sujay Raj</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 24, 2015 at 12:21 AM, Sebastian Huber <span dir="ltr"><<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>I would use the sendfile system call implementation from FreeBSD and add it to the libbsd. Its not a big win if you use read() and write() to implement sendfile(). This makes only sense if you can use kernel space zero-copy buffers.<br></div><div><br></div><div>----- Eduardo Silva <<a href="mailto:eduardo@monkey.io" target="_blank">eduardo@monkey.io</a>> schrieb:<br>></div><div><div class="h5"><div dir="ltr"><div><div><div><div>Sujay, <br><div><br></div></div>Monkey use conditionals for each implementation: Linux, FreeBSD and OSX. My suggestion is that RTEMS may implement a sendfile based on FreeBSD format which can easily be emulated as a read() and further write() for socket operations. That will help not only Monkey, but also other software that requires such interface.<br><div><br></div></div>I am not the best one to talk about RTEMS, but the Kernel always knows better it buffers capacity that the program on the other side.<br><div><br></div></div>do you think is possible to do that on RTEMS ?<br><div><br></div></div>regards, <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 23, 2015 at 12:05 PM, Joel Sherrill <span dir="ltr"><<a href="mailto:joel.sherrill@oarcorp.com" target="_blank">joel.sherrill@oarcorp.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><span><br></span></span><div><br></div><span><span>><br></span></span><div><br></div><span><span>> On 6/23/2015 12:49 PM, Sujay Raj wrote:<br></span></span><div><br></div><span><span>></span></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>> I am working on porting Monkey HTTP server on rtems.<br><div><br></div>><br><div><br></div>> Sendfile is not specified in POSIX.1-2001 or other standards and its implementations vary depending on the unix/linux system being used.<br><div><br></div>><br><div><br></div>> Freebsd has sendfile in its libc.<br><div><br></div>></blockquote><span><br>><br></span><br>> FreeBSD has a completely different API for sendfile(). Plus the source<br><div><br></div>> must be a regular file and the destination a socket.<br><div><br></div>><br><div><br></div>><a href="https://www.freebsd.org/cgi/man.cgi?query=sendfile&sektion=2" rel="noreferrer" target="_blank">https://www.freebsd.org/cgi/man.cgi?query=sendfile&sektion=2</a><br><div><br></div>><br><div><br></div>> This is a random discussion of sendfile() on various OSes. It mentions<br><div><br></div>> the assumption that the source must normally be able to be mmap'ed.<br><div><br></div>> Since you can't do that on RTEMS, you are stuck with a loop<br><div><br></div>> implementation. [1]<br><div><br></div>><br><div><br></div>><a href="https://groups.google.com/forum/#!topic/comp.unix.programmer/65oDSzpEzx8" rel="noreferrer" target="_blank">https://groups.google.com/forum/#!topic/comp.unix.programmer/65oDSzpEzx8</a><span><span><br></span></span><div><br></div><span><span>><br></span></span><div><br></div><span><span>></span></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>> So I opened this thread to discuss how should we proceed with this matter, if we should work on getting sendfile in newlib, or if there is any portable solution that we can use in its place.<br><div><br></div>></blockquote><span><br>><br></span><br>> Given that (a) it is not POSIX and (b) there is no agreement between<br><div><br></div>> Linux and FreeBSD, it is highly unlikely newlib would accept an<br><div><br></div>> implementation.<br><div><br></div>><br><div><br></div>> Given (b), I don't personally see merging it into RTEMS since we<br><div><br></div>> have to pick a winner and loser on the API.<br><div><br></div>><br><div><br></div>> What's the feeling on having a default implementation in Monkey and<br><div><br></div>> using that as a backup? With [1] as a consideration again.<br><div><br></div>><br><div><br></div>><br><div><br></div>> [1] The size of the buffer user for read/write has to be accounted<br><div><br></div>> for. If this is on a thread stack, then it can't be too large or that<br><div><br></div>> imposes a burden on calling sendfile(). I can see an implementation<br><div><br></div>> doing a malloc() of the buffer and then free()'ing it.<div><div><br><div><br></div>><br><div><br></div>><br><div><br></div>> <br><div><br></div>><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>> cc to Joel and Eduardo.<br><div><br></div>><br><div><br></div>> Thanks and Regards,<br><div><br></div>> Sujay Raj<br><div><br></div>></blockquote><br>><br></div></div><span><span><span style="color:#888888" color="#888888"><br>> -- <br></span></span></span><div><br></div><span><span><span style="color:#888888" color="#888888">> Joel Sherrill, Ph.D. Director of Research & Development<br></span></span></span><div><br></div><span><span><span style="color:#888888" color="#888888">> joel.sherrill@OARcorp.com On-Line Applications Research<br></span></span></span><div><br></div><span><span><span style="color:#888888" color="#888888">> Ask me about RTEMS: a free RTOS Huntsville AL 35805<br></span></span></span><div><br></div><span><span><span style="color:#888888" color="#888888">> Support Available <a href="tel:%28256%29%20722-9985" target="_blank">(256) 722-9985</a><br></span></span></span><div><br></div><span><span style="color:#888888" color="#888888">></span></span></blockquote></div><br><br clear="all"><br>-- <br><div><div dir="ltr">Eduardo Silva<div>Monkey Software</div></div></div><br>></div><div><br></div><div><br></div></div></div><div>-- <br></div><div><pre>Sebastian Huber, embedded brains GmbH<br></pre><div><br></div><pre>Address : Dornierstr. 4, D-82178 Puchheim, Germany<br>Phone : +49 89 189 47 41-16<br>Fax : +49 89 189 47 41-09<br>E-Mail : <a href="http://lists.rtems.org/mailman/listinfo/devel" target="_blank">sebastian.huber at embedded-brains.de</a><br>PGP : Public key available on request.<br></pre><div><br></div><pre>Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.</pre></div></div><br>_______________________________________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br></blockquote></div><br></div>