From: Ben Gras Date: Mon, 31 Oct 2005 14:28:19 +0000 (+0000) Subject: Giovanni's symlinks patches (libs) X-Git-Tag: v3.1.2a~537 X-Git-Url: http://zhaoyanbai.com/repos/%22https:/www.google.com/jsapi/static/mdoc.3.html?a=commitdiff_plain;h=3acb6bf1fef771b69716f0832092799656c5739b;p=minix.git Giovanni's symlinks patches (libs) --- diff --git a/lib/posix/lstat.c b/lib/posix/lstat.c index b96fa6fff..bdde67c52 100644 --- a/lib/posix/lstat.c +++ b/lib/posix/lstat.c @@ -1,13 +1,16 @@ -/* -lstat.c -*/ - -#define stat _stat - +#include +#define lstat _lstat #include +#include -int lstat(const char *path, struct stat *sb) +PUBLIC int lstat(name, buffer) +_CONST char *name; +struct stat *buffer; { - /* Without symlinks, lstat is equal to stat */ - return stat(path, sb); + message m; + + m.m1_i1 = strlen(name) + 1; + m.m1_p1 = (char *) name; + m.m1_p2 = (char *) buffer; + return(_syscall(FS, LSTAT, &m)); } diff --git a/lib/posix/readlink.c b/lib/posix/readlink.c index be8350d0c..3243c93bb 100644 --- a/lib/posix/readlink.c +++ b/lib/posix/readlink.c @@ -1,12 +1,18 @@ -/* -readlink.c -*/ - +#include #include -#include +#include -int readlink(const char *path, char *buf, int bufsiz) +PUBLIC int readlink(name, buffer, bufsiz) +_CONST char *name; +char *buffer; +size_t bufsiz; { - errno = EINVAL; /* "The named file is not a symbolic link" */ - return -1; + message m; + + m.m1_i1 = strlen(name) + 1; + m.m1_i2 = bufsiz; + m.m1_p1 = (char *) name; + m.m1_p2 = (char *) buffer; + + return(_syscall(FS, RDLNK, &m)); } diff --git a/lib/posix/symlink.c b/lib/posix/symlink.c index 3e918fe08..9398ca918 100644 --- a/lib/posix/symlink.c +++ b/lib/posix/symlink.c @@ -1,12 +1,16 @@ -/* -symlink.c -*/ - -#include +#include +#define symlink _symlink +#include #include -int symlink(const char *path1, const char *path2) +PUBLIC int symlink(name, name2) +_CONST char *name, *name2; { - errno= ENOSYS; - return -1; + message m; + + m.m1_i1 = strlen(name) + 1; + m.m1_i2 = strlen(name2) + 1; + m.m1_p1 = (char *) name; + m.m1_p2 = (char *) name2; + return(_syscall(FS, SYMLINK, &m)); }