mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-25 16:31:06 +00:00
Remove debugging output, emulate access syscall
This commit is contained in:
parent
0f6b59097e
commit
e436d60ce7
@ -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,13 +398,21 @@ extern "C" pid_t getpid(void)
|
||||
|
||||
extern "C" int access(char const *pathname, int mode)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("chmod '%s' to 0x%x not implemented", path, mode);
|
||||
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)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("clock_gettime called - not implemented");
|
||||
errno = EINVAL;
|
||||
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)
|
||||
{
|
||||
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,6 +693,7 @@ namespace {
|
||||
|
||||
case TIOCGETA:
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("TIOCGETA - argp=0x%p", argp);
|
||||
::termios *termios = (::termios *)argp;
|
||||
|
||||
@ -769,6 +798,7 @@ namespace {
|
||||
|
||||
int Plugin::fsync(Libc::File_descriptor *fd)
|
||||
{
|
||||
if (verbose)
|
||||
PDBG("not implemented");
|
||||
return 0;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user