source: trunk/sys/dietlibc/include/sys/stat.h @ 1

Last change on this file since 1 was 1, checked in by alain, 5 years ago

First import

File size: 3.0 KB
Line 
1/*
2   This file is part of MutekP.
3 
4   MutekP is free software; you can redistribute it and/or modify it
5   under the terms of the GNU General Public License as published by
6   the Free Software Foundation; either version 2 of the License, or
7   (at your option) any later version.
8 
9   MutekP is distributed in the hope that it will be useful, but
10   WITHOUT ANY WARRANTY; without even the implied warranty of
11   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12   General Public License for more details.
13 
14   You should have received a copy of the GNU General Public License
15   along with MutekP; if not, write to the Free Software Foundation,
16   Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 
18   UPMC / LIP6 / SOC (c) 2008
19   Copyright Ghassan Almaless <ghassan.almaless@gmail.com>
20*/
21
22#ifndef _STAT_H_
23#define _STAT_H_
24
25#include <sys/types.h>
26
27typedef uint32_t mode_t;
28
29#define S_IFMT          0x0170000
30#define S_IFSOCK        0x0140000
31#define S_IFLNK         0x0120000
32#define S_IFREG         0x0100000
33#define S_IFBLK         0x0060000
34#define S_IFDIR         0x0040000
35#define S_IFCHR         0x0020000
36#define S_IFIFO         0x0010000
37
38#define S_ISUID         0x0004000
39#define S_ISGID         0x0002000
40#define S_ISVTX         0x0001000
41
42#define S_IRWXU         0x0000700
43#define S_IRUSR         0x0000400
44#define S_IWUSR         0x0000200
45#define S_IXUSR         0x0000100
46
47#define S_IRWXG         0x0000070
48#define S_IRGRP         0x0000040
49#define S_IWGRP         0x0000020
50#define S_IXGRP         0x0000010
51
52#define S_IRWXO         0x0000007
53#define S_IROTH         0x0000004
54#define S_IWOTH         0x0000002
55#define S_IXOTH         0x0000001
56
57#define S_IREAD         S_IRUSR
58#define S_IWRITE        S_IWUSR
59#define S_IEXEC         S_IXUSR
60
61#define S_ISLNK(n)      (((n) & S_IFMT) == S_IFLNK)
62#define S_ISREG(n)      (((n) & S_IFMT) == S_IFREG)
63#define S_ISDIR(n)      (((n) & S_IFMT) == S_IFDIR)
64#define S_ISCHR(n)      (((n) & S_IFMT) == S_IFCHR)
65#define S_ISBLK(n)      (((n) & S_IFMT) == S_IFBLK)
66#define S_ISFIFO(n)     (((n) & S_IFMT) == S_IFIFO)
67#define S_ISSOCK(n)     (((n) & S_IFMT) == S_IFSOCK)
68
69
70struct stat
71{
72  dev_t     st_dev;     /* ID of device containing file */
73  ino_t     st_ino;     /* inode number */
74  mode_t    st_mode;    /* protection */
75  nlink_t   st_nlink;   /* number of hard links */
76  uid_t     st_uid;     /* user ID of owner */
77  gid_t     st_gid;     /* group ID of owner */
78  dev_t     st_rdev;    /* device ID (if special file) */
79  uint64_t  st_size;    /* total size, in bytes */
80  blksize_t st_blksize; /* blocksize for file system I/O */
81  blkcnt_t  st_blocks;  /* number of 512B blocks allocated */
82  time_t    st_atime;   /* time of last access */
83  time_t    st_mtime;   /* time of last modification */
84  time_t    st_ctime;   /* time of last status change */
85};
86
87int stat(const char *path, struct stat *buf);
88int fstat(int fd, struct stat *buf);
89int lstat(const char *path, struct stat *buf);
90int chmod(const char *path, mode_t mode);
91
92int mkdir(const char *pathname, mode_t mode);
93int mkfifo(const char *pathname, mode_t mode);
94
95#endif
Note: See TracBrowser for help on using the repository browser.