initial check-in, version 0.5.0

This commit is contained in:
Rich Felker
2011-02-12 00:22:29 -05:00
commit 0b44a0315b
1021 changed files with 45711 additions and 0 deletions

9
src/fcntl/creat.c Normal file
View File

@ -0,0 +1,9 @@
#include <fcntl.h>
#include "libc.h"
int creat(const char *filename, mode_t mode)
{
return open(filename, O_CREAT|O_WRONLY|O_TRUNC, mode);
}
LFS64(creat);

22
src/fcntl/fcntl.c Normal file
View File

@ -0,0 +1,22 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdarg.h>
#include "syscall.h"
#include "libc.h"
int fcntl(int fd, int cmd, ...)
{
int r;
long arg;
va_list ap;
va_start(ap, cmd);
arg = va_arg(ap, long);
va_end(ap);
if (cmd == F_SETFL) arg |= O_LARGEFILE;
if (cmd == F_SETLKW) CANCELPT_BEGIN;
r = __syscall_fcntl(fd, cmd, arg);
if (cmd == F_SETLKW) CANCELPT_END;
return r;
}
LFS64(fcntl);

21
src/fcntl/open.c Normal file
View File

@ -0,0 +1,21 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdarg.h>
#include "syscall.h"
#include "libc.h"
int open(const char *filename, int flags, ...)
{
int r;
mode_t mode;
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, mode_t);
va_end(ap);
CANCELPT_BEGIN;
r = __syscall_open(filename, flags, mode);
CANCELPT_END;
return r;
}
LFS64(open);

21
src/fcntl/openat.c Normal file
View File

@ -0,0 +1,21 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdarg.h>
#include "syscall.h"
#include "libc.h"
int openat(int fd, const char *filename, int flags, ...)
{
int r;
mode_t mode;
va_list ap;
va_start(ap, flags);
mode = va_arg(ap, mode_t);
va_end(ap);
CANCELPT_BEGIN;
r = syscall4(__NR_openat, fd, (long)filename, flags|O_LARGEFILE, mode);
CANCELPT_END;
return r;
}
LFS64(openat);