mirror of
https://github.com/genodelabs/genode.git
synced 2025-02-21 10:01:57 +00:00
parent
f9422b241f
commit
f970e4a71b
@ -818,7 +818,7 @@ int Libc::Vfs_plugin::fcntl(Libc::File_descriptor *fd, int cmd, long arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
PERR("fcntl(): command %d not supported", cmd);
|
PERR("fcntl(): command %d not supported - vfs", cmd);
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -232,12 +232,25 @@ namespace {
|
|||||||
int Plugin::fcntl(Libc::File_descriptor *pipefdo, int cmd, long arg)
|
int Plugin::fcntl(Libc::File_descriptor *pipefdo, int cmd, long arg)
|
||||||
{
|
{
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case F_GETFL:
|
case F_GETFL:
|
||||||
if (is_write_end(pipefdo))
|
if (is_write_end(pipefdo))
|
||||||
return O_WRONLY;
|
return O_WRONLY;
|
||||||
else
|
else
|
||||||
return O_RDONLY;
|
return O_RDONLY;
|
||||||
default: PERR("fcntl(): command %d not supported", cmd); return -1;
|
case F_SETFD:
|
||||||
|
{
|
||||||
|
const long supported_flags = FD_CLOEXEC;
|
||||||
|
/* if unsupported flags are used, fall through with error */
|
||||||
|
if (!(arg & ~supported_flags)) {
|
||||||
|
/* close fd if exec is called - no exec support -> ignore */
|
||||||
|
if (arg & FD_CLOEXEC)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
PERR("fcntl(): command %d arg %ld not supported - pipe",
|
||||||
|
cmd, arg);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,6 +300,7 @@ namespace {
|
|||||||
FD_ZERO(readfds);
|
FD_ZERO(readfds);
|
||||||
in_writefds = *writefds;
|
in_writefds = *writefds;
|
||||||
FD_ZERO(writefds);
|
FD_ZERO(writefds);
|
||||||
|
FD_ZERO(exceptfds);
|
||||||
|
|
||||||
for (int libc_fd = 0; libc_fd < nfds; libc_fd++) {
|
for (int libc_fd = 0; libc_fd < nfds; libc_fd++) {
|
||||||
fdo = Libc::file_descriptor_allocator()->find_by_libc_fd(libc_fd);
|
fdo = Libc::file_descriptor_allocator()->find_by_libc_fd(libc_fd);
|
||||||
|
@ -297,8 +297,21 @@ namespace {
|
|||||||
int fcntl(Libc::File_descriptor *fd, int cmd, long arg)
|
int fcntl(Libc::File_descriptor *fd, int cmd, long arg)
|
||||||
{
|
{
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case F_GETFL: return context(fd)->status_flags();
|
case F_GETFL: return context(fd)->status_flags();
|
||||||
default: PERR("fcntl(): command %d not supported", cmd); return -1;
|
case F_SETFD:
|
||||||
|
{
|
||||||
|
const long supported_flags = FD_CLOEXEC;
|
||||||
|
/* if unsupported flags are used, fall through with error */
|
||||||
|
if (!(arg & ~supported_flags)) {
|
||||||
|
/* close fd if exec is called - no exec support -> ignore */
|
||||||
|
if (arg & FD_CLOEXEC)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
PERR("fcntl(): command %d args %ld not supported - terminal",
|
||||||
|
cmd, arg);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user