From 0b44a0315b47dd8eced9f3b7f31580cf14bbfc01 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sat, 12 Feb 2011 00:22:29 -0500 Subject: initial check-in, version 0.5.0 --- src/stat/chmod.c | 7 +++++++ src/stat/fchmod.c | 7 +++++++ src/stat/fchmodat.c | 7 +++++++ src/stat/fstat.c | 10 ++++++++++ src/stat/fstatat.c | 10 ++++++++++ src/stat/fstatvfs.c | 13 +++++++++++++ src/stat/lstat.c | 10 ++++++++++ src/stat/mkdir.c | 7 +++++++ src/stat/mkdirat.c | 7 +++++++ src/stat/mkfifo.c | 6 ++++++ src/stat/mkfifoat.c | 6 ++++++ src/stat/mknod.c | 10 ++++++++++ src/stat/mknodat.c | 7 +++++++ src/stat/stat.c | 10 ++++++++++ src/stat/statvfs.c | 13 +++++++++++++ src/stat/umask.c | 7 +++++++ 16 files changed, 137 insertions(+) create mode 100644 src/stat/chmod.c create mode 100644 src/stat/fchmod.c create mode 100644 src/stat/fchmodat.c create mode 100644 src/stat/fstat.c create mode 100644 src/stat/fstatat.c create mode 100644 src/stat/fstatvfs.c create mode 100644 src/stat/lstat.c create mode 100644 src/stat/mkdir.c create mode 100644 src/stat/mkdirat.c create mode 100644 src/stat/mkfifo.c create mode 100644 src/stat/mkfifoat.c create mode 100644 src/stat/mknod.c create mode 100644 src/stat/mknodat.c create mode 100644 src/stat/stat.c create mode 100644 src/stat/statvfs.c create mode 100644 src/stat/umask.c (limited to 'src/stat') diff --git a/src/stat/chmod.c b/src/stat/chmod.c new file mode 100644 index 00000000..cb310fec --- /dev/null +++ b/src/stat/chmod.c @@ -0,0 +1,7 @@ +#include +#include "syscall.h" + +int chmod(const char *path, mode_t mode) +{ + return syscall2(__NR_chmod, (long)path, mode); +} diff --git a/src/stat/fchmod.c b/src/stat/fchmod.c new file mode 100644 index 00000000..91897383 --- /dev/null +++ b/src/stat/fchmod.c @@ -0,0 +1,7 @@ +#include +#include "syscall.h" + +int fchmod(int fd, mode_t mode) +{ + return syscall2(__NR_fchmod, fd, mode); +} diff --git a/src/stat/fchmodat.c b/src/stat/fchmodat.c new file mode 100644 index 00000000..f4f22b2c --- /dev/null +++ b/src/stat/fchmodat.c @@ -0,0 +1,7 @@ +#include +#include "syscall.h" + +int fchmodat(int fd, const char *path, mode_t mode, int flag) +{ + return syscall4(__NR_fchmodat, fd, (long)path, mode, flag); +} diff --git a/src/stat/fstat.c b/src/stat/fstat.c new file mode 100644 index 00000000..5f643301 --- /dev/null +++ b/src/stat/fstat.c @@ -0,0 +1,10 @@ +#include +#include "syscall.h" +#include "libc.h" + +int fstat(int fd, struct stat *buf) +{ + return syscall2(__NR_fstat64, fd, (long)buf); +} + +LFS64(fstat); diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c new file mode 100644 index 00000000..22bc2934 --- /dev/null +++ b/src/stat/fstatat.c @@ -0,0 +1,10 @@ +#include +#include "syscall.h" +#include "libc.h" + +int fstatat(int fd, const char *path, struct stat *buf, int flag) +{ + return syscall4(__NR_fstatat64, fd, (long)path, (long)buf, flag); +} + +LFS64(fstatat); diff --git a/src/stat/fstatvfs.c b/src/stat/fstatvfs.c new file mode 100644 index 00000000..83bd7486 --- /dev/null +++ b/src/stat/fstatvfs.c @@ -0,0 +1,13 @@ +#include +#include "syscall.h" +#include "libc.h" + +int fstatvfs(int fd, struct statvfs *buf) +{ + return syscall2(__NR_fstatfs64, fd, (long)buf); +} + +weak_alias(fstatvfs, fstatfs); + +LFS64(fstatvfs); +LFS64(fstatfs); diff --git a/src/stat/lstat.c b/src/stat/lstat.c new file mode 100644 index 00000000..afdb5538 --- /dev/null +++ b/src/stat/lstat.c @@ -0,0 +1,10 @@ +#include +#include "syscall.h" +#include "libc.h" + +int lstat(const char *path, struct stat *buf) +{ + return syscall2(__NR_lstat64, (long)path, (long)buf); +} + +LFS64(lstat); diff --git a/src/stat/mkdir.c b/src/stat/mkdir.c new file mode 100644 index 00000000..8295cad5 --- /dev/null +++ b/src/stat/mkdir.c @@ -0,0 +1,7 @@ +#include +#include "syscall.h" + +int mkdir(const char *path, mode_t mode) +{ + return syscall2(__NR_mkdir, (long)path, mode); +} diff --git a/src/stat/mkdirat.c b/src/stat/mkdirat.c new file mode 100644 index 00000000..1fb38250 --- /dev/null +++ b/src/stat/mkdirat.c @@ -0,0 +1,7 @@ +#include +#include "syscall.h" + +int mkdirat(int fd, const char *path, mode_t mode) +{ + return syscall3(__NR_mkdirat, fd, (long)path, mode); +} diff --git a/src/stat/mkfifo.c b/src/stat/mkfifo.c new file mode 100644 index 00000000..60efcf73 --- /dev/null +++ b/src/stat/mkfifo.c @@ -0,0 +1,6 @@ +#include + +int mkfifo(const char *path, mode_t mode) +{ + return mknod(path, mode | S_IFIFO, 0); +} diff --git a/src/stat/mkfifoat.c b/src/stat/mkfifoat.c new file mode 100644 index 00000000..d3a1f970 --- /dev/null +++ b/src/stat/mkfifoat.c @@ -0,0 +1,6 @@ +#include + +int mkfifoat(int fd, const char *path, mode_t mode) +{ + return mknodat(fd, path, mode | S_IFIFO, 0); +} diff --git a/src/stat/mknod.c b/src/stat/mknod.c new file mode 100644 index 00000000..0123eeef --- /dev/null +++ b/src/stat/mknod.c @@ -0,0 +1,10 @@ +#include +#include "syscall.h" + +int mknod(const char *path, mode_t mode, dev_t dev) +{ + /* since dev_t is system-specific anyway we defer to the idiotic + * legacy-compatible bitfield mapping of the type.. at least we've + * made it large enough to leave space for future expansion.. */ + return syscall3(__NR_mknod, (long)path, mode, dev & 0xffff); +} diff --git a/src/stat/mknodat.c b/src/stat/mknodat.c new file mode 100644 index 00000000..b5687e47 --- /dev/null +++ b/src/stat/mknodat.c @@ -0,0 +1,7 @@ +#include +#include "syscall.h" + +int mknodat(int fd, const char *path, mode_t mode, dev_t dev) +{ + return syscall4(__NR_mknodat, fd, (long)path, mode, dev & 0xffff); +} diff --git a/src/stat/stat.c b/src/stat/stat.c new file mode 100644 index 00000000..67640cc1 --- /dev/null +++ b/src/stat/stat.c @@ -0,0 +1,10 @@ +#include +#include "syscall.h" +#include "libc.h" + +int stat(const char *path, struct stat *buf) +{ + return syscall2(__NR_stat64, (long)path, (long)buf); +} + +LFS64(stat); diff --git a/src/stat/statvfs.c b/src/stat/statvfs.c new file mode 100644 index 00000000..55a05d52 --- /dev/null +++ b/src/stat/statvfs.c @@ -0,0 +1,13 @@ +#include +#include "syscall.h" +#include "libc.h" + +int statvfs(const char *path, struct statvfs *buf) +{ + return syscall2(__NR_statfs64, (long)path, (long)buf); +} + +weak_alias(statvfs, statfs); + +LFS64(statvfs); +LFS64(statfs); diff --git a/src/stat/umask.c b/src/stat/umask.c new file mode 100644 index 00000000..49cb48a6 --- /dev/null +++ b/src/stat/umask.c @@ -0,0 +1,7 @@ +#include +#include "syscall.h" + +mode_t umask(mode_t mode) +{ + return syscall1(__NR_umask, mode); +} -- cgit v1.2.1