OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [isoinfra/] [current/] [include/] [sys/] [stat.h] - Blame information for rev 865

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#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 Free Software Foundation, 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
18
// version.
19
//
20
// eCos is distributed in the hope that it will be useful, but WITHOUT
21
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
23
// for more details.
24
//
25
// You should have received a copy of the GNU General Public License
26
// along with eCos; if not, write to the Free Software Foundation, Inc.,
27
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
28
//
29
// As a special exception, if other files instantiate templates or use
30
// macros or inline functions from this file, or you compile this file
31
// and link it with other works to produce a work based on this file,
32
// this file does not by itself cause the resulting work to be covered by
33
// the GNU General Public License. However the source code for this file
34
// must still be made available in accordance with section (3) of the GNU
35
// General Public License v2.
36
//
37
// This exception does not invalidate any other reasons why a work based
38
// on this file might be covered by the GNU General Public License.
39
// -------------------------------------------
40
// ####ECOSGPLCOPYRIGHTEND####
41
//========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):     jlarmour
45
// Contributors:
46
// Date:          2000-05-08
47
// Purpose:       This file provides the macros, types and functions
48
//                for file characteristics required by POSIX 1003.1.
49
// Description:   The real contents of this file get set from the
50
//                configuration (set by the implementation)
51
// Usage:         #include <sys/stat.h>
52
//
53
//####DESCRIPTIONEND####
54
//
55
//======================================================================
56
*/
57
 
58
/* CONFIGURATION */
59
 
60
#include <pkgconf/isoinfra.h>          /* Configuration header */
61
 
62
/* INCLUDES */
63
 
64
#include <cyg/infra/cyg_type.h>       /* __externC */
65
 
66
#ifdef CYGBLD_ISO_STAT_DEFS_HEADER
67
# include CYGBLD_ISO_STAT_DEFS_HEADER
68
#else
69
 
70
#include <sys/types.h>   /* ino_t, dev_t, etc. */
71
#include <time.h>        /* time_t */
72
 
73
#define __stat_mode_DIR    (1<<0)
74
#define __stat_mode_CHR    (1<<1)
75
#define __stat_mode_BLK    (1<<2)
76
#define __stat_mode_REG    (1<<3)
77
#define __stat_mode_FIFO   (1<<4)
78
#define __stat_mode_MQ     (1<<5)
79
#define __stat_mode_SEM    (1<<6)
80
#define __stat_mode_SHM    (1<<7)
81
#define __stat_mode_LNK    (1<<8)
82
#define __stat_mode_SOCK   (1<<9)
83
 
84
#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE >= 200112L)
85
#define S_IFDIR          (__stat_mode_DIR)
86
#define S_IFCHR          (__stat_mode_CHR)
87
#define S_IFBLK          (__stat_mode_BLK)
88
#define S_IFREG          (__stat_mode_REG)
89
#define S_IFIFO          (__stat_mode_FIFO)
90
#define S_IFLNK          (__stat_mode_LNK)
91
#define S_IFSOCK         (__stat_mode_SOCK)
92
#define S_IFMT           (S_IFDIR|S_IFCHR|S_IFBLK|S_IFREG| \
93
                          S_IFIFO|S_IFLNK|S_IFSOCK)
94
#endif
95
 
96
#define S_ISDIR(__mode)  ((__mode) & __stat_mode_DIR )
97
#define S_ISCHR(__mode)  ((__mode) & __stat_mode_CHR )
98
#define S_ISBLK(__mode)  ((__mode) & __stat_mode_BLK )
99
#define S_ISREG(__mode)  ((__mode) & __stat_mode_REG )
100
#define S_ISFIFO(__mode) ((__mode) & __stat_mode_FIFO )
101
#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE >= 200112L)
102
#define S_ISLNK(__mode)  ((__mode) & __stat_mode_LNK )
103
#define S_ISSOCK(__mode)  ((__mode) & __stat_mode_SOCK )
104
#endif
105
 
106
#define S_TYPEISMQ(__buf)   ((__buf)->st_mode & __stat_mode_MQ )
107
#define S_TYPEISSEM(__buf)  ((__buf)->st_mode & __stat_mode_SEM )
108
#define S_TYPEISSHM(__buf)  ((__buf)->st_mode & __stat_mode_SHM )
109
 
110
 
111
#define S_IRUSR  (1<<16)
112
#define S_IWUSR  (1<<17)
113
#define S_IXUSR  (1<<18)
114
#define S_IRWXU  (S_IRUSR|S_IWUSR|S_IXUSR)
115
 
116
#define S_IRGRP  (1<<19)
117
#define S_IWGRP  (1<<20)
118
#define S_IXGRP  (1<<21)
119
#define S_IRWXG  (S_IRGRP|S_IWGRP|S_IXGRP)
120
 
121
#define S_IROTH  (1<<22)
122
#define S_IWOTH  (1<<23)
123
#define S_IXOTH  (1<<24)
124
#define S_IRWXO  (S_IROTH|S_IWOTH|S_IXOTH)
125
 
126
#define S_ISUID  (1<<25)
127
#define S_ISGID  (1<<26)
128
 
129
 
130
struct stat {
131
    mode_t  st_mode;     /* File mode */
132
    ino_t   st_ino;      /* File serial number */
133
    dev_t   st_dev;      /* ID of device containing file */
134
    nlink_t st_nlink;    /* Number of hard links */
135
    uid_t   st_uid;      /* User ID of the file owner */
136
    gid_t   st_gid;      /* Group ID of the file's group */
137
    off_t   st_size;     /* File size (regular files only) */
138
    time_t  st_atime;    /* Last access time */
139
    time_t  st_mtime;    /* Last data modification time */
140
    time_t  st_ctime;    /* Last file status change time */
141
};
142
 
143
#endif /* ifndef CYGBLD_ISO_STAT_DEFS_HEADER */
144
 
145
/* PROTOTYPES */
146
 
147
__externC int stat( const char *path, struct stat *buf );
148
 
149
__externC int fstat( int fd, struct stat *buf );
150
 
151
__externC int mkdir(const char *path, mode_t mode);
152
 
153
__externC int chmod(const char *path, mode_t mode);
154
 
155
#endif /* CYGONCE_ISO_STAT_H multiple inclusion protection */
156
 
157
/* EOF stat.h */

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.