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:
parent
098baf52a8
commit
2b3fbf5ffa
|
@ -46,6 +46,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
|
||||||
|
|
|
@ -82,6 +82,7 @@ struct stat
|
||||||
|
|
||||||
int chmod (char const *file_name, mode_t mode);
|
int chmod (char const *file_name, mode_t mode);
|
||||||
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);
|
||||||
|
|
|
@ -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);
|
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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue