Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Bond
wine
Commits
bf3e2e9f
Commit
bf3e2e9f
authored
24 years ago
by
James Hatheway
Committed by
Alexandre Julliard
24 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Portability fixes.
parent
315b00e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
dlls/winsock/socket.c
+21
-7
21 additions, 7 deletions
dlls/winsock/socket.c
dlls/wsock32/socket.c
+53
-19
53 additions, 19 deletions
dlls/wsock32/socket.c
dlls/wsock32/wscontrol.h
+60
-60
60 additions, 60 deletions
dlls/wsock32/wscontrol.h
with
134 additions
and
86 deletions
dlls/winsock/socket.c
+
21
−
7
View file @
bf3e2e9f
...
...
@@ -21,12 +21,9 @@
#ifdef HAVE_SYS_FILIO_H
# include <sys/filio.h>
#endif
#if defined(__svr4__) || defined(__sun)
#include
<sys/ioccom.h>
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
#endif
#if defined(__EMX__)
# include <sys/so_ioctl.h>
...
...
@@ -1384,11 +1381,28 @@ INT WINAPI WSAIoctl (SOCKET s,
}
else
{
struct
ws_sockaddr_in
*
ipTemp
=
(
struct
ws_sockaddr_in
*
)
&
ifInfo
.
ifr_netmask
;
/* Trying to avoid some compile problems across platforms.
(Linux, FreeBSD, Solaris...) */
#ifndef ifr_netmask
#ifndef ifr_addr
intArray
->
iiNetmask
.
AddressIn
.
sin_family
=
AF_INET
;
intArray
->
iiNetmask
.
AddressIn
.
sin_port
=
0
;
intArray
->
iiNetmask
.
AddressIn
.
sin_addr
.
ws_addr
=
0
;
ERR
(
"Unable to determine Netmask on your platform!
\n
"
);
#else
struct
ws_sockaddr_in
*
ipTemp
=
(
struct
ws_sockaddr_in
*
)
&
ifInfo
.
ifr_addr
;
intArray
->
iiNetmask
.
AddressIn
.
sin_family
=
AF_INET
;
intArray
->
iiNetmask
.
AddressIn
.
sin_port
=
ipTemp
->
sin_port
;
intArray
->
iiNetmask
.
AddressIn
.
sin_addr
.
ws_addr
=
ipTemp
->
sin_addr
.
S_un
.
S_addr
;
#endif
#else
struct
ws_sockaddr_in
*
ipTemp
=
(
struct
ws_sockaddr_in
*
)
&
ifInfo
.
ifr_netmask
;
intArray
->
iiNetmask
.
AddressIn
.
sin_family
=
AF_INET
;
intArray
->
iiNetmask
.
AddressIn
.
sin_port
=
ipTemp
->
sin_port
;
intArray
->
iiNetmask
.
AddressIn
.
sin_addr
.
ws_addr
=
ipTemp
->
sin_addr
.
S_un
.
S_addr
;
intArray
->
iiNetmask
.
AddressIn
.
sin_family
=
AF_INET
;
intArray
->
iiNetmask
.
AddressIn
.
sin_port
=
ipTemp
->
sin_port
;
intArray
->
iiNetmask
.
AddressIn
.
sin_addr
.
ws_addr
=
ipTemp
->
sin_addr
.
S_un
.
S_addr
;
#endif
}
/* Socket Status Flags */
...
...
This diff is collapsed.
Click to expand it.
dlls/wsock32/socket.c
+
53
−
19
View file @
bf3e2e9f
...
...
@@ -17,6 +17,9 @@
#include
<stdio.h>
#include
<stdlib.h>
#include
<unistd.h>
#ifdef HAVE_SYS_SOCKIO_H
# include <sys/sockio.h>
#endif
#ifdef HAVE_NET_IF_H
# include <net/if.h>
#endif
...
...
@@ -176,20 +179,39 @@ DWORD WINAPI WsControl(DWORD protocoll,
/* Interface ID */
IntInfo
->
if_index
=
pcommand
->
toi_entity
.
tei_instance
;
/* MAC Address */
strcpy
(
ifInfo
.
ifr_name
,
ifName
);
if
(
ioctl
(
sock
,
SIOCGIFHWADDR
,
&
ifInfo
)
<
0
)
{
ERR
(
"Error obtaining MAC Address!
\n
"
);
close
(
sock
);
return
(
-
1
);
}
else
{
/* FIXME: Is it correct to assume size of 6? */
memcpy
(
IntInfo
->
if_physaddr
,
ifInfo
.
ifr_hwaddr
.
sa_data
,
6
);
IntInfo
->
if_physaddrlen
=
6
;
}
/* MAC Address - Let's try to do this in a cross-platform way... */
#if defined(SIOCGIFHWADDR)
/* Linux */
strcpy
(
ifInfo
.
ifr_name
,
ifName
);
if
(
ioctl
(
sock
,
SIOCGIFHWADDR
,
&
ifInfo
)
<
0
)
{
ERR
(
"Error obtaining MAC Address!
\n
"
);
close
(
sock
);
return
(
-
1
);
}
else
{
/* FIXME: Is it correct to assume size of 6? */
memcpy
(
IntInfo
->
if_physaddr
,
ifInfo
.
ifr_hwaddr
.
sa_data
,
6
);
IntInfo
->
if_physaddrlen
=
6
;
}
#elif defined(SIOCGENADDR)
/* Solaris */
if
(
ioctl
(
sock
,
SIOCGENADDR
,
&
ifInfo
)
<
0
)
{
ERR
(
"Error obtaining MAC Address!
\n
"
);
close
(
sock
);
return
(
-
1
);
}
else
{
/* FIXME: Is it correct to assume size of 6? */
memcpy
(
IntInfo
->
if_physaddr
,
ifInfo
.
ifr_enaddr
,
6
);
IntInfo
->
if_physaddrlen
=
6
;
}
#else
memset
(
IntInfo
->
if_physaddr
,
0
,
6
);
ERR
(
"Unable to determine MAC Address on your platform!
\n
"
);
#endif
/* Interface name and length */
strcpy
(
IntInfo
->
if_descr
,
ifName
);
...
...
@@ -349,8 +371,20 @@ DWORD WINAPI WsControl(DWORD protocoll,
}
else
{
struct
ws_sockaddr_in
*
ipTemp
=
(
struct
ws_sockaddr_in
*
)
&
ifInfo
.
ifr_netmask
;
baseIPInfo
->
iae_mask
=
ipTemp
->
sin_addr
.
S_un
.
S_addr
;
/* Trying to avoid some compile problems across platforms.
(Linux, FreeBSD, Solaris...) */
#ifndef ifr_netmask
#ifndef ifr_addr
baseIPInfo
->
iae_mask
=
0
;
ERR
(
"Unable to determine Netmask on your platform!
\n
"
);
#else
struct
ws_sockaddr_in
*
ipTemp
=
(
struct
ws_sockaddr_in
*
)
&
ifInfo
.
ifr_addr
;
baseIPInfo
->
iae_mask
=
ipTemp
->
sin_addr
.
S_un
.
S_addr
;
#endif
#else
struct
ws_sockaddr_in
*
ipTemp
=
(
struct
ws_sockaddr_in
*
)
&
ifInfo
.
ifr_netmask
;
baseIPInfo
->
iae_mask
=
ipTemp
->
sin_addr
.
S_un
.
S_addr
;
#endif
}
/* FIXME: How should the below be properly calculated? ******************/
...
...
@@ -536,7 +570,7 @@ int WSCNTL_GetInterfaceName(int intNumber, char *intName)
Helper function for WsControl - This function returns the bytes (octets) transmitted
and received for the supplied interface number from the /proc fs.
*/
int
WSCNTL_GetTransRecvStat
(
int
intNumber
,
ulong
*
transBytes
,
ulong
*
recvBytes
)
int
WSCNTL_GetTransRecvStat
(
int
intNumber
,
u
nsigned
long
*
transBytes
,
u
nsigned
long
*
recvBytes
)
{
FILE
*
procfs
;
char
buf
[
512
],
result
[
512
];
/* Size doesn't matter, something big */
...
...
@@ -616,7 +650,7 @@ int WSCNTL_GetTransRecvStat(int intNumber, ulong *transBytes, ulong *recvBytes)
result
[
resultPos
+
1
]
=
'\0'
;
resultPos
++
;
bufPos
++
;
}
*
recvBytes
=
strtoul
(
result
,
NULL
,
10
);
/* convert string to ulong, using base 10 */
*
recvBytes
=
strtoul
(
result
,
NULL
,
10
);
/* convert string to u
nsigned
long, using base 10 */
/* Skip columns #3 to #9 (Don't need them) */
...
...
@@ -640,7 +674,7 @@ int WSCNTL_GetTransRecvStat(int intNumber, ulong *transBytes, ulong *recvBytes)
result
[
resultPos
+
1
]
=
'\0'
;
resultPos
++
;
bufPos
++
;
}
*
transBytes
=
strtoul
(
result
,
NULL
,
10
);
/* convert string to ulong, using base 10 */
*
transBytes
=
strtoul
(
result
,
NULL
,
10
);
/* convert string to u
nsigned
long, using base 10 */
fclose
(
procfs
);
...
...
This diff is collapsed.
Click to expand it.
dlls/wsock32/wscontrol.h
+
60
−
60
View file @
bf3e2e9f
...
...
@@ -22,7 +22,7 @@ typedef unsigned char uchar; /* This doesn't seem to be in any standard headers
/* WsControl Helper Functions */
int
WSCNTL_GetInterfaceCount
(
void
);
/* Obtains the number of network interfaces */
int
WSCNTL_GetInterfaceName
(
int
,
char
*
);
/* Obtains the name of an interface */
int
WSCNTL_GetTransRecvStat
(
int
intNumber
,
ulong
*
transBytes
,
ulong
*
recvBytes
);
/* Obtains bytes
int
WSCNTL_GetTransRecvStat
(
int
intNumber
,
u
nsigned
long
*
transBytes
,
u
nsigned
long
*
recvBytes
);
/* Obtains bytes
recv'd/trans by interface */
/*
...
...
@@ -37,55 +37,55 @@ int WSCNTL_GetTransRecvStat(int intNumber, ulong *transBytes, ulong *recvBytes);
/* Structure of an entity ID */
typedef
struct
TDIEntityID
{
ulong
tei_entity
;
ulong
tei_instance
;
u
nsigned
long
tei_entity
;
u
nsigned
long
tei_instance
;
}
TDIEntityID
;
/* Structure of an object ID */
typedef
struct
TDIObjectID
{
TDIEntityID
toi_entity
;
u
long
toi_class
;
u
long
toi_type
;
u
long
toi_id
;
TDIEntityID
toi_entity
;
u
nsigned
long
toi_class
;
u
nsigned
long
toi_type
;
u
nsigned
long
toi_id
;
}
TDIObjectID
;
typedef
struct
IPSNMPInfo
{
ulong
ipsi_forwarding
;
ulong
ipsi_defaultttl
;
ulong
ipsi_inreceives
;
ulong
ipsi_inhdrerrors
;
ulong
ipsi_inaddrerrors
;
ulong
ipsi_forwdatagrams
;
ulong
ipsi_inunknownprotos
;
ulong
ipsi_indiscards
;
ulong
ipsi_indelivers
;
ulong
ipsi_outrequests
;
ulong
ipsi_routingdiscards
;
ulong
ipsi_outdiscards
;
ulong
ipsi_outnoroutes
;
ulong
ipsi_reasmtimeout
;
ulong
ipsi_reasmreqds
;
ulong
ipsi_reasmoks
;
ulong
ipsi_reasmfails
;
ulong
ipsi_fragoks
;
ulong
ipsi_fragfails
;
ulong
ipsi_fragcreates
;
ulong
ipsi_numif
;
ulong
ipsi_numaddr
;
ulong
ipsi_numroutes
;
u
nsigned
long
ipsi_forwarding
;
u
nsigned
long
ipsi_defaultttl
;
u
nsigned
long
ipsi_inreceives
;
u
nsigned
long
ipsi_inhdrerrors
;
u
nsigned
long
ipsi_inaddrerrors
;
u
nsigned
long
ipsi_forwdatagrams
;
u
nsigned
long
ipsi_inunknownprotos
;
u
nsigned
long
ipsi_indiscards
;
u
nsigned
long
ipsi_indelivers
;
u
nsigned
long
ipsi_outrequests
;
u
nsigned
long
ipsi_routingdiscards
;
u
nsigned
long
ipsi_outdiscards
;
u
nsigned
long
ipsi_outnoroutes
;
u
nsigned
long
ipsi_reasmtimeout
;
u
nsigned
long
ipsi_reasmreqds
;
u
nsigned
long
ipsi_reasmoks
;
u
nsigned
long
ipsi_reasmfails
;
u
nsigned
long
ipsi_fragoks
;
u
nsigned
long
ipsi_fragfails
;
u
nsigned
long
ipsi_fragcreates
;
u
nsigned
long
ipsi_numif
;
u
nsigned
long
ipsi_numaddr
;
u
nsigned
long
ipsi_numroutes
;
}
IPSNMPInfo
;
typedef
struct
IPAddrEntry
{
ulong
iae_addr
;
ulong
iae_index
;
ulong
iae_mask
;
ulong
iae_bcastaddr
;
ulong
iae_reasmsize
;
ushort
iae_context
;
ushort
iae_pad
;
u
nsigned
long
iae_addr
;
u
nsigned
long
iae_index
;
u
nsigned
long
iae_mask
;
u
nsigned
long
iae_bcastaddr
;
u
nsigned
long
iae_reasmsize
;
ushort
iae_context
;
ushort
iae_pad
;
}
IPAddrEntry
;
...
...
@@ -93,29 +93,29 @@ typedef struct IPAddrEntry
#define MAX_IFDESCR_LEN 256
typedef
struct
IFEntry
{
ulong
if_index
;
ulong
if_type
;
ulong
if_mtu
;
ulong
if_speed
;
ulong
if_physaddrlen
;
uchar
if_physaddr
[
MAX_PHYSADDR_SIZE
];
ulong
if_adminstatus
;
ulong
if_operstatus
;
ulong
if_lastchange
;
ulong
if_inoctets
;
ulong
if_inucastpkts
;
ulong
if_innucastpkts
;
ulong
if_indiscards
;
ulong
if_inerrors
;
ulong
if_inunknownprotos
;
ulong
if_outoctets
;
ulong
if_outucastpkts
;
ulong
if_outnucastpkts
;
ulong
if_outdiscards
;
ulong
if_outerrors
;
ulong
if_outqlen
;
ulong
if_descrlen
;
uchar
if_descr
[
1
];
u
nsigned
long
if_index
;
u
nsigned
long
if_type
;
u
nsigned
long
if_mtu
;
u
nsigned
long
if_speed
;
u
nsigned
long
if_physaddrlen
;
uchar
if_physaddr
[
MAX_PHYSADDR_SIZE
];
u
nsigned
long
if_adminstatus
;
u
nsigned
long
if_operstatus
;
u
nsigned
long
if_lastchange
;
u
nsigned
long
if_inoctets
;
u
nsigned
long
if_inucastpkts
;
u
nsigned
long
if_innucastpkts
;
u
nsigned
long
if_indiscards
;
u
nsigned
long
if_inerrors
;
u
nsigned
long
if_inunknownprotos
;
u
nsigned
long
if_outoctets
;
u
nsigned
long
if_outucastpkts
;
u
nsigned
long
if_outnucastpkts
;
u
nsigned
long
if_outdiscards
;
u
nsigned
long
if_outerrors
;
u
nsigned
long
if_outqlen
;
u
nsigned
long
if_descrlen
;
uchar
if_descr
[
1
];
}
IFEntry
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment