PatchworkOS  3984a1d
A non-POSIX operating system.
Loading...
Searching...
No Matches
sharefile.c
Go to the documentation of this file.
1#include <stdio.h>
2#include <sys/io.h>
3
4uint64_t sharefile(char* key, uint64_t size, const char* path, clock_t timeout)
5{
6 fd_t fd = open(path);
7 if (fd == ERR)
8 {
9 return ERR;
10 }
11
12 uint64_t result = share(key, size, fd, timeout);
13 close(fd);
14 return result;
15}
fd_t open(const char *path)
System call for opening files.
Definition open.c:8
uint64_t close(fd_t fd)
System call for closing files.
Definition close.c:8
uint64_t share(char *key, uint64_t size, fd_t fd, clock_t timeout)
System call for sharing a file descriptor with another process.
Definition share.c:6
uint64_t sharefile(char *key, uint64_t size, const char *path, clock_t timeout)
Helper for sharing a file by its path.
Definition sharefile.c:4
#define ERR
Integer error value.
Definition ERR.h:17
__UINT64_TYPE__ fd_t
A file descriptor.
Definition fd_t.h:12
__UINT64_TYPE__ clock_t
A nanosecond time.
Definition clock_t.h:13
__UINT64_TYPE__ uint64_t
Definition stdint.h:17