summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1997-09-14 16:57:27 +0000
committerphk <phk@FreeBSD.org>1997-09-14 16:57:27 +0000
commitbb6f420228a605137ef8cdfee0a709b394004873 (patch)
treeec74fbb8fdc96d74ae3b8aaadada11901746686d /lib
parentb079abc11c97decabfeb4683ebd3561674cdf55d (diff)
downloadFreeBSD-src-bb6f420228a605137ef8cdfee0a709b394004873.zip
FreeBSD-src-bb6f420228a605137ef8cdfee0a709b394004873.tar.gz
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.
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 1593311..eb48b5a 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 9928b8e..8e5ff31 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 \
OpenPOWER on IntegriCloud