added waitpid() and removed its dependency from bsdcompat

This commit is contained in:
manojampalam 2016-03-21 21:41:08 -07:00
parent f04dc7c355
commit 936508e00c
10 changed files with 26 additions and 48 deletions

View File

@ -1203,7 +1203,7 @@
#define HAVE_VSNPRINTF 1
/* Define to 1 if you have the `waitpid' function. */
/* #undef HAVE_WAITPID */
#define HAVE_WAITPID 1
/* Define to 1 if you have the `_getlong' function. */
/* #undef HAVE__GETLONG */
@ -1681,8 +1681,6 @@
#define WIN32_ZLIB_NO 1
#define USE_MSCNG 1
typedef unsigned long pid_t;
#ifndef ssize_t
#ifdef _WIN64
typedef __int64 ssize_t;

View File

@ -157,6 +157,7 @@
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\sys\socket.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\sys\stat.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\sys\time.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\sys\wait.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\unistd.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\w32posix.h" />
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\poll.h" />

View File

@ -40,6 +40,9 @@
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\poll.h">
<Filter>inc</Filter>
</ClInclude>
<ClInclude Include="$(OpenSSH-Src-Path)\contrib\win32\win32compat\inc\sys\wait.h">
<Filter>inc\sys</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="inc">

View File

@ -67,3 +67,8 @@ typedef int sigset_t;
#define sigaddset(set, sig) ( (*(set)) |= (0x80000000 >> (sig)))
#define sigismember(set, sig) ( (*(set) & (0x80000000 >> (sig)))?1:0 )
#define sigdelset(set, sig) ( (*(set)) &= (~( 0x80000000 >> (sig)) ) )
typedef unsigned short _mode_t;
typedef _mode_t mode_t;
typedef unsigned long pid_t;

View File

@ -0,0 +1,10 @@
#pragma once
#include "..\w32posix.h"
#define _W_INT(w) (*(int*)&(w)) /* convert union wait to int */
#define WIFEXITED(w) (!((_W_INT(w)) & 0377))
#define WIFSTOPPED(w) ((_W_INT(w)) & 0100)
#define WIFSIGNALED(w) (!WIFEXITED(w) && !WIFSTOPPED(w))
#define WEXITSTATUS(w) (int)(WIFEXITED(w) ? ((_W_INT(w) >> 8) & 0377) : -1)
#define WTERMSIG(w) (int)(WIFSIGNALED(w) ? (_W_INT(w) & 0177) : -1)
pid_t waitpid(pid_t pid, int *status, int options);

View File

@ -138,5 +138,3 @@ struct iovec
size_t iov_len;
};
typedef unsigned short _mode_t;
typedef _mode_t mode_t;

View File

@ -1,32 +0,0 @@
#ifndef COMPAT_TYPES_H
#define COMPAT_TYPES_H 1
/* Compatibility header to allow code that uses these types to compile on Win32 */
/* device code */
#if defined(__MINGW32__)
typedef unsigned short _mode_t;
typedef _mode_t mode_t;
//typedef long time_t;
typedef long long __time64_t;
typedef long long off64_t;
/* On Win32 group and other permissions are the same as user permissions, sort of */
/*
FIXME: GFPZR: In newer GCC versions these seems to be defined.
*/
/*
#ifndef S_IXGRP
#define S_IXGRP S_IXUSR
#endif
#ifndef S_IXOTH
#define S_IXOTH S_IXUSR
#endif
*/
#endif
#endif

View File

@ -1,7 +0,0 @@
#ifndef COMPAT_WAIT_H
#define COMPAT_WAIT_H 1
/* Compatibility header to avoid lots of #ifdef _WIN32's in includes.h */
#endif

View File

@ -1,7 +1,13 @@
#include <Windows.h>
#include "inc\defs.h"
int usleep(unsigned int useconds)
{
Sleep(useconds / 1000);
return 1;
}
pid_t waitpid(pid_t pid, int *status, int options) {
/* TODO - implement this*/
return 0;
}

View File

@ -24,8 +24,6 @@
#include "includes.h"
#ifndef WIN32_FIXME
#ifndef HAVE_WAITPID
#include <errno.h>
#include <sys/wait.h>
@ -53,5 +51,3 @@ waitpid(int pid, int *stat_loc, int options)
}
#endif /* !HAVE_WAITPID */
#endif /* WIN32_FIXME */