scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | README | LICENSE

commit 97caea2d7a7e55453218c4457a18f4c692b2ac52
parent 4522220ff333d34cf402dd8bb449416c31716198
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sat, 16 May 2020 19:16:25 +0200

libc: Add remove()

Remove() can be implemented using unlink() directly, and this patch
adds support for it in linux amd64.

Diffstat:
Msrc/libc/arch/amd64/linux/Makefile | 1+
Msrc/libc/arch/amd64/linux/syscall.lst | 1+
Msrc/libc/stdio/Makefile | 1+
Asrc/libc/stdio/remove.c | 11+++++++++++
4 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/libc/arch/amd64/linux/Makefile b/src/libc/arch/amd64/linux/Makefile @@ -14,6 +14,7 @@ GENOBJS =\ _write.$O\ _brk.$O\ _sigaction.$O\ + _unlink.$O\ GENSRC = $(GENOBJS:.$O=.s) diff --git a/src/libc/arch/amd64/linux/syscall.lst b/src/libc/arch/amd64/linux/syscall.lst @@ -9,3 +9,4 @@ 39 _getpid 60 _Exit 62 _kill +87 _unlink diff --git a/src/libc/stdio/Makefile b/src/libc/stdio/Makefile @@ -31,6 +31,7 @@ OBJS =\ putc.$O\ putchar.$O\ puts.$O\ + remove.$O\ rewind.$O\ setbuf.$O\ setvbuf.$O\ diff --git a/src/libc/stdio/remove.c b/src/libc/stdio/remove.c @@ -0,0 +1,11 @@ +#include <stdio.h> + +#include "../syscall.h" + +#undef remove + +int +remove(const char *filename) +{ + return _unlink(filename); +}