DMTCP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions | Variables
nosyscallsreal.c File Reference
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/select.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <ctype.h>
#include <syslog.h>
#include "constants.h"
#include "syscallwrappers.h"

Go to the source code of this file.

Macros

#define _GNU_SOURCE
 
#define _XOPEN_SOURCE   500
 
#define REAL_FUNC_PASSTHROUGH(name)   return name
 
#define REAL_FUNC_PASSTHROUGH_TYPED(type, name)   REAL_FUNC_PASSTHROUGH(name)
 
#define REAL_FUNC_PASSTHROUGH_TYPED_DLSYM(type, name)   return dlsym(RTLD_NEXT, #name)
 
#define REAL_FUNC_PASSTHROUGH_PID_T(name)   REAL_FUNC_PASSTHROUGH(name)
 
#define REAL_FUNC_PASSTHROUGH_VOID(name)   name
 
#define SYMBOL_NOT_FOUND_ERROR(name)
 

Functions

void _dmtcp_lock ()
 
void _dmtcp_unlock ()
 
void initialize_wrappers ()
 
int _real_pthread_mutex_lock (pthread_mutex_t *mutex)
 
int _real_pthread_mutex_trylock (pthread_mutex_t *mutex)
 
int _real_pthread_mutex_unlock (pthread_mutex_t *mutex)
 
int _real_pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
 
int _real_pthread_rwlock_rdlock (pthread_rwlock_t *rwlock)
 
int _real_pthread_rwlock_wrlock (pthread_rwlock_t *rwlock)
 
ssize_t _real_read (int fd, void *buf, size_t count)
 
ssize_t _real_write (int fd, const void *buf, size_t count)
 
int _real_select (int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
 
int _real_socket (int domain, int type, int protocol)
 call the libc version of this function via dlopen/dlsym More...
 
int _real_connect (int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen)
 call the libc version of this function via dlopen/dlsym More...
 
int _real_bind (int sockfd, const struct sockaddr *my_addr, socklen_t addrlen)
 call the libc version of this function via dlopen/dlsym More...
 
int _real_listen (int sockfd, int backlog)
 call the libc version of this function via dlopen/dlsym More...
 
int _real_accept (int sockfd, struct sockaddr *addr, socklen_t *addrlen)
 call the libc version of this function via dlopen/dlsym More...
 
int _real_setsockopt (int s, int level, int optname, const void *optval, socklen_t optlen)
 call the libc version of this function via dlopen/dlsym More...
 
int _real_getsockopt (int s, int level, int optname, void *optval, socklen_t *optlen)
 
int _real_execve (const char *filename, char *const argv[], char *const envp[])
 
int _real_execv (const char *path, char *const argv[])
 
int _real_execvp (const char *file, char *const argv[])
 
int _real_system (const char *cmd)
 
pid_t _real_fork (void)
 
int _real_close (int fd)
 
int _real_fclose (FILE *fp)
 
int _real_dup (int oldfd)
 
int _real_dup2 (int oldfd, int newfd)
 
void _real_exit (int status)
 
LIB_PRIVATE int _real_fcntl (int fd, int cmd, void *arg)
 
int _real_ptsname_r (int fd, char *buf, size_t buflen)
 
int _real_socketpair (int d, int type, int protocol, int sv[2])
 
void _real_openlog (const char *ident, int option, int facility)
 
void _real_closelog (void)
 
int _dmtcp_unsetenv (const char *name)
 
off_t _real_lseek (int fd, off_t offset, int whence)
 
pid_t _real_getpid (void)
 
pid_t _real_getppid (void)
 
int _real_tcsetpgrp (int fd, pid_t pgrp)
 
int _real_tcgetpgrp (int fd)
 
pid_t _real_getpgrp (void)
 
pid_t _real_setpgrp (void)
 
pid_t _real_getpgid (pid_t pid)
 
int _real_setpgid (pid_t pid, pid_t pgid)
 
pid_t _real_getsid (pid_t pid)
 
pid_t _real_setsid (void)
 
int _real_kill (pid_t pid, int sig)
 
pid_t _real_wait (__WAIT_STATUS stat_loc)
 
pid_t _real_waitpid (pid_t pid, int *stat_loc, int options)
 
int _real_waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options)
 
pid_t _real_wait3 (__WAIT_STATUS status, int options, struct rusage *rusage)
 
pid_t _real_wait4 (pid_t pid, __WAIT_STATUS status, int options, struct rusage *rusage)
 
int _real_ioctl (int d, unsigned long int request,...)
 
LIB_PRIVATE void * _real_mmap (void *addr, size_t length, int prot, int flags, int fd, off_t offset)
 
LIB_PRIVATE int _real_munmap (void *addr, size_t length)
 
long _real_syscall (long sys_num,...)
 
LIB_PRIVATE pid_t dmtcp_gettid ()
 
LIB_PRIVATE int dmtcp_tkill (int tid, int sig)
 
LIB_PRIVATE int dmtcp_tgkill (int tgid, int tid, int sig)
 
int _real_open (const char *pathname, int flags,...)
 
int _real_open64 (const char *pathname, int flags,...)
 
FILE * _real_fopen (const char *path, const char *mode)
 
FILE * _real_fopen64 (const char *path, const char *mode)
 
int _real_shmget (key_t key, size_t size, int shmflg)
 
void * _real_shmat (int shmid, const void *shmaddr, int shmflg)
 
int _real_shmdt (const void *shmaddr)
 
int _real_shmctl (int shmid, int cmd, struct shmid_ds *buf)
 
LIB_PRIVATE int _real_poll (struct pollfd *fds, nfds_t nfds, int timeout)
 
ssize_t _real_readlink (const char *path, char *buf, size_t bufsiz)
 
void _dmtcp_setup_trampolines ()
 

Variables

int send_sigwinch
 

Macro Definition Documentation

#define _GNU_SOURCE

Definition at line 23 of file nosyscallsreal.c.

#define _XOPEN_SOURCE   500

Definition at line 24 of file nosyscallsreal.c.

#define REAL_FUNC_PASSTHROUGH (   name)    return name

Definition at line 76 of file nosyscallsreal.c.

#define REAL_FUNC_PASSTHROUGH_PID_T (   name)    REAL_FUNC_PASSTHROUGH(name)

Definition at line 81 of file nosyscallsreal.c.

#define REAL_FUNC_PASSTHROUGH_TYPED (   type,
  name 
)    REAL_FUNC_PASSTHROUGH(name)

Definition at line 78 of file nosyscallsreal.c.

