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
*
@ -376,6 +386,9 @@ extern "C" pid_t fork(void)
}
extern "C" pid_t vfork(void) { return fork(); }
extern "C" pid_t getpid(void)
{
noux()->syscall(Noux::Session::SYSCALL_GETPID);
@ -385,14 +398,22 @@ extern "C" pid_t getpid(void)
extern "C" int access(char const *pathname, int mode)
{
PDBG("access '%s' (mode=%x) called, not implemented", pathname, mode);
return 0;
if (verbose)
PDBG("access '%s' (mode=%x) called, not implemented", pathname, mode);
struct stat stat;
if (::stat(pathname, &stat) == 0)
return 0;
errno = ENOENT;
return -1;
}
extern "C" int chmod(char const *path, mode_t mode)
{
PDBG("chmod '%s' to 0x%x not implemented", path, mode);
if (verbose)
PDBG("chmod '%s' to 0x%x not implemented", path, mode);
return 0;
}
@ -426,7 +447,8 @@ extern "C" pid_t _wait4(pid_t pid, int *status, int options,
extern "C" int clock_gettime(clockid_t clk_id, struct timespec *tp)
{
PDBG("clock_gettime called - not implemented");
if (verbose)
PDBG("clock_gettime called - not implemented");
errno = EINVAL;
return -1;
}
@ -434,7 +456,8 @@ extern "C" int clock_gettime(clockid_t clk_id, struct timespec *tp)
extern "C" int gettimeofday(struct timeval *tv, struct timezone *tz)
{
PDBG("gettimeofdaye called - not implemented");
if (verbose)
PDBG("gettimeofdaye called - not implemented");
errno = EINVAL;
return -1;
}
@ -548,10 +571,14 @@ namespace {
Libc::File_descriptor *Plugin::open(char const *pathname, int flags)
{
if (Genode::strlen(pathname) + 1 > sizeof(sysio()->open_in.path)) {
PDBG("ENAMETOOLONG");
errno = ENAMETOOLONG;
return 0;
}
if (flags & O_CREAT)
unlink(pathname);
Genode::strncpy(sysio()->open_in.path, pathname, sizeof(sysio()->open_in.path));
sysio()->open_in.mode = flags;
@ -559,6 +586,7 @@ namespace {
/*
* XXX we should return meaningful errno values
*/
PDBG("ENOENT (sysio()->error.open=%d)", sysio()->error.open);
errno = ENOENT;
return 0;
}
@ -665,7 +693,8 @@ namespace {
case TIOCGETA:
{
PDBG("TIOCGETA - argp=0x%p", argp);
if (verbose)
PDBG("TIOCGETA - argp=0x%p", argp);
::termios *termios = (::termios *)argp;
/*
@ -769,7 +798,8 @@ namespace {
int Plugin::fsync(Libc::File_descriptor *fd)
{
PDBG("not implemented");
if (verbose)
PDBG("not implemented");
return 0;
}

View File

@ -333,7 +333,7 @@ namespace Noux {
bool const create = sysio->open_in.mode & Sysio::OPEN_MODE_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);
Fs_handle_guard dir_guard(_fs, dir);
@ -350,7 +350,6 @@ namespace Noux {
error = Sysio::OPEN_ERR_NO_PERM; }
sysio->error.open = error;
return 0;
}

View File

@ -29,6 +29,8 @@ namespace Noux {
class Tar_file_system : public File_system
{
enum { verbose = false };
Lock _lock;
struct Rom_name
@ -336,7 +338,10 @@ namespace Noux {
case Record::TYPE_FILE: mode |= Sysio::STAT_MODE_FILE; break;
case Record::TYPE_SYMLINK: mode |= Sysio::STAT_MODE_SYMLINK; 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;
@ -364,7 +369,10 @@ namespace Noux {
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 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());

View File

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