Remove debugging output, emulate access syscall

This commit is contained in:
Norman Feske 2012-05-18 17:12:26 +02:00
parent 0f6b59097e
commit e436d60ce7
4 changed files with 48 additions and 12 deletions

View File

@ -211,6 +211,16 @@ extern "C" int execve(char const *filename, char *const argv[],
} }
/**
* Called by execvp
*/
extern "C" int _execve(char const *filename, char *const argv[],
char *const envp[])
{
return execve(filename, argv, envp);
}
/** /**
* Return number of marhalled file descriptors into select argument buffer * Return number of marhalled file descriptors into select argument buffer
* *
@ -376,6 +386,9 @@ extern "C" pid_t fork(void)
} }
extern "C" pid_t vfork(void) { return fork(); }
extern "C" pid_t getpid(void) extern "C" pid_t getpid(void)
{ {
noux()->syscall(Noux::Session::SYSCALL_GETPID); noux()->syscall(Noux::Session::SYSCALL_GETPID);
@ -385,13 +398,21 @@ extern "C" pid_t getpid(void)
extern "C" int access(char const *pathname, int mode) extern "C" int access(char const *pathname, int mode)
{ {
if (verbose)
PDBG("access '%s' (mode=%x) called, not implemented", pathname, mode); PDBG("access '%s' (mode=%x) called, not implemented", pathname, mode);
struct stat stat;
if (::stat(pathname, &stat) == 0)
return 0; return 0;
errno = ENOENT;
return -1;
} }
extern "C" int chmod(char const *path, mode_t mode) extern "C" int chmod(char const *path, mode_t mode)
{ {
if (verbose)
PDBG("chmod '%s' to 0x%x not implemented", path, mode); PDBG("chmod '%s' to 0x%x not implemented", path, mode);
return 0; return 0;
} }
@ -426,6 +447,7 @@ extern "C" pid_t _wait4(pid_t pid, int *status, int options,
extern "C" int clock_gettime(clockid_t clk_id, struct timespec *tp) extern "C" int clock_gettime(clockid_t clk_id, struct timespec *tp)
{ {
if (verbose)
PDBG("clock_gettime called - not implemented"); PDBG("clock_gettime called - not implemented");
errno = EINVAL; errno = EINVAL;
return -1; return -1;
@ -434,6 +456,7 @@ extern "C" int clock_gettime(clockid_t clk_id, struct timespec *tp)
extern "C" int gettimeofday(struct timeval *tv, struct timezone *tz) extern "C" int gettimeofday(struct timeval *tv, struct timezone *tz)
{ {
if (verbose)
PDBG("gettimeofdaye called - not implemented"); PDBG("gettimeofdaye called - not implemented");
errno = EINVAL; errno = EINVAL;
return -1; return -1;
@ -548,10 +571,14 @@ namespace {
Libc::File_descriptor *Plugin::open(char const *pathname, int flags) Libc::File_descriptor *Plugin::open(char const *pathname, int flags)
{ {
if (Genode::strlen(pathname) + 1 > sizeof(sysio()->open_in.path)) { if (Genode::strlen(pathname) + 1 > sizeof(sysio()->open_in.path)) {
PDBG("ENAMETOOLONG");
errno = ENAMETOOLONG; errno = ENAMETOOLONG;
return 0; return 0;
} }
if (flags & O_CREAT)
unlink(pathname);
Genode::strncpy(sysio()->open_in.path, pathname, sizeof(sysio()->open_in.path)); Genode::strncpy(sysio()->open_in.path, pathname, sizeof(sysio()->open_in.path));
sysio()->open_in.mode = flags; sysio()->open_in.mode = flags;
@ -559,6 +586,7 @@ namespace {
/* /*
* XXX we should return meaningful errno values * XXX we should return meaningful errno values
*/ */
PDBG("ENOENT (sysio()->error.open=%d)", sysio()->error.open);
errno = ENOENT; errno = ENOENT;
return 0; return 0;
} }
@ -665,6 +693,7 @@ namespace {
case TIOCGETA: case TIOCGETA:
{ {
if (verbose)
PDBG("TIOCGETA - argp=0x%p", argp); PDBG("TIOCGETA - argp=0x%p", argp);
::termios *termios = (::termios *)argp; ::termios *termios = (::termios *)argp;
@ -769,6 +798,7 @@ namespace {
int Plugin::fsync(Libc::File_descriptor *fd) int Plugin::fsync(Libc::File_descriptor *fd)
{ {
if (verbose)
PDBG("not implemented"); PDBG("not implemented");
return 0; return 0;
} }

View File

@ -333,7 +333,7 @@ namespace Noux {
bool const create = sysio->open_in.mode & Sysio::OPEN_MODE_CREATE; bool const create = sysio->open_in.mode & Sysio::OPEN_MODE_CREATE;
if (create) if (create)
PDBG("creation of file %s requested", file_name.base()); PDBG("creation of file %s requested", file_name.base() + 1);
::File_system::Dir_handle dir = _fs.dir(dir_path.base(), false); ::File_system::Dir_handle dir = _fs.dir(dir_path.base(), false);
Fs_handle_guard dir_guard(_fs, dir); Fs_handle_guard dir_guard(_fs, dir);
@ -350,7 +350,6 @@ namespace Noux {
error = Sysio::OPEN_ERR_NO_PERM; } error = Sysio::OPEN_ERR_NO_PERM; }
sysio->error.open = error; sysio->error.open = error;
return 0; return 0;
} }

View File

@ -29,6 +29,8 @@ namespace Noux {
class Tar_file_system : public File_system class Tar_file_system : public File_system
{ {
enum { verbose = false };
Lock _lock; Lock _lock;
struct Rom_name struct Rom_name
@ -336,7 +338,10 @@ namespace Noux {
case Record::TYPE_FILE: mode |= Sysio::STAT_MODE_FILE; break; case Record::TYPE_FILE: mode |= Sysio::STAT_MODE_FILE; break;
case Record::TYPE_SYMLINK: mode |= Sysio::STAT_MODE_SYMLINK; break; case Record::TYPE_SYMLINK: mode |= Sysio::STAT_MODE_SYMLINK; break;
case Record::TYPE_DIR: mode |= Sysio::STAT_MODE_DIRECTORY; break; case Record::TYPE_DIR: mode |= Sysio::STAT_MODE_DIRECTORY; break;
default: PDBG("unhandled record type %d", record->type());
default:
if (verbose)
PDBG("unhandled record type %d", record->type());
} }
sysio->stat_out.st.mode = mode; sysio->stat_out.st.mode = mode;
@ -364,7 +369,10 @@ namespace Noux {
case 0: sysio->dirent_out.entry.type = Sysio::DIRENT_TYPE_FILE; break; case 0: sysio->dirent_out.entry.type = Sysio::DIRENT_TYPE_FILE; break;
case 2: sysio->dirent_out.entry.type = Sysio::DIRENT_TYPE_SYMLINK; break; case 2: sysio->dirent_out.entry.type = Sysio::DIRENT_TYPE_SYMLINK; break;
case 5: sysio->dirent_out.entry.type = Sysio::DIRENT_TYPE_DIRECTORY; break; case 5: sysio->dirent_out.entry.type = Sysio::DIRENT_TYPE_DIRECTORY; break;
default: PDBG("unhandled record type %d", record->type());
default:
if (verbose)
PDBG("unhandled record type %d", record->type());
} }
Absolute_path absolute_path(record->name()); Absolute_path absolute_path(record->name());

View File

@ -140,7 +140,6 @@ namespace Noux {
Terminal::Session::Size size = terminal.size(); Terminal::Session::Size size = terminal.size();
sysio->ioctl_out.tiocgwinsz.rows = size.lines(); sysio->ioctl_out.tiocgwinsz.rows = size.lines();
sysio->ioctl_out.tiocgwinsz.columns = size.columns(); sysio->ioctl_out.tiocgwinsz.columns = size.columns();
PDBG("OP_TIOCGWINSZ requested");
return true; return true;
} }