1 |
27 |
unneback |
#ifndef CYGONCE_ISO_STAT_H
|
2 |
|
|
#define CYGONCE_ISO_STAT_H
|
3 |
|
|
/*========================================================================
|
4 |
|
|
//
|
5 |
|
|
// stat.h
|
6 |
|
|
//
|
7 |
|
|
// POSIX file characteristics
|
8 |
|
|
//
|
9 |
|
|
//========================================================================
|
10 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
18 |
|
|
//
|
19 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
20 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
21 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
22 |
|
|
// for more details.
|
23 |
|
|
//
|
24 |
|
|
// You should have received a copy of the GNU General Public License along
|
25 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
26 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
27 |
|
|
//
|
28 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
29 |
|
|
// or inline functions from this file, or you compile this file and link it
|
30 |
|
|
// with other works to produce a work based on this file, this file does not
|
31 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
32 |
|
|
// License. However the source code for this file must still be made available
|
33 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
34 |
|
|
//
|
35 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
36 |
|
|
// this file might be covered by the GNU General Public License.
|
37 |
|
|
//
|
38 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
39 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//========================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): jlarmour
|
46 |
|
|
// Contributors:
|
47 |
|
|
// Date: 2000-05-08
|
48 |
|
|
// Purpose: This file provides the macros, types and functions
|
49 |
|
|
// for file characteristics required by POSIX 1003.1.
|
50 |
|
|
// Description: The real contents of this file get set from the
|
51 |
|
|
// configuration (set by the implementation)
|
52 |
|
|
// Usage: #include <sys/stat.h>
|
53 |
|
|
//
|
54 |
|
|
//####DESCRIPTIONEND####
|
55 |
|
|
//
|
56 |
|
|
//======================================================================
|
57 |
|
|
*/
|
58 |
|
|
|
59 |
|
|
/* CONFIGURATION */
|
60 |
|
|
|
61 |
|
|
#include <pkgconf/isoinfra.h> /* Configuration header */
|
62 |
|
|
|
63 |
|
|
/* INCLUDES */
|
64 |
|
|
|
65 |
|
|
#ifdef CYGBLD_ISO_STAT_DEFS_HEADER
|
66 |
|
|
# include CYGBLD_ISO_STAT_DEFS_HEADER
|
67 |
|
|
#else
|
68 |
|
|
|
69 |
|
|
#include <sys/types.h> /* ino_t, dev_t, etc. */
|
70 |
|
|
#include <time.h> /* time_t */
|
71 |
|
|
|
72 |
|
|
#define __stat_mode_DIR (1<<0)
|
73 |
|
|
#define __stat_mode_CHR (1<<1)
|
74 |
|
|
#define __stat_mode_BLK (1<<2)
|
75 |
|
|
#define __stat_mode_REG (1<<3)
|
76 |
|
|
#define __stat_mode_FIFO (1<<4)
|
77 |
|
|
#define __stat_mode_MQ (1<<5)
|
78 |
|
|
#define __stat_mode_SEM (1<<6)
|
79 |
|
|
#define __stat_mode_SHM (1<<7)
|
80 |
|
|
|
81 |
|
|
#define S_ISDIR(__mode) ((__mode) & __stat_mode_DIR )
|
82 |
|
|
#define S_ISCHR(__mode) ((__mode) & __stat_mode_CHR )
|
83 |
|
|
#define S_ISBLK(__mode) ((__mode) & __stat_mode_BLK )
|
84 |
|
|
#define S_ISREG(__mode) ((__mode) & __stat_mode_REG )
|
85 |
|
|
#define S_ISFIFO(__mode) ((__mode) & __stat_mode_FIFO )
|
86 |
|
|
|
87 |
|
|
#define S_TYPEISMQ(__buf) ((__buf)->st_mode & __stat_mode_MQ )
|
88 |
|
|
#define S_TYPEISSEM(__buf) ((__buf)->st_mode & __stat_mode_SEM )
|
89 |
|
|
#define S_TYPEISSHM(__buf) ((__buf)->st_mode & __stat_mode_SHM )
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
#define S_IRUSR (1<<8)
|
93 |
|
|
#define S_IWUSR (1<<9)
|
94 |
|
|
#define S_IXUSR (1<<10)
|
95 |
|
|
#define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
|
96 |
|
|
|
97 |
|
|
#define S_IRGRP (1<<11)
|
98 |
|
|
#define S_IWGRP (1<<12)
|
99 |
|
|
#define S_IXGRP (1<<13)
|
100 |
|
|
#define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
|
101 |
|
|
|
102 |
|
|
#define S_IROTH (1<<14)
|
103 |
|
|
#define S_IWOTH (1<<15)
|
104 |
|
|
#define S_IXOTH (1<<16)
|
105 |
|
|
#define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
|
106 |
|
|
|
107 |
|
|
#define S_ISUID (1<<17)
|
108 |
|
|
#define S_ISGID (1<<18)
|
109 |
|
|
|
110 |
|
|
|
111 |
|
|
struct stat {
|
112 |
|
|
mode_t st_mode; /* File mode */
|
113 |
|
|
ino_t st_ino; /* File serial number */
|
114 |
|
|
dev_t st_dev; /* ID of device containing file */
|
115 |
|
|
nlink_t st_nlink; /* Number of hard links */
|
116 |
|
|
uid_t st_uid; /* User ID of the file owner */
|
117 |
|
|
gid_t st_gid; /* Group ID of the file's group */
|
118 |
|
|
off_t st_size; /* File size (regular files only) */
|
119 |
|
|
time_t st_atime; /* Last access time */
|
120 |
|
|
time_t st_mtime; /* Last data modification time */
|
121 |
|
|
time_t st_ctime; /* Last file status change time */
|
122 |
|
|
};
|
123 |
|
|
|
124 |
|
|
#endif /* ifndef CYGBLD_ISO_STAT_DEFS_HEADER */
|
125 |
|
|
|
126 |
|
|
/* PROTOTYPES */
|
127 |
|
|
|
128 |
|
|
__externC int stat( const char *path, struct stat *buf );
|
129 |
|
|
|
130 |
|
|
__externC int fstat( int fd, struct stat *buf );
|
131 |
|
|
|
132 |
|
|
__externC int mkdir(const char *path, mode_t mode);
|
133 |
|
|
|
134 |
|
|
#endif /* CYGONCE_ISO_STAT_H multiple inclusion protection */
|
135 |
|
|
|
136 |
|
|
/* EOF stat.h */
|