]>
git.proxmox.com Git - wasi-libc.git/blob - libc-top-half/musl/src/time/__map_file.c
7 const char unsigned *__map_file(const char *pathname
, size_t *size
)
10 const unsigned char *map
= MAP_FAILED
;
11 int fd
= sys_open(pathname
, O_RDONLY
|O_CLOEXEC
|O_NONBLOCK
);
13 if (!syscall(SYS_fstat
, fd
, &st
)) {
14 map
= __mmap(0, st
.st_size
, PROT_READ
, MAP_SHARED
, fd
, 0);
17 __syscall(SYS_close
, fd
);
18 return map
== MAP_FAILED
? 0 : map
;