shithub: scc

Download patch

ref: 52ef32b73c4bb6a8a039a5c72d7c81b953953262
parent: a911bb38dfeb9667c1a69afa86edcedb1d47b218
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat May 16 15:16:25 EDT 2020

libc: Add remove()

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

--- a/src/libc/arch/amd64/linux/Makefile
+++ b/src/libc/arch/amd64/linux/Makefile
@@ -14,6 +14,7 @@
 	_write.$O\
 	_brk.$O\
 	_sigaction.$O\
+	_unlink.$O\
 
 GENSRC = $(GENOBJS:.$O=.s)
 
--- 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
--- a/src/libc/stdio/Makefile
+++ b/src/libc/stdio/Makefile
@@ -31,6 +31,7 @@
 	putc.$O\
 	putchar.$O\
 	puts.$O\
+	remove.$O\
 	rewind.$O\
 	setbuf.$O\
 	setvbuf.$O\
--- /dev/null
+++ b/src/libc/stdio/remove.c
@@ -1,0 +1,11 @@
+#include <stdio.h>
+
+#include "../syscall.h"
+
+#undef remove
+
+int
+remove(const char *filename)
+{
+	return _unlink(filename);
+}