mescc: getcwd: Move to libc.
authorJan Nieuwenhuizen <janneke@gnu.org>
Sun, 11 Nov 2018 09:12:19 +0000 (10:12 +0100)
committerJan Nieuwenhuizen <janneke@gnu.org>
Sun, 11 Nov 2018 09:12:19 +0000 (10:12 +0100)
* lib/linux/libc.c (getcwd): New function.
* lib/linux/tcc.c (getcwd): Remove.

lib/linux/libc.c
lib/linux/tcc.c

index 011d20d677d168f6344e6ecd039892628ec4e96b..28114e53cb0e231f4866cb6d5283b418b5dd4a94 100644 (file)
@@ -150,6 +150,15 @@ fsync (int filedes)
   return _sys_call1 (SYS_fsync, (int)filedes);
 }
 
+char *
+getcwd (char *buffer, size_t size)
+{
+  int r = _sys_call2 (SYS_getcwd, (long)buffer, (long)size);
+  if (r >= 0)
+    return buffer;
+  return 0;
+}
+
 #include "linux/clock_gettime.c"
 #include "linux/gettimeofday.c"
 #include "linux/time.c"
index 57bdde58f91ec5847ad0ef91f3bad583824ebe81..dcc182a19c50b799b2c3b69a1d234d431d23590c 100644 (file)
@@ -54,9 +54,3 @@ stat (char const *file_name, struct stat *statbuf)
 {
   return _sys_call2 (SYS_stat, (long)file_name, (long)statbuf);
 }
-
-char *
-getcwd (char *buffer, size_t size)
-{
-  return _sys_call2 (SYS_getcwd, (long)buffer, (long)size);
-}