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-timerfd.cc
Go to the documentation of this file.
1
#include "
sys/dce-timerfd.h
"
2
#include "
utils.h
"
3
#include "
process.h
"
4
#include "
unix-timer-fd.h
"
5
#include "ns3/log.h"
6
#include <errno.h>
7
#include "
file-usage.h
"
8
using namespace
ns3;
9
10
NS_LOG_COMPONENT_DEFINE
(
"SimuTimerFd"
);
11
12
int
dce_timerfd_create
(
int
clockid,
int
flags)
13
{
14
Thread
*current =
Current
();
15
NS_LOG_FUNCTION (current <<
UtilsGetNodeId
() << clockid << flags);
16
NS_ASSERT (current != 0);
17
18
int
fd =
UtilsAllocateFd
();
19
if
(fd == -1)
20
{
21
current->
err
= EMFILE;
22
return
-1;
23
}
24
25
UnixFd
*unixFd =
new
UnixTimerFd
(clockid, flags);
26
unixFd->
IncFdCount
();
27
current->
process
->
openFiles
[fd] =
new
FileUsage
(fd, unixFd);
28
return
fd;
29
}
30
31
int
dce_timerfd_settime
(
int
fd,
int
flags,
32
const
struct
itimerspec *new_value,
33
struct
itimerspec *old_value)
34
{
35
NS_LOG_FUNCTION (
Current
() <<
UtilsGetNodeId
() << fd << flags << new_value << old_value);
36
NS_ASSERT (
Current
() != 0);
37
Thread
*current =
Current
();
38
39
OPENED_FD_METHOD
(
int
, Settime (flags, new_value, old_value))
40
}
41
42
int
dce_timerfd_gettime
(
int
fd,
struct
itimerspec *cur_value)
43
{
44
NS_LOG_FUNCTION (
Current
() <<
UtilsGetNodeId
() << fd << cur_value);
45
NS_ASSERT (
Current
() != 0);
46
Thread
*current =
Current
();
47
48
OPENED_FD_METHOD
(
int
, Gettime (cur_value))
49
}
50
model
dce-timerfd.cc
Generated on Fri Aug 30 2013 13:57:55 for ns-3-dce by
1.8.1.2