82 lines
1.9 KiB
C
82 lines
1.9 KiB
C
#ifndef _SYS_STAT_H
|
|
#define _SYS_STAT_H
|
|
|
|
#include <luna/vfs.h>
|
|
#include <sys/types.h>
|
|
|
|
struct stat // FIXME: This struct is quite stubbed out.
|
|
{
|
|
ino_t st_ino;
|
|
mode_t st_mode;
|
|
off_t st_size;
|
|
int st_dev; // Not implemented.
|
|
int st_nlink; // Not implemented.
|
|
uid_t st_uid;
|
|
gid_t st_gid;
|
|
time_t st_atime;
|
|
time_t st_mtime;
|
|
time_t st_ctime;
|
|
};
|
|
|
|
/* Type of file. */
|
|
#define S_IFMT 070000
|
|
/* Directory. */
|
|
#define S_IFDIR __VFS_TO_IFMT(__VFS_DIRECTORY)
|
|
/* Regular file. */
|
|
#define S_IFREG __VFS_TO_IFMT(__VFS_FILE)
|
|
/* Character device. */
|
|
#define S_IFCHR __VFS_TO_IFMT(__VFS_DEVICE)
|
|
|
|
#define __S_IFCMP(mode, value) (mode & S_IFMT) == value
|
|
|
|
/* Is it a directory? */
|
|
#define S_ISDIR(mode) (__S_IFCMP((mode), S_IFDIR))
|
|
/* Is it a regular file? */
|
|
#define S_ISREG(mode) (__S_IFCMP((mode), S_IFREG))
|
|
/* Is it a character device? */
|
|
#define S_ISCHR(mode) (__S_IFCMP((mode), S_IFCHR))
|
|
|
|
// Not implemented.
|
|
#define S_ISBLK(mode) ((mode)&0)
|
|
#define S_ISFIFO(mode) ((mode)&0)
|
|
|
|
#define S_IRWXU 0700
|
|
#define S_IRUSR 0400
|
|
#define S_IWUSR 0200
|
|
#define S_IXUSR 0100
|
|
#define S_IRWXG 070
|
|
#define S_IRGRP 040
|
|
#define S_IWGRP 020
|
|
#define S_IXGRP 010
|
|
#define S_IRWXO 07
|
|
#define S_IROTH 04
|
|
#define S_IWOTH 02
|
|
#define S_IXOTH 01
|
|
#define S_ISUID 04000
|
|
#define S_ISGID 02000
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
/* Creates a new directory at the path pathname with the specified mode. */
|
|
int mkdir(const char* pathname, mode_t mode);
|
|
|
|
/* Returns information about the file pointed to by fd in buf. */
|
|
int fstat(int fd, struct stat* buf);
|
|
|
|
/* Returns information about the file pointed at path in buf. */
|
|
int stat(const char* pathname, struct stat* buf);
|
|
|
|
/* Changes the current process' file creation mask. */
|
|
mode_t umask(mode_t cmask);
|
|
|
|
int chmod(const char* pathname, mode_t mode); // Not implemented.
|
|
int fchmod(int fd, mode_t mode); // Not implemented.
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif |