diff --git a/include/fcntl.h b/include/fcntl.h index 2980d47b..84415bcf 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -46,6 +46,7 @@ #define F_GETFL 3 #define F_SETFL 4 +#define creat(file_name, mode) open (file_name, O_WRONLY | O_CREAT | O_TRUNC, mode) int dup (int old); int dup2 (int old, int new); int fcntl (int filedes, int command, ...); diff --git a/include/linux/x86/syscall.h b/include/linux/x86/syscall.h index 620a8b7d..e8de351a 100644 --- a/include/linux/x86/syscall.h +++ b/include/linux/x86/syscall.h @@ -86,5 +86,6 @@ // tar #define SYS_symlink 0x53 #define SYS_readlink 0x55 +#define SYS_mknod 0x0e #endif // __MES_LINUX_X86_SYSCALL_H diff --git a/include/linux/x86_64/syscall.h b/include/linux/x86_64/syscall.h index 66022289..527b5ec6 100644 --- a/include/linux/x86_64/syscall.h +++ b/include/linux/x86_64/syscall.h @@ -83,5 +83,6 @@ // tar #define SYS_symlink 0x58 #define SYS_readlink 0x59 +#define SYS_mknod 0x85 #endif // __MES_LINUX_X86_64_SYSCALL_H diff --git a/include/sys/stat.h b/include/sys/stat.h index 484cc992..a9a14d5c 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -82,6 +82,7 @@ struct stat int chmod (char const *file_name, mode_t mode); int mkdir (char const *file_name, mode_t mode); +int mknod (char const *file_name, mode_t mode, dev_t dev); int chown (char const *file_name, uid_t owner, gid_t group); int rmdir (char const *file_name); int stat (char const *file_name, struct stat *buf); diff --git a/lib/linux/gnu.c b/lib/linux/gnu.c index 1e9553e3..5c77bc66 100644 --- a/lib/linux/gnu.c +++ b/lib/linux/gnu.c @@ -210,3 +210,9 @@ readlink (char const *file_name, char *buffer, size_t size) { return _sys_call3 (SYS_readlink, (long)file_name, (long)buffer, (long)size); } + +int +mknod (char const *file_name, mode_t mode, dev_t dev) +{ + return _sys_call3 (SYS_mknod, (long)file_name, (long)mode, (long)dev); +}