typ off64_t sys/stat.h hdr alloca lib syscall syscall.h sys/syscall.h mem stat.st_atim,stat.st_fstype sys/types.h sys/stat.h mem DIR dirent.h -DDIRENT_ILLEGAL_ACCESS tst fdview execute{ #include <fcntl.h> #define VIEW 15 main() { int fd; int oflags; int nflags; int xflags; if ((fd = open(argv[0], 0)) < 0) return(1); if ((oflags = fcntl(fd, F_GETFL, 0)) < 0) return(1); nflags = (oflags & 0xffff) | (VIEW<<16); if (fcntl(fd, F_SETFL, nflags) < 0) return(1); if ((xflags = fcntl(fd, F_GETFL, 0)) < 0) return(1); if (xflags != nflags) return(1); return(0); } }end pass{ echo "#define getfdview(f) ((fcntl(f,F_GETFL,0)>>16)&037)" echo "#define setfdview(f,v) (fcntl(f,F_SETFL,(fcntl(f,F_GETFL,0)&0xffff)|(((v)&037)<<16)))" }end fail{ echo "/* hack alert -- this is the view of the last user open */" echo "#define getfdview(f) (state.path.open_level)" echo "#define setfdview(f,v)" }end tst no_exit_exit note{ exit() bypasses _exit() }end exec{ #include <sys/types.h> #include <signal.h> #ifdef __STDC__ #include <unistd.h> #endif #if _STD_ void _exit(int code) { kill(getpid(), SIGKILL); } #else void _exit(code) int code; { kill(getpid(), SIGKILL); } #endif int main() { return 0; } }end