PERFORCE change 109800 for review
Roman Divacky
rdivacky at FreeBSD.org
Sun Nov 12 14:49:58 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=109800
Change 109800 by rdivacky at rdivacky_witten on 2006/11/12 14:49:41
Semi-working sendfile implementation. There are rough edges though.
1) linux permits SOCK_DGRAM sockets to be used too
2) we always return as if full load was sent
more work to come
Affected files ...
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_socket.c#10 edit
Differences ...
==== //depot/projects/linuxolator/src/sys/compat/linux/linux_socket.c#10 (text+ko) ====
@@ -1302,5 +1302,30 @@
int
linux_sendfile(struct thread *td, struct linux_sendfile_args *args)
{
- return (ENOSYS);
+ struct sendfile_args sa;
+ off_t off;
+ int error;
+
+ if ((error = copyin(args->offset, &off, sizeof(off))))
+ return (error);
+#ifdef DEBUG
+ if (ldebug(sendfile))
+ printf(ARGS(sendfile, "%d, %d, %d, %d"), args->in, args->out, (int) off,
+ args->count);
+#endif
+
+ sa.fd = args->in;
+ sa.s = args->out;
+ sa.offset = off;
+ sa.nbytes = args->count;
+ sa.hdtr = NULL;
+ sa.sbytes = NULL;
+ sa.flags = 0;
+
+ error = sendfile(td, &sa);
+ if (error)
+ return (error);
+
+ td->td_retval[0] = args->count;
+ return (0);
}
More information about the p4-projects
mailing list