Lines Matching full:mode

128 ok_mode(const char *testname, const char *comment, int mode)  in ok_mode()  argument
133 printf("ok %d - %s # mode 0x%x\n", testnum, testname, mode); in ok_mode()
135 printf("ok %d - %s # mode 0x%x - %s\n", testnum, testname, in ok_mode()
136 mode, comment); in ok_mode()
140 notok_mode(const char *testname, const char *comment, int mode) in notok_mode() argument
145 printf("not ok %d - %s # mode 0x%x\n", testnum, testname, in notok_mode()
146 mode); in notok_mode()
148 printf("not ok %d - %s # mode 0x%x - %s\n", testnum, testname, in notok_mode()
149 mode, comment); in notok_mode()
157 int mode, int expected_errno) in try_directory_open() argument
161 dfd = open(directory, mode); in try_directory_open()
164 notok_mode(testname, "opened", mode); in try_directory_open()
166 ok_mode(testname, NULL, mode); in try_directory_open()
170 ok_mode(testname, NULL, mode); in try_directory_open()
172 notok_mode(testname, "wrong errno", mode); in try_directory_open()
174 notok_mode(testname, "failed", mode); in try_directory_open()
182 int expected_errno, i, mode; in check_directory_open_modes() local
189 mode = modes[i]; in check_directory_open_modes()
190 if (mode == O_RDONLY) in check_directory_open_modes()
194 try_directory_open(__func__, directory, mode, in check_directory_open_modes()
203 int dfd, fd, i, mode; in check_dup() local
206 * dup() should work regardless of open mode. in check_dup()
209 mode = modes[i]; in check_dup()
210 fd = open(path, mode); in check_dup()
212 notok_mode(testname, "open", mode); in check_dup()
217 ok_mode(testname, NULL, mode); in check_dup()
220 notok_mode(testname, NULL, mode); in check_dup()
229 int dfd, fd, i, mode; in check_dup2() local
232 * dup2() should work regardless of open mode. in check_dup2()
235 mode = modes[i]; in check_dup2()
236 fd = open(path, mode); in check_dup2()
238 notok_mode(testname, "open", mode); in check_dup2()
243 ok_mode(testname, NULL, mode); in check_dup2()
246 notok_mode(testname, NULL, mode); in check_dup2()
255 int fd, i, mode; in check_fchdir() local
258 * fchdir() should work regardless of open mode. in check_fchdir()
261 mode = modes[i]; in check_fchdir()
262 fd = open(path, mode); in check_fchdir()
264 notok_mode(testname, "open", mode); in check_fchdir()
268 ok_mode(testname, NULL, mode); in check_fchdir()
270 notok_mode(testname, "failed", mode); in check_fchdir()
279 int fd, i, mode; in check_fchflags() local
282 * fchflags() should work regardless of open mode. in check_fchflags()
285 mode = modes[i]; in check_fchflags()
286 fd = open(path, mode); in check_fchflags()
288 notok_mode(testname, "open", mode); in check_fchflags()
292 ok_mode(testname, NULL, mode); in check_fchflags()
294 notok_mode(testname, "failed", mode); in check_fchflags()
303 int fd, i, mode; in check_fchmod() local
306 * fchmod() should work regardless of open mode. in check_fchmod()
309 mode = modes[i]; in check_fchmod()
310 fd = open(path, mode); in check_fchmod()
312 notok_mode(testname, "open", mode); in check_fchmod()
316 ok_mode(testname, NULL, mode); in check_fchmod()
318 notok_mode(testname, "failed", mode); in check_fchmod()
327 int fd, i, mode; in check_fchown() local
330 * fchown() should work regardless of open mode. in check_fchown()
333 mode = modes[i]; in check_fchown()
334 fd = open(path, mode); in check_fchown()
336 notok_mode(testname, "open", mode); in check_fchown()
340 ok_mode(testname, NULL, mode); in check_fchown()
342 notok_mode(testname, "failed", mode); in check_fchown()
351 int fd, i, mode; in check_flock() local
354 * flock() should work regardless of open mode. in check_flock()
357 mode = modes[i]; in check_flock()
358 fd = open(path, mode); in check_flock()
360 notok_mode(testname, "open", mode); in check_flock()
364 ok_mode(testname, NULL, mode); in check_flock()
366 notok_mode(testname, "failed", mode); in check_flock()
375 int fd, i, mode; in check_fpathconf() local
379 * fpathconf() should work regardless of open mode. in check_fpathconf()
382 mode = modes[i]; in check_fpathconf()
383 fd = open(path, mode); in check_fpathconf()
385 notok_mode(testname, "open", mode); in check_fpathconf()
390 ok_mode(testname, NULL, mode); in check_fpathconf()
392 notok_mode(testname, "failed", mode); in check_fpathconf()
402 int fd, i, mode; in check_fstat() local
405 * fstat() should work regardless of open mode. in check_fstat()
408 mode = modes[i]; in check_fstat()
409 fd = open(path, mode); in check_fstat()
411 notok_mode(testname, "open", mode); in check_fstat()
415 ok_mode(testname, NULL, mode); in check_fstat()
417 notok_mode(testname, "failed", mode); in check_fstat()
427 int fd, i, mode; in check_fstatfs() local
430 * fstatfs() should work regardless of open mode. in check_fstatfs()
433 mode = modes[i]; in check_fstatfs()
434 fd = open(path, mode); in check_fstatfs()
436 notok_mode(testname, "open", mode); in check_fstatfs()
440 ok_mode(testname, NULL, mode); in check_fstatfs()
442 notok_mode(testname, "failed", mode); in check_fstatfs()
451 int fd, i, mode; in check_fsync() local
454 * fstatfs() should work regardless of open mode. in check_fsync()
457 mode = modes[i]; in check_fsync()
458 fd = open(path, mode); in check_fsync()
460 notok_mode(testname, "open", mode); in check_fsync()
464 ok_mode(testname, NULL, mode); in check_fsync()
466 notok_mode(testname, "failed", mode); in check_fsync()
476 int fd, i, mode; in check_ftruncate() local
479 * ftruncate() should work as long as long as (mode & O_ACCMODE) is in check_ftruncate()
486 mode = modes[i]; in check_ftruncate()
487 fd = open(path, mode); in check_ftruncate()
489 notok_mode(testname, "open", mode); in check_ftruncate()
490 notok_mode(testname, "truncate1 skipped", mode); in check_ftruncate()
491 notok_mode(testname, "truncate2 skipped", mode); in check_ftruncate()
492 notok_mode(testname, "truncate3 skipped", mode); in check_ftruncate()
496 notok_mode(testname, "fstat", mode); in check_ftruncate()
497 notok_mode(testname, "truncate1 skipped", mode); in check_ftruncate()
498 notok_mode(testname, "truncate2 skipped", mode); in check_ftruncate()
499 notok_mode(testname, "truncate3 skipped", mode); in check_ftruncate()
503 ok_mode(testname, "setup", mode); in check_ftruncate()
507 if (((mode & O_ACCMODE) == O_WRONLY) || in check_ftruncate()
508 ((mode & O_ACCMODE) == O_RDWR)) in check_ftruncate()
510 mode); in check_ftruncate()
513 mode); in check_ftruncate()
515 mode); in check_ftruncate()
517 mode); in check_ftruncate()
522 if (((mode & O_ACCMODE) == O_WRONLY) || in check_ftruncate()
523 ((mode & O_ACCMODE) == O_RDWR)) { in check_ftruncate()
525 mode); in check_ftruncate()
527 mode); in check_ftruncate()
529 mode); in check_ftruncate()
533 ok_mode(testname, "truncate1 failed", mode); in check_ftruncate()
538 if (((mode & O_ACCMODE) == O_WRONLY) || in check_ftruncate()
539 ((mode & O_ACCMODE) == O_RDWR)) in check_ftruncate()
541 mode); in check_ftruncate()
544 mode); in check_ftruncate()
546 mode); in check_ftruncate()
551 if (((mode & O_ACCMODE) == O_WRONLY) || in check_ftruncate()
552 ((mode & O_ACCMODE) == O_RDWR)) { in check_ftruncate()
554 mode); in check_ftruncate()
556 mode); in check_ftruncate()
560 ok_mode(testname, "truncate2 failed", mode); in check_ftruncate()
565 if (((mode & O_ACCMODE) == O_WRONLY) || in check_ftruncate()
566 ((mode & O_ACCMODE) == O_RDWR)) in check_ftruncate()
568 mode); in check_ftruncate()
571 mode); in check_ftruncate()
573 if (((mode & O_ACCMODE) == O_WRONLY) || in check_ftruncate()
574 ((mode & O_ACCMODE) == O_RDWR)) in check_ftruncate()
576 mode); in check_ftruncate()
578 ok_mode(testname, "truncate3 failed", mode); in check_ftruncate()
588 int fd, i, mode; in check_futimes() local
591 * futimes() should work regardless of open mode. in check_futimes()
594 mode = modes[i]; in check_futimes()
595 fd = open(path, mode); in check_futimes()
597 notok_mode(testname, "open", mode); in check_futimes()
601 ok_mode(testname, NULL, mode); in check_futimes()
603 notok_mode(testname, "failed", mode); in check_futimes()
612 int fd, i, mode; in check_lseek() local
615 * lseek() should work regardless of open mode. in check_lseek()
618 mode = modes[i]; in check_lseek()
619 fd = open(path, mode); in check_lseek()
621 notok_mode(testname, "open", mode); in check_lseek()
625 ok_mode(testname, NULL, mode); in check_lseek()
627 notok_mode(testname, "failed", mode); in check_lseek()
636 int fd, i, mode; in check_getdents() local
644 mode = modes[i]; in check_getdents()
645 fd = open(path, mode); in check_getdents()
647 notok_mode(testname, "open", mode); in check_getdents()
651 if (isdir && ((mode & O_ACCMODE) == O_RDONLY)) in check_getdents()
653 mode); in check_getdents()
656 mode); in check_getdents()
658 notok_mode(testname, "file succeeded", mode); in check_getdents()
660 if (isdir && ((mode & O_ACCMODE) == O_RDONLY)) in check_getdents()
662 mode); in check_getdents()
664 ok_mode(testname, "directory failed", mode); in check_getdents()
666 ok_mode(testname, "file failed", mode); in check_getdents()
676 int fd, i, mode, sv[2]; in check_sendfile() local
680 * sendfile() should work only on files, and only when the access mode in check_sendfile()
684 mode = modes[i]; in check_sendfile()
685 fd = open(path, mode); in check_sendfile()
687 notok_mode(testname, "open", mode); in check_sendfile()
691 notok_mode(testname, "socketpair", mode); in check_sendfile()
697 mode); in check_sendfile()
698 else if (((mode & O_ACCMODE) == O_RDONLY) || in check_sendfile()
699 ((mode & O_ACCMODE) == O_RDWR)) in check_sendfile()
700 ok_mode(testname, "succeeded", mode); in check_sendfile()
702 notok_mode(testname, "succeeded", mode); in check_sendfile()
705 ok_mode(testname, "directory failed", mode); in check_sendfile()
706 else if (((mode & O_ACCMODE) == O_RDONLY) || in check_sendfile()
707 ((mode & O_ACCMODE) == O_RDWR)) in check_sendfile()
708 notok_mode(testname, "failed", mode); in check_sendfile()
710 ok_mode(testname, "failed", mode); in check_sendfile()
772 int fd, i, mode; in check_write() local
782 mode = modes[i]; in check_write()
783 fd = open(path, mode); in check_write()
785 notok_mode(testname, "open", mode); in check_write()
789 if ((mode & O_ACCMODE) == O_WRONLY || in check_write()
790 (mode & O_ACCMODE) == O_RDWR) in check_write()
791 notok_mode(testname, "write failed", mode); in check_write()
793 ok_mode(testname, "write failed", mode); in check_write()
795 if (!((mode & O_ACCMODE) == O_WRONLY || in check_write()
796 (mode & O_ACCMODE) == O_RDWR)) in check_write()
797 notok_mode(testname, "write succeeded", mode); in check_write()
799 ok_mode(testname, "write succeeded", mode); in check_write()
858 int fd, i, mode; in check_read() local
866 mode = modes[i]; in check_read()
867 fd = open(path, mode); in check_read()
869 notok_mode(testname, "open", mode); in check_read()
873 if ((mode & O_ACCMODE) == O_RDONLY || in check_read()
874 (mode & O_ACCMODE) == O_RDWR) in check_read()
875 notok_mode(testname, "read failed", mode); in check_read()
877 ok_mode(testname, "read failed", mode); in check_read()
879 if (!((mode & O_ACCMODE) == O_RDONLY || in check_read()
880 (mode & O_ACCMODE) == O_RDWR)) in check_read()
881 notok_mode(testname, "read succeeded", mode); in check_read()
883 ok_mode(testname, "read succeeded", mode); in check_read()
893 int fd, i, mode; in check_mmap_read() local
901 mode = modes[i]; in check_mmap_read()
902 fd = open(path, mode); in check_mmap_read()
904 notok_mode(testname, "open", mode); in check_mmap_read()
911 ok_mode(testname, "mmap dir failed", mode); in check_mmap_read()
912 else if ((mode & O_ACCMODE) == O_RDONLY || in check_mmap_read()
913 (mode & O_ACCMODE) == O_RDWR) in check_mmap_read()
915 mode); in check_mmap_read()
917 ok_mode(testname, "mmap file failed", mode); in check_mmap_read()
921 mode); in check_mmap_read()
922 else if ((mode & O_ACCMODE) == O_RDONLY || in check_mmap_read()
923 (mode & O_ACCMODE) == O_RDWR) in check_mmap_read()
925 mode); in check_mmap_read()
928 mode); in check_mmap_read()
939 int fd, i, mode; in check_mmap_write() local
949 mode = modes[i]; in check_mmap_write()
950 fd = open(path, mode); in check_mmap_write()
952 notok_mode(testname, "open", mode); in check_mmap_write()
958 if ((mode & O_ACCMODE) == O_WRONLY || in check_mmap_write()
959 (mode & O_ACCMODE) == O_RDWR) in check_mmap_write()
961 mode); in check_mmap_write()
963 ok_mode(testname, "mmap failed", mode); in check_mmap_write()
965 if ((mode & O_ACCMODE) == O_WRONLY || in check_mmap_write()
966 (mode & O_ACCMODE) == O_RDWR) in check_mmap_write()
968 mode); in check_mmap_write()
970 notok_mode(testname, "mmap succeeded", mode); in check_mmap_write()
981 int fd, i, mode; in check_mmap_exec() local
989 mode = modes[i]; in check_mmap_exec()
990 fd = open(path, mode); in check_mmap_exec()
992 notok_mode(testname, "open", mode); in check_mmap_exec()
999 ok_mode(testname, "mmap dir failed", mode); in check_mmap_exec()
1000 else if ((mode & O_ACCMODE) == O_RDONLY || in check_mmap_exec()
1001 (mode & O_ACCMODE) == O_RDWR) in check_mmap_exec()
1003 mode); in check_mmap_exec()
1005 ok_mode(testname, "mmap file failed", mode); in check_mmap_exec()
1009 mode); in check_mmap_exec()
1012 mode); in check_mmap_exec()
1023 int fd, i, mode; in check_mmap_write_private() local
1031 mode = modes[i]; in check_mmap_write_private()
1032 fd = open(path, mode); in check_mmap_write_private()
1034 notok_mode(testname, "open", mode); in check_mmap_write_private()
1041 ok_mode(testname, "mmap dir failed", mode); in check_mmap_write_private()
1042 else if ((mode & O_ACCMODE) == O_RDONLY || in check_mmap_write_private()
1043 (mode & O_ACCMODE) == O_RDWR) in check_mmap_write_private()
1045 mode); in check_mmap_write_private()
1047 ok_mode(testname, "mmap file failed", mode); in check_mmap_write_private()
1051 mode); in check_mmap_write_private()
1052 else if ((mode & O_ACCMODE) == O_RDONLY || in check_mmap_write_private()
1053 (mode & O_ACCMODE) == O_RDWR) in check_mmap_write_private()
1055 mode); in check_mmap_write_private()
1058 mode); in check_mmap_write_private()