Commit Graph

10 Commits

Author SHA1 Message Date
Andreas Kling
8f45a259fc ByteBuffer: Remove pointer() in favor of data()
We had two ways to get the data inside a ByteBuffer. That was silly.
2019-09-30 08:57:01 +02:00
Andreas Kling
38b75d2a97 CIODevice: read(u8*, int) overload should return 0 on EOF 2019-09-11 21:13:14 +02:00
Andreas Kling
b305a51c90 CIODevice: read_all() should return a null ByteBuffer when nothing read
We were returning a zero-length ByteBuffer in some cases. We should be
consistent about this and always return a null ByteBuffer if nothing
was read at all.
2019-09-11 19:33:51 +02:00
Andreas Kling
7127c4fdbb LibCore: CIODevice::set_error() is meant to be called with the 'errno'
The point of this function is to stash away the innermost error code
so that we don't lose it by the time we get back to the client code.
2019-08-17 11:07:15 +02:00
Andreas Kling
385e9268f4 CIODevice: printf() thought it was calling ::write() but it was write()
There's some confusion between the write syscall and CIODevice::write()
here. The internal write() returns a boolean, and has already whined
in case the syscall failed, so we don't need to do that again.
2019-08-01 10:41:04 +02:00
Andreas Kling
a292d8cd5a LibCore: Add CFileStreamReader, a simple streaming CFile reader.
This is extremely barebones right now, but can be used to easily read binary
data from a CFile piece by piece.
2019-07-27 16:38:44 +02:00
Andreas Kling
9ed7f4576b CIODevice: Try to preallocate the exact needed buffer size in read_all().
If we can get the exact file size from fstat(), it's a very good idea to use
it since it means we avoid eleventy thousand reallocations.
2019-07-27 14:24:19 +02:00
Andreas Kling
8f4fba95c0 CIODevice: Add a virtual did_update_fd() no notify subclasses of fd change.
This will allow subclasses to react when the file descriptor changes.
2019-07-27 10:47:46 +02:00
Robin Burchell
f2c0e55070 Userspace: Deal with select() returning EINTR on a signal interruption
Add a trivial CSafeSyscall template that calls a callback until it stops
returning EINTR, and use it everywhere we use select() now.

Thanks to Andreas for the suggestion of using a template parameter for
the syscall function to invoke.
2019-07-21 14:27:14 +02:00
Andreas Kling
04b9dc2d30 Libraries: Create top level directory for libraries.
Things were getting a little crowded in the project root, so this patch
moves the Lib*/ directories into Libraries/.
2019-07-04 16:16:50 +02:00