Browse Source

fix #76

pull/77/head
Max Lv 10 years ago
parent
commit
cd68efa602
3 changed files with 59 additions and 1 deletions
  1. 4
      libcork/include/libcork/config/config.h
  2. 52
      libcork/include/libcork/config/mingw32.h
  3. 4
      libcork/posix/subprocess.c

4
libcork/include/libcork/config/config.h

@ -52,6 +52,10 @@
/* Do some BSD (4.3 code base or newer)specific autodetection. */ /* Do some BSD (4.3 code base or newer)specific autodetection. */
#include <libcork/config/bsd.h> #include <libcork/config/bsd.h>
#elif defined(__MINGW32__)
/* Do some mingw32 autodetection. */
#include <libcork/config/mingw32.h>
#endif /* platforms */ #endif /* platforms */

52
libcork/include/libcork/config/mingw32.h

@ -0,0 +1,52 @@
/* -*- coding: utf-8 -*-
* ----------------------------------------------------------------------
* Copyright © 2011, RedJack, LLC.
* All rights reserved.
*
* Please see the COPYING file in this distribution for license
* details.
* ----------------------------------------------------------------------
*/
#ifndef LIBCORK_CONFIG_MINGW32_H
#define LIBCORK_CONFIG_MINGW32_H
#include <io.h>
/*-----------------------------------------------------------------------
* Endianness
*/
/* Assume MinGW32 only works on x86 platform */
#define CORK_CONFIG_IS_BIG_ENDIAN 0
#define CORK_CONFIG_IS_LITTLE_ENDIAN 1
#define CORK_HAVE_REALLOCF 0
#define CORK_HAVE_PTHREADS 1
/*
* File io stuff. Odd that this is not defined by MinGW.
* Maybe there is an M$ish way to do it.
*/
#define F_SETFL 4
#define O_NONBLOCK 0x4000 /* non blocking I/O (POSIX style) */
#define F_GETFD 1
#define F_SETFD 2
#define FD_CLOEXEC 0x1
#define WNOHANG 1
/*
* simple adaptors
*/
static inline int mingw_mkdir(const char *path, int mode)
{
return mkdir(path);
}
#define mkdir mingw_mkdir
#endif /* LIBCORK_CONFIG_MINGW32_H */

4
libcork/posix/subprocess.c

@ -12,8 +12,10 @@
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>
#ifndef __MINGW32__
#include <sys/select.h> #include <sys/select.h>
#include <sys/wait.h> #include <sys/wait.h>
#endif
#include <unistd.h> #include <unistd.h>
#include "libcork/core.h" #include "libcork/core.h"
@ -506,7 +508,7 @@ cork_subprocess_is_finished(struct cork_subprocess *self)
&& cork_read_pipe_is_finished(&self->stderr_pipe); && cork_read_pipe_is_finished(&self->stderr_pipe);
} }
#if defined(__APPLE__)
#if defined(__APPLE__) || defined(__MINGW32__)
#include <pthread.h> #include <pthread.h>
#define THREAD_YIELD pthread_yield_np #define THREAD_YIELD pthread_yield_np
#elif defined(__linux__) || defined(BSD) #elif defined(__linux__) || defined(BSD)

Loading…
Cancel
Save