You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pi...@apache.org on 2007/05/22 11:33:19 UTC

svn commit: r540507 - in /webservices/axis2/trunk/c/util/src: dir_handler.c platforms/unix/thread_unix.c platforms/unix/uuid_gen_unix.c

Author: pini
Date: Tue May 22 02:33:18 2007
New Revision: 540507

URL: http://svn.apache.org/viewvc?view=rev&rev=540507
Log:
Fixed some build problems

Modified:
    webservices/axis2/trunk/c/util/src/dir_handler.c
    webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c
    webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c

Modified: webservices/axis2/trunk/c/util/src/dir_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/dir_handler.c?view=diff&rev=540507&r1=540506&r2=540507
==============================================================================
--- webservices/axis2/trunk/c/util/src/dir_handler.c (original)
+++ webservices/axis2/trunk/c/util/src/dir_handler.c Tue May 22 02:33:18 2007
@@ -27,7 +27,7 @@
 
 extern int AXIS2_ALPHASORT();
 
-int dir_select(struct dirent *entry);
+int dir_select(const struct dirent *entry);
 
 
 /**
@@ -314,7 +314,7 @@
         return(AXIS2_FALSE);
 }
 
-int dir_select(struct dirent *entry)
+int dir_select(const struct dirent *entry)
 
 {
     struct stat stat_p;

Modified: webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c?view=diff&rev=540507&r1=540506&r2=540507
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c Tue May 22 02:33:18 2007
@@ -15,6 +15,7 @@
  * limitations under the License.
  */
 
+#include <config.h>
 #include "axutil_thread_unix.h"
 
 
@@ -242,7 +243,11 @@
 AXIS2_EXTERN axutil_thread_once_t* AXIS2_CALL
 axutil_thread_once_init(axutil_allocator_t* allocator)
 {
+#ifdef AXIS2_SOLARIS
+    static const pthread_once_t once_init = {PTHREAD_ONCE_INIT};
+#else
     static const pthread_once_t once_init = PTHREAD_ONCE_INIT;
+#endif
     axutil_thread_once_t *control = AXIS2_MALLOC(allocator,
             sizeof(axutil_thread_once_t));
     if (!control)

Modified: webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c?view=diff&rev=540507&r1=540506&r2=540507
==============================================================================
--- webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c (original)
+++ webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c Tue May 22 02:33:18 2007
@@ -236,7 +236,65 @@
 }
 
 #else
-# ifdef HAVE_STRUCT_LIFREQ  // Solaris-ish
+
+#ifdef IS_MACOSX  /* Darwin */
+
+#ifndef max
+# define        max(a,b)        ((a) > (b) ? (a) : (b))
+#endif /* !max */
+
+char * AXIS2_CALL
+axutil_uuid_get_mac_addr()
+{
+    struct ifconf ifc;
+    struct ifreq *ifr;
+    int sockfd;
+    char buffer[512], *cp, *cplim;
+
+    sockfd = socket(AF_INET, SOCK_DGRAM, 0);
+    if (sockfd < 0)
+    {
+        perror("socket failed");
+        return NULL;
+    }
+
+    ifc.ifc_len = 512;
+    ifc.ifc_buf = buffer;
+
+    if (ioctl(sockfd, SIOCGIFCONF, (char *)&ifc) < 0)
+    {
+        perror("ioctl error");
+        close(sockfd);
+        return NULL;
+    }
+
+    ifr = ifc.ifc_req;
+
+    cplim = buffer + ifc.ifc_len;
+
+    char * macaddr = NULL;
+
+    for (cp = buffer; cp < cplim && macaddr == NULL;)
+    {
+        ifr = (struct ifreq *)cp;
+        if (ifr->ifr_addr.sa_family == AF_LINK)
+        {
+            struct sockaddr_dl *sdl = (struct sockaddr_dl *) & ifr->ifr_addr;
+
+            /* just take the ethernet adapters */
+            if (sdl->sdl_type == IFT_ETHER)
+            {
+                macaddr = (char *)ether_ntoa(LLADDR(sdl));
+            }
+        }
+        cp += sizeof(ifr->ifr_name) + max(sizeof(ifr->ifr_addr), ifr->ifr_addr.sa_len);
+
+    }
+
+    close(sockfd);
+    return macaddr;
+}
+# else /* Solaris-ish */
 
 /* code modified from that posted on:
 * http://forum.sun.com/jive/thread.jspa?threadID=84804&tstart=30
@@ -244,7 +302,6 @@
 char * AXIS2_CALL
 axutil_uuid_get_mac_addr()
 {
-    unsigned char eth_addr[6];
     int sock;
     int i;
     struct lifconf lic;
@@ -304,64 +361,6 @@
     close(sock);
     free(lifrs);
     return NULL;
-}
-
-# else    // Darwin
-
-#ifndef max
-# define        max(a,b)        ((a) > (b) ? (a) : (b))
-#endif /* !max */
-
-char * AXIS2_CALL
-axutil_uuid_get_mac_addr()
-{
-    struct ifconf ifc;
-    struct ifreq *ifr;
-    int sockfd;
-    char buffer[512], *cp, *cplim;
-
-    sockfd = socket(AF_INET, SOCK_DGRAM, 0);
-    if (sockfd < 0)
-    {
-        perror("socket failed");
-        return NULL;
-    }
-
-    ifc.ifc_len = 512;
-    ifc.ifc_buf = buffer;
-
-    if (ioctl(sockfd, SIOCGIFCONF, (char *)&ifc) < 0)
-    {
-        perror("ioctl error");
-        close(sockfd);
-        return NULL;
-    }
-
-    ifr = ifc.ifc_req;
-
-    cplim = buffer + ifc.ifc_len;
-
-    char * macaddr = NULL;
-
-    for (cp = buffer; cp < cplim && macaddr == NULL;)
-    {
-        ifr = (struct ifreq *)cp;
-        if (ifr->ifr_addr.sa_family == AF_LINK)
-        {
-            struct sockaddr_dl *sdl = (struct sockaddr_dl *) & ifr->ifr_addr;
-
-            /* just take the ethernet adapters */
-            if (sdl->sdl_type == IFT_ETHER)
-            {
-                macaddr = (char *)ether_ntoa(LLADDR(sdl));
-            }
-        }
-        cp += sizeof(ifr->ifr_name) + max(sizeof(ifr->ifr_addr), ifr->ifr_addr.sa_len);
-
-    }
-
-    close(sockfd);
-    return macaddr;
 }
 # endif
 #endif



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org