mescc: Tinycc support: unlink.

* mlibc/include/unistd.h (unlink): Declare.
* stage0/x86.M1 (SYS_unlink): New define.
* mlibc/libc-mes+tcc.c (unlink): New function.
This commit is contained in:
Jan Nieuwenhuizen 2017-07-24 17:09:33 +02:00
parent b860cb7a17
commit 3e39c56f35
3 changed files with 14 additions and 0 deletions

View File

@ -43,6 +43,7 @@ int access (char const *s, int mode);
int close (int fd);
char *getcwd (char *buf, size_t size);
int read (int fd, void* buf, size_t n);
int unlink (char const *file_name);
int write (int fd, char const* s, int n);
#endif // ! (__GNUC__ && POSIX)

View File

@ -43,6 +43,18 @@ getcwd (char *buf, size_t size)
asm ("int____$0x80");
}
int
unlink (char const *file_name)
{
asm ("mov____0x8(%ebp),%ebx !8");
asm ("mov____$i32,%eax SYS_unlink");
asm ("int____$0x80");
}
int
fprintf (FILE *stream, char const *format, ...)
{

View File

@ -163,6 +163,7 @@ DEFINE SYS_read 03000000
DEFINE SYS_write 04000000
DEFINE SYS_open 05000000
DEFINE SYS_close 06000000
DEFINE SYS_unlink 0a000000
DEFINE SYS_access 21000000
DEFINE SYS_brk 2d000000
DEFINE SYS_fsync 76000000