add clock_adjtime, remap_file_pages, and syncfs syscall wrappers
authorRich Felker <dalias@aerifal.cx>
Mon, 17 Sep 2012 02:26:23 +0000 (22:26 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 17 Sep 2012 02:26:23 +0000 (22:26 -0400)
patch by Justin Cormack, with slight modification

include/sys/mman.h
include/sys/timex.h
include/unistd.h
src/linux/clock_adjtime.c [new file with mode: 0644]
src/linux/remap_file_pages.c [new file with mode: 0644]
src/linux/syncfs.c [new file with mode: 0644]

index 136b45b349f1242d680fc89dab25b67938ef1cae..9a1e60fff380c91749fc68b5fa67a2b61d42f52e 100644 (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)
index 126239226c84dd3dee1cf3eff95692053beff7b0..f37c13cefee8f2a02e1b30ea995b4102b24f3ac1 100644 (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
 }
index d3bb781aca551344d2f13cb40b8743d008b12348..985d279eea87501ab0f2673920508c620023bd6a 100644 (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)
diff --git a/src/linux/clock_adjtime.c b/src/linux/clock_adjtime.c
new file mode 100644 (file)
index 0000000..1fc9bef
--- /dev/null
@@ -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);
+}
diff --git a/src/linux/remap_file_pages.c b/src/linux/remap_file_pages.c
new file mode 100644 (file)
index 0000000..f95c4cc
--- /dev/null
@@ -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);
+}
diff --git a/src/linux/syncfs.c b/src/linux/syncfs.c
new file mode 100644 (file)
index 0000000..fe2b8a7
--- /dev/null
@@ -0,0 +1,8 @@
+#define _GNU_SOURCE
+#include <unistd.h>
+#include "syscall.h"
+
+void syncfs(int fd)
+{
+       __syscall(SYS_syncfs, fd);
+}