summaryrefslogtreecommitdiff
path: root/ace/os_include/fcntl.h
blob: 1a3a5d0d9d9ada4746b090e389be718d07f1e251 (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
/* -*- C++ -*- */

//=============================================================================
/**
 *  @file    fctnl.h
 *
 *  $Id$
 *
 *  @author Douglas C. Schmidt (schmidt@cs.wustl.edu)
 *  @author etc
 */
//=============================================================================

#ifndef ACE_OS_INCLUDE_FCNTL_H
# define ACE_OS_INCLUDE_FCNTL_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"

// Only include if platform/compiler provide the header.
# if !defined (ACE_LACKS_FCNTL_H)
#   include /**/ <fcntl.h>
# endif /* !ACE_LACKS_FCNTL_H */

// Include additional/alternate headers for certain platfor/compiler combinations.
# if defined (ACE_NEEDS_SYS_FCNTL_H)
#   include /**/ <sys/fcntl.h>
# endif /* ACE_NEEDS_SYS_FCNTL_H) */

// defined Win32 specific macros for UNIX platforms
# if !defined (O_BINARY)
#   define O_BINARY 0
# endif /* O_BINARY */
# if !defined (_O_BINARY)
#   define _O_BINARY O_BINARY
# endif /* _O_BINARY */
# if !defined (O_TEXT)
#   define O_TEXT 0
# endif /* O_TEXT */
# if !defined (_O_TEXT)
#   define _O_TEXT O_TEXT
# endif /* _O_TEXT */
# if !defined (O_RAW)
#   define O_RAW 0
# endif /* O_RAW */
# if !defined (_O_RAW)
#   define _O_RAW O_RAW
# endif /* _O_RAW */

# if !defined (O_NONBLOCK)
#   define O_NONBLOCK  1
# endif /* O_NONBLOCK  */

# if defined (ACE_HAS_POSIX_NONBLOCK)
#   define ACE_NONBLOCK O_NONBLOCK
# else
#   define ACE_NONBLOCK O_NDELAY
# endif /* ACE_HAS_POSIX_NONBLOCK */

# if defined (ACE_LACKS_FILELOCKS)
#   if ! defined (VXWORKS) && ! defined (ACE_PSOS) && ! defined (__rtems__)
// VxWorks defines struct flock in sys/fcntlcom.h.  But it doesn't
// appear to support flock ().  RTEMS defines struct flock but
// currently does not support locking.
struct flock
{
  short l_type;
  short l_whence;
  off_t l_start;
  off_t l_len;          /* len == 0 means until end of file */
  long  l_sysid;
  pid_t l_pid;
  long  l_pad[4];               /* reserve area */
};
#   endif /* ! VXWORKS */
# endif /* ACE_LACKS_FILELOCKS */


struct ace_flock_t
{
# if defined (ACE_WIN32)
  ACE_OVERLAPPED overlapped_;
# else
  struct flock lock_;
# endif /* ACE_WIN32 */

  /// Name of this filelock.
  const ACE_TCHAR *lockname_;

  /// Handle to the underlying file.
  ACE_HANDLE handle_;

# if defined (CHORUS)
  /// This is the mutex that's stored in shared memory.  It can only
  /// be destroyed by the actor that initialized it.
  ACE_mutex_t *process_lock_;
# endif /* CHORUS */
};

#endif /* ACE_OS_INCLUDE_FCNTL_H */