Functions

portability.c File Reference

#include <stdio.h>
#include "portability.h"
#include "utility.h"
Include dependency graph for portability.c:

Go to the source code of this file.

Functions

int gs_lock_fd_nowait (int fd, int lock_type)
int gs_lock_fd (int fd, int lock_type)
int gs_unlock_fd (int fd)
void initialize_sockets ()
void cleanup_sockets ()

Detailed Description

This file contains various routines that help in portability to multiple platforms. Especially, there is a WIN32 section that implements various functions that are missing on WIN32.

Definition in file portability.c.


Function Documentation

void cleanup_sockets (  ) 

Definition at line 158 of file portability.c.

{}    

Here is the caller graph for this function:

int gs_lock_fd ( int  fd,
int  lock_type 
)

Definition at line 125 of file portability.c.

{               
  struct flock fl;
  
  fl.l_type   = lock_type;
  fl.l_whence = SEEK_SET;
  fl.l_start  = 0;
  fl.l_len    = sizeof(int);
  fl.l_pid    = getpid();
  
  return fcntl(fd, F_SETLKW, &fl);
}

Here is the caller graph for this function:

int gs_lock_fd_nowait ( int  fd,
int  lock_type 
)

Definition at line 112 of file portability.c.

{
  struct flock fl;
  
  fl.l_type   = lock_type;
  fl.l_whence = SEEK_SET;
  fl.l_start  = 0;
  fl.l_len    = sizeof(int);
  fl.l_pid    = getpid();
  
  return fcntl(fd, F_SETLK, &fl);
}

Here is the caller graph for this function:

int gs_unlock_fd ( int  fd  ) 

Definition at line 138 of file portability.c.

{
  struct flock fl;

  fl.l_type   = F_UNLCK;
  fl.l_whence = SEEK_SET;
  fl.l_start  = 0;
  fl.l_len    = sizeof(int);
  fl.l_pid    = getpid();

  if(fcntl(fd, F_SETLK, &fl) == -1) {
    return -1;
  }

  return 0;
}

Here is the caller graph for this function:

void initialize_sockets (  ) 

Definition at line 156 of file portability.c.

{}    

Here is the caller graph for this function: