alan.
This is to fix a number of build problems under Solaris. There still appears to be a problem with ptrace in the server code that is preventing a build. I am looking at this.
I am using defined(__sun) as for the most part thes patches go into code which is already inside a defined(__sun) || defined(something else) || defined(something else again).
alan. =========
Alan Hargreaves - Alan.Hargreaves@Sun.COM
wine/dlls/ntdll/signal_i386.c Bug 1569 - Cast needed for FAULT_ADDRESS in Solaris
wine/dlls/iphlpapi/ifenum.c Bug 1572 - Brace in incorrect place makes an if else clause malformed - struct ifreq has been deprecated in Solaris and also does not have an element for ifr_mtu. Inserted a replacement getInterfaceMtuByName if __sun is defined. This version uses struct lifreq. - Solaris does not implement getInterfaceAddrByName. Added this routine to be used if __sun is defined.
? wine/server/cscope.out Index: wine/dlls/iphlpapi/ifenum.c =================================================================== RCS file: /home/wine/wine/dlls/iphlpapi/ifenum.c,v retrieving revision 1.3 diff -u -r1.3 ifenum.c --- wine/dlls/iphlpapi/ifenum.c 21 May 2003 18:26:00 -0000 1.3 +++ wine/dlls/iphlpapi/ifenum.c 7 Jul 2003 06:50:47 -0000 @@ -615,6 +615,34 @@ return ret; } #elif defined (SIOCGARP) +#ifdef __sun + +/* Solaris does not define getInterfaceAddrByName */ + +uint32_t getInterfaceAddrByName(const char * name) +{ + int fd; + struct ifreq ifr; + struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr; + uint32_t ret = (uint32_t)NULL; + + fd = socket(PF_INET, SOCK_DGRAM, 0); + + if (fd < 0) { + return ret; + } + + memset(&ifr, 0, sizeof(struct ifreq)); + strncpy(ifr.ifr_name, name, IFNAMSIZ); + ifr.ifr_name[IFNAMSIZ-1] = '\0'; + if ((ioctl(fd, SIOCGIFADDR, &ifr))>=0) { + ret = ntohl(sin->sin_addr.s_addr); + } + close(fd); + return ret; +} +#endif /* __sun */ + DWORD getInterfacePhysicalByName(const char *name, PDWORD len, PBYTE addr, PDWORD type) { @@ -661,9 +689,9 @@ } } } - else - ret = ERROR_NO_MORE_FILES; } + else + ret = ERROR_NO_MORE_FILES; return ret; } #elif defined (HAVE_SYS_SYSCTL_H) && defined (HAVE_NET_IF_DL_H) @@ -768,6 +796,38 @@ return ERROR_INVALID_DATA; } +#if defined(__sun) + +DWORD getInterfaceMtuByName(const char *name, PDWORD mtu) +{ + DWORD ret; + int fd; + + if (!name) + return ERROR_INVALID_PARAMETER; + if (!mtu) + return ERROR_INVALID_PARAMETER; + + fd = socket(PF_INET, SOCK_DGRAM, 0); + if (fd != -1) { + struct lifreq ifr; + + strncpy(ifr.lifr_name, name, IFNAMSIZ); + ifr.lifr_name[IFNAMSIZ-1] = '\0'; + if ((ioctl(fd, SIOCGIFMTU, &ifr))) + ret = ERROR_INVALID_DATA; + else { + *mtu = ifr.lifr_mtu; + ret = NO_ERROR; + } + } + else + ret = ERROR_NO_MORE_FILES; + return ret; +} + +#else /* defined(__sun) */ + DWORD getInterfaceMtuByName(const char *name, PDWORD mtu) { DWORD ret; @@ -795,6 +855,7 @@ ret = ERROR_NO_MORE_FILES; return ret; } +#endif DWORD getInterfaceMtuByIndex(DWORD index, PDWORD mtu) { Index: wine/dlls/ntdll/signal_i386.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/signal_i386.c,v retrieving revision 1.66 diff -u -r1.66 signal_i386.c --- wine/dlls/ntdll/signal_i386.c 1 Jul 2003 03:37:41 -0000 1.66 +++ wine/dlls/ntdll/signal_i386.c 7 Jul 2003 06:50:53 -0000 @@ -368,7 +368,11 @@ #define TRAP_sig(context) ((context)->uc_mcontext.gregs[TRAPNO]) #endif +#ifdef __sun +#define FAULT_ADDRESS (((k_siginfo_t *)__siginfo)->si_addr) +#else #define FAULT_ADDRESS (__siginfo->si_addr) +#endif #endif /* svr4 || SCO_DS */