Kernel/LibC: Implement flock
This commit is contained in:
@@ -33,6 +33,7 @@ set(LIBC_SOURCES
|
||||
strings.cpp
|
||||
sys/banan-os.cpp
|
||||
sys/epoll.cpp
|
||||
sys/file.cpp
|
||||
sys/ioctl.cpp
|
||||
sys/mman.cpp
|
||||
sys/resource.cpp
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef _SYS_FILE_H
|
||||
#define _SYS_FILE_H 1
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
#define LOCK_UN 0
|
||||
#define LOCK_EX 1
|
||||
#define LOCK_SH 2
|
||||
#define LOCK_NB 4
|
||||
|
||||
int flock(int fd, int op);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
|
||||
@@ -107,6 +107,7 @@ __BEGIN_DECLS
|
||||
O(SYS_EPOLL_CREATE1, epoll_create1) \
|
||||
O(SYS_EPOLL_CTL, epoll_ctl) \
|
||||
O(SYS_EPOLL_PWAIT2, epoll_pwait2) \
|
||||
O(SYS_FLOCK, flock) \
|
||||
|
||||
enum Syscall
|
||||
{
|
||||
|
||||
8
userspace/libraries/LibC/sys/file.cpp
Normal file
8
userspace/libraries/LibC/sys/file.cpp
Normal file
@@ -0,0 +1,8 @@
|
||||
#include <sys/file.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int flock(int fd, int op)
|
||||
{
|
||||
return syscall(SYS_FLOCK, fd, op);
|
||||
}
|
||||
Reference in New Issue
Block a user