Add support for symbolic links

This patch adds support for symbolic links in libc, libc plugins, file
system servers and Noux.

Fixes #322.
This commit is contained in:
Christian Prochaska
2012-10-08 14:44:31 +02:00
committed by Norman Feske
parent 4017e592f0
commit e9ac4b653b
45 changed files with 1267 additions and 562 deletions

View File

@ -14,6 +14,7 @@
#ifndef _LIBC_PLUGIN__PLUGIN_H_
#define _LIBC_PLUGIN__PLUGIN_H_
#include <os/path.h>
#include <util/list.h>
#include <netdb.h>
@ -28,6 +29,8 @@ namespace Libc {
class File_descriptor;
typedef Genode::Path<PATH_MAX> Absolute_path;
class Plugin : public List<Plugin>::Element
{
protected:
@ -41,7 +44,8 @@ namespace Libc {
virtual int priority();
virtual bool supports_chdir(const char *path);
virtual bool supports_execve(char const *filename, char *const argv[],
char *const envp[]);
virtual bool supports_mkdir(const char *path, mode_t mode);
virtual bool supports_freeaddrinfo(struct ::addrinfo *res);
virtual bool supports_getaddrinfo(const char *node, const char *service,
@ -49,6 +53,7 @@ namespace Libc {
struct ::addrinfo **res);
virtual bool supports_open(const char *pathname, int flags);
virtual bool supports_pipe();
virtual bool supports_readlink(const char *path, char *buf, size_t bufsiz);
virtual bool supports_rename(const char *oldpath, const char *newpath);
virtual bool supports_select(int nfds,
fd_set *readfds,
@ -57,6 +62,7 @@ namespace Libc {
struct timeval *timeout);
virtual bool supports_socket(int domain, int type, int protocol);
virtual bool supports_stat(const char *path);
virtual bool supports_symlink(const char *oldpath, const char *newpath);
virtual bool supports_unlink(const char *path);
virtual bool supports_mmap();
@ -66,14 +72,14 @@ namespace Libc {
virtual int bind(File_descriptor *,
const struct ::sockaddr *addr,
socklen_t addrlen);
virtual int chdir(const char *path);
virtual int close(File_descriptor *fd);
virtual int connect(File_descriptor *,
const struct ::sockaddr *addr,
socklen_t addrlen);
virtual int dup2(File_descriptor *, File_descriptor *new_fd);
virtual int execve(char const *filename, char *const argv[],
char *const envp[]);
virtual int fstatfs(File_descriptor *, struct statfs *buf);
virtual int fchdir(File_descriptor *);
virtual int fcntl(File_descriptor *, int cmd, long arg);
virtual void freeaddrinfo(struct ::addrinfo *res);
virtual int fstat(File_descriptor *, struct stat *buf);
@ -103,6 +109,7 @@ namespace Libc {
virtual File_descriptor *open(const char *pathname, int flags);
virtual int pipe(File_descriptor *pipefd[2]);
virtual ssize_t read(File_descriptor *, void *buf, ::size_t count);
virtual ssize_t readlink(const char *path, char *buf, ::size_t bufsiz);
virtual ssize_t recv(File_descriptor *, void *buf, ::size_t len, int flags);
virtual ssize_t recvfrom(File_descriptor *, void *buf, ::size_t len, int flags,
struct sockaddr *src_addr, socklen_t *addrlen);
@ -121,6 +128,7 @@ namespace Libc {
virtual int shutdown(File_descriptor *, int how);
virtual File_descriptor *socket(int domain, int type, int protocol);
virtual int stat(const char *path, struct stat *buf);
virtual int symlink(const char *oldpath, const char *newpath);
virtual int unlink(const char *path);
virtual ssize_t write(File_descriptor *, const void *buf, ::size_t count);
};