From e5948ee29a76172326d8d4cb551b2c42d6e75f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 28 Jun 2004 12:27:39 +0000 Subject: [PATCH] Resurrected posix_stdio.o: it now contains additional stdio functions not covered by glibc's libio/stdio. Added rename() and remove(). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8216 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kernel/libroot/posix/stdio/Jamfile | 11 +++++++---- src/kernel/libroot/posix/stdio/remove.c | 23 +++++++++++++++++++++++ src/kernel/libroot/posix/stdio/rename.c | 23 +++++++++++++++++++++++ 3 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 src/kernel/libroot/posix/stdio/remove.c create mode 100644 src/kernel/libroot/posix/stdio/rename.c diff --git a/src/kernel/libroot/posix/stdio/Jamfile b/src/kernel/libroot/posix/stdio/Jamfile index e8784baf94..a6237dcce8 100644 --- a/src/kernel/libroot/posix/stdio/Jamfile +++ b/src/kernel/libroot/posix/stdio/Jamfile @@ -1,6 +1,9 @@ SubDir OBOS_TOP src kernel libroot posix stdio ; -# KernelMergeObject posix_stdio.o : +KernelMergeObject posix_stdio.o : + <$(SOURCE_GRIST)>remove.c + <$(SOURCE_GRIST)>rename.c +# The other files are superseded by the glibc libio/stdio stuff # <$(SOURCE_GRIST)>fclose.c # <$(SOURCE_GRIST)>feof.c # <$(SOURCE_GRIST)>fflush.c @@ -45,9 +48,9 @@ SubDir OBOS_TOP src kernel libroot posix stdio ; # <$(SOURCE_GRIST)>vsprintf.c # <$(SOURCE_GRIST)>wbuf.c # <$(SOURCE_GRIST)>wsetup.c -# : -# -fPIC -DPIC -# ; + : + -fPIC -DPIC + ; KernelMergeObject kernel_posix_stdio.o : <$(SOURCE_GRIST)>kernel_vsprintf.c diff --git a/src/kernel/libroot/posix/stdio/remove.c b/src/kernel/libroot/posix/stdio/remove.c new file mode 100644 index 0000000000..55805db807 --- /dev/null +++ b/src/kernel/libroot/posix/stdio/remove.c @@ -0,0 +1,23 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + + +#include +#include +#include + + +int +remove(const char *path) +{ + int status = _kern_unlink(path); + if (status < B_OK) { + errno = status; + return -1; + } + + return status; +} + diff --git a/src/kernel/libroot/posix/stdio/rename.c b/src/kernel/libroot/posix/stdio/rename.c new file mode 100644 index 0000000000..df6b7080d6 --- /dev/null +++ b/src/kernel/libroot/posix/stdio/rename.c @@ -0,0 +1,23 @@ +/* +** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. +** Distributed under the terms of the Haiku License. +*/ + + +#include +#include +#include + + +int +rename(const char *from, const char *to) +{ + int status = _kern_rename(from, to); + if (status < B_OK) { + errno = status; + return -1; + } + + return status; +} +