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.
This commit is contained in:
phk 1997-09-14 16:57:27 +00:00
parent b079abc11c
commit bb6f420228
2 changed files with 13 additions and 2 deletions

View File

@ -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';

View File

@ -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 \