Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Nov 2006 14:49:57 GMT
From:      Roman Divacky <rdivacky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 109800 for review
Message-ID:  <200611121449.kACEnvnp007162@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=109800

Change 109800 by rdivacky@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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200611121449.kACEnvnp007162>