MCPcopy Create free account
hub / github.com/axboe/liburing / test_write_efbig

Function test_write_efbig

test/read-write.c:828–918  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

826}
827
828static int test_write_efbig(void)
829{
830 struct io_uring_sqe *sqe;
831 struct io_uring_cqe *cqe;
832 struct io_uring ring;
833 struct rlimit rlim, old_rlim;
834 int i, fd, ret;
835 loff_t off;
836
837 if (geteuid()) {
838 fprintf(stdout, "Not root, skipping %s\n", __FUNCTION__);
839 return 0;
840 }
841
842 if (getrlimit(RLIMIT_FSIZE, &old_rlim) < 0) {
843 perror("getrlimit");
844 return 1;
845 }
846 rlim = old_rlim;
847 rlim.rlim_cur = 128 * 1024;
848 rlim.rlim_max = 128 * 1024;
849 if (setrlimit(RLIMIT_FSIZE, &rlim) < 0) {
850 perror("setrlimit");
851 return 1;
852 }
853
854 fd = open(".efbig", O_WRONLY | O_CREAT, 0644);
855 if (fd < 0) {
856 perror("file open");
857 goto err;
858 }
859 unlink(".efbig");
860
861 ret = io_uring_queue_init(32, &ring, 0);
862 if (ret) {
863 fprintf(stderr, "ring create failed: %d\n", ret);
864 goto err;
865 }
866
867 off = 0;
868 for (i = 0; i < 32; i++) {
869 sqe = io_uring_get_sqe(&ring);
870 if (!sqe) {
871 fprintf(stderr, "sqe get failed\n");
872 goto err;
873 }
874 io_uring_prep_writev(sqe, fd, &vecs[i], 1, off);
875 io_uring_sqe_set_data64(sqe, i);
876 off += BS;
877 }
878
879 ret = io_uring_submit(&ring);
880 if (ret != 32) {
881 fprintf(stderr, "submit got %d, wanted %d\n", ret, 32);
882 goto err;
883 }
884
885 for (i = 0; i < 32; i++) {

Callers 1

mainFunction · 0.85

Calls 4

io_uring_queue_initFunction · 0.85
io_uring_submitFunction · 0.85
io_uring_queue_exitFunction · 0.85
io_uring_get_sqeFunction · 0.50

Tested by

no test coverage detected