blob: 9b08fffee66635420a1d2c4bc210c7ef140cf97d [file] [log] [blame] [raw]
#ifndef _SHARED_H
#define _SHARED_H
#include <sys/types.h>
#include <windows.h>
//#include "sys/fifo.h"
#define MAX_ENVIRONBLK (2048)
#define SYSNAMELEN (24)
/* This struct is copied to shared seg before creating a new process */
/* The child will read it */
typedef struct _pginfo_s {
int pgid;
int showwindow;
char cwd[126];
char environ[MAX_ENVIRONBLK];
int stdinfd;
int stdoutfd;
int stderrfd;
} _pginfo_t, *_PGINFO;
typedef struct _shmblk_s {
void* mutex;
_pginfo_t pginfo;
} _shmblk_t, *_SHMBLK;
// To avoid stack corruptions
typedef struct {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD dwVolumeSerialNumber;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD nNumberOfLinks;
DWORD nFileIndexHigh;
DWORD nFileIndexLow;
//#ifdef _WIN32_WCE
DWORD dwOID; // Newer version of Windows CE have this member
//#endif
} BY_HANDLE_FILE_INFORMATION_NEW;
#define _FT_OFFSET_IN_SEC (11644473600ULL)
#define _FT_OFFSET_IN_USEC (_FT_OFFSET_IN_SEC*1000000ULL)
time_t __filetime_to_time_t(FILETIME);
FILETIME __time_t_to_filetime(time_t);
void __filetime_to_timeval(const FILETIME *, struct timeval *);
void __timeval_to_filetime(const struct timeval *, FILETIME *);
#define __filetime_to_timespec(ft, ts) \
do { \
(ts)->tv_sec = __filetime_to_time_t(*(ft)); \
(ts)->tv_nsec = ((ft)->dwLowDateTime % 10000000) * 100; \
} while(0)
#define __timespec_to_filetime(ts, ft) \
do { \
ULARGE_INTEGER _li; \
_li.QuadPart = (ts)->tv_nsec / 100; \
_li.QuadPart += (ts)->tv_sec * 10000000ULL; \
_li.QuadPart += _FT_OFFSET_IN_USEC * 10; \
(ft)->dwLowDateTime = _li.LowPart; \
(ft)->dwHighDateTime = _li.HighPart; \
} while(0)
#endif