mescc: Mes C Library: Support GNU Tar: Add creat, mknod.
* include/linux/x86_64/syscall.h (SYS_mknod): New macro. * include/linux/x86/syscall.h (SYS_mknod): New macro. * lib/linux/mknod.c: New file. * build-aux/configure-lib.sh (libc_gnu_SOURCES): Add it. * include/sys/stat.h (mknod): Declare it. * include/fcntl.h (creat): New macro.
This commit is contained in:
parent
203ef4944b
commit
b97c59ff21
|
@ -312,6 +312,7 @@ lib/linux/kill.c
|
||||||
lib/linux/link.c
|
lib/linux/link.c
|
||||||
lib/linux/lstat.c
|
lib/linux/lstat.c
|
||||||
lib/linux/mkdir.c
|
lib/linux/mkdir.c
|
||||||
|
lib/linux/mknod.c
|
||||||
lib/linux/nanosleep.c
|
lib/linux/nanosleep.c
|
||||||
lib/linux/pipe.c
|
lib/linux/pipe.c
|
||||||
lib/linux/readlink.c
|
lib/linux/readlink.c
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
#define F_GETFL 3
|
#define F_GETFL 3
|
||||||
#define F_SETFL 4
|
#define F_SETFL 4
|
||||||
|
|
||||||
|
#define creat(file_name, mode) open (file_name, O_WRONLY | O_CREAT | O_TRUNC, mode)
|
||||||
int dup (int old);
|
int dup (int old);
|
||||||
int dup2 (int old, int new);
|
int dup2 (int old, int new);
|
||||||
int fcntl (int filedes, int command, ...);
|
int fcntl (int filedes, int command, ...);
|
||||||
|
|
|
@ -86,5 +86,6 @@
|
||||||
// tar
|
// tar
|
||||||
#define SYS_symlink 0x53
|
#define SYS_symlink 0x53
|
||||||
#define SYS_readlink 0x55
|
#define SYS_readlink 0x55
|
||||||
|
#define SYS_mknod 0x0e
|
||||||
|
|
||||||
#endif // __MES_LINUX_X86_SYSCALL_H
|
#endif // __MES_LINUX_X86_SYSCALL_H
|
||||||
|
|
|
@ -83,5 +83,6 @@
|
||||||
// tar
|
// tar
|
||||||
#define SYS_symlink 0x58
|
#define SYS_symlink 0x58
|
||||||
#define SYS_readlink 0x59
|
#define SYS_readlink 0x59
|
||||||
|
#define SYS_mknod 0x85
|
||||||
|
|
||||||
#endif // __MES_LINUX_X86_64_SYSCALL_H
|
#endif // __MES_LINUX_X86_64_SYSCALL_H
|
||||||
|
|
|
@ -85,6 +85,7 @@ struct stat
|
||||||
int chmod (char const *file_name, mode_t mode);
|
int chmod (char const *file_name, mode_t mode);
|
||||||
int fstat (int filedes, struct stat *buf);
|
int fstat (int filedes, struct stat *buf);
|
||||||
int mkdir (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 chown (char const *file_name, uid_t owner, gid_t group);
|
||||||
int rmdir (char const *file_name);
|
int rmdir (char const *file_name);
|
||||||
int stat (char const *file_name, struct stat *buf);
|
int stat (char const *file_name, struct stat *buf);
|
||||||
|
|
29
lib/linux/mknod.c
Normal file
29
lib/linux/mknod.c
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/* -*-comment-start: "//";comment-end:""-*-
|
||||||
|
* GNU Mes --- Maxwell Equations of Software
|
||||||
|
* Copyright © 2018,2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/syscall.h>
|
||||||
|
#include <syscall.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
mknod (char const *file_name, mode_t mode, dev_t dev)
|
||||||
|
{
|
||||||
|
return _sys_call3 (SYS_mknod, (long) file_name, (long) mode, (long) dev);
|
||||||
|
}
|
Loading…
Reference in a new issue