noux: getdtablesize support

Fixes #1847
This commit is contained in:
Emery Hemingway 2016-01-08 14:52:11 +01:00 committed by Christian Helmuth
parent 976833f171
commit 7186c45de6
4 changed files with 27 additions and 0 deletions

View File

@ -85,6 +85,7 @@ namespace Noux {
SYSCALL_UTIMES,
SYSCALL_SYNC,
SYSCALL_KILL,
SYSCALL_GETDTABLESIZE,
SYSCALL_INVALID = -1
};
@ -134,6 +135,7 @@ namespace Noux {
NOUX_DECL_SYSCALL_NAME(UTIMES)
NOUX_DECL_SYSCALL_NAME(SYNC)
NOUX_DECL_SYSCALL_NAME(KILL)
NOUX_DECL_SYSCALL_NAME(GETDTABLESIZE)
case SYSCALL_INVALID: return 0;
}
return 0;

View File

@ -459,6 +459,8 @@ namespace Noux {
SYSIO_DECL(sync, { }, { });
SYSIO_DECL(kill, { int pid; Signal sig; }, { });
SYSIO_DECL(getdtablesize, { }, { int n; });
};
};
};

View File

@ -227,6 +227,21 @@ extern "C" struct passwd *getpwuid(uid_t uid)
}
extern "C" int getdtablesize()
{
if (!noux_syscall(Noux::Session::SYSCALL_GETDTABLESIZE)) {
PWRN("getdtablesize syscall failed");
errno = ENOSYS;
return -1;
}
int n = sysio()->getdtablesize_out.n;
if (verbose)
PDBG("%d", n);
return n;
}
extern "C" uid_t getgid()
{
sysio()->userinfo_in.request = Noux::Sysio::USERINFO_GET_GID;

View File

@ -864,6 +864,14 @@ bool Noux::Child::syscall(Noux::Session::Syscall sc)
break;
}
case SYSCALL_GETDTABLESIZE:
{
_sysio->getdtablesize_out.n =
Noux::File_descriptor_registry::MAX_FILE_DESCRIPTORS;
result = true;
break;
}
case SYSCALL_SOCKET:
case SYSCALL_GETSOCKOPT:
case SYSCALL_SETSOCKOPT: