Re: [PATCH] Bindings for ‘sendfile’

2013-04-18 Thread Thien-Thi Nguyen
() l...@gnu.org (Ludovic Courtès) () Wed, 17 Apr 2013 18:27:04 +0200 So that was over a PF_INET/SOCK_STREAM socket, right? Yes. FWIW, ttn-do sizzweb can also operate over PF_UNIX/SOCK_STREAM and i recall doing some testing (w/ similar results) there. Would it occur systematically, or

Re: [PATCH] Bindings for ‘sendfile’

2013-04-17 Thread Ludovic Courtès
Thien-Thi Nguyen t...@gnuvola.org skribis: Anyway, i hope Guile grows a ‘sendfile-some’ (or whatever) so that i can adapt my programs to use it instead of the ttn-do ‘sendfile’: I’m open to the idea. To get a better understanding, do you have examples of real applications where it makes a

Re: [PATCH] Bindings for ‘sendfile’

2013-04-17 Thread Thien-Thi Nguyen
() l...@gnu.org (Ludovic Courtès) () Wed, 17 Apr 2013 14:52:40 +0200 concrete cases of recurring short writes? The original application was ttn-do serve-debiso, which configures ttn-do sizzweb to serve debian ISOs (or rather, the various component .deb files and metadata that apt-get requests

Re: [PATCH] Bindings for ‘sendfile’

2013-04-17 Thread Ludovic Courtès
Thien-Thi Nguyen t...@gnuvola.org skribis: The original application was ttn-do serve-debiso, which configures ttn-do sizzweb to serve debian ISOs (or rather, the various component .deb files and metadata that apt-get requests from the loopback-mounted ISO) over the home network.

Re: [PATCH] Bindings for ‘sendfile’

2013-04-16 Thread Ludovic Courtès
Thien-Thi Nguyen t...@gnuvola.org skribis: My reading of sendfile(2) is that it does its best to send as much as possible, but does not guarantee sending everything. What it does succeed in sending, it reports to the caller. The caller loops as desired, after evaluating (in some

Re: [PATCH] Bindings for ‘sendfile’

2013-04-16 Thread Thien-Thi Nguyen
() l...@gnu.org (Ludovic Courtès) () Tue, 16 Apr 2013 18:31:00 +0200 Thien-Thi Nguyen t...@gnuvola.org skribis: My reading of sendfile(2) is that it does its best to send as much as possible, but does not guarantee sending everything. What it does succeed in sending, it reports

Re: [PATCH] Bindings for ‘sendfile’

2013-04-14 Thread Thien-Thi Nguyen
() Mark H Weaver m...@netris.org () Wed, 10 Apr 2013 07:26:32 -0400 Regarding the proposed low-level interface (which I will call 'sendfile-some' for now), I have a question: can it actually be used to write a robust asynchronous server? I can't imagine why not, although i certainly

Re: [PATCH] Bindings for ‘sendfile’

2013-04-14 Thread Thien-Thi Nguyen
() l...@gnu.org (Ludovic Courtès) () Wed, 10 Apr 2013 22:56:38 +0200 Well, I sympathize with the idea of sticking to the underlying syscall semantics; yet, for my own uses of ‘sendfile’, I can only think of cases all I want is to send the file. I understand; it's easy to project one's

Re: [PATCH] Bindings for ‘sendfile’

2013-04-10 Thread Mark H Weaver
Thien-Thi Nguyen t...@gnuvola.org writes: Another way to think about it is: A ‘sendfile/all’ can be implemented in terms of a ‘sendfile/non-looping’ but not the other way around. So overall, i think hiding partial i/o is a mistake. This is just one instance of that, it seems (‘write’ and

Re: [PATCH] Bindings for ‘sendfile’

2013-04-10 Thread Ludovic Courtès
Thien-Thi Nguyen t...@gnuvola.org skribis: So overall, i think hiding partial i/o is a mistake. Well, I sympathize with the idea of sticking to the underlying syscall semantics; yet, for my own uses of ‘sendfile’, I can only think of cases all I want is to send the file. (Besides, it seems to

Re: [PATCH] Bindings for ‘sendfile’

2013-04-09 Thread Thien-Thi Nguyen
() l...@gnu.org (Ludovic Courtès) () Sun, 07 Apr 2013 21:53:26 +0200 +In other cases, the libc function may send fewer bytes than +@var{count}---for instance because @var{out} is a slow or limited +device, such as a pipe. When that happens, Guile's @code{sendfile} +automatically

Re: [PATCH] Bindings for ‘sendfile’

2013-04-09 Thread Ludovic Courtès
Hi! Thien-Thi Nguyen t...@gnuvola.org skribis: () l...@gnu.org (Ludovic Courtès) () Sun, 07 Apr 2013 21:53:26 +0200 +In other cases, the libc function may send fewer bytes than +@var{count}---for instance because @var{out} is a slow or limited +device, such as a pipe. When that

Re: [PATCH] Bindings for ‘sendfile’

2013-04-09 Thread Thien-Thi Nguyen
() l...@gnu.org (Ludovic Courtès) () Tue, 09 Apr 2013 17:02:03 +0200 After a long discussion on IRC was Mark, I was mostly convinced that leaving that to users is questionable. User behavior in the wild is always questionable. :-D First, because one obviously expects the procedure to

Re: [PATCH] Bindings for ‘sendfile’

2013-04-07 Thread Ludovic Courtès
There were sporadic failures of the sendfile/pipe tests on Hydra. I managed to reproduce them and noticed that sometimes sendfile(2) would return 64KiB, which is much less than what we asked for. Although the man page doesn’t mention it, this can happen when writing to a slow or limited device,

Re: [PATCH] Bindings for ‘sendfile’

2013-04-07 Thread Ludovic Courtès
I just pushed a new version, which reinstates the return value, and appropriately detects EOF condition on the input (by just returning 0). Comments welcome! Ludo’.

Re: [PATCH] Bindings for ‘sendfile’

2013-03-25 Thread Ludovic Courtès
Mark H Weaver m...@netris.org skribis: The sendfile commit (fbac7c6113056bc6ee85996b10bdc08325c742a5) has caused the following build failures on Hydra. Thanks for the notification. On GNU/Linux: (both i686-linux and x86_64-linux without threads) http://hydra.nixos.org/build/4463700/log/raw

Re: [PATCH] Bindings for ‘sendfile’

2013-03-23 Thread Mark H Weaver
Hi Ludovic, The sendfile commit (fbac7c6113056bc6ee85996b10bdc08325c742a5) has caused the following build failures on Hydra. Thanks, Mark == On GNU/Linux: (both i686-linux and x86_64-linux without threads)

Re: [PATCH] Bindings for ‘sendfile’

2013-03-22 Thread Mark H Weaver
l...@gnu.org (Ludovic Courtès) writes: Mark H Weaver m...@netris.org skribis: Since the code below will behave badly if 'c_count' does not fit in an 'ssize_t', we should validate here that it _does_ fit. Oops, indeed. (Note that sendfile(2) and write(2) have that problem: they take a

Re: [PATCH] Bindings for ‘sendfile’

2013-03-21 Thread Ludovic Courtès
Hi Mark, Mark H Weaver m...@netris.org skribis: l...@gnu.org (Ludovic Courtès) writes: I plan to commit the patch below, which adds bindings for ‘sendfile’. Comments? Looks great to me, modulo one comment below. Thanks for the quick review! I especially like the fact that although it

Re: [PATCH] Bindings for ‘sendfile’

2013-03-21 Thread Andy Wingo
On Thu 21 Mar 2013 10:40, l...@gnu.org (Ludovic Courtès) writes: l...@gnu.org (Ludovic Courtès) writes: I plan to commit the patch below, which adds bindings for ‘sendfile’. Should probably go in gnulib at some point, no? Looks good tho :) -- http://wingolog.org/

Re: [PATCH] Bindings for ‘sendfile’

2013-03-21 Thread Andrew Gaylard
On 03/21/13 11:15, Ludovic Courtès wrote: Noah Lavine noah.b.lav...@gmail.com skribis: I've thought for a while that if I had time (which I know I won't) I would make a module called (linux) with bindings for non-POSIX Linux kernel features. What do you think of this idea? If so, what do you

Re: [PATCH] Bindings for ‘sendfile’

2013-03-21 Thread Ludovic Courtès
Andy Wingo wi...@pobox.com skribis: On Thu 21 Mar 2013 10:40, l...@gnu.org (Ludovic Courtès) writes: l...@gnu.org (Ludovic Courtès) writes: I plan to commit the patch below, which adds bindings for ‘sendfile’. Should probably go in gnulib at some point, no? Yes, you’re right. I’ll see

Re: [PATCH] Bindings for ‘sendfile’

2013-03-21 Thread Noah Lavine
Hello, Yes, you're completely right - making it work on all platforms is much better than what I had proposed. I'm glad you're doing this. Thanks, Noah On Thu, Mar 21, 2013 at 5:15 AM, Ludovic Courtès l...@gnu.org wrote: Hi Noah, Noah Lavine noah.b.lav...@gmail.com skribis: I've thought

Re: [PATCH] Bindings for ‘sendfile’

2013-03-20 Thread Noah Lavine
Hi, sendfile looks very useful! I've thought for a while that if I had time (which I know I won't) I would make a module called (linux) with bindings for non-POSIX Linux kernel features. What do you think of this idea? If so, what do you think of putting sendfile there and expanding it with

Re: [PATCH] Bindings for ‘sendfile’

2013-03-20 Thread Nala Ginrut
On Wed, 2013-03-20 at 23:21 +0100, Ludovic Courtès wrote: Hi, I plan to commit the patch below, which adds bindings for ‘sendfile’. Comments? As a server-develop fan, I definitely love it. Besides, can we add more linux-specific features and add them into a place like (ice-9 linux)?

Re: [PATCH] Bindings for ‘sendfile’

2013-03-20 Thread Mark H Weaver
Hi Ludovic, l...@gnu.org (Ludovic Courtès) writes: I plan to commit the patch below, which adds bindings for ‘sendfile’. Comments? Looks great to me, modulo one comment below. I especially like the fact that although it can make use of the non-standard Linux syscall, it works properly on all

Re: [PATCH] Bindings for ‘sendfile’

2013-03-20 Thread Mark H Weaver
Mark H Weaver m...@netris.org writes: +for (result = 0, left = c_count; result c_count; ) If 'c_count's does not fit in a 'ssize_t', then this loop will go forever and 'result' will wrap around to negative numbers and undefined C behavior. Having just consulted the relevant C standards,