#define REAL_FUNC_PASSTHROUGH_TYPED_DLSYM (   type,
  name 
)    return dlsym(RTLD_NEXT, #name)

Definition at line 79 of file nosyscallsreal.c.

#define REAL_FUNC_PASSTHROUGH_VOID (   name)    name

Definition at line 84 of file nosyscallsreal.c.

#define SYMBOL_NOT_FOUND_ERROR (   name)
Value:
fprintf(stderr, "ERROR: DMTCP internal error.\n" \
" Symbol %s not found!\n", #name); \
abort(); \
return -1;

Definition at line 86 of file nosyscallsreal.c.

Function Documentation

void _dmtcp_lock ( )

Definition at line 92 of file nosyscallsreal.c.

void _dmtcp_setup_trampolines ( )

Definition at line 446 of file nosyscallsreal.c.

void _dmtcp_unlock ( )

Definition at line 93 of file nosyscallsreal.c.

int _dmtcp_unsetenv ( const char *  name)

Definition at line 261 of file nosyscallsreal.c.

int _real_accept ( int  sockfd,
struct sockaddr *  addr,
socklen_t *  addrlen 
)

call the libc version of this function via dlopen/dlsym

Definition at line 161 of file nosyscallsreal.c.

int _real_bind ( int  sockfd,
const struct sockaddr *  my_addr,
socklen_t  addrlen 
)

call the libc version of this function via dlopen/dlsym

Definition at line 149 of file nosyscallsreal.c.

int _real_close ( int  fd)

Definition at line 205 of file nosyscallsreal.c.

void _real_closelog ( void  )

Definition at line 256 of file nosyscallsreal.c.

int _real_connect ( int  sockfd,
const struct sockaddr *  serv_addr,
socklen_t  addrlen 
)

call the libc version of this function via dlopen/dlsym

Definition at line 143 of file nosyscallsreal.c.

int _real_dup ( int  oldfd)

Definition at line 215 of file nosyscallsreal.c.

int _real_dup2 ( int  oldfd,
int  newfd 
)

Definition at line 220 of file nosyscallsreal.c.

int _real_execv ( const char *  path,
char *const  argv[] 
)

Definition at line 185 of file nosyscallsreal.c.

int _real_execve ( const char *  filename,
char *const  argv[],
char *const  envp[] 
)

Definition at line 179 of file nosyscallsreal.c.

int _real_execvp ( const char *  file,
char *const  argv[] 
)

Definition at line 190 of file nosyscallsreal.c.

void _real_exit ( int  status)

Definition at line 230 of file nosyscallsreal.c.

int _real_fclose ( FILE *  fp)

Definition at line 210 of file nosyscallsreal.c.

LIB_PRIVATE int _real_fcntl ( int  fd,
int  cmd,
void *  arg 
)

Definition at line 236 of file nosyscallsreal.c.

FILE* _real_fopen ( const char *  path,
const char *  mode 
)

Definition at line 412 of file nosyscallsreal.c.

FILE* _real_fopen64 ( const char *  path,
const char *  mode 
)

Definition at line 416 of file nosyscallsreal.c.

pid_t _real_fork ( void  )

Definition at line 200 of file nosyscallsreal.c.

pid_t _real_getpgid ( pid_t  pid)

Definition at line 293 of file nosyscallsreal.c.

pid_t _real_getpgrp ( void  )

Definition at line 285 of file nosyscallsreal.c.

pid_t _real_getpid ( void  )

Definition at line 269 of file nosyscallsreal.c.

pid_t _real_getppid ( void  )

Definition at line 273 of file nosyscallsreal.c.

pid_t _real_getsid ( pid_t  pid)

Definition at line 301 of file nosyscallsreal.c.

int _real_getsockopt ( int  s,
int  level,
int  optname,
void *  optval,
socklen_t *  optlen 
)

Definition at line 173 of file nosyscallsreal.c.

int _real_ioctl ( int  d,
unsigned long int  request,
  ... 
)

Definition at line 334 of file nosyscallsreal.c.

int _real_kill ( pid_t  pid,
int  sig 
)

Definition at line 309 of file nosyscallsreal.c.

int _real_listen ( int  sockfd,
int  backlog 
)

call the libc version of this function via dlopen/dlsym

Definition at line 155 of file nosyscallsreal.c.

off_t _real_lseek ( int  fd,
off_t  offset,
int  whence 
)

Definition at line 265 of file nosyscallsreal.c.

LIB_PRIVATE void* _real_mmap ( void *  addr,
size_t  length,
int  prot,
int  flags,
int  fd,
off_t  offset 
)

Definition at line 349 of file nosyscallsreal.c.

LIB_PRIVATE int _real_munmap ( void *  addr,
size_t  length 
)

Definition at line 355 of file nosyscallsreal.c.

int _real_open ( const char *  pathname,
int  flags,
  ... 
)

Definition at line 388 of file nosyscallsreal.c.

int _real_open64 ( const char *  pathname,
int  flags,
  ... 
)

Definition at line 400 of file nosyscallsreal.c.

void _real_openlog ( const char *  ident,
int  option,
int  facility 
)

Definition at line 251 of file nosyscallsreal.c.

LIB_PRIVATE int _real_poll ( struct pollfd *  fds,
nfds_t  nfds,
int  timeout 
)

Definition at line 437 of file nosyscallsreal.c.

int _real_pthread_mutex_lock ( pthread_mutex_t *  mutex)

Definition at line 99 of file nosyscallsreal.c.

int _real_pthread_mutex_trylock ( pthread_mutex_t *  mutex)

Definition at line 103 of file nosyscallsreal.c.

int _real_pthread_mutex_unlock ( pthread_mutex_t *  mutex)

Definition at line 107 of file nosyscallsreal.c.

int _real_pthread_rwlock_rdlock ( pthread_rwlock_t *  rwlock)

Definition at line 115 of file nosyscallsreal.c.

int _real_pthread_rwlock_unlock ( pthread_rwlock_t *  rwlock)

Definition at line 111 of file nosyscallsreal.c.

int _real_pthread_rwlock_wrlock ( pthread_rwlock_t *  rwlock)

Definition at line 119 of file nosyscallsreal.c.

int _real_ptsname_r ( int  fd,
char *  buf,
size_t  buflen 
)

Definition at line 241 of file nosyscallsreal.c.

ssize_t _real_read ( int  fd,
void *  buf,
size_t  count 
)

Definition at line 123 of file nosyscallsreal.c.

ssize_t _real_readlink ( const char *  path,
char *  buf,
size_t  bufsiz 
)

Definition at line 441 of file nosyscallsreal.c.

int _real_select ( int  nfds,
fd_set *  readfds,
fd_set *  writefds,
fd_set *  exceptfds,
struct timeval *  timeout 
)

Definition at line 131 of file nosyscallsreal.c.

int _real_setpgid ( pid_t  pid,
pid_t  pgid 
)

Definition at line 297 of file nosyscallsreal.c.

pid_t _real_setpgrp ( void  )

Definition at line 289 of file nosyscallsreal.c.

pid_t _real_setsid ( void  )

Definition at line 305 of file nosyscallsreal.c.

int _real_setsockopt ( int  s,
int  level,
int  optname,
const void *  optval,
socklen_t  optlen 
)

call the libc version of this function via dlopen/dlsym

Definition at line 167 of file nosyscallsreal.c.

void* _real_shmat ( int  shmid,
const void *  shmaddr,
int  shmflg 
)

Definition at line 424 of file nosyscallsreal.c.

int _real_shmctl ( int  shmid,
int  cmd,
struct shmid_ds *  buf 
)

Definition at line 432 of file nosyscallsreal.c.

int _real_shmdt ( const void *  shmaddr)

Definition at line 428 of file nosyscallsreal.c.

int _real_shmget ( key_t  key,
size_t  size,
int  shmflg 
)

Definition at line 420 of file nosyscallsreal.c.

int _real_socket ( int  domain,
int  type,
int  protocol 
)

call the libc version of this function via dlopen/dlsym

Definition at line 137 of file nosyscallsreal.c.

int _real_socketpair ( int  d,
int  type,
int  protocol,
int  sv[2] 
)

Definition at line 246 of file nosyscallsreal.c.

long _real_syscall ( long  sys_num,
  ... 
)

Definition at line 361 of file nosyscallsreal.c.

int _real_system ( const char *  cmd)

Definition at line 195 of file nosyscallsreal.c.

int _real_tcgetpgrp ( int  fd)

Definition at line 281 of file nosyscallsreal.c.

int _real_tcsetpgrp ( int  fd,
pid_t  pgrp 
)

Definition at line 277 of file nosyscallsreal.c.

pid_t _real_wait ( __WAIT_STATUS  stat_loc)

Definition at line 313 of file nosyscallsreal.c.

pid_t _real_wait3 ( __WAIT_STATUS  status,
int  options,
struct rusage *  rusage 
)

Definition at line 325 of file nosyscallsreal.c.

pid_t _real_wait4 ( pid_t  pid,
__WAIT_STATUS  status,
int  options,
struct rusage *  rusage 
)

Definition at line 329 of file nosyscallsreal.c.

int _real_waitid ( idtype_t  idtype,
id_t  id,
siginfo_t *  infop,
int  options 
)

Definition at line 321 of file nosyscallsreal.c.

pid_t _real_waitpid ( pid_t  pid,
int *  stat_loc,
int  options 
)

Definition at line 317 of file nosyscallsreal.c.

ssize_t _real_write ( int  fd,
const void *  buf,
size_t  count 
)

Definition at line 127 of file nosyscallsreal.c.

LIB_PRIVATE pid_t dmtcp_gettid ( )

Definition at line 378 of file nosyscallsreal.c.

LIB_PRIVATE int dmtcp_tgkill ( int  tgid,
int  tid,
int  sig 
)

Definition at line 384 of file nosyscallsreal.c.

LIB_PRIVATE int dmtcp_tkill ( int  tid,
int  sig 
)

Definition at line 381 of file nosyscallsreal.c.

void initialize_wrappers ( )

Definition at line 95 of file nosyscallsreal.c.

Variable Documentation

int send_sigwinch

Definition at line 333 of file nosyscallsreal.c.