mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-12-03 13:20:25 -05:00
checkpoint
This commit is contained in:
parent
be3499ee56
commit
ec46077fb5
46 changed files with 9443 additions and 15887 deletions
48
libfuse/lib/sys.c
Normal file
48
libfuse/lib/sys.c
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#define _GNU_SOURCE
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static
|
||||
int
|
||||
sys_get_pagesize_(void)
|
||||
{
|
||||
#ifdef _SC_PAGESIZE
|
||||
return sysconf(_SC_PAGESIZE);
|
||||
#else
|
||||
return getpagesize();
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
sys_get_pagesize(void)
|
||||
{
|
||||
static int pagesize = 0;
|
||||
|
||||
if(pagesize == 0)
|
||||
pagesize = sys_get_pagesize_();
|
||||
|
||||
return pagesize;
|
||||
}
|
||||
|
||||
int
|
||||
sys_alloc_pipe(int pipe_[2],
|
||||
int bufsize_)
|
||||
{
|
||||
#ifdef F_SETPIPE_SZ
|
||||
int rv;
|
||||
|
||||
rv = pipe(pipe_);
|
||||
if(rv == -1)
|
||||
return -1;
|
||||
|
||||
rv = fcntl(pipe_[0],F_SETPIPE_SZ,bufsize_);
|
||||
if(rv == -1)
|
||||
return -1;
|
||||
|
||||
return rv;
|
||||
#else
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue