diff --git a/build-aux/configure-lib.sh b/build-aux/configure-lib.sh index 3b6a9a6f..6575c809 100644 --- a/build-aux/configure-lib.sh +++ b/build-aux/configure-lib.sh @@ -311,6 +311,7 @@ lib/linux/kill.c lib/linux/link.c lib/linux/lstat.c lib/linux/mkdir.c +lib/linux/mknod.c lib/linux/nanosleep.c lib/linux/pipe.c lib/linux/readlink.c diff --git a/include/fcntl.h b/include/fcntl.h index 148d5ea6..f29d56ac 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -48,6 +48,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 10c3f31b..36ef06bc 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 6db24496..891f31c8 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -85,6 +85,7 @@ struct stat int chmod (char const *file_name, mode_t mode); int fstat (int filedes, struct stat *buf); 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/mknod.c b/lib/linux/mknod.c new file mode 100644 index 00000000..8339f7a6 --- /dev/null +++ b/lib/linux/mknod.c @@ -0,0 +1,29 @@ +/* -*-comment-start: "//";comment-end:""-*- + * GNU Mes --- Maxwell Equations of Software + * Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen + * + * This file is part of GNU Mes. + * + * GNU Mes is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or (at + * your option) any later version. + * + * GNU Mes is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Mes. If not, see . + */ + +#include +#include +#include + +int +mknod (char const *file_name, mode_t mode, dev_t dev) +{ + return _sys_call3 (SYS_mknod, (long) file_name, (long) mode, (long) dev); +}