summaryrefslogtreecommitdiff
path: root/ace/os_include/sys/stat.h
blob: 1f00680de5347df90dbab1256964782b9100a134 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// -*- C++ -*-

//=============================================================================
/**
 *  @file    stat.h
 *
 *  data returned by the stat() function 
 *
 *  $Id$
 *
 *  @author Don Hinton <dhinton@ieee.org>
 *  @author This code was originally in various places including ace/OS.h.
 */
//=============================================================================

#ifndef ACE_OS_INCLUDE_SYS_STAT_H
#define ACE_OS_INCLUDE_SYS_STAT_H

#include "ace/pre.h"

#include "ace/config-all.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/os_include/sys/types.h"

#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
#  include <direct.h>
#endif /* ACE_WIN32 && !ACE_HAS_WINCE */

#if !defined (ACE_LACKS_SYS_STAT_H)
# include /**/ <sys/stat.h>
#endif /* !ACE_LACKS_SYS_STAT_H */

# if defined (ACE_LACKS_MODE_MASKS)
// MODE MASKS

// the following macros are for POSIX conformance.

#   if !defined (ACE_HAS_USER_MODE_MASKS)
#     define S_IRWXU 00700         /* read, write, execute: owner. */
#     define S_IRUSR 00400         /* read permission: owner. */
#     define S_IWUSR 00200         /* write permission: owner. */
#     define S_IXUSR 00100         /* execute permission: owner. */
#   endif /* ACE_HAS_USER_MODE_MASKS */
#   define S_IRWXG 00070           /* read, write, execute: group. */
#   define S_IRGRP 00040           /* read permission: group. */
#   define S_IWGRP 00020           /* write permission: group. */
#   define S_IXGRP 00010           /* execute permission: group. */
#   define S_IRWXO 00007           /* read, write, execute: other. */
#   define S_IROTH 00004           /* read permission: other. */
#   define S_IWOTH 00002           /* write permission: other. */
#   define S_IXOTH 00001           /* execute permission: other. */

// eVC doesn't define these bits, but MSVC does. The bit settings are copied
// from the MSVC defs.
#   if defined (ACE_HAS_WINCE)
#     define S_IFDIR 0040000
#     define S_IFREG 0100000
#   endif /* ACE_HAS_WINCE */
# endif /* ACE_LACKS_MODE_MASKS */

#if defined (ACE_HAS_WINCE)
struct stat
{
    /// always 0 on Windows platforms
    dev_t st_dev;

    /// always 0 on Windows platforms
    dev_t st_rdev;

    /// file attribute
    unsigned short st_mode;

    /// number of hard links
    short st_nlink;

    /// time of last access
    ACE_Time_Value st_atime;

    /// time of last data modification
    ACE_Time_Value st_mtime;

    /// time of creation
    ACE_Time_Value st_ctime;

    /// file size, in bytes
    off_t st_size;

    // Following members do not have direct conversion in Window platforms.
//    u_long st_blksize;        // optimal blocksize for I/O
//    u_long st_flags;          // user defined flags for file
};
#endif /* ACE_HAS_WINCE */

#if defined (__BORLANDC__)
#  if (__BORLANDC__ <= 0x540)
#    define _stat stat
#  endif
#  define _umask umask
#  define _fstat fstat
#endif /* __BORLANDC__ */

#if defined (ACE_PSOS_SNARFS_HEADER_INFO)
   // Header information snarfed from compiler provided header files
   // that are not included because there is already an identically
   // named file provided with pSOS, which does not have this info
   // from compiler supplied header
   extern mode_t umask (mode_t);
   extern int mkfifo (const char *, mode_t);
   extern int mkdir (const char *, mode_t);
#endif /* ACE_PSOS_SNARFS_HEADER_INFO */

#include "ace/post.h"
#endif /* ACE_OS_INCLUDE_SYS_STAT_H */