mirror of
https://github.com/genodelabs/genode.git
synced 2025-06-22 08:50:09 +00:00
committed by
Christian Helmuth
parent
d9d32847b1
commit
23e15cb2ab
@ -67,7 +67,7 @@ class Open_file
|
|||||||
|
|
||||||
Open_file(const char *filename) : _fd(-1)
|
Open_file(const char *filename) : _fd(-1)
|
||||||
{
|
{
|
||||||
_fd = ::open(filename, O_CREAT|O_RDWR);
|
Libc::with_libc([&] () { _fd = ::open(filename, O_CREAT|O_RDWR); });
|
||||||
if (_fd == -1)
|
if (_fd == -1)
|
||||||
::perror("open");
|
::perror("open");
|
||||||
}
|
}
|
||||||
@ -188,10 +188,13 @@ namespace Terminal {
|
|||||||
/* sanitize argument */
|
/* sanitize argument */
|
||||||
num_bytes = Genode::min(num_bytes, _io_buffer.size());
|
num_bytes = Genode::min(num_bytes, _io_buffer.size());
|
||||||
|
|
||||||
/* write data to descriptor */
|
ssize_t written_bytes = 0;
|
||||||
ssize_t written_bytes = ::write(fd(),
|
Libc::with_libc([&] () {
|
||||||
_io_buffer.local_addr<char>(),
|
/* write data to descriptor */
|
||||||
num_bytes);
|
written_bytes = ::write(fd(),
|
||||||
|
_io_buffer.local_addr<char>(),
|
||||||
|
num_bytes);
|
||||||
|
});
|
||||||
|
|
||||||
if (written_bytes < 0) {
|
if (written_bytes < 0) {
|
||||||
Genode::error("write error, dropping data");
|
Genode::error("write error, dropping data");
|
||||||
@ -297,4 +300,7 @@ struct Main
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void Libc::Component::construct(Libc::Env &env) { static Main main(env); }
|
void Libc::Component::construct(Libc::Env &env)
|
||||||
|
{
|
||||||
|
Libc::with_libc([&] () { static Main main(env); });
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user