From 723428bebe3105ad3c3406e416402d1831b482c4 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 15 Aug 2021 00:16:45 -0400 Subject: Inital commit --- linux/fs/stat.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 linux/fs/stat.c (limited to 'linux/fs/stat.c') diff --git a/linux/fs/stat.c b/linux/fs/stat.c new file mode 100644 index 0000000..4bec71d --- /dev/null +++ b/linux/fs/stat.c @@ -0,0 +1,51 @@ +#include +#include + +#include +#include +#include +#include + +static int cp_stat(struct m_inode * inode, struct stat * statbuf) +{ + struct stat tmp; + int i; + + verify_area(statbuf,sizeof (* statbuf)); + tmp.st_dev = inode->i_dev; + tmp.st_ino = inode->i_num; + tmp.st_mode = inode->i_mode; + tmp.st_nlink = inode->i_nlinks; + tmp.st_uid = inode->i_uid; + tmp.st_gid = inode->i_gid; + tmp.st_rdev = inode->i_zone[0]; + tmp.st_size = inode->i_size; + tmp.st_atime = inode->i_atime; + tmp.st_mtime = inode->i_mtime; + tmp.st_ctime = inode->i_ctime; + for (i=0 ; i= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode)) + return -ENOENT; + return cp_stat(inode,statbuf); +} -- cgit v1.2.3