mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 09:02:43 +00:00 
			
		
		
		
	Make it possible to build the Kernel on a macOS host.
It still requires an ELF compiler and linker, but at least it builds. I need to get rid of the "Unix" namespace. This does a lot of that.
This commit is contained in:
		
							parent
							
								
									44036f32bc
								
							
						
					
					
						commit
						85b886c2e0
					
				
					 31 changed files with 88 additions and 94 deletions
				
			
		|  | @ -49,11 +49,11 @@ public: | ||||||
|             m_buffer[m_offset++] = ch; |             m_buffer[m_offset++] = ch; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Unix::size_t offset() const { return m_offset; } |     size_t offset() const { return m_offset; } | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     ByteBuffer& m_buffer; |     ByteBuffer& m_buffer; | ||||||
|     Unix::size_t m_offset { 0 }; |     size_t m_offset { 0 }; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -11,18 +11,23 @@ typedef signed short signed_word; | ||||||
| typedef signed int signed_dword; | typedef signed int signed_dword; | ||||||
| typedef signed long long int signed_qword; | typedef signed long long int signed_qword; | ||||||
| 
 | 
 | ||||||
| typedef dword size_t; | typedef unsigned long size_t; | ||||||
| typedef signed_dword ssize_t; | typedef long ssize_t; | ||||||
|  | 
 | ||||||
|  | static_assert(sizeof(size_t) == sizeof(dword)); | ||||||
|  | static_assert(sizeof(ssize_t) == sizeof(signed_dword)); | ||||||
| 
 | 
 | ||||||
| typedef signed_dword ptrdiff_t; | typedef signed_dword ptrdiff_t; | ||||||
| 
 | 
 | ||||||
| typedef byte uint8_t; | typedef byte uint8_t; | ||||||
| typedef word uint16_t; | typedef word uint16_t; | ||||||
| typedef dword uint32_t; | typedef dword uint32_t; | ||||||
|  | typedef qword uint64_t; | ||||||
| 
 | 
 | ||||||
| typedef signed_byte int8_t; | typedef signed_byte int8_t; | ||||||
| typedef signed_word int16_t; | typedef signed_word int16_t; | ||||||
| typedef signed_dword int32_t; | typedef signed_dword int32_t; | ||||||
|  | typedef signed_qword int64_t; | ||||||
| 
 | 
 | ||||||
| #else | #else | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
|  |  | ||||||
|  | @ -16,8 +16,8 @@ public: | ||||||
|     void open(Direction); |     void open(Direction); | ||||||
|     void close(Direction); |     void close(Direction); | ||||||
| 
 | 
 | ||||||
|     Unix::ssize_t write(const byte*, Unix::size_t); |     ssize_t write(const byte*, size_t); | ||||||
|     Unix::ssize_t read(byte*, Unix::size_t); |     ssize_t read(byte*, size_t); | ||||||
| 
 | 
 | ||||||
|     bool can_read() const; |     bool can_read() const; | ||||||
|     bool can_write() const; |     bool can_write() const; | ||||||
|  |  | ||||||
|  | @ -141,7 +141,7 @@ public: | ||||||
|     void* sys$mmap(const Syscall::SC_mmap_params*); |     void* sys$mmap(const Syscall::SC_mmap_params*); | ||||||
|     int sys$munmap(void*, size_t size); |     int sys$munmap(void*, size_t size); | ||||||
|     int sys$set_mmap_name(void*, size_t, const char*); |     int sys$set_mmap_name(void*, size_t, const char*); | ||||||
|     int sys$get_dir_entries(int fd, void*, size_t); |     ssize_t sys$get_dir_entries(int fd, void*, size_t); | ||||||
|     int sys$getcwd(char*, size_t); |     int sys$getcwd(char*, size_t); | ||||||
|     int sys$chdir(const char*); |     int sys$chdir(const char*); | ||||||
|     int sys$sleep(unsigned seconds); |     int sys$sleep(unsigned seconds); | ||||||
|  |  | ||||||
|  | @ -7,7 +7,7 @@ extern "C" { | ||||||
| void memcpy(void*, const void*, dword); | void memcpy(void*, const void*, dword); | ||||||
| void strcpy(char*, const char*); | void strcpy(char*, const char*); | ||||||
| int strcmp(char const*, const char*); | int strcmp(char const*, const char*); | ||||||
| dword strlen(const char*); | size_t strlen(const char*); | ||||||
| void *memset(void*, byte, dword); | void *memset(void*, byte, dword); | ||||||
| char *strdup(const char*); | char *strdup(const char*); | ||||||
| int memcmp(const void*, const void*, size_t); | int memcmp(const void*, const void*, size_t); | ||||||
|  |  | ||||||
|  | @ -14,13 +14,13 @@ void DoubleBuffer::flip() | ||||||
|     m_read_buffer_index = 0; |     m_read_buffer_index = 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t DoubleBuffer::write(const byte* data, size_t size) | ssize_t DoubleBuffer::write(const byte* data, size_t size) | ||||||
| { | { | ||||||
|     m_write_buffer->append(data, size); |     m_write_buffer->append(data, size); | ||||||
|     return size; |     return size; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t DoubleBuffer::read(byte* data, size_t size) | ssize_t DoubleBuffer::read(byte* data, size_t size) | ||||||
| { | { | ||||||
|     if (m_read_buffer_index >= m_read_buffer->size() && !m_write_buffer->isEmpty()) |     if (m_read_buffer_index >= m_read_buffer->size() && !m_write_buffer->isEmpty()) | ||||||
|         flip(); |         flip(); | ||||||
|  |  | ||||||
|  | @ -13,8 +13,8 @@ public: | ||||||
|     { |     { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Unix::ssize_t write(const byte*, size_t); |     ssize_t write(const byte*, size_t); | ||||||
|     Unix::ssize_t read(byte*, size_t); |     ssize_t read(byte*, size_t); | ||||||
| 
 | 
 | ||||||
|     bool is_empty() const { return m_read_buffer_index >= m_read_buffer->size() && m_write_buffer->isEmpty(); } |     bool is_empty() const { return m_read_buffer_index >= m_read_buffer->size() && m_write_buffer->isEmpty(); } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										12
									
								
								Kernel/elf.h
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								Kernel/elf.h
									
										
									
									
									
								
							|  | @ -17,16 +17,11 @@ | ||||||
|    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||||||
|    02111-1307 USA.  */ |    02111-1307 USA.  */ | ||||||
| 
 | 
 | ||||||
| #ifndef _ELF_H | #pragma once | ||||||
| #define	_ELF_H 1 |  | ||||||
| 
 |  | ||||||
| #include <features.h> |  | ||||||
| 
 |  | ||||||
| __BEGIN_DECLS |  | ||||||
| 
 | 
 | ||||||
| /* Standard ELF types.  */ | /* Standard ELF types.  */ | ||||||
| 
 | 
 | ||||||
| #include <stdint.h> | #include <AK/Types.h> | ||||||
| 
 | 
 | ||||||
| /* Type for a 16-bit quantity.  */ | /* Type for a 16-bit quantity.  */ | ||||||
| typedef uint16_t Elf32_Half; | typedef uint16_t Elf32_Half; | ||||||
|  | @ -2640,6 +2635,3 @@ typedef Elf32_Addr Elf32_Conflict; | ||||||
| #define R_M32R_NUM		256	/* Keep this the last entry. */ | #define R_M32R_NUM		256	/* Keep this the last entry. */ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| __END_DECLS |  | ||||||
| 
 |  | ||||||
| #endif	/* elf.h */ |  | ||||||
|  |  | ||||||
|  | @ -29,8 +29,8 @@ typedef struct | ||||||
| 
 | 
 | ||||||
| static byte alloc_map[POOL_SIZE / CHUNK_SIZE / 8]; | static byte alloc_map[POOL_SIZE / CHUNK_SIZE / 8]; | ||||||
| 
 | 
 | ||||||
| volatile dword sum_alloc = 0; | volatile size_t sum_alloc = 0; | ||||||
| volatile dword sum_free = POOL_SIZE; | volatile size_t sum_free = POOL_SIZE; | ||||||
| volatile size_t kmalloc_sum_eternal = 0; | volatile size_t kmalloc_sum_eternal = 0; | ||||||
| volatile size_t kmalloc_sum_page_aligned = 0; | volatile size_t kmalloc_sum_page_aligned = 0; | ||||||
| 
 | 
 | ||||||
|  | @ -193,12 +193,12 @@ void kfree(void *ptr) | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void* operator new(unsigned int size) | void* operator new(size_t size) | ||||||
| { | { | ||||||
|     return kmalloc(size); |     return kmalloc(size); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void* operator new[](unsigned int size) | void* operator new[](size_t size) | ||||||
| { | { | ||||||
|     return kmalloc(size); |     return kmalloc(size); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -8,10 +8,10 @@ void kfree(void*); | ||||||
| 
 | 
 | ||||||
| bool is_kmalloc_address(void*); | bool is_kmalloc_address(void*); | ||||||
| 
 | 
 | ||||||
| extern volatile dword sum_alloc; | extern volatile size_t sum_alloc; | ||||||
| extern volatile dword sum_free; | extern volatile size_t sum_free; | ||||||
| extern volatile dword kmalloc_sum_eternal; | extern volatile size_t kmalloc_sum_eternal; | ||||||
| extern volatile dword kmalloc_sum_page_aligned; | extern volatile size_t kmalloc_sum_page_aligned; | ||||||
| 
 | 
 | ||||||
| inline void* operator new(size_t, void* p) { return p; } | inline void* operator new(size_t, void* p) { return p; } | ||||||
| inline void* operator new[](size_t, void* p) { return p; } | inline void* operator new[](size_t, void* p) { return p; } | ||||||
|  |  | ||||||
|  | @ -17,7 +17,6 @@ typedef dword gid_t; | ||||||
| typedef int pid_t; | typedef int pid_t; | ||||||
| typedef dword time_t; | typedef dword time_t; | ||||||
| typedef dword suseconds_t; | typedef dword suseconds_t; | ||||||
| typedef dword size_t; |  | ||||||
| 
 | 
 | ||||||
| struct timeval { | struct timeval { | ||||||
|     time_t tv_sec; |     time_t tv_sec; | ||||||
|  |  | ||||||
|  | @ -14,8 +14,8 @@ public: | ||||||
| 
 | 
 | ||||||
|     virtual bool hasDataAvailableForRead() const = 0; |     virtual bool hasDataAvailableForRead() const = 0; | ||||||
| 
 | 
 | ||||||
|     virtual Unix::ssize_t read(byte* buffer, Unix::size_t bufferSize) = 0; |     virtual ssize_t read(byte* buffer, size_t bufferSize) = 0; | ||||||
|     virtual Unix::ssize_t write(const byte* buffer, Unix::size_t bufferSize) = 0; |     virtual ssize_t write(const byte* buffer, size_t bufferSize) = 0; | ||||||
| 
 | 
 | ||||||
|     unsigned major() const { return m_major; } |     unsigned major() const { return m_major; } | ||||||
|     unsigned minor() const { return m_minor; } |     unsigned minor() const { return m_minor; } | ||||||
|  |  | ||||||
|  | @ -12,7 +12,7 @@ public: | ||||||
|     DiskDevice& device() { return *m_device; } |     DiskDevice& device() { return *m_device; } | ||||||
|     const DiskDevice& device() const { return *m_device; } |     const DiskDevice& device() const { return *m_device; } | ||||||
| 
 | 
 | ||||||
|     unsigned blockSize() const { return m_blockSize; } |     size_t blockSize() const { return m_blockSize; } | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     explicit DiskBackedFS(RetainPtr<DiskDevice>&&); |     explicit DiskBackedFS(RetainPtr<DiskDevice>&&); | ||||||
|  | @ -27,7 +27,7 @@ protected: | ||||||
|     bool writeBlocks(unsigned index, unsigned count, const ByteBuffer&); |     bool writeBlocks(unsigned index, unsigned count, const ByteBuffer&); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     unsigned m_blockSize { 0 }; |     size_t m_blockSize { 0 }; | ||||||
|     RetainPtr<DiskDevice> m_device; |     RetainPtr<DiskDevice> m_device; | ||||||
| 
 | 
 | ||||||
|     mutable SpinLock m_blockCacheLock; |     mutable SpinLock m_blockCacheLock; | ||||||
|  |  | ||||||
|  | @ -325,7 +325,7 @@ RetainPtr<CoreInode> Ext2FS::get_inode(InodeIdentifier inode) const | ||||||
|     return new_inode; |     return new_inode; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t Ext2FSInode::read_bytes(Unix::off_t offset, Unix::size_t count, byte* buffer, FileDescriptor*) | ssize_t Ext2FSInode::read_bytes(Unix::off_t offset, size_t count, byte* buffer, FileDescriptor*) | ||||||
| { | { | ||||||
|     ASSERT(offset >= 0); |     ASSERT(offset >= 0); | ||||||
|     if (m_raw_inode.i_size == 0) |     if (m_raw_inode.i_size == 0) | ||||||
|  | @ -335,7 +335,7 @@ Unix::ssize_t Ext2FSInode::read_bytes(Unix::off_t offset, Unix::size_t count, by | ||||||
|     // This avoids wasting an entire block on short links. (Most links are short.)
 |     // This avoids wasting an entire block on short links. (Most links are short.)
 | ||||||
|     static const unsigned max_inline_symlink_length = 60; |     static const unsigned max_inline_symlink_length = 60; | ||||||
|     if (is_symlink() && size() < max_inline_symlink_length) { |     if (is_symlink() && size() < max_inline_symlink_length) { | ||||||
|         Unix::ssize_t nread = min((Unix::off_t)size() - offset, static_cast<Unix::off_t>(count)); |         ssize_t nread = min((Unix::off_t)size() - offset, static_cast<Unix::off_t>(count)); | ||||||
|         memcpy(buffer, m_raw_inode.i_block + offset, nread); |         memcpy(buffer, m_raw_inode.i_block + offset, nread); | ||||||
|         return nread; |         return nread; | ||||||
|     } |     } | ||||||
|  | @ -361,8 +361,8 @@ Unix::ssize_t Ext2FSInode::read_bytes(Unix::off_t offset, Unix::size_t count, by | ||||||
| 
 | 
 | ||||||
|     dword offset_into_first_block = offset % block_size; |     dword offset_into_first_block = offset % block_size; | ||||||
| 
 | 
 | ||||||
|     Unix::ssize_t nread = 0; |     ssize_t nread = 0; | ||||||
|     Unix::size_t remaining_count = min((Unix::off_t)count, (Unix::off_t)size() - offset); |     size_t remaining_count = min((Unix::off_t)count, (Unix::off_t)size() - offset); | ||||||
|     byte* out = buffer; |     byte* out = buffer; | ||||||
| 
 | 
 | ||||||
| #ifdef EXT2_DEBUG | #ifdef EXT2_DEBUG | ||||||
|  | @ -387,7 +387,7 @@ Unix::ssize_t Ext2FSInode::read_bytes(Unix::off_t offset, Unix::size_t count, by | ||||||
|     return nread; |     return nread; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t Ext2FS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset, Unix::size_t count, byte* buffer, FileDescriptor*) const | ssize_t Ext2FS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset, size_t count, byte* buffer, FileDescriptor*) const | ||||||
| { | { | ||||||
|     ASSERT(offset >= 0); |     ASSERT(offset >= 0); | ||||||
|     ASSERT(inode.fsid() == id()); |     ASSERT(inode.fsid() == id()); | ||||||
|  | @ -411,7 +411,7 @@ Unix::ssize_t Ext2FS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset | ||||||
|     // This avoids wasting an entire block on short links. (Most links are short.)
 |     // This avoids wasting an entire block on short links. (Most links are short.)
 | ||||||
|     static const unsigned maxInlineSymlinkLength = 60; |     static const unsigned maxInlineSymlinkLength = 60; | ||||||
|     if (isSymbolicLink(e2inode->i_mode) && e2inode->i_size < maxInlineSymlinkLength) { |     if (isSymbolicLink(e2inode->i_mode) && e2inode->i_size < maxInlineSymlinkLength) { | ||||||
|         Unix::ssize_t nread = min((Unix::off_t)e2inode->i_size - offset, static_cast<Unix::off_t>(count)); |         ssize_t nread = min((Unix::off_t)e2inode->i_size - offset, static_cast<Unix::off_t>(count)); | ||||||
|         memcpy(buffer, e2inode->i_block + offset, nread); |         memcpy(buffer, e2inode->i_block + offset, nread); | ||||||
|         return nread; |         return nread; | ||||||
|     } |     } | ||||||
|  | @ -431,8 +431,8 @@ Unix::ssize_t Ext2FS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset | ||||||
| 
 | 
 | ||||||
|     dword offsetIntoFirstBlock = offset % blockSize(); |     dword offsetIntoFirstBlock = offset % blockSize(); | ||||||
| 
 | 
 | ||||||
|     Unix::ssize_t nread = 0; |     ssize_t nread = 0; | ||||||
|     Unix::size_t remainingCount = min((Unix::off_t)count, (Unix::off_t)e2inode->i_size - offset); |     size_t remainingCount = min((Unix::off_t)count, (Unix::off_t)e2inode->i_size - offset); | ||||||
|     byte* out = buffer; |     byte* out = buffer; | ||||||
| 
 | 
 | ||||||
| #ifdef EXT2_DEBUG | #ifdef EXT2_DEBUG | ||||||
|  | @ -453,7 +453,7 @@ Unix::ssize_t Ext2FS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset | ||||||
|         else |         else | ||||||
|             offsetIntoBlock = 0; |             offsetIntoBlock = 0; | ||||||
| 
 | 
 | ||||||
|         dword numBytesToCopy = min(blockSize() - offsetIntoBlock, remainingCount); |         size_t numBytesToCopy = min(blockSize() - offsetIntoBlock, remainingCount); | ||||||
|         memcpy(out, block.pointer() + offsetIntoBlock, numBytesToCopy); |         memcpy(out, block.pointer() + offsetIntoBlock, numBytesToCopy); | ||||||
|         remainingCount -= numBytesToCopy; |         remainingCount -= numBytesToCopy; | ||||||
|         nread += numBytesToCopy; |         nread += numBytesToCopy; | ||||||
|  |  | ||||||
|  | @ -22,7 +22,7 @@ public: | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     // ^CoreInode
 |     // ^CoreInode
 | ||||||
|     virtual Unix::ssize_t read_bytes(Unix::off_t, Unix::size_t, byte* buffer, FileDescriptor*) override; |     virtual ssize_t read_bytes(Unix::off_t, size_t, byte* buffer, FileDescriptor*) override; | ||||||
|     virtual void populate_metadata() const override; |     virtual void populate_metadata() const override; | ||||||
|     virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) override; |     virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) override; | ||||||
|     virtual InodeIdentifier lookup(const String& name) override; |     virtual InodeIdentifier lookup(const String& name) override; | ||||||
|  | @ -74,7 +74,7 @@ private: | ||||||
|     virtual InodeMetadata inodeMetadata(InodeIdentifier) const override; |     virtual InodeMetadata inodeMetadata(InodeIdentifier) const override; | ||||||
|     virtual bool set_mtime(InodeIdentifier, dword timestamp) override; |     virtual bool set_mtime(InodeIdentifier, dword timestamp) override; | ||||||
|     virtual InodeIdentifier create_inode(InodeIdentifier parentInode, const String& name, Unix::mode_t, unsigned size, int& error) override; |     virtual InodeIdentifier create_inode(InodeIdentifier parentInode, const String& name, Unix::mode_t, unsigned size, int& error) override; | ||||||
|     virtual Unix::ssize_t read_inode_bytes(InodeIdentifier, Unix::off_t offset, Unix::size_t count, byte* buffer, FileDescriptor*) const override; |     virtual ssize_t read_inode_bytes(InodeIdentifier, Unix::off_t offset, size_t count, byte* buffer, FileDescriptor*) const override; | ||||||
|     virtual InodeIdentifier create_directory(InodeIdentifier parentInode, const String& name, Unix::mode_t, int& error) override; |     virtual InodeIdentifier create_directory(InodeIdentifier parentInode, const String& name, Unix::mode_t, int& error) override; | ||||||
|     virtual InodeIdentifier find_parent_of_inode(InodeIdentifier) const override; |     virtual InodeIdentifier find_parent_of_inode(InodeIdentifier) const override; | ||||||
|     virtual RetainPtr<CoreInode> get_inode(InodeIdentifier) const override; |     virtual RetainPtr<CoreInode> get_inode(InodeIdentifier) const override; | ||||||
|  |  | ||||||
|  | @ -133,7 +133,7 @@ Unix::off_t FileDescriptor::seek(Unix::off_t offset, int whence) | ||||||
|     return m_currentOffset; |     return m_currentOffset; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t FileDescriptor::read(byte* buffer, Unix::size_t count) | ssize_t FileDescriptor::read(byte* buffer, size_t count) | ||||||
| { | { | ||||||
|     if (is_fifo()) { |     if (is_fifo()) { | ||||||
|         ASSERT(fifo_direction() == FIFO::Reader); |         ASSERT(fifo_direction() == FIFO::Reader); | ||||||
|  | @ -143,12 +143,12 @@ Unix::ssize_t FileDescriptor::read(byte* buffer, Unix::size_t count) | ||||||
|         // FIXME: What should happen to m_currentOffset?
 |         // FIXME: What should happen to m_currentOffset?
 | ||||||
|         return m_vnode->characterDevice()->read(buffer, count); |         return m_vnode->characterDevice()->read(buffer, count); | ||||||
|     } |     } | ||||||
|     Unix::ssize_t nread = m_vnode->fileSystem()->read_inode_bytes(m_vnode->inode, m_currentOffset, count, buffer, this); |     ssize_t nread = m_vnode->fileSystem()->read_inode_bytes(m_vnode->inode, m_currentOffset, count, buffer, this); | ||||||
|     m_currentOffset += nread; |     m_currentOffset += nread; | ||||||
|     return nread; |     return nread; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t FileDescriptor::write(const byte* data, Unix::size_t size) | ssize_t FileDescriptor::write(const byte* data, size_t size) | ||||||
| { | { | ||||||
|     if (is_fifo()) { |     if (is_fifo()) { | ||||||
|         ASSERT(fifo_direction() == FIFO::Writer); |         ASSERT(fifo_direction() == FIFO::Writer); | ||||||
|  | @ -189,7 +189,7 @@ ByteBuffer FileDescriptor::readEntireFile() | ||||||
| 
 | 
 | ||||||
|     if (m_vnode->isCharacterDevice()) { |     if (m_vnode->isCharacterDevice()) { | ||||||
|         auto buffer = ByteBuffer::createUninitialized(1024); |         auto buffer = ByteBuffer::createUninitialized(1024); | ||||||
|         Unix::ssize_t nread = m_vnode->characterDevice()->read(buffer.pointer(), buffer.size()); |         ssize_t nread = m_vnode->characterDevice()->read(buffer.pointer(), buffer.size()); | ||||||
|         buffer.trim(nread); |         buffer.trim(nread); | ||||||
|         return buffer; |         return buffer; | ||||||
|     } |     } | ||||||
|  | @ -205,7 +205,7 @@ bool FileDescriptor::isDirectory() const | ||||||
|     return m_vnode->metadata().isDirectory(); |     return m_vnode->metadata().isDirectory(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| ssize_t FileDescriptor::get_dir_entries(byte* buffer, Unix::size_t size) | ssize_t FileDescriptor::get_dir_entries(byte* buffer, size_t size) | ||||||
| { | { | ||||||
|     auto metadata = m_vnode->metadata(); |     auto metadata = m_vnode->metadata(); | ||||||
|     if (!metadata.isValid()) |     if (!metadata.isValid()) | ||||||
|  |  | ||||||
|  | @ -23,14 +23,14 @@ public: | ||||||
|     int close(); |     int close(); | ||||||
| 
 | 
 | ||||||
|     Unix::off_t seek(Unix::off_t, int whence); |     Unix::off_t seek(Unix::off_t, int whence); | ||||||
|     Unix::ssize_t read(byte*, Unix::size_t); |     ssize_t read(byte*, size_t); | ||||||
|     Unix::ssize_t write(const byte* data, Unix::size_t); |     ssize_t write(const byte* data, size_t); | ||||||
|     int stat(Unix::stat*); |     int stat(Unix::stat*); | ||||||
| 
 | 
 | ||||||
|     bool hasDataAvailableForRead(); |     bool hasDataAvailableForRead(); | ||||||
|     bool can_write(); |     bool can_write(); | ||||||
| 
 | 
 | ||||||
|     ssize_t get_dir_entries(byte* buffer, Unix::size_t); |     ssize_t get_dir_entries(byte* buffer, size_t); | ||||||
| 
 | 
 | ||||||
|     ByteBuffer readEntireFile(); |     ByteBuffer readEntireFile(); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -44,20 +44,20 @@ ByteBuffer CoreInode::read_entire(FileDescriptor* descriptor) | ||||||
|     size_t initial_size = metadata().size ? metadata().size : 4096; |     size_t initial_size = metadata().size ? metadata().size : 4096; | ||||||
|     auto contents = ByteBuffer::createUninitialized(initial_size); |     auto contents = ByteBuffer::createUninitialized(initial_size); | ||||||
| 
 | 
 | ||||||
|     Unix::ssize_t nread; |     ssize_t nread; | ||||||
|     byte buffer[4096]; |     byte buffer[4096]; | ||||||
|     byte* out = contents.pointer(); |     byte* out = contents.pointer(); | ||||||
|     Unix::off_t offset = 0; |     Unix::off_t offset = 0; | ||||||
|     for (;;) { |     for (;;) { | ||||||
|         nread = read_bytes(offset, sizeof(buffer), buffer, descriptor); |         nread = read_bytes(offset, sizeof(buffer), buffer, descriptor); | ||||||
|         //kprintf("nread: %u, bufsiz: %u, initial_size: %u\n", nread, sizeof(buffer), initial_size);
 |         //kprintf("nread: %u, bufsiz: %u, initial_size: %u\n", nread, sizeof(buffer), initial_size);
 | ||||||
|         ASSERT(nread <= (Unix::ssize_t)sizeof(buffer)); |         ASSERT(nread <= (ssize_t)sizeof(buffer)); | ||||||
|         if (nread <= 0) |         if (nread <= 0) | ||||||
|             break; |             break; | ||||||
|         memcpy(out, buffer, nread); |         memcpy(out, buffer, nread); | ||||||
|         out += nread; |         out += nread; | ||||||
|         offset += nread; |         offset += nread; | ||||||
|         ASSERT(offset <= (Unix::ssize_t)initial_size); // FIXME: Support dynamically growing the buffer.
 |         ASSERT(offset <= (ssize_t)initial_size); // FIXME: Support dynamically growing the buffer.
 | ||||||
|     } |     } | ||||||
|     if (nread < 0) { |     if (nread < 0) { | ||||||
|         kprintf("CoreInode::read_entire: ERROR: %d\n", nread); |         kprintf("CoreInode::read_entire: ERROR: %d\n", nread); | ||||||
|  | @ -82,20 +82,20 @@ ByteBuffer FS::readEntireInode(InodeIdentifier inode, FileDescriptor* handle) co | ||||||
|     size_t initialSize = metadata.size ? metadata.size : 4096; |     size_t initialSize = metadata.size ? metadata.size : 4096; | ||||||
|     auto contents = ByteBuffer::createUninitialized(initialSize); |     auto contents = ByteBuffer::createUninitialized(initialSize); | ||||||
| 
 | 
 | ||||||
|     Unix::ssize_t nread; |     ssize_t nread; | ||||||
|     byte buffer[4096]; |     byte buffer[4096]; | ||||||
|     byte* out = contents.pointer(); |     byte* out = contents.pointer(); | ||||||
|     Unix::off_t offset = 0; |     Unix::off_t offset = 0; | ||||||
|     for (;;) { |     for (;;) { | ||||||
|         nread = read_inode_bytes(inode, offset, sizeof(buffer), buffer, handle); |         nread = read_inode_bytes(inode, offset, sizeof(buffer), buffer, handle); | ||||||
|         //kprintf("nread: %u, bufsiz: %u, initialSize: %u\n", nread, sizeof(buffer), initialSize);
 |         //kprintf("nread: %u, bufsiz: %u, initialSize: %u\n", nread, sizeof(buffer), initialSize);
 | ||||||
|         ASSERT(nread <= (Unix::ssize_t)sizeof(buffer)); |         ASSERT(nread <= (ssize_t)sizeof(buffer)); | ||||||
|         if (nread <= 0) |         if (nread <= 0) | ||||||
|             break; |             break; | ||||||
|         memcpy(out, buffer, nread); |         memcpy(out, buffer, nread); | ||||||
|         out += nread; |         out += nread; | ||||||
|         offset += nread; |         offset += nread; | ||||||
|         ASSERT(offset <= (Unix::ssize_t)initialSize); // FIXME: Support dynamically growing the buffer.
 |         ASSERT(offset <= (ssize_t)initialSize); // FIXME: Support dynamically growing the buffer.
 | ||||||
|     } |     } | ||||||
|     if (nread < 0) { |     if (nread < 0) { | ||||||
|         kprintf("[fs] readInode: ERROR: %d\n", nread); |         kprintf("[fs] readInode: ERROR: %d\n", nread); | ||||||
|  | @ -115,7 +115,7 @@ FS::DirectoryEntry::DirectoryEntry(const char* n, InodeIdentifier i, byte ft) | ||||||
|     name[name_length] = '\0'; |     name[name_length] = '\0'; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| FS::DirectoryEntry::DirectoryEntry(const char* n, Unix::size_t nl, InodeIdentifier i, byte ft) | FS::DirectoryEntry::DirectoryEntry(const char* n, size_t nl, InodeIdentifier i, byte ft) | ||||||
|     : name_length(nl) |     : name_length(nl) | ||||||
|     , inode(i) |     , inode(i) | ||||||
|     , fileType(ft) |     , fileType(ft) | ||||||
|  |  | ||||||
|  | @ -33,13 +33,13 @@ public: | ||||||
|     virtual bool writeInode(InodeIdentifier, const ByteBuffer&) = 0; |     virtual bool writeInode(InodeIdentifier, const ByteBuffer&) = 0; | ||||||
|     virtual InodeMetadata inodeMetadata(InodeIdentifier) const = 0; |     virtual InodeMetadata inodeMetadata(InodeIdentifier) const = 0; | ||||||
| 
 | 
 | ||||||
|     virtual Unix::ssize_t read_inode_bytes(InodeIdentifier, Unix::off_t offset, Unix::size_t count, byte* buffer, FileDescriptor*) const = 0; |     virtual ssize_t read_inode_bytes(InodeIdentifier, Unix::off_t offset, size_t count, byte* buffer, FileDescriptor*) const = 0; | ||||||
| 
 | 
 | ||||||
|     struct DirectoryEntry { |     struct DirectoryEntry { | ||||||
|         DirectoryEntry(const char* name, InodeIdentifier, byte fileType); |         DirectoryEntry(const char* name, InodeIdentifier, byte fileType); | ||||||
|         DirectoryEntry(const char* name, Unix::size_t name_length, InodeIdentifier, byte fileType); |         DirectoryEntry(const char* name, size_t name_length, InodeIdentifier, byte fileType); | ||||||
|         char name[256]; |         char name[256]; | ||||||
|         Unix::size_t name_length { 0 }; |         size_t name_length { 0 }; | ||||||
|         InodeIdentifier inode; |         InodeIdentifier inode; | ||||||
|         byte fileType { 0 }; |         byte fileType { 0 }; | ||||||
|     }; |     }; | ||||||
|  | @ -80,7 +80,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     ByteBuffer read_entire(FileDescriptor* = nullptr); |     ByteBuffer read_entire(FileDescriptor* = nullptr); | ||||||
| 
 | 
 | ||||||
|     virtual Unix::ssize_t read_bytes(Unix::off_t, Unix::size_t, byte* buffer, FileDescriptor*) = 0; |     virtual ssize_t read_bytes(Unix::off_t, size_t, byte* buffer, FileDescriptor*) = 0; | ||||||
|     virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) = 0; |     virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) = 0; | ||||||
|     virtual InodeIdentifier lookup(const String& name) = 0; |     virtual InodeIdentifier lookup(const String& name) = 0; | ||||||
|     virtual String reverse_lookup(InodeIdentifier) = 0; |     virtual String reverse_lookup(InodeIdentifier) = 0; | ||||||
|  |  | ||||||
|  | @ -18,14 +18,14 @@ bool FullDevice::hasDataAvailableForRead() const | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t FullDevice::read(byte* buffer, Unix::size_t bufferSize) | ssize_t FullDevice::read(byte* buffer, size_t bufferSize) | ||||||
| { | { | ||||||
|     Unix::size_t count = min(GoodBufferSize, bufferSize); |     size_t count = min(GoodBufferSize, bufferSize); | ||||||
|     memset(buffer, 0, count); |     memset(buffer, 0, count); | ||||||
|     return count; |     return count; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t FullDevice::write(const byte*, Unix::size_t bufferSize) | ssize_t FullDevice::write(const byte*, size_t bufferSize) | ||||||
| { | { | ||||||
|     if (bufferSize == 0) |     if (bufferSize == 0) | ||||||
|         return 0; |         return 0; | ||||||
|  |  | ||||||
|  | @ -8,8 +8,8 @@ public: | ||||||
|     FullDevice(); |     FullDevice(); | ||||||
|     virtual ~FullDevice(); |     virtual ~FullDevice(); | ||||||
| 
 | 
 | ||||||
|     virtual Unix::ssize_t read(byte* buffer, Unix::size_t bufferSize) override; |     virtual ssize_t read(byte* buffer, size_t bufferSize) override; | ||||||
|     virtual Unix::ssize_t write(const byte* buffer, Unix::size_t bufferSize) override; |     virtual ssize_t write(const byte* buffer, size_t bufferSize) override; | ||||||
|     virtual bool hasDataAvailableForRead() const override; |     virtual bool hasDataAvailableForRead() const override; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -9,6 +9,6 @@ inline static const Unix::off_t maxFileOffset = 2147483647; | ||||||
| inline static const Unix::off_t maxFileOffset = std::numeric_limits<Unix::off_t>::max(); | inline static const Unix::off_t maxFileOffset = std::numeric_limits<Unix::off_t>::max(); | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| static const Unix::size_t GoodBufferSize = 4096; | static const size_t GoodBufferSize = 4096; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,12 +17,12 @@ bool NullDevice::hasDataAvailableForRead() const | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t NullDevice::read(byte*, Unix::size_t) | ssize_t NullDevice::read(byte*, size_t) | ||||||
| { | { | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t NullDevice::write(const byte*, Unix::size_t bufferSize) | ssize_t NullDevice::write(const byte*, size_t bufferSize) | ||||||
| { | { | ||||||
|     return min(GoodBufferSize, bufferSize); |     return min(GoodBufferSize, bufferSize); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -8,8 +8,8 @@ public: | ||||||
|     NullDevice(); |     NullDevice(); | ||||||
|     virtual ~NullDevice() override; |     virtual ~NullDevice() override; | ||||||
| 
 | 
 | ||||||
|     virtual Unix::ssize_t read(byte* buffer, Unix::size_t bufferSize) override; |     virtual ssize_t read(byte* buffer, size_t bufferSize) override; | ||||||
|     virtual Unix::ssize_t write(const byte* buffer, Unix::size_t bufferSize) override; |     virtual ssize_t write(const byte* buffer, size_t bufferSize) override; | ||||||
|     virtual bool hasDataAvailableForRead() const override; |     virtual bool hasDataAvailableForRead() const override; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -34,18 +34,18 @@ bool RandomDevice::hasDataAvailableForRead() const | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t RandomDevice::read(byte* buffer, Unix::size_t bufferSize) | ssize_t RandomDevice::read(byte* buffer, size_t bufferSize) | ||||||
| { | { | ||||||
|     const int range = 'z' - 'a'; |     const int range = 'z' - 'a'; | ||||||
|     Unix::ssize_t nread = min(bufferSize, GoodBufferSize); |     ssize_t nread = min(bufferSize, GoodBufferSize); | ||||||
|     for (Unix::ssize_t i = 0; i < nread; ++i) { |     for (ssize_t i = 0; i < nread; ++i) { | ||||||
|         dword r = myrand() % range; |         dword r = myrand() % range; | ||||||
|         buffer[i] = 'a' + r; |         buffer[i] = 'a' + r; | ||||||
|     } |     } | ||||||
|     return nread; |     return nread; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t RandomDevice::write(const byte*, Unix::size_t bufferSize) | ssize_t RandomDevice::write(const byte*, size_t bufferSize) | ||||||
| { | { | ||||||
|     // FIXME: Use input for entropy? I guess that could be a neat feature?
 |     // FIXME: Use input for entropy? I guess that could be a neat feature?
 | ||||||
|     return min(GoodBufferSize, bufferSize); |     return min(GoodBufferSize, bufferSize); | ||||||
|  |  | ||||||
|  | @ -8,8 +8,8 @@ public: | ||||||
|     RandomDevice(); |     RandomDevice(); | ||||||
|     virtual ~RandomDevice() override; |     virtual ~RandomDevice() override; | ||||||
| 
 | 
 | ||||||
|     virtual Unix::ssize_t read(byte* buffer, Unix::size_t bufferSize) override; |     virtual ssize_t read(byte* buffer, size_t bufferSize) override; | ||||||
|     virtual Unix::ssize_t write(const byte* buffer, Unix::size_t bufferSize) override; |     virtual ssize_t write(const byte* buffer, size_t bufferSize) override; | ||||||
|     virtual bool hasDataAvailableForRead() const override; |     virtual bool hasDataAvailableForRead() const override; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -170,7 +170,7 @@ bool SynthFS::writeInode(InodeIdentifier, const ByteBuffer&) | ||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t SynthFS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset, Unix::size_t count, byte* buffer, FileDescriptor* handle) const | ssize_t SynthFS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offset, size_t count, byte* buffer, FileDescriptor* handle) const | ||||||
| { | { | ||||||
|     ASSERT(inode.fsid() == id()); |     ASSERT(inode.fsid() == id()); | ||||||
| #ifdef SYNTHFS_DEBUG | #ifdef SYNTHFS_DEBUG | ||||||
|  | @ -200,7 +200,7 @@ Unix::ssize_t SynthFS::read_inode_bytes(InodeIdentifier inode, Unix::off_t offse | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto* data = generatedData ? &generatedData : &file.m_data; |     auto* data = generatedData ? &generatedData : &file.m_data; | ||||||
|     Unix::ssize_t nread = min(static_cast<Unix::off_t>(data->size() - offset), static_cast<Unix::off_t>(count)); |     ssize_t nread = min(static_cast<Unix::off_t>(data->size() - offset), static_cast<Unix::off_t>(count)); | ||||||
|     memcpy(buffer, data->pointer() + offset, nread); |     memcpy(buffer, data->pointer() + offset, nread); | ||||||
|     if (nread == 0 && handle && handle->generatorCache()) |     if (nread == 0 && handle && handle->generatorCache()) | ||||||
|         handle->generatorCache().clear(); |         handle->generatorCache().clear(); | ||||||
|  | @ -249,7 +249,7 @@ void SynthFSInode::populate_metadata() const | ||||||
|     // Already done when SynthFS created the file.
 |     // Already done when SynthFS created the file.
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t SynthFSInode::read_bytes(Unix::off_t offset, Unix::size_t count, byte* buffer, FileDescriptor* descriptor) | ssize_t SynthFSInode::read_bytes(Unix::off_t offset, size_t count, byte* buffer, FileDescriptor* descriptor) | ||||||
| { | { | ||||||
| #ifdef SYNTHFS_DEBUG | #ifdef SYNTHFS_DEBUG | ||||||
|     kprintf("SynthFS: read_bytes %u\n", index()); |     kprintf("SynthFS: read_bytes %u\n", index()); | ||||||
|  | @ -269,7 +269,7 @@ Unix::ssize_t SynthFSInode::read_bytes(Unix::off_t offset, Unix::size_t count, b | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     auto* data = generatedData ? &generatedData : &m_data; |     auto* data = generatedData ? &generatedData : &m_data; | ||||||
|     Unix::ssize_t nread = min(static_cast<Unix::off_t>(data->size() - offset), static_cast<Unix::off_t>(count)); |     ssize_t nread = min(static_cast<Unix::off_t>(data->size() - offset), static_cast<Unix::off_t>(count)); | ||||||
|     memcpy(buffer, data->pointer() + offset, nread); |     memcpy(buffer, data->pointer() + offset, nread); | ||||||
|     if (nread == 0 && descriptor && descriptor->generatorCache()) |     if (nread == 0 && descriptor && descriptor->generatorCache()) | ||||||
|         descriptor->generatorCache().clear(); |         descriptor->generatorCache().clear(); | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ public: | ||||||
|     virtual InodeMetadata inodeMetadata(InodeIdentifier) const override; |     virtual InodeMetadata inodeMetadata(InodeIdentifier) const override; | ||||||
|     virtual bool set_mtime(InodeIdentifier, dword timestamp) override; |     virtual bool set_mtime(InodeIdentifier, dword timestamp) override; | ||||||
|     virtual InodeIdentifier create_inode(InodeIdentifier parentInode, const String& name, Unix::mode_t, unsigned size, int& error) override; |     virtual InodeIdentifier create_inode(InodeIdentifier parentInode, const String& name, Unix::mode_t, unsigned size, int& error) override; | ||||||
|     virtual Unix::ssize_t read_inode_bytes(InodeIdentifier, Unix::off_t offset, Unix::size_t count, byte* buffer, FileDescriptor*) const override; |     virtual ssize_t read_inode_bytes(InodeIdentifier, Unix::off_t offset, size_t count, byte* buffer, FileDescriptor*) const override; | ||||||
|     virtual InodeIdentifier create_directory(InodeIdentifier parentInode, const String& name, Unix::mode_t, int& error) override; |     virtual InodeIdentifier create_directory(InodeIdentifier parentInode, const String& name, Unix::mode_t, int& error) override; | ||||||
|     virtual InodeIdentifier find_parent_of_inode(InodeIdentifier) const override; |     virtual InodeIdentifier find_parent_of_inode(InodeIdentifier) const override; | ||||||
|     virtual RetainPtr<CoreInode> get_inode(InodeIdentifier) const override; |     virtual RetainPtr<CoreInode> get_inode(InodeIdentifier) const override; | ||||||
|  | @ -50,7 +50,7 @@ public: | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     // ^CoreInode
 |     // ^CoreInode
 | ||||||
|     virtual Unix::ssize_t read_bytes(Unix::off_t, Unix::size_t, byte* buffer, FileDescriptor*) override; |     virtual ssize_t read_bytes(Unix::off_t, size_t, byte* buffer, FileDescriptor*) override; | ||||||
|     virtual void populate_metadata() const override; |     virtual void populate_metadata() const override; | ||||||
|     virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) override; |     virtual bool traverse_as_directory(Function<bool(const FS::DirectoryEntry&)>) override; | ||||||
|     virtual InodeIdentifier lookup(const String& name) override; |     virtual InodeIdentifier lookup(const String& name) override; | ||||||
|  |  | ||||||
|  | @ -258,8 +258,6 @@ typedef ::time_t time_t; | ||||||
| 
 | 
 | ||||||
| typedef dword blksize_t; | typedef dword blksize_t; | ||||||
| typedef dword blkcnt_t; | typedef dword blkcnt_t; | ||||||
| typedef dword size_t; |  | ||||||
| typedef signed_dword ssize_t; |  | ||||||
| 
 | 
 | ||||||
| #define NCCS 32 | #define NCCS 32 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -17,14 +17,14 @@ bool ZeroDevice::hasDataAvailableForRead() const | ||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t ZeroDevice::read(byte* buffer, Unix::size_t bufferSize) | ssize_t ZeroDevice::read(byte* buffer, size_t bufferSize) | ||||||
| { | { | ||||||
|     Unix::size_t count = min(GoodBufferSize, bufferSize); |     size_t count = min(GoodBufferSize, bufferSize); | ||||||
|     memset(buffer, 0, count); |     memset(buffer, 0, count); | ||||||
|     return count; |     return count; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Unix::ssize_t ZeroDevice::write(const byte*, Unix::size_t bufferSize) | ssize_t ZeroDevice::write(const byte*, size_t bufferSize) | ||||||
| { | { | ||||||
|     return min(GoodBufferSize, bufferSize); |     return min(GoodBufferSize, bufferSize); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -8,8 +8,8 @@ public: | ||||||
|     ZeroDevice(); |     ZeroDevice(); | ||||||
|     virtual ~ZeroDevice() override; |     virtual ~ZeroDevice() override; | ||||||
| 
 | 
 | ||||||
|     virtual Unix::ssize_t read(byte* buffer, Unix::size_t bufferSize) override; |     virtual ssize_t read(byte* buffer, size_t bufferSize) override; | ||||||
|     virtual Unix::ssize_t write(const byte* buffer, Unix::size_t bufferSize) override; |     virtual ssize_t write(const byte* buffer, size_t bufferSize) override; | ||||||
|     virtual bool hasDataAvailableForRead() const override; |     virtual bool hasDataAvailableForRead() const override; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling