DF-3105 / df3105c.c
#include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> #include <sys/mman.h> #include <sys/stat.h> int main(int argc,char**argv){ char buf[64]; int fd=open(argv[1],O_RDONLY); struct stat st; fstat(fd,&st); printf("stat_size=%lld (inf_len 64-bit OK: %s)\n",(long long)st.st_size, st.st_size==5368696832LL?"yes":"NO"); unsigned long long offs[]={0, 2048, 0xFFFFC000ULL, 0x100000000ULL}; for(unsigned i=0;i<4;i++){ errno=0; ssize_t r=pread(fd,buf,32,offs[i]); printf("pread@%#llx -> ret=%zd errno=%d buf0=%02x\n",offs[i],r,errno, r>0?(unsigned char)buf[0]:0); } void*p=mmap(NULL,4096,PROT_READ,MAP_SHARED,fd,0); printf("mmap@0 -> %s (v_object NULL => EINVAL, all UDF files)\n", p==MAP_FAILED?"FAIL/EINVAL":"OK"); return 0; } |