Add project file for iscsi-ls and make it build under visual studio
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -282,3 +282,4 @@ scsi_task_set_iov_in
|
||||
scsi_task_set_iov_out
|
||||
scsi_version_to_str
|
||||
scsi_version_descriptor_to_str
|
||||
win32_poll
|
||||
@@ -272,7 +272,10 @@ static int iscsi_tcp_connect(struct iscsi_context *iscsi, union socket_address *
|
||||
}
|
||||
|
||||
if (connect(iscsi->fd, &sa->sa, socksize) != 0
|
||||
&& errno != EINPROGRESS) {
|
||||
#if defined(WIN32)
|
||||
&& WSAGetLastError() != WSAEWOULDBLOCK
|
||||
#endif
|
||||
&& errno != EINPROGRESS) {
|
||||
iscsi_set_error(iscsi, "Connect failed with errno : "
|
||||
"%s(%d)", strerror(errno), errno);
|
||||
close(iscsi->fd);
|
||||
@@ -385,7 +388,8 @@ iscsi_connect_async(struct iscsi_context *iscsi, const char *portal,
|
||||
iscsi->connect_data = private_data;
|
||||
|
||||
if (iscsi->drv->connect(iscsi, &sa, ai->ai_family) < 0) {
|
||||
iscsi_set_error(iscsi, "Couldn't connect transport");
|
||||
iscsi_set_error(iscsi, "Couldn't connect transport: %s",
|
||||
iscsi_get_error(iscsi));
|
||||
freeaddrinfo(ai);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,13 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
#include <winsock2.h>
|
||||
#include "win32_compat.h"
|
||||
#pragma comment(lib, "ws2_32.lib")
|
||||
WSADATA wsaData;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_POLL_H
|
||||
#include <poll.h>
|
||||
#endif
|
||||
@@ -31,8 +38,6 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <getopt.h>
|
||||
#include <unistd.h>
|
||||
#include "iscsi.h"
|
||||
#include "scsi-lowlevel.h"
|
||||
|
||||
@@ -194,7 +199,8 @@ void list_luns(struct client_state *clnt, const char *target, const char *portal
|
||||
iscsi_set_header_digest(iscsi, ISCSI_HEADER_DIGEST_NONE_CRC32C);
|
||||
|
||||
if (iscsi_full_connect_sync(iscsi, portal, -1) != 0) {
|
||||
printf("iscsi_connect failed. %s\n", iscsi_get_error(iscsi));
|
||||
printf("list_luns: iscsi_connect failed. %s\n",
|
||||
iscsi_get_error(iscsi));
|
||||
exit(10);
|
||||
}
|
||||
|
||||
@@ -343,48 +349,40 @@ int main(int argc, char *argv[])
|
||||
struct iscsi_url *iscsi_url = NULL;
|
||||
struct client_state state;
|
||||
const char *url = NULL;
|
||||
int c;
|
||||
int i;
|
||||
static int show_help = 0, show_usage = 0, debug = 0;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"usage", no_argument, NULL, 'u'},
|
||||
{"debug", no_argument, NULL, 'd'},
|
||||
{"show-luns", no_argument, NULL, 's'},
|
||||
{"url", no_argument, NULL, 'U'},
|
||||
{"initiator-name", required_argument, NULL, 'i'},
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
int option_index;
|
||||
|
||||
while ((c = getopt_long(argc, argv, "h?uUdi:s", long_options,
|
||||
&option_index)) != -1) {
|
||||
switch (c) {
|
||||
case 'h':
|
||||
case '?':
|
||||
show_help = 1;
|
||||
break;
|
||||
case 'u':
|
||||
show_usage = 1;
|
||||
break;
|
||||
case 'U':
|
||||
useurls = 1;
|
||||
break;
|
||||
case 'd':
|
||||
debug = 1;
|
||||
break;
|
||||
case 'i':
|
||||
initiator = optarg;
|
||||
break;
|
||||
case 's':
|
||||
showluns = 1;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Unrecognized option '%c'\n\n", c);
|
||||
print_help();
|
||||
exit(0);
|
||||
}
|
||||
#ifdef WIN32
|
||||
if (WSAStartup(MAKEWORD(2,2), &wsaData) != 0) {
|
||||
printf("Failed to start Winsock2\n");
|
||||
exit(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (!strcmp(argv[i], "-?") ||
|
||||
!strcmp(argv[i], "-h") ||
|
||||
!strcmp(argv[i], "--help")) {
|
||||
show_help = 1;
|
||||
} else if (!strcmp(argv[i], "-u") ||
|
||||
!strcmp(argv[i], "-usage")) {
|
||||
show_usage = 1;
|
||||
} else if (!strcmp(argv[i], "-d") ||
|
||||
!strcmp(argv[i], "--debug")) {
|
||||
debug = 1;
|
||||
} else if (!strcmp(argv[i], "-i") ||
|
||||
!strcmp(argv[i], "--initiator-name")) {
|
||||
initiator = argv[++i];
|
||||
} else if (!strcmp(argv[i], "-s") ||
|
||||
!strcmp(argv[i], "--show-luns")) {
|
||||
showluns = 1;
|
||||
} else if (!strcmp(argv[i], "-U") ||
|
||||
!strcmp(argv[i], "--url")) {
|
||||
useurls = 1;
|
||||
} else if (!strncmp("iscsi://", argv[i], 8)) {
|
||||
url = strdup(argv[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (show_help != 0) {
|
||||
print_help();
|
||||
@@ -396,16 +394,8 @@ int main(int argc, char *argv[])
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (optind != argc -1) {
|
||||
print_usage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
memset(&state, 0, sizeof(state));
|
||||
|
||||
if (argv[optind] != NULL) {
|
||||
url = strdup(argv[optind]);
|
||||
}
|
||||
if (url == NULL) {
|
||||
fprintf(stderr, "You must specify iscsi target portal.\n");
|
||||
print_usage();
|
||||
@@ -442,7 +432,8 @@ int main(int argc, char *argv[])
|
||||
state.password = iscsi_url->passwd;
|
||||
|
||||
if (iscsi_connect_async(iscsi, iscsi_url->portal, discoveryconnect_cb, &state) != 0) {
|
||||
fprintf(stderr, "iscsi_connect failed. %s\n", iscsi_get_error(iscsi));
|
||||
fprintf(stderr, "connect_async: iscsi_connect failed. %s\n",
|
||||
iscsi_get_error(iscsi));
|
||||
exit(10);
|
||||
}
|
||||
|
||||
|
||||
163
win32/iscsi-ls/iscsi-ls.vcxproj
Normal file
163
win32/iscsi-ls/iscsi-ls.vcxproj
Normal file
@@ -0,0 +1,163 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{C003740B-3E9C-458B-9596-DE4330D8A0BA}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>iscsi-ls</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<LibraryPath>..\libiscsi\Debug;..\..\bin;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<LibraryPath>..\libiscsi\Debug;..\..\bin;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<LibraryPath>..\libiscsi\Release;..\..\bin;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<LibraryPath>..\libiscsi\Release;..\..\bin;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_U_=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\.;..\..\win32</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libiscsi.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_U_=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\.;..\..\win32</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>libiscsi.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ProjectReference>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
</ProjectReference>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_U_=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\.;..\..\win32</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>libiscsi.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0501;_U_=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>..\..\include;..\..\.;..\..\win32</AdditionalIncludeDirectories>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>libiscsi.lib;WS2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\utils\iscsi-ls.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
14
win32/iscsi-ls/iscsi-ls.vcxproj.filters
Normal file
14
win32/iscsi-ls/iscsi-ls.vcxproj.filters
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{38246570-1DA0-489E-920A-20A22AAAB787}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\utils\iscsi-ls.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -3,6 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{07C74339-C53E-4C5C-B9A5-2AA95ED03B2A}") = "libiscsi", "libiscsi.vcxproj", "{A3B13826-6DEF-4C25-A790-A16B37804064}"
|
||||
EndProject
|
||||
Project("{07C74339-C53E-4C5C-B9A5-2AA95ED03B2A}") = "iscsi-ls", "..\iscsi-ls\iscsi-ls.vcxproj", "{C003740B-3E9C-458B-9596-DE4330D8A0BA}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
@@ -19,6 +21,14 @@ Global
|
||||
{A3B13826-6DEF-4C25-A790-A16B37804064}.Release|Win32.Build.0 = Release|Win32
|
||||
{A3B13826-6DEF-4C25-A790-A16B37804064}.Release|x64.ActiveCfg = Release|x64
|
||||
{A3B13826-6DEF-4C25-A790-A16B37804064}.Release|x64.Build.0 = Release|x64
|
||||
{C003740B-3E9C-458B-9596-DE4330D8A0BA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C003740B-3E9C-458B-9596-DE4330D8A0BA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C003740B-3E9C-458B-9596-DE4330D8A0BA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{C003740B-3E9C-458B-9596-DE4330D8A0BA}.Debug|x64.Build.0 = Debug|x64
|
||||
{C003740B-3E9C-458B-9596-DE4330D8A0BA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C003740B-3E9C-458B-9596-DE4330D8A0BA}.Release|Win32.Build.0 = Release|Win32
|
||||
{C003740B-3E9C-458B-9596-DE4330D8A0BA}.Release|x64.ActiveCfg = Release|x64
|
||||
{C003740B-3E9C-458B-9596-DE4330D8A0BA}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
@@ -169,7 +169,7 @@
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
|
||||
@@ -37,6 +37,22 @@ THE SOFTWARE.
|
||||
|
||||
#define SOL_TCP IPPROTO_TCP
|
||||
|
||||
#if(_WIN32_WINNT < 0x0600)
|
||||
|
||||
#define POLLIN 0x0001 /* There is data to read */
|
||||
#define POLLPRI 0x0002 /* There is urgent data to read */
|
||||
#define POLLOUT 0x0004 /* Writing now will not block */
|
||||
#define POLLERR 0x0008 /* Error condition */
|
||||
#define POLLHUP 0x0010 /* Hung up */
|
||||
#define POLLNVAL 0x0020 /* Invalid request: fd not open */
|
||||
|
||||
struct pollfd {
|
||||
SOCKET fd; /* file descriptor */
|
||||
short events; /* requested events */
|
||||
short revents; /* returned events */
|
||||
};
|
||||
#endif
|
||||
|
||||
typedef int ssize_t;
|
||||
typedef int uid_t;
|
||||
typedef int gid_t;
|
||||
@@ -47,10 +63,11 @@ typedef int socklen_t;
|
||||
#define ioctl ioctlsocket
|
||||
#define readv win32_readv
|
||||
#define writev win32_writev
|
||||
#define strncasecmp _strnicmp
|
||||
#define strdup _strdup
|
||||
#define poll(x, y, z) win32_poll(x, y, z)
|
||||
#define inet_pton(x,y,z) win32_inet_pton(x,y,z)
|
||||
#define sleep(x) Sleep(x * 1000)
|
||||
#define snprintf sprintf_s
|
||||
#define snprintf(a, b, c, ...) _snprintf_s(a, b, b, c, ## __VA_ARGS__)
|
||||
int win32_inet_pton(int af, const char * src, void * dst);
|
||||
int win32_poll(struct pollfd *fds, unsigned int nfsd, int timeout);
|
||||
|
||||
Reference in New Issue
Block a user