aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1997-09-14 16:57:27 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1997-09-14 16:57:27 +0000
commit27262cac335c433fac7556ebe204dcb725f0afe4 (patch)
treec12402b85fe569832338ad06adf5d1148b39e9ea /lib
parent7822f1c624c42acafde15b5359d3cd8f80ee99fe (diff)
downloadsrc-27262cac335c433fac7556ebe204dcb725f0afe4.tar.gz
src-27262cac335c433fac7556ebe204dcb725f0afe4.zip
Add __getcwd() syscall, and have getcwd() take a shot at it.
If your kernel doesn't support __getcwd() or if __getcwd() cannot deliver because of cache expiry, it does the canonical thing.
Notes
Notes: svn path=/head/; revision=29392
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/getcwd.c11
-rw-r--r--lib/libc/sys/Makefile.inc4
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c
index 1593311d4c8a..eb48b5a52b9b 100644
--- a/lib/libc/gen/getcwd.c
+++ b/lib/libc/gen/getcwd.c
@@ -89,6 +89,17 @@ getcwd(pt, size)
return (NULL);
ept = pt + ptsize;
}
+ if (!__getcwd(pt,ptsize)) {
+ char c;
+ bpt = pt;
+ ept = pt + strlen(pt) - 1;
+ while (bpt < ept) {
+ c = *bpt;
+ *bpt++ = *ept;
+ *ept-- = c;
+ }
+ return (pt);
+ }
bpt = ept - 1;
*bpt = '\0';
diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc
index 9928b8ec985d..8e5ff31e3ef2 100644
--- a/lib/libc/sys/Makefile.inc
+++ b/lib/libc/sys/Makefile.inc
@@ -1,5 +1,5 @@
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
-# $Id: Makefile.inc,v 1.38 1997/09/14 03:29:55 peter Exp $
+# $Id: Makefile.inc,v 1.39 1997/09/14 05:44:33 peter Exp $
# sys sources
.PATH: ${.CURDIR}/../libc/${MACHINE}/sys ${.CURDIR}/../libc/sys
@@ -23,7 +23,7 @@ ASM= access.o acct.o adjtime.o chdir.o chflags.o chmod.o \
getuid.o issetugid.o kill.o ktrace.o lchown.o \
lfs_bmapv.o lfs_markv.o \
lfs_segclean.o lfs_segwait.o link.o lstat.o \
- madvise.o mincore.o minherit.o mkdir.o mlock.o \
+ madvise.o __getcwd.o mincore.o minherit.o mkdir.o mlock.o \
mount.o \
mprotect.o msgsys.o msync.o munlock.o munmap.o \
ntp_adjtime.o pathconf.o profil.o quotactl.o \