mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
Compat work towards porting vim.
This commit is contained in:
parent
2e5b9d318f
commit
a356746d04
17 changed files with 200 additions and 77 deletions
|
@ -389,7 +389,7 @@ PageFaultResponse MemoryManager::handle_page_fault(const PageFault& fault)
|
|||
ASSERT(success);
|
||||
return PageFaultResponse::Continue;
|
||||
}
|
||||
kprintf("PV(error) fault in Region{%p}[%u]\n", region, page_index_in_region);
|
||||
kprintf("PV(error) fault in Region{%p}[%u] at L%x\n", region, page_index_in_region, fault.laddr().get());
|
||||
} else {
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -226,7 +226,7 @@ Process* Process::fork(RegisterDump& regs)
|
|||
|
||||
for (auto& region : m_regions) {
|
||||
#ifdef FORK_DEBUG
|
||||
dbgprintf("fork: cloning Region{%p} \"%s\" L%x\n", region.ptr(), region->name.characters(), region->laddr().get());
|
||||
dbgprintf("fork: cloning Region{%p} \"%s\" L%x\n", region.ptr(), region->name().characters(), region->laddr().get());
|
||||
#endif
|
||||
auto cloned_region = region->clone();
|
||||
child->m_regions.append(move(cloned_region));
|
||||
|
@ -1140,10 +1140,9 @@ int Process::sys$utime(const char* pathname, const utimbuf* buf)
|
|||
|
||||
int Process::sys$access(const char* pathname, int mode)
|
||||
{
|
||||
(void) mode;
|
||||
if (!validate_read_str(pathname))
|
||||
return -EFAULT;
|
||||
ASSERT_NOT_REACHED();
|
||||
return VFS::the().access(String(pathname), mode, cwd_inode());
|
||||
}
|
||||
|
||||
int Process::sys$fcntl(int fd, int cmd, dword arg)
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
|
||||
#define WNOHANG 1
|
||||
|
||||
#define R_OK 4
|
||||
#define W_OK 2
|
||||
#define X_OK 1
|
||||
#define F_OK 0
|
||||
|
||||
#define SIG_DFL ((void*)0)
|
||||
#define SIG_ERR ((void*)-1)
|
||||
#define SIG_IGN ((void*)1)
|
||||
|
@ -265,6 +270,7 @@ typedef dword blkcnt_t;
|
|||
|
||||
typedef uint32_t tcflag_t;
|
||||
typedef uint8_t cc_t;
|
||||
typedef uint32_t speed_t;
|
||||
|
||||
struct termios {
|
||||
tcflag_t c_iflag;
|
||||
|
@ -272,6 +278,8 @@ struct termios {
|
|||
tcflag_t c_cflag;
|
||||
tcflag_t c_lflag;
|
||||
cc_t c_cc[NCCS];
|
||||
speed_t c_ispeed;
|
||||
speed_t c_ospeed;
|
||||
};
|
||||
|
||||
struct stat {
|
||||
|
|
|
@ -268,6 +268,28 @@ KResult VFS::mkdir(const String& path, mode_t mode, Inode& base)
|
|||
return KResult(error);
|
||||
}
|
||||
|
||||
KResult VFS::access(const String& path, int mode, Inode& base)
|
||||
{
|
||||
auto inode_or_error = resolve_path_to_inode(path, base);
|
||||
if (inode_or_error.is_error())
|
||||
return inode_or_error.error();
|
||||
auto inode = inode_or_error.value();
|
||||
auto metadata = inode->metadata();
|
||||
if (mode & R_OK) {
|
||||
if (!metadata.may_read(*current))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
if (mode & W_OK) {
|
||||
if (!metadata.may_write(*current))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
if (mode & X_OK) {
|
||||
if (!metadata.may_execute(*current))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
return KSuccess;
|
||||
}
|
||||
|
||||
KResult VFS::chmod(const String& path, mode_t mode, Inode& base)
|
||||
{
|
||||
auto inode_or_error = resolve_path_to_inode(path, base);
|
||||
|
|
|
@ -70,6 +70,7 @@ public:
|
|||
bool unlink(const String& path, Inode& base, int& error);
|
||||
bool rmdir(const String& path, Inode& base, int& error);
|
||||
KResult chmod(const String& path, mode_t, Inode& base);
|
||||
KResult access(const String& path, int mode, Inode& base);
|
||||
bool stat(const String& path, int& error, int options, Inode& base, struct stat&);
|
||||
KResult utime(const String& path, Inode& base, time_t atime, time_t mtime);
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ sudo id
|
|||
|
||||
make_cmd="make -j2"
|
||||
|
||||
rm -r ../Root/usr && \
|
||||
$make_cmd -C ../LibC clean && \
|
||||
$make_cmd -C ../LibC && \
|
||||
(cd ../LibC && ./install.sh) && \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue