add clock_adjtime, remap_file_pages, and syncfs syscall wrappers

patch by Justin Cormack, with slight modification
This commit is contained in:
Rich Felker 2012-09-16 22:26:23 -04:00
parent bd261bf25e
commit 662da62eb7
6 changed files with 36 additions and 0 deletions

View File

@ -10,6 +10,10 @@ extern "C" {
#define __NEED_size_t
#define __NEED_off_t
#if defined(_GNU_SOURCE)
#define __NEED_ssize_t
#endif
#include <bits/alltypes.h>
#include <bits/mman.h>
@ -29,6 +33,7 @@ int munlockall (void);
#ifdef _GNU_SOURCE
void *mremap (void *, size_t, size_t, int, ...);
int remap_file_pages (void *, size_t, int, ssize_t, int);
#endif
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)

View File

@ -5,6 +5,10 @@
extern "C" {
#endif
#define __NEED_clockid_t
#include <bits/alltypes.h>
#include <sys/time.h>
struct ntptimeval {
@ -83,6 +87,7 @@ struct timex {
#define MAXTC 6
int adjtimex(struct timex *);
int clock_adjtime(clockid_t, struct timex *);
#ifdef __cplusplus
}

View File

@ -184,6 +184,7 @@ int getresgid(gid_t *, gid_t *, gid_t *);
char *get_current_dir_name(void);
int pipe2(int [2], int);
int dup3(int, int, int);
void syncfs(int);
#endif
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)

View File

@ -0,0 +1,9 @@
#define _GNU_SOURCE
#include <time.h>
#include <sys/timex.h>
#include "syscall.h"
int clock_adjtime (clockid_t clock_id, struct timex *utx)
{
return syscall(SYS_clock_adjtime, clock_id, utx);
}

View File

@ -0,0 +1,8 @@
#define _GNU_SOURCE
#include <sys/mman.h>
#include "syscall.h"
int remap_file_pages(void *addr, size_t size, int prot, ssize_t pgoff, int flags)
{
return syscall(SYS_remap_file_pages, addr, size, prot, pgoff, flags);
}

8
src/linux/syncfs.c Normal file
View File

@ -0,0 +1,8 @@
#define _GNU_SOURCE
#include <unistd.h>
#include "syscall.h"
void syncfs(int fd)
{
__syscall(SYS_syncfs, fd);
}