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/gnu.c (mknod): New function, use it.
* include/sys/stat.h: Declare it.
* include/fcntl.h (creat): New macro.
This commit is contained in:
Jan Nieuwenhuizen 2019-01-05 10:56:58 +01:00
parent 098baf52a8
commit 2b3fbf5ffa
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
5 changed files with 10 additions and 0 deletions

View File

@ -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, ...);

View File

@ -86,5 +86,6 @@
// tar
#define SYS_symlink 0x53
#define SYS_readlink 0x55
#define SYS_mknod 0x0e
#endif // __MES_LINUX_X86_SYSCALL_H

View File

@ -83,5 +83,6 @@
// tar
#define SYS_symlink 0x58
#define SYS_readlink 0x59
#define SYS_mknod 0x85
#endif // __MES_LINUX_X86_64_SYSCALL_H

View File

@ -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);

View File

@ -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);
}