Giovanni's symlinks patches (libs)

This commit is contained in:
Ben Gras 2005-10-31 14:28:19 +00:00
parent 4c648c343e
commit 3acb6bf1fe
3 changed files with 38 additions and 25 deletions

View File

@ -1,13 +1,16 @@
/* #include <lib.h>
lstat.c #define lstat _lstat
*/
#define stat _stat
#include <sys/stat.h> #include <sys/stat.h>
#include <string.h>
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 */ message m;
return stat(path, sb);
m.m1_i1 = strlen(name) + 1;
m.m1_p1 = (char *) name;
m.m1_p2 = (char *) buffer;
return(_syscall(FS, LSTAT, &m));
} }

View File

@ -1,12 +1,18 @@
/* #include <lib.h>
readlink.c
*/
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <string.h>
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" */ message m;
return -1;
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));
} }

View File

@ -1,12 +1,16 @@
/* #include <lib.h>
symlink.c #define symlink _symlink
*/ #include <string.h>
#include <errno.h>
#include <unistd.h> #include <unistd.h>
int symlink(const char *path1, const char *path2) PUBLIC int symlink(name, name2)
_CONST char *name, *name2;
{ {
errno= ENOSYS; message m;
return -1;
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));
} }