#include "dce-manager.h"
#include "process.h"
#include "utils.h"
#include "unix-fd.h"
#include "unix-file-fd.h"
#include "socket-fd-factory.h"
#include "waiter.h"
#include "dce-fcntl.h"
#include "dce-unistd.h"
#include "dce-poll.h"
#include "dce-stdio.h"
#include "sys/dce-socket.h"
#include "sys/dce-ioctl.h"
#include "sys/dce-stat.h"
#include "sys/dce-mman.h"
#include "sys/dce-select.h"
#include "ns3/log.h"
#include "ns3/event-id.h"
#include "ns3/simulator.h"
#include "ns3/nstime.h"
#include <fcntl.h>
#include <errno.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <sys/mman.h>
#include <sys/types.h>
#include "ns3/node.h"
#include "local-socket-fd-factory.h"
#include "ns3-socket-fd-factory.h"
#include "file-usage.h"
#include "dce-stdlib.h"
#include "pipe-fd.h"
Go to the source code of this file.
Macros | |
#define | _LARGEFILE64_SOURCE 1 |
#define | DEFINE_FORWARDER_PATH(name, pathname,...) |
#define | SOCK_MAX_ADDRESS_SIZE 128 |
Functions | |
int | dce_accept (int fd, struct sockaddr *addr, socklen_t *addrlen) |
int | dce_access (const char *pathname, int mode) |
int | dce_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen) |
int | dce_close (int fd) |
int | dce_connect (int fd, const struct sockaddr *my_addr, socklen_t addrlen) |
int | dce_creat (const char *path, mode_t mode) |
int | dce_dup (int oldfd) |
int | dce_dup2 (int oldfd, int newfd) |
int | dce_fcntl (int fd, int cmd,...) |
int | dce_ftruncate (int fd, off_t length) |
int | dce_ftruncate64 (int fd, off_t length) |
int | dce_getpeername (int fd, struct sockaddr *name, socklen_t *namelen) |
int | dce_getsockname (int fd, struct sockaddr *name, socklen_t *namelen) |
int | dce_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen) |
int | dce_ioctl (int fd, long unsigned int request,...) |
int | dce_isatty (int fd) |
int | dce_listen (int fd, int backlog) |
off_t | dce_lseek (int fildes, off_t offset, int whence) |
off64_t | dce_lseek64 (int fd, off64_t offset, int whence) |
int | dce_mkdir (const char *pathname, mode_t mode) |
void * | dce_mmap (void *addr, size_t length, int prot, int flags, int fd, off_t offset) |
void * | dce_mmap64 (void *start, size_t length, int prot, int flags, int fd, off64_t offset) |
int | dce_munmap (void *start, size_t length) |
int | dce_open (const char *path, int flags,...) |
int | dce_open64 (const char *path, int flags,...) |
int | dce_pipe (int pipefd[2]) |
ssize_t | dce_pread (int fd, void *buf, size_t count, off_t offset) |
ssize_t | dce_pwrite (int fd, const void *buf, size_t count, off_t offset) |
ssize_t | dce_read (int fd, void *buf, size_t count) |
ssize_t | dce_readv (int fd, const struct iovec *iov, int iovcnt) |
ssize_t | dce_recv (int fd, void *buf, size_t count, int flags) |
ssize_t | dce_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) |
ssize_t | dce_recvmsg (int fd, struct msghdr *msg, int flags) |
int | dce_rmdir (const char *pathname) |
ssize_t | dce_send (int fd, const void *buf, size_t len, int flags) |
ssize_t | dce_sendmsg (int fd, const struct msghdr *msg, int flags) |
ssize_t | dce_sendto (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) |
int | dce_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen) |
int | dce_shutdown (int fd, int how) |
int | dce_socket (int domain, int type, int protocol) |
int | dce_socketpair (int domain, int type, int protocol, int sv[2]) |
int | dce_truncate (const char *path, off_t length) |
char * | dce_ttyname (int fd) |
int | dce_unlink (const char *pathname) |
int | dce_unlink_real (const char *pathname) |
ssize_t | dce_write (int fd, const void *buf, size_t count) |
ssize_t | dce_writev (int fd, const struct iovec *iov, int iovcnt) |
NS_LOG_COMPONENT_DEFINE ("SimuFd") | |
void | unlink_notify (std::string fullpath) |
#define DEFINE_FORWARDER_PATH | ( | name, | |
pathname, | |||
... | |||
) |
Definition at line 44 of file dce-fd.cc.
Referenced by dce_access(), dce_mkdir(), dce_rmdir(), and dce_unlink_real().
#define SOCK_MAX_ADDRESS_SIZE 128 |
Definition at line 41 of file dce-fd.cc.
Referenced by dce_recvfrom().
int dce_accept | ( | int | fd, |
struct sockaddr * | addr, | ||
socklen_t * | addrlen | ||
) |
Definition at line 459 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_access | ( | const char * | pathname, |
int | mode | ||
) |
Definition at line 188 of file dce-fd.cc.
References DEFINE_FORWARDER_PATH.
Referenced by ns3::LinuxSocketFdFactory::Access().
int dce_bind | ( | int | fd, |
const struct sockaddr * | my_addr, | ||
socklen_t | addrlen | ||
) |
Definition at line 435 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_getifaddrs().
int dce_close | ( | int | fd | ) |
Definition at line 192 of file dce-fd.cc.
References ns3::FileUsage::CanForget(), ns3::UnixFd::Close(), ns3::Current(), ns3::Thread::err, ns3::UnixFd::GetFdCount(), ns3::FileUsage::GetFile(), ns3::Process::openFiles, ns3::Thread::process, and ns3::UtilsGetNodeId().
Referenced by dce_dup2(), dce_freopen(), dce_getifaddrs(), ns3::dce_internalClosedir(), dce_opendir(), ns3::DceManager::DeleteProcess(), ns3::DceManager::EnsureDirectoryExists(), and anonymous_namespace{dce-stdio.cc}::my_close().
int dce_connect | ( | int | fd, |
const struct sockaddr * | my_addr, | ||
socklen_t | addrlen | ||
) |
Definition at line 443 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_creat | ( | const char * | path, |
mode_t | mode | ||
) |
Definition at line 138 of file dce-fd.cc.
References dce_open().
Referenced by ns3::DceManager::CreatePidFile().
int dce_dup | ( | int | oldfd | ) |
Definition at line 554 of file dce-fd.cc.
References ns3::CheckFdExists(), ns3::Current(), ns3::Thread::err, ns3::UnixFd::IncFdCount(), ns3::Process::openFiles, ns3::Thread::process, ns3::UtilsAllocateFd(), and ns3::UtilsGetNodeId().
Referenced by dce_fcntl().
int dce_dup2 | ( | int | oldfd, |
int | newfd | ||
) |
Definition at line 579 of file dce-fd.cc.
References ns3::CheckFdExists(), ns3::Current(), dce_close(), ns3::Thread::err, ns3::UnixFd::IncFdCount(), MAX_FDS, ns3::Process::openFiles, ns3::Thread::process, and ns3::UtilsGetNodeId().
int dce_fcntl | ( | int | fd, |
int | cmd, | ||
... | |||
) |
Definition at line 656 of file dce-fd.cc.
References ns3::Current(), dce_dup(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_ftruncate | ( | int | fd, |
off_t | length | ||
) |
Definition at line 697 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_ftruncate64(), and dce_truncate().
int dce_ftruncate64 | ( | int | fd, |
off_t | length | ||
) |
Definition at line 715 of file dce-fd.cc.
References ns3::Current(), dce_ftruncate(), and ns3::UtilsGetNodeId().
int dce_getpeername | ( | int | fd, |
struct sockaddr * | name, | ||
socklen_t * | namelen | ||
) |
Definition at line 546 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_getsockname | ( | int | fd, |
struct sockaddr * | name, | ||
socklen_t * | namelen | ||
) |
Definition at line 538 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_getifaddrs().
int dce_getsockopt | ( | int | fd, |
int | level, | ||
int | optname, | ||
void * | optval, | ||
socklen_t * | optlen | ||
) |
Definition at line 529 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_ioctl | ( | int | fd, |
long unsigned int | request, | ||
... | |||
) |
Definition at line 275 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_if_indextoname(), and dce_if_nametoindex().
int dce_isatty | ( | int | fd | ) |
Definition at line 226 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_listen | ( | int | fd, |
int | backlog | ||
) |
Definition at line 451 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
off_t dce_lseek | ( | int | fildes, |
off_t | offset, | ||
int | whence | ||
) |
Definition at line 643 of file dce-fd.cc.
References ns3::Current(), dce_lseek64(), and ns3::UtilsGetNodeId().
Referenced by dce_fdopen(), dce_pread(), dce_pwrite(), anonymous_namespace{dce-stdio.cc}::mode_setup(), and anonymous_namespace{dce-stdio.cc}::my_seek().
off64_t dce_lseek64 | ( | int | fd, |
off64_t | offset, | ||
int | whence | ||
) |
Definition at line 648 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_lseek().
int dce_mkdir | ( | const char * | pathname, |
mode_t | mode | ||
) |
Definition at line 179 of file dce-fd.cc.
References ns3::Current(), DEFINE_FORWARDER_PATH, ns3::Thread::process, and ns3::Process::uMask.
Referenced by ns3::DceManager::EnsureDirectoryExists(), and ns3::LinuxSocketFdFactory::Mkdir().
void* dce_mmap | ( | void * | addr, |
size_t | length, | ||
int | prot, | ||
int | flags, | ||
int | fd, | ||
off_t | offset | ||
) |
Definition at line 615 of file dce-fd.cc.
References dce_mmap64().
void* dce_mmap64 | ( | void * | start, |
size_t | length, | ||
int | prot, | ||
int | flags, | ||
int | fd, | ||
off64_t | offset | ||
) |
Definition at line 621 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD_ERR, and ns3::UtilsGetNodeId().
Referenced by dce_mmap().
int dce_munmap | ( | void * | start, |
size_t | length | ||
) |
Definition at line 630 of file dce-fd.cc.
References ns3::Current(), ns3::Thread::err, errno, and ns3::UtilsGetNodeId().
int dce_open | ( | const char * | path, |
int | flags, | ||
... | |||
) |
Definition at line 78 of file dce-fd.cc.
References ns3::Current(), ns3::Thread::err, errno, ns3::UnixFd::IncFdCount(), ns3::Process::minimizeFiles, ns3::Process::openFiles, ns3::Thread::process, ns3::UtilsAllocateFd(), ns3::UtilsGetNodeId(), and ns3::UtilsGetRealFilePath().
Referenced by dce_creat(), dce_fopen(), dce_fopen64(), dce_freopen(), dce_open64(), dce_opendir(), dce_truncate(), ns3::DceManager::EnsureDirectoryExists(), and ns3::LinuxSocketFdFactory::Open().
int dce_open64 | ( | const char * | path, |
int | flags, | ||
... | |||
) |
Definition at line 67 of file dce-fd.cc.
References dce_open().
int dce_pipe | ( | int | pipefd[2] | ) |
Definition at line 723 of file dce-fd.cc.
References ns3::Current(), ns3::Thread::err, ns3::UnixFd::IncFdCount(), ns3::Process::openFiles, ns3::Thread::process, ns3::UtilsAllocateFd(), and ns3::UtilsGetNodeId().
ssize_t dce_pread | ( | int | fd, |
void * | buf, | ||
size_t | count, | ||
off_t | offset | ||
) |
Definition at line 780 of file dce-fd.cc.
References ns3::Current(), dce_lseek(), dce_read(), ns3::Thread::err, and ns3::UtilsGetNodeId().
ssize_t dce_pwrite | ( | int | fd, |
const void * | buf, | ||
size_t | count, | ||
off_t | offset | ||
) |
Definition at line 810 of file dce-fd.cc.
References ns3::Current(), dce_lseek(), dce_write(), ns3::Thread::err, and ns3::UtilsGetNodeId().
ssize_t dce_read | ( | int | fd, |
void * | buf, | ||
size_t | count | ||
) |
Definition at line 336 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_pread(), dce_readv(), and anonymous_namespace{dce-stdio.cc}::my_read().
ssize_t dce_readv | ( | int | fd, |
const struct iovec * | iov, | ||
int | iovcnt | ||
) |
Definition at line 390 of file dce-fd.cc.
References ns3::Current(), dce_read(), and ns3::Thread::err.
ssize_t dce_recv | ( | int | fd, |
void * | buf, | ||
size_t | count, | ||
int | flags | ||
) |
Definition at line 475 of file dce-fd.cc.
References dce_recvfrom().
ssize_t dce_recvfrom | ( | int | fd, |
void * | buf, | ||
size_t | len, | ||
int | flags, | ||
struct sockaddr * | from, | ||
socklen_t * | fromlen | ||
) |
Definition at line 480 of file dce-fd.cc.
References ns3::Current(), dce_recvmsg(), ns3::Thread::err, and SOCK_MAX_ADDRESS_SIZE.
Referenced by dce_recv().
ssize_t dce_recvmsg | ( | int | fd, |
struct msghdr * | msg, | ||
int | flags | ||
) |
Definition at line 512 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_recvfrom(), and netlink_request().
int dce_rmdir | ( | const char * | pathname | ) |
Definition at line 184 of file dce-fd.cc.
References DEFINE_FORWARDER_PATH.
ssize_t dce_send | ( | int | fd, |
const void * | buf, | ||
size_t | len, | ||
int | flags | ||
) |
Definition at line 242 of file dce-fd.cc.
References dce_sendto().
ssize_t dce_sendmsg | ( | int | fd, |
const struct msghdr * | msg, | ||
int | flags | ||
) |
Definition at line 266 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_sendto().
ssize_t dce_sendto | ( | int | fd, |
const void * | buf, | ||
size_t | len, | ||
int | flags, | ||
const struct sockaddr * | to, | ||
socklen_t | tolen | ||
) |
Definition at line 247 of file dce-fd.cc.
References ns3::Current(), and dce_sendmsg().
Referenced by dce_send(), and netlink_request().
int dce_setsockopt | ( | int | fd, |
int | level, | ||
int | optname, | ||
const void * | optval, | ||
socklen_t | optlen | ||
) |
Definition at line 520 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_shutdown | ( | int | fd, |
int | how | ||
) |
Definition at line 467 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_socket | ( | int | domain, |
int | type, | ||
int | protocol | ||
) |
Definition at line 344 of file dce-fd.cc.
References ns3::Current(), ns3::Thread::err, ns3::UnixFd::IncFdCount(), ns3::Process::manager, ns3::Process::openFiles, ns3::Thread::process, ns3::UtilsAllocateFd(), and ns3::UtilsGetNodeId().
Referenced by dce_getifaddrs(), dce_if_indextoname(), dce_if_nametoindex(), and dce_socketpair().
int dce_socketpair | ( | int | domain, |
int | type, | ||
int | protocol, | ||
int | sv[2] | ||
) |
Definition at line 418 of file dce-fd.cc.
References dce_socket().
int dce_truncate | ( | const char * | path, |
off_t | length | ||
) |
Definition at line 681 of file dce-fd.cc.
References ns3::Current(), dce_ftruncate(), dce_open(), ns3::Thread::err, errno, and ns3::UtilsGetNodeId().
char* dce_ttyname | ( | int | fd | ) |
Definition at line 234 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
int dce_unlink | ( | const char * | pathname | ) |
Definition at line 165 of file dce-fd.cc.
References dce_unlink_real(), unlink_notify(), and ns3::UtilsGetRealFilePath().
int dce_unlink_real | ( | const char * | pathname | ) |
Definition at line 143 of file dce-fd.cc.
References DEFINE_FORWARDER_PATH.
Referenced by dce_unlink().
ssize_t dce_write | ( | int | fd, |
const void * | buf, | ||
size_t | count | ||
) |
Definition at line 288 of file dce-fd.cc.
References ns3::Current(), OPENED_FD_METHOD, and ns3::UtilsGetNodeId().
Referenced by dce_pwrite(), and anonymous_namespace{dce-stdio.cc}::my_write().
ssize_t dce_writev | ( | int | fd, |
const struct iovec * | iov, | ||
int | iovcnt | ||
) |
Definition at line 297 of file dce-fd.cc.
References ns3::CheckFdExists(), ns3::Current(), ns3::Thread::err, ns3::FdDecUsage(), ns3::Process::openFiles, ns3::Thread::process, ns3::UtilsGetNodeId(), and ns3::UnixFd::Write().
NS_LOG_COMPONENT_DEFINE | ( | "SimuFd" | ) |
void unlink_notify | ( | std::string | fullpath | ) |
Definition at line 148 of file dce-fd.cc.
References ns3::Current(), ns3::Process::manager, ns3::Thread::process, ns3::SocketFdFactory::UnlinkNotify(), and ns3::LocalSocketFdFactory::UnlinkNotify().
Referenced by dce_unlink(), and dce_unlinkat().