Lines Matching +full:com +full:- +full:offset
1 /*-
43 #include <atf-c.h>
89 random_port = rand() % (portrange_last - portrange_first) + in generate_random_port()
135 ATF_REQUIRE_MSG(sock != -1, "socket(%d, %d, 0) failed: %s", in make_socket()
150 (const struct sockaddr*)res->ai_addr, res->ai_addrlen, in setup_client()
151 host, nitems(host) - 1, NULL, 0, NI_NUMERICHOST); in setup_client()
157 host, res->ai_family, res->ai_socktype); in setup_client()
160 sock = make_socket(res->ai_family, res->ai_socktype, res->ai_protocol); in setup_client()
161 error = connect(sock, (struct sockaddr*)res->ai_addr, res->ai_addrlen); in setup_client()
180 sock = make_socket(res->ai_family, res->ai_socktype, res->ai_protocol); in setup_server()
183 (const struct sockaddr*)res->ai_addr, res->ai_addrlen, in setup_server()
184 host, nitems(host) - 1, NULL, 0, NI_NUMERICHOST); in setup_server()
190 host, res->ai_family, res->ai_socktype); in setup_server()
193 error = bind(sock, res->ai_addr, res->ai_addrlen); in setup_server()
225 if (recv_sock == -1) in server_cat()
232 buffer_size - received_bytes, 0); in server_cat()
280 verify_source_and_dest(const char* dest_filename, int src_fd, off_t offset, in verify_source_and_dest() argument
291 ATF_REQUIRE_MSG(dest_fd != -1, "open failed"); in verify_source_and_dest()
301 length = (nbytes == 0) ? (size_t)(src_file_size - offset) : nbytes; in verify_source_and_dest()
308 ATF_REQUIRE_EQ_MSG(0, lseek(src_fd, offset, SEEK_SET), in verify_source_and_dest()
315 printf("Will mmap in the source file from offset=%jd to length=%zu\n", in verify_source_and_dest()
316 offset, length); in verify_source_and_dest()
318 src_pointer = mmap(NULL, length, PROT_READ, MAP_PRIVATE, src_fd, offset); in verify_source_and_dest()
334 off_t offset; in fd_positive_file_test() local
343 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in fd_positive_file_test()
358 offset = 0; in fd_positive_file_test()
359 error = sendfile(fd, client_sock, offset, nbytes, NULL, NULL, in fd_positive_file_test()
365 verify_source_and_dest(DESTINATION_FILE, fd, offset, nbytes); in fd_positive_file_test()
381 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
397 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
406 off_t offset; in fd_positive_shm_test() local
416 ATF_REQUIRE_MSG(fd != -1, "shm_open failed: %s", strerror(errno)); in fd_positive_shm_test()
442 offset = 0; in fd_positive_shm_test()
443 error = sendfile(fd, client_sock, offset, nbytes, NULL, NULL, in fd_positive_shm_test()
449 verify_source_and_dest(DESTINATION_FILE, fd, offset, nbytes); in fd_positive_shm_test()
465 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
480 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
494 fd = -1; in fd_negative_bad_fd_test()
497 ATF_REQUIRE_ERRNO(EBADF, error == -1); in fd_negative_bad_fd_test()
513 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
528 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
536 off_t offset; in flags_test() local
595 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in flags_test()
610 offset = 0; in flags_test()
611 error = sendfile(fd, client_sock, offset, nbytes, NULL, NULL, in flags_test()
618 verify_source_and_dest(DESTINATION_FILE, fd, offset, nbytes); in flags_test()
633 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
647 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
679 off_t offset; in hdtr_positive_test() local
688 offset = 0; in hdtr_positive_test()
719 ATF_REQUIRE_MSG(rc != -1, "asprintf failed: %s", strerror(errno)); in hdtr_positive_test()
725 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in hdtr_positive_test()
728 ATF_REQUIRE_MSG(fd2 != -1, "open failed: %s", strerror(errno)); in hdtr_positive_test()
739 error = sendfile(fd, client_sock, offset, nbytes, &hdtr, in hdtr_positive_test()
746 verify_source_and_dest(DESTINATION_FILE, fd2, offset, nbytes); in hdtr_positive_test()
765 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
780 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
793 hdtr1 = (struct sf_hdtr*)-1; in hdtr_negative_bad_pointers_test()
797 hdtr2.headers = (struct iovec*)-1; in hdtr_negative_bad_pointers_test()
801 hdtr3.trailers = (struct iovec*)-1; in hdtr_negative_bad_pointers_test()
804 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in hdtr_negative_bad_pointers_test()
810 ATF_CHECK_ERRNO(EFAULT, error == -1); in hdtr_negative_bad_pointers_test()
813 ATF_CHECK_ERRNO(EFAULT, error == -1); in hdtr_negative_bad_pointers_test()
816 ATF_CHECK_ERRNO(EFAULT, error == -1); in hdtr_negative_bad_pointers_test()
833 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
848 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
863 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in offset_negative_value_less_than_zero_test()
865 error = sendfile(fd, client_sock, -1, 0, NULL, NULL, SF_FLAGS(0, 0)); in offset_negative_value_less_than_zero_test()
866 ATF_REQUIRE_ERRNO(EINVAL, error == -1); in offset_negative_value_less_than_zero_test()
878 "Verify that a negative offset results in EINVAL (IPv4)"); in ATF_TC_HEAD()
883 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
893 "Verify that a negative offset results in EINVAL (IPv6)"); in ATF_TC_HEAD()
898 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
916 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in sbytes_positive_test()
940 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
955 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
963 off_t *sbytes_p = (off_t*)-1; in sbytes_negative_test()
972 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in sbytes_negative_test()
978 ATF_REQUIRE_ERRNO(EFAULT, error == -1); in sbytes_negative_test()
995 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
1010 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
1024 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in s_negative_not_connected_socket_test()
1027 ATF_REQUIRE_ERRNO(ENOTCONN, error == -1); in s_negative_not_connected_socket_test()
1038 "Verify that a non-connected SOCK_STREAM socket results in ENOTCONN (IPv4)"); in ATF_TC_HEAD()
1044 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
1054 "Verify that a non-connected SOCK_STREAM socket results in ENOTCONN (IPv6)"); in ATF_TC_HEAD()
1060 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
1070 "Verify that an invalid file descriptor, e.g., -1, fails with EBADF"); in ATF_TC_HEAD()
1078 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
1080 client_sock = -1; in ATF_TC_BODY()
1083 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in ATF_TC_BODY()
1086 ATF_REQUIRE_ERRNO(EBADF, error == -1); in ATF_TC_BODY()
1096 "Verify that a non-socket file descriptor fails with ENOTSOCK"); in ATF_TC_HEAD()
1104 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
1107 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in ATF_TC_BODY()
1110 ATF_REQUIRE_MSG(client_sock != -1, "open failed: %s", strerror(errno)); in ATF_TC_BODY()
1113 ATF_REQUIRE_ERRNO(ENOTSOCK, error == -1); in ATF_TC_BODY()
1128 ATF_REQUIRE_MSG(fd != -1, "open failed: %s", strerror(errno)); in s_negative_udp_socket_test()
1131 ATF_REQUIRE_ERRNO(EINVAL, error == -1); in s_negative_udp_socket_test()
1142 "Verify that a non-SOCK_STREAM type socket results in EINVAL (IPv4)"); in ATF_TC_HEAD()
1148 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()
1158 "Verify that a non-SOCK_STREAM type socket results in EINVAL (IPv6)"); in ATF_TC_HEAD()
1164 …atf_tc_skip("Sendfile(4) unimplemented. https://github.com/qemu-bsd-user/qemu-bsd-user/issues/25"); in ATF_TC_BODY()