libc: match ioctl request type to contrib type

There is a type mismatch as in the FreeBSD contrib code the type of the
request is 'unsigned long'. So far, only I/O controls where the request
falls into the signed range where used and this was not a problem.

Some of the SNDCTL requests, however, have the bit set.

Fixes #3887.
This commit is contained in:
Josef Söntgen
2020-09-09 16:07:45 +02:00
committed by Christian Helmuth
parent 85a84f5042
commit 2312ad35dd
7 changed files with 10 additions and 10 deletions

View File

@ -110,7 +110,7 @@ namespace Libc {
virtual int getsockopt(File_descriptor *, int level, virtual int getsockopt(File_descriptor *, int level,
int optname, void *optval, int optname, void *optval,
socklen_t *optlen); socklen_t *optlen);
virtual int ioctl(File_descriptor *, int request, char *argp); virtual int ioctl(File_descriptor *, unsigned long request, char *argp);
virtual int listen(File_descriptor *, int backlog); virtual int listen(File_descriptor *, int backlog);
virtual ::off_t lseek(File_descriptor *, ::off_t offset, int whence); virtual ::off_t lseek(File_descriptor *, ::off_t offset, int whence);
virtual int mkdir(const char *pathname, mode_t mode); virtual int mkdir(const char *pathname, mode_t mode);

View File

@ -1029,7 +1029,7 @@ _ZN4Libc6Plugin5closeEPNS_15File_descriptorE T
_ZN4Libc6Plugin5fcntlEPNS_15File_descriptorEil T _ZN4Libc6Plugin5fcntlEPNS_15File_descriptorEil T
_ZN4Libc6Plugin5fstatEPNS_15File_descriptorEP4stat T _ZN4Libc6Plugin5fstatEPNS_15File_descriptorEP4stat T
_ZN4Libc6Plugin5fsyncEPNS_15File_descriptorE T _ZN4Libc6Plugin5fsyncEPNS_15File_descriptorE T
_ZN4Libc6Plugin5ioctlEPNS_15File_descriptorEiPc T _ZN4Libc6Plugin5ioctlEPNS_15File_descriptorEmPc T
_ZN4Libc6Plugin5lseekEPNS_15File_descriptorEli T _ZN4Libc6Plugin5lseekEPNS_15File_descriptorEli T
_ZN4Libc6Plugin5lseekEPNS_15File_descriptorExi T _ZN4Libc6Plugin5lseekEPNS_15File_descriptorExi T
_ZN4Libc6Plugin5mkdirEPKct T _ZN4Libc6Plugin5mkdirEPKct T

View File

@ -375,7 +375,7 @@ __SYS_(ssize_t, getdirentries, (int libc_fd, char *buf, ::size_t nbytes, ::off_t
FD_FUNC_WRAPPER(getdirentries, libc_fd, buf, nbytes, basep); }) FD_FUNC_WRAPPER(getdirentries, libc_fd, buf, nbytes, basep); })
__SYS_(int, ioctl, (int libc_fd, int request, char *argp), { __SYS_(int, ioctl, (int libc_fd, unsigned long request, char *argp), {
FD_FUNC_WRAPPER(ioctl, libc_fd, request, argp); }) FD_FUNC_WRAPPER(ioctl, libc_fd, request, argp); })

View File

@ -91,7 +91,7 @@ class Libc::Vfs_plugin : public Plugin
*/ */
void _vfs_write_mtime(Vfs::Vfs_handle&); void _vfs_write_mtime(Vfs::Vfs_handle&);
int _legacy_ioctl(File_descriptor *, int , char *); int _legacy_ioctl(File_descriptor *, unsigned long, char *);
/** /**
* Call functor 'fn' with ioctl info for the given file descriptor 'fd' * Call functor 'fn' with ioctl info for the given file descriptor 'fd'
@ -177,7 +177,7 @@ class Libc::Vfs_plugin : public Plugin
int fsync(File_descriptor *fd) override; int fsync(File_descriptor *fd) override;
int ftruncate(File_descriptor *, ::off_t) override; int ftruncate(File_descriptor *, ::off_t) override;
ssize_t getdirentries(File_descriptor *, char *, ::size_t , ::off_t *) override; ssize_t getdirentries(File_descriptor *, char *, ::size_t , ::off_t *) override;
int ioctl(File_descriptor *, int , char *) override; int ioctl(File_descriptor *, unsigned long, char *) override;
::off_t lseek(File_descriptor *fd, ::off_t offset, int whence) override; ::off_t lseek(File_descriptor *fd, ::off_t offset, int whence) override;
int mkdir(const char *, mode_t) override; int mkdir(const char *, mode_t) override;
File_descriptor *open(const char *path, int flags) override; File_descriptor *open(const char *path, int flags) override;

View File

@ -184,7 +184,7 @@ DUMMY(ssize_t, -1, getdirentries, (File_descriptor *, char *, ::size_t, ::off_t
DUMMY(int, -1, getpeername, (File_descriptor *, struct sockaddr *, socklen_t *)); DUMMY(int, -1, getpeername, (File_descriptor *, struct sockaddr *, socklen_t *));
DUMMY(int, -1, getsockname, (File_descriptor *, struct sockaddr *, socklen_t *)); DUMMY(int, -1, getsockname, (File_descriptor *, struct sockaddr *, socklen_t *));
DUMMY(int, -1, getsockopt, (File_descriptor *, int, int, void *, socklen_t *)); DUMMY(int, -1, getsockopt, (File_descriptor *, int, int, void *, socklen_t *));
DUMMY(int, -1, ioctl, (File_descriptor *, int, char*)); DUMMY(int, -1, ioctl, (File_descriptor *, unsigned long, char*));
DUMMY(int, -1, listen, (File_descriptor *, int)); DUMMY(int, -1, listen, (File_descriptor *, int));
DUMMY(::off_t, -1, lseek, (File_descriptor *, ::off_t, int)); DUMMY(::off_t, -1, lseek, (File_descriptor *, ::off_t, int));
DUMMY(ssize_t, -1, read, (File_descriptor *, void *, ::size_t)); DUMMY(ssize_t, -1, read, (File_descriptor *, void *, ::size_t));

View File

@ -315,7 +315,7 @@ struct Libc::Socket_fs::Plugin : Libc::Plugin
int close(File_descriptor *) override; int close(File_descriptor *) override;
bool poll(File_descriptor &fd, struct pollfd &pfd) override; bool poll(File_descriptor &fd, struct pollfd &pfd) override;
int select(int, fd_set *, fd_set *, fd_set *, timeval *) override; int select(int, fd_set *, fd_set *, fd_set *, timeval *) override;
int ioctl(File_descriptor *, int, char *) override; int ioctl(File_descriptor *, unsigned long, char *) override;
}; };
@ -1275,7 +1275,7 @@ int Socket_fs::Plugin::close(File_descriptor *fd)
} }
int Socket_fs::Plugin::ioctl(File_descriptor *, int request, char*) int Socket_fs::Plugin::ioctl(File_descriptor *, unsigned long request, char*)
{ {
if (request == FIONREAD) { if (request == FIONREAD) {
/* /*

View File

@ -1061,7 +1061,7 @@ ssize_t Libc::Vfs_plugin::getdirentries(File_descriptor *fd, char *buf,
} }
int Libc::Vfs_plugin::ioctl(File_descriptor *fd, int request, char *argp) int Libc::Vfs_plugin::ioctl(File_descriptor *fd, unsigned long request, char *argp)
{ {
bool handled = false; bool handled = false;
@ -1114,7 +1114,7 @@ int Libc::Vfs_plugin::ioctl(File_descriptor *fd, int request, char *argp)
* XXX Remove this method once all ioctl operations are supported via * XXX Remove this method once all ioctl operations are supported via
* regular VFS file accesses. * regular VFS file accesses.
*/ */
int Libc::Vfs_plugin::_legacy_ioctl(File_descriptor *fd, int request, char *argp) int Libc::Vfs_plugin::_legacy_ioctl(File_descriptor *fd, unsigned long request, char *argp)
{ {
using ::off_t; using ::off_t;