ns-3 Direct Code Execution
Home
Tutorials ▼
Docs ▼
Wiki
Manual
Develop ▼
API
Bugs
API
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
dce-stat.cc
Go to the documentation of this file.
1
#include <sys/stat.h>
2
#include <fcntl.h>
3
#include "
sys/dce-stat.h
"
4
#include "
utils.h
"
5
#include "
process.h
"
6
#include "ns3/log.h"
7
#include "ns3/assert.h"
8
#include <errno.h>
9
#include "
file-usage.h
"
10
11
using namespace
ns3;
12
13
NS_LOG_COMPONENT_DEFINE
(
"SimuStat"
);
14
15
int
dce___xstat
(
int
ver,
const
char
*path,
struct
stat *buf)
16
{
17
Thread
*current =
Current
();
18
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
() << path << buf);
19
NS_ASSERT (current != 0);
20
if
(std::string (path) ==
""
)
21
{
22
current->
err
= ENOENT;
23
return
-1;
24
}
25
int
retval = ::__xstat (ver,
UtilsGetRealFilePath
(path).c_str (), buf);
26
if
(retval == -1)
27
{
28
current->
err
=
errno
;
29
return
-1;
30
}
31
return
retval;
32
}
33
int
dce___xstat64
(
int
ver,
const
char
*path,
struct
stat64 *buf)
34
{
35
Thread
*current =
Current
();
36
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
() << path << buf);
37
NS_ASSERT (current != 0);
38
if
(std::string (path) ==
""
)
39
{
40
current->
err
= ENOENT;
41
return
-1;
42
}
43
int
retval = ::__xstat64 (ver,
UtilsGetRealFilePath
(path).c_str (), buf);
44
if
(retval == -1)
45
{
46
current->
err
=
errno
;
47
return
-1;
48
}
49
return
retval;
50
}
51
int
dce___fxstat
(
int
ver,
int
fd,
struct
stat *buf)
52
{
53
Thread
*current =
Current
();
54
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
() << fd);
55
NS_ASSERT (current != 0);
56
57
OPENED_FD_METHOD
(
int
, Fxstat (ver, buf))
58
}
59
int
dce___fxstat64
(
int
ver,
int
fd,
struct
stat64 *buf)
60
{
61
Thread
*current =
Current
();
62
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
() << fd);
63
NS_ASSERT (current != 0);
64
65
OPENED_FD_METHOD
(
int
, Fxstat64 (ver, buf))
66
}
67
int
dce___lxstat
(
int
ver,
const
char
*pathname,
struct
stat *buf)
68
{
69
Thread
*current =
Current
();
70
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
() << pathname << buf);
71
NS_ASSERT (current != 0);
72
if
(std::string (pathname) ==
""
)
73
{
74
current->
err
= ENOENT;
75
return
-1;
76
}
77
int
retval = ::__lxstat (ver,
UtilsGetRealFilePath
(pathname).c_str (), buf);
78
if
(retval == -1)
79
{
80
current->
err
=
errno
;
81
return
-1;
82
}
83
return
retval;
84
}
85
int
dce___lxstat64
(
int
ver,
const
char
*pathname,
struct
stat64 *buf)
86
{
87
Thread
*current =
Current
();
88
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
() << pathname << buf);
89
NS_ASSERT (current != 0);
90
if
(std::string (pathname) ==
""
)
91
{
92
current->
err
= ENOENT;
93
return
-1;
94
}
95
int
retval = ::__lxstat64 (ver,
UtilsGetRealFilePath
(pathname).c_str (), buf);
96
if
(retval == -1)
97
{
98
current->
err
=
errno
;
99
return
-1;
100
}
101
return
retval;
102
}
103
104
int
dce_fstat
(
int
fd,
struct
stat *buf)
105
{
106
return
dce___fxstat
(_STAT_VER, fd, buf);
107
}
108
int
dce_fstat64
(
int
fd,
struct
stat64 *buf)
109
{
110
return
dce___fxstat64
(_STAT_VER, fd, buf);
111
}
model
dce-stat.cc
Generated on Fri Aug 30 2013 13:57:55 for ns-3-dce by
1.8.1.2