Actually, I realised the similarities with sendfile() after I made the
post. :-) But I thought sendfile() could only be used for sending data
from a "regular" file descriptor to another file- or socket descriptor..?
The syscall I would like to implement is kind of the reverse to sendfile()
since it should be used to copy data _from_ a socket descriptor to a
file descriptor.
Hmm, I made a small test program and from what I can understand it seems
to verify what I thought:
--- #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include <errno.h> #include <stdio.h>int main(void) { pid_t pid; int fdarr[2];
if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdarr) ˙-1) { perror("socketpair"); return 1; }
if ((pid ˙ork()) ˙-1) { perror("fork"); return 1; } else if (pid) { close(fdarr[0]); if (sendfile(1, fdarr[1], NULL, 5) ˙-1) { perror("sendfile"); return 1; } } else { close(fdarr[1]); write(fdarr[0], "Test\n", 5); }
return 0; }
---The output from the program is "sendfile: Invalid argument"..
> -Andi
-- Joel Eriksson - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/