* stage0/x86.M1 (SYS_close): New define.
* mlibc/include/unistd.h (close): Declare.
* mlibc/libc-mes+tcc.c: New file.
* make.scm: Build and install it.
(add-target (group "check-scaffold-tests" #:dependencies (filter (target-prefix? "check-scaffold/tests") %targets)))
+(add-target (cpp.mescc "mlibc/libc-mes+tcc.c"))
+(add-target (compile.mescc "mlibc/libc-mes+tcc.c"))
(define* (add-tcc-test name)
(add-target (bin.gcc (string-append "scaffold/tinycc/" name ".c") #:libc #f #:includes '("scaffold/tinycc")))
(add-target (install "mlibc/libc-mes.E" #:dir "lib"))
(add-target (install "mlibc/libc-mes.M1" #:dir "lib"))
+(add-target (install "mlibc/libc-mes+tcc.E" #:dir "lib"))
+(add-target (install "mlibc/libc-mes+tcc.M1" #:dir "lib"))
(add-target (install "mlibc/mini-libc-mes.E" #:dir "lib"))
(add-target (install "mlibc/mini-libc-mes.M1" #:dir "lib"))
#endif
int access (char const *s, int mode);
+int close (int fd);
int read (int fd, void* buf, size_t n);
int write (int fd, char const* s, int n);
#endif // ! (__GNUC__ && POSIX)
--- /dev/null
+/* -*-comment-start: "//";comment-end:""-*-
+ * Mes --- Maxwell Equations of Software
+ * Copyright © 2017 Jan Nieuwenhuizen <janneke@gnu.org>
+ *
+ * This file is part of Mes.
+ *
+ * Mes is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * Mes is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mes. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <libc-mes.c>
+
+void
+close ()
+{
+ asm ("mov____0x8(%ebp),%ebx !8");
+
+ asm ("mov____$i32,%eax SYS_close");
+ asm ("int____$0x80");
+}
DEFINE SYS_read 03000000
DEFINE SYS_write 04000000
DEFINE SYS_open 05000000
+DEFINE SYS_close 06000000
DEFINE SYS_access 21000000
DEFINE SYS_brk 2d000000
DEFINE SYS_fsync 76000000