mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-09 14:28:12 +00:00
Begin support for mingw stratum build.
Conflicts: configure.ac
This commit is contained in:
parent
3c85498d57
commit
c113534feb
74
api.c
74
api.c
@ -44,6 +44,80 @@
|
||||
// However lots of PGA's may mean more
|
||||
#define QUEUE 100
|
||||
|
||||
#if defined WIN32
|
||||
static char WSAbuf[1024];
|
||||
|
||||
struct WSAERRORS {
|
||||
int id;
|
||||
char *code;
|
||||
} WSAErrors[] = {
|
||||
{ 0, "No error" },
|
||||
{ WSAEINTR, "Interrupted system call" },
|
||||
{ WSAEBADF, "Bad file number" },
|
||||
{ WSAEACCES, "Permission denied" },
|
||||
{ WSAEFAULT, "Bad address" },
|
||||
{ WSAEINVAL, "Invalid argument" },
|
||||
{ WSAEMFILE, "Too many open sockets" },
|
||||
{ WSAEWOULDBLOCK, "Operation would block" },
|
||||
{ WSAEINPROGRESS, "Operation now in progress" },
|
||||
{ WSAEALREADY, "Operation already in progress" },
|
||||
{ WSAENOTSOCK, "Socket operation on non-socket" },
|
||||
{ WSAEDESTADDRREQ, "Destination address required" },
|
||||
{ WSAEMSGSIZE, "Message too long" },
|
||||
{ WSAEPROTOTYPE, "Protocol wrong type for socket" },
|
||||
{ WSAENOPROTOOPT, "Bad protocol option" },
|
||||
{ WSAEPROTONOSUPPORT, "Protocol not supported" },
|
||||
{ WSAESOCKTNOSUPPORT, "Socket type not supported" },
|
||||
{ WSAEOPNOTSUPP, "Operation not supported on socket" },
|
||||
{ WSAEPFNOSUPPORT, "Protocol family not supported" },
|
||||
{ WSAEAFNOSUPPORT, "Address family not supported" },
|
||||
{ WSAEADDRINUSE, "Address already in use" },
|
||||
{ WSAEADDRNOTAVAIL, "Can't assign requested address" },
|
||||
{ WSAENETDOWN, "Network is down" },
|
||||
{ WSAENETUNREACH, "Network is unreachable" },
|
||||
{ WSAENETRESET, "Net connection reset" },
|
||||
{ WSAECONNABORTED, "Software caused connection abort" },
|
||||
{ WSAECONNRESET, "Connection reset by peer" },
|
||||
{ WSAENOBUFS, "No buffer space available" },
|
||||
{ WSAEISCONN, "Socket is already connected" },
|
||||
{ WSAENOTCONN, "Socket is not connected" },
|
||||
{ WSAESHUTDOWN, "Can't send after socket shutdown" },
|
||||
{ WSAETOOMANYREFS, "Too many references, can't splice" },
|
||||
{ WSAETIMEDOUT, "Connection timed out" },
|
||||
{ WSAECONNREFUSED, "Connection refused" },
|
||||
{ WSAELOOP, "Too many levels of symbolic links" },
|
||||
{ WSAENAMETOOLONG, "File name too long" },
|
||||
{ WSAEHOSTDOWN, "Host is down" },
|
||||
{ WSAEHOSTUNREACH, "No route to host" },
|
||||
{ WSAENOTEMPTY, "Directory not empty" },
|
||||
{ WSAEPROCLIM, "Too many processes" },
|
||||
{ WSAEUSERS, "Too many users" },
|
||||
{ WSAEDQUOT, "Disc quota exceeded" },
|
||||
{ WSAESTALE, "Stale NFS file handle" },
|
||||
{ WSAEREMOTE, "Too many levels of remote in path" },
|
||||
{ WSASYSNOTREADY, "Network system is unavailable" },
|
||||
{ WSAVERNOTSUPPORTED, "Winsock version out of range" },
|
||||
{ WSANOTINITIALISED, "WSAStartup not yet called" },
|
||||
{ WSAEDISCON, "Graceful shutdown in progress" },
|
||||
{ WSAHOST_NOT_FOUND, "Host not found" },
|
||||
{ WSANO_DATA, "No host data of that type was found" },
|
||||
{ -1, "Unknown error code" }
|
||||
};
|
||||
|
||||
char *WSAErrorMsg(void) {
|
||||
int i;
|
||||
int id = WSAGetLastError();
|
||||
|
||||
/* Assume none of them are actually -1 */
|
||||
for (i = 0; WSAErrors[i].id != -1; i++)
|
||||
if (WSAErrors[i].id == id)
|
||||
break;
|
||||
|
||||
sprintf(WSAbuf, "Socket Error: (%d) %s", id, WSAErrors[i].code);
|
||||
|
||||
return &(WSAbuf[0]);
|
||||
}
|
||||
#endif
|
||||
static char *io_buffer = NULL;
|
||||
static char *msg_buffer = NULL;
|
||||
static SOCKETTYPE sock = INVSOCK;
|
||||
|
@ -92,6 +92,7 @@ case $target in
|
||||
PTHREAD_FLAGS=""
|
||||
DLOPEN_FLAGS=""
|
||||
WS2_LIBS="-lws2_32"
|
||||
AC_DEFINE([_WIN32_WINNT], [0x0501], "WinNT version for XP+ support")
|
||||
;;
|
||||
powerpc-*-darwin*)
|
||||
CFLAGS="$CFLAGS -faltivec"
|
||||
|
@ -29,6 +29,8 @@
|
||||
* nonce range is completely calculated.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
@ -7,6 +7,8 @@
|
||||
* any later version. See COPYING for more details.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include "logging.h"
|
||||
|
13
miner.h
13
miner.h
@ -52,6 +52,19 @@ void *alloca (size_t);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
static inline int fsync (int fd)
|
||||
{
|
||||
return (FlushFileBuffers ((HANDLE) _get_osfhandle (fd))) ? 0 : -1;
|
||||
}
|
||||
|
||||
#ifndef MSG_DONTWAIT
|
||||
# define MSG_DONTWAIT 0x1000000
|
||||
#endif
|
||||
#endif /* __MINGW32__ */
|
||||
|
||||
#if defined (__linux)
|
||||
#ifndef LINUX
|
||||
#define LINUX
|
||||
|
3
util.c
3
util.c
@ -26,11 +26,12 @@
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <netinet/tcp.h>
|
||||
# include <netdb.h>
|
||||
#else
|
||||
# include <winsock2.h>
|
||||
# include <mstcpip.h>
|
||||
# include <ws2tcpip.h>
|
||||
#endif
|
||||
#include <netdb.h>
|
||||
|
||||
#include "miner.h"
|
||||
#include "elist.h"
|
||||
|
75
util.h
75
util.h
@ -24,80 +24,7 @@
|
||||
#define INVINETADDR INADDR_NONE
|
||||
#define CLOSESOCKET closesocket
|
||||
|
||||
static char WSAbuf[1024];
|
||||
|
||||
struct WSAERRORS {
|
||||
int id;
|
||||
char *code;
|
||||
} WSAErrors[] = {
|
||||
{ 0, "No error" },
|
||||
{ WSAEINTR, "Interrupted system call" },
|
||||
{ WSAEBADF, "Bad file number" },
|
||||
{ WSAEACCES, "Permission denied" },
|
||||
{ WSAEFAULT, "Bad address" },
|
||||
{ WSAEINVAL, "Invalid argument" },
|
||||
{ WSAEMFILE, "Too many open sockets" },
|
||||
{ WSAEWOULDBLOCK, "Operation would block" },
|
||||
{ WSAEINPROGRESS, "Operation now in progress" },
|
||||
{ WSAEALREADY, "Operation already in progress" },
|
||||
{ WSAENOTSOCK, "Socket operation on non-socket" },
|
||||
{ WSAEDESTADDRREQ, "Destination address required" },
|
||||
{ WSAEMSGSIZE, "Message too long" },
|
||||
{ WSAEPROTOTYPE, "Protocol wrong type for socket" },
|
||||
{ WSAENOPROTOOPT, "Bad protocol option" },
|
||||
{ WSAEPROTONOSUPPORT, "Protocol not supported" },
|
||||
{ WSAESOCKTNOSUPPORT, "Socket type not supported" },
|
||||
{ WSAEOPNOTSUPP, "Operation not supported on socket" },
|
||||
{ WSAEPFNOSUPPORT, "Protocol family not supported" },
|
||||
{ WSAEAFNOSUPPORT, "Address family not supported" },
|
||||
{ WSAEADDRINUSE, "Address already in use" },
|
||||
{ WSAEADDRNOTAVAIL, "Can't assign requested address" },
|
||||
{ WSAENETDOWN, "Network is down" },
|
||||
{ WSAENETUNREACH, "Network is unreachable" },
|
||||
{ WSAENETRESET, "Net connection reset" },
|
||||
{ WSAECONNABORTED, "Software caused connection abort" },
|
||||
{ WSAECONNRESET, "Connection reset by peer" },
|
||||
{ WSAENOBUFS, "No buffer space available" },
|
||||
{ WSAEISCONN, "Socket is already connected" },
|
||||
{ WSAENOTCONN, "Socket is not connected" },
|
||||
{ WSAESHUTDOWN, "Can't send after socket shutdown" },
|
||||
{ WSAETOOMANYREFS, "Too many references, can't splice" },
|
||||
{ WSAETIMEDOUT, "Connection timed out" },
|
||||
{ WSAECONNREFUSED, "Connection refused" },
|
||||
{ WSAELOOP, "Too many levels of symbolic links" },
|
||||
{ WSAENAMETOOLONG, "File name too long" },
|
||||
{ WSAEHOSTDOWN, "Host is down" },
|
||||
{ WSAEHOSTUNREACH, "No route to host" },
|
||||
{ WSAENOTEMPTY, "Directory not empty" },
|
||||
{ WSAEPROCLIM, "Too many processes" },
|
||||
{ WSAEUSERS, "Too many users" },
|
||||
{ WSAEDQUOT, "Disc quota exceeded" },
|
||||
{ WSAESTALE, "Stale NFS file handle" },
|
||||
{ WSAEREMOTE, "Too many levels of remote in path" },
|
||||
{ WSASYSNOTREADY, "Network system is unavailable" },
|
||||
{ WSAVERNOTSUPPORTED, "Winsock version out of range" },
|
||||
{ WSANOTINITIALISED, "WSAStartup not yet called" },
|
||||
{ WSAEDISCON, "Graceful shutdown in progress" },
|
||||
{ WSAHOST_NOT_FOUND, "Host not found" },
|
||||
{ WSANO_DATA, "No host data of that type was found" },
|
||||
{ -1, "Unknown error code" }
|
||||
};
|
||||
|
||||
static char *WSAErrorMsg()
|
||||
{
|
||||
int i;
|
||||
int id = WSAGetLastError();
|
||||
|
||||
/* Assume none of them are actually -1 */
|
||||
for (i = 0; WSAErrors[i].id != -1; i++)
|
||||
if (WSAErrors[i].id == id)
|
||||
break;
|
||||
|
||||
sprintf(WSAbuf, "Socket Error: (%d) %s", id, WSAErrors[i].code);
|
||||
|
||||
return &(WSAbuf[0]);
|
||||
}
|
||||
|
||||
extern char *WSAErrorMsg(void);
|
||||
#define SOCKERRMSG WSAErrorMsg()
|
||||
|
||||
#ifndef SHUT_RDWR
|
||||
|
Loading…
Reference in New Issue
Block a user