MentOS  0.8.0
The Mentoring Operating System
stat.h
Go to the documentation of this file.
1 
6 #pragma once
7 
9 #define __SYS_STAT_H
10 
11 #include "bits/stat.h"
12 #include "stddef.h"
13 #include "time.h"
14 
18 #define S_IFMT 0xF000
19 #define S_IFSOCK 0xC000
20 #define S_IFLNK 0xA000
21 #define S_IFREG 0x8000
22 #define S_IFBLK 0x6000
23 #define S_IFDIR 0x4000
24 #define S_IFCHR 0x2000
25 #define S_IFIFO 0x1000
27 
31 #define S_ISTYPE(mode, mask) (((mode) & S_IFMT) == (mask))
32 #define S_ISSOCK(mode) (S_ISTYPE(mode, S_IFSOCK))
33 #define S_ISLNK(mode) (S_ISTYPE(mode, S_IFLNK))
34 #define S_ISREG(mode) (S_ISTYPE(mode, S_IFREG))
35 #define S_ISBLK(mode) (S_ISTYPE(mode, S_IFBLK))
36 #define S_ISDIR(mode) (S_ISTYPE(mode, S_IFDIR))
37 #define S_ISCHR(mode) (S_ISTYPE(mode, S_IFCHR))
38 #define S_ISFIFO(mode) (S_ISTYPE(mode, S_IFIFO))
40 
44 #define S_ISUID 0x0800
45 #define S_ISGID 0x0400
46 #define S_ISVTX 0x0200
47 #define S_IRWXU 0x01C0
48 #define S_IRUSR 0x0100
49 #define S_IWUSR 0x0080
50 #define S_IXUSR 0x0040
51 #define S_IRWXG 0x0038
52 #define S_IRGRP 0x0020
53 #define S_IWGRP 0x0010
54 #define S_IXGRP 0x0008
55 #define S_IRWXO 0x0007
56 #define S_IROTH 0x0004
57 #define S_IWOTH 0x0002
58 #define S_IXOTH 0x0001
60 
65 int stat(const char *path, stat_t *buf);
66 
71 int fstat(int fd, stat_t *buf);
72 
77 int mkdir(const char *path, mode_t mode);
78 
82 int rmdir(const char *path);
83 
90 int creat(const char *path, mode_t mode);
Defines the structure used by the functiosn fstat(), lstat(), and stat().
Define basic data types.
unsigned int mode_t
The type of mode.
Definition: stddef.h:49
Data structure which contains information about a file.
Definition: stat.h:16
int mkdir(const char *path, mode_t mode)
Creates a new directory at the given path.
int fstat(int fd, stat_t *buf)
Retrieves information about the file at the given location.
int rmdir(const char *path)
Removes the given directory.
int stat(const char *path, stat_t *buf)
Retrieves information about the file at the given location.
int creat(const char *path, mode_t mode)
Creates a new file or rewrite an existing one.
Time-related functions.