+#if 1
+ /* sendfile test. Open libsystem, set up some headers, and send it */
+ struct sf_hdtr my_sf_hdtr;
+ int my_libsys_fd;
+ off_t my_libsys_len;
+
+ my_libsys_fd = open("/usr/lib/libSystem.dylib", O_RDONLY, 0644);
+ if (my_libsys_fd < 0) {
+ printf( "test failed - could not open /usr/lib/libSystem.dylib\n" );
+ close ( my_child_fd );
+ exit ( -1 );
+ }
+
+ my_libsys_len = 7+2; /* 2 bytes of header */
+ my_buffer[0] = 's';
+ my_iov[0].iov_base = &my_buffer[0];
+ my_iov[0].iov_len = 1;
+ my_buffer[1] = 'e';
+ my_iov[1].iov_base = &my_buffer[1];
+ my_iov[1].iov_len = 1;
+ my_buffer[2] = 'n';
+ my_iov[2].iov_base = &my_buffer[2];
+ my_iov[2].iov_len = 1;
+ my_buffer[3] = 'd';
+ my_iov[3].iov_base = &my_buffer[3];
+ my_iov[3].iov_len = 1;
+
+ my_sf_hdtr.headers = &my_iov[0];
+ my_sf_hdtr.hdr_cnt = 2;
+ my_sf_hdtr.trailers = &my_iov[2];
+ my_sf_hdtr.trl_cnt = 2;
+
+ my_result = sendfile(my_libsys_fd, my_child_fd, 3, &my_libsys_len, &my_sf_hdtr, 0);
+ if (my_result < 0 || my_libsys_len != 11) {
+ printf( "sendfile failed with error %d - \"%s\" \n", errno, strerror( errno) );
+ close( my_child_fd );
+ exit( -1 );
+ }
+
+ my_result = close ( my_libsys_fd );
+ if ( my_libsys_fd < 0 ) {
+ printf ( "close failed with error %d - \"%s\" \n", errno, strerror( errno) );
+ close ( my_child_fd );
+ exit ( -1 );
+ }
+#endif
+