#include <stdio.h>#include "portability.h"#include "utility.h"
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 () |
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.
| void cleanup_sockets | ( | ) |
| 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);
}

| 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);
}

| 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;
}

| void initialize_sockets | ( | ) |
1.6.3-20100507