]> sourceware.org Git - systemtap.git/commitdiff
Test for sendfile syscall can handle non-socket fds now.
authorMark Wielaard <mjw@redhat.com>
Sat, 13 Feb 2010 19:54:58 +0000 (20:54 +0100)
committerMark Wielaard <mjw@redhat.com>
Sat, 13 Feb 2010 19:54:58 +0000 (20:54 +0100)
Since 2.6.33 sendfile can handle non-socket fds, so make the test
handle both success and failure.

* testsuite/systemtap.syscall/sendfile.c (main): Make buffer 22 bytes,
  since 22 == EINVAL, test for 22 bytes send or -22 failure.

testsuite/systemtap.syscall/sendfile.c

index 690d078e9a5715e0e9fda428c2b03e0ea0c20b3b..a21694fe6af79802c2970927476e6881cb4dc297 100644 (file)
@@ -14,7 +14,7 @@ int main ()
        int write_fd;
        struct stat stat_buf;
        off_t offset = 0;
-       char buff[512];
+       char buff[22]; // Note below 22 == EINVAL
        int ret;
 
        memset(buff, 5, sizeof(buff));
@@ -32,11 +32,11 @@ int main ()
        write_fd = creat("foobar2",S_IREAD|S_IWRITE|S_IRWXO);
 
        /* 
-        * For kernel2.6 the write_fd has to be a socket otherwise
-        * sendfile will fail. So we test for failure here.
+        * For 2.6 the write_fd had to be a socket otherwise
+        * sendfile would fail. So we also test for failure here.
         */
        ret = sendfile (write_fd, read_fd, &offset, stat_buf.st_size);
-       //staptest// sendfile (NNNN, NNNN, XXXX, 512) = -22 (EINVAL)
+       //staptest// sendfile (NNNN, NNNN, XXXX, 22) = -?22
 
        close (read_fd);
        close (write_fd);
This page took 0.029195 seconds and 5 git commands to generate.