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 @@
/*
lstat.c
*/
#define stat _stat
#include <lib.h>
#define lstat _lstat
#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 */
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));
}

View File

@ -1,12 +1,18 @@
/*
readlink.c
*/
#include <lib.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" */
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));
}

View File

@ -1,12 +1,16 @@
/*
symlink.c
*/
#include <errno.h>
#include <lib.h>
#define symlink _symlink
#include <string.h>
#include <unistd.h>
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));
}