forked from Bananymous/banan-os
Kernel: fix stat command and device numbers
This commit is contained in:
parent
06ce1f0667
commit
3508df67b1
|
@ -76,7 +76,7 @@ namespace Kernel
|
|||
virtual timespec ctime() const override { return { 0, 0 }; }
|
||||
virtual blksize_t blksize() const override { return 0; }
|
||||
virtual blkcnt_t blocks() const override { return 0; }
|
||||
virtual dev_t dev() const override { return 0x4935; }
|
||||
virtual dev_t dev() const override { return 0x4900; }
|
||||
virtual dev_t rdev() const override { return 0x7854; }
|
||||
|
||||
virtual BAN::ErrorOr<size_t> read(size_t, void*, size_t) { ASSERT_NOT_REACHED(); }
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Kernel::Input
|
|||
virtual void on_byte(uint8_t) = 0;
|
||||
|
||||
public:
|
||||
virtual ino_t ino() const { return m_ino; }
|
||||
virtual ino_t ino() const override { return m_ino; }
|
||||
virtual mode_t mode() const override { return Mode::IFCHR | Mode::IRUSR | Mode::IRGRP; }
|
||||
virtual nlink_t nlink() const override { return 1; }
|
||||
virtual uid_t uid() const override { return 0; }
|
||||
|
|
|
@ -104,13 +104,13 @@ namespace Kernel
|
|||
TRY(validate_fd(fd));
|
||||
const auto& open_fd = open_file_description(fd);
|
||||
|
||||
out->st_dev = 0;
|
||||
out->st_dev = open_fd.inode->dev();
|
||||
out->st_ino = open_fd.inode->ino();
|
||||
out->st_mode = open_fd.inode->mode();
|
||||
out->st_nlink = open_fd.inode->nlink();
|
||||
out->st_uid = open_fd.inode->uid();
|
||||
out->st_gid = open_fd.inode->gid();
|
||||
out->st_rdev = 0;
|
||||
out->st_rdev = open_fd.inode->rdev();
|
||||
out->st_size = open_fd.inode->size();
|
||||
out->st_atim = open_fd.inode->atime();
|
||||
out->st_mtim = open_fd.inode->mtime();
|
||||
|
|
|
@ -447,8 +447,11 @@ argument_done:
|
|||
|
||||
TTY_PRINTLN(" File: {}", arguments[1]);
|
||||
TTY_PRINTLN(" Size: {}\tBlocks: {}\tIO Block: {}\t {}", st.st_size, st.st_blocks, st.st_blksize, type);
|
||||
TTY_PRINTLN("Device: {},{}\tInode: {}\tLinks: {}", st.st_dev, st.st_rdev, st.st_ino, st.st_nlink);
|
||||
TTY_PRINTLN("Access: ({}/{})\tUid: {}\tGid: {}", st.st_mode, mode_string(st.st_mode), st.st_uid, st.st_gid);
|
||||
TTY_PRINT("Device: {},{}\tInode: {}\tLinks: {}", st.st_dev >> 8, st.st_dev & 0xFF, st.st_ino, st.st_nlink);
|
||||
if (st.st_rdev)
|
||||
TTY_PRINT("\tDevice type: {},{}", st.st_rdev >> 8, st.st_rdev & 0xFF);
|
||||
TTY_PRINTLN("");
|
||||
TTY_PRINTLN("Access: ({4O}/{})\tUid: {}\tGid: {}", st.st_mode & 0777, mode_string(st.st_mode), st.st_uid, st.st_gid);
|
||||
TTY_PRINTLN("Access: {}", BAN::from_unix_time(st.st_atime));
|
||||
TTY_PRINTLN("Modify: {}", BAN::from_unix_time(st.st_mtime));
|
||||
TTY_PRINTLN("Change: {}", BAN::from_unix_time(st.st_ctime));
|
||||
|
|
Loading…
Reference in New Issue