浏览代码

Added support for remove() and unlink().

dtrg 13 年之前
父节点
当前提交
4b494f90e2
共有 4 个文件被更改,包括 34 次插入0 次删除
  1. 2 0
      plat/linux386/include/unistd.h
  2. 2 0
      plat/linux386/libsys/pmfile
  3. 15 0
      plat/linux386/libsys/remove.c
  4. 15 0
      plat/linux386/libsys/unlink.c

+ 2 - 0
plat/linux386/include/unistd.h

@@ -55,6 +55,8 @@ extern int read(int fd, void* buffer, size_t count);
 extern int write(int fd, void* buffer, size_t count);
 extern off_t lseek(int fildes, off_t offset, int whence);
 extern int fcntl(int fd, int op, ...);
+extern int unlink(const char* path);
+extern int remove(const char* path);
 
 /* Special variables */
 

+ 2 - 0
plat/linux386/libsys/pmfile

@@ -26,6 +26,8 @@ libsys_linux386 = acklibrary {
 	ackfile (d.."sbrk.c"),
 	ackfile (d.."signal.c"),
 	ackfile (d.."write.c"),
+	ackfile (d.."unlink.c"),
+	ackfile (d.."remove.c"),
 	
 	install = pm.install("%BINDIR%lib/%PLATFORM%/libsys.a"),
 }

+ 15 - 0
plat/linux386/libsys/remove.c

@@ -0,0 +1,15 @@
+/* $Source$
+ * $State$
+ * $Revision$
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include "libsys.h"
+
+int remove(const char* path)
+{
+	return unlink(path);
+}

+ 15 - 0
plat/linux386/libsys/unlink.c

@@ -0,0 +1,15 @@
+/* $Source$
+ * $State$
+ * $Revision$
+ */
+
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdarg.h>
+#include "libsys.h"
+
+int unlink(const char* path)
+{
+	return _syscall(__NR_unlink, (quad) path, 0, 0);
+}