Changeset: b35a4cb41491 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b35a4cb41491
Modified Files:
        NT/monetdb_config.h.in
        clients/R/MonetDB.R/R/control.R
        clients/R/MonetDB.R/src/mapi.c
        clients/Tests/exports.stable.out
        clients/mapiclient/mclient.c
        clients/mapiclient/mnc.c
        clients/mapilib/mapi.c
        clients/mapilib/mapi.h
        clients/odbc/driver/ODBCGlobal.h
        common/stream/stream.c
        common/utils/mutils.c
        common/utils/mutils.h
        configure.ag
        gdk/gdk_atoms.c
        gdk/gdk_posix.c
        gdk/gdk_posix.h
        gdk/gdk_storage.c
        gdk/gdk_utils.c
        monetdb5/modules/atoms/batxml.c
        monetdb5/modules/kernel/aggr.c
        monetdb5/modules/kernel/alarm.c
        monetdb5/modules/kernel/batmmath.c
        monetdb5/modules/kernel/batstr.c
        monetdb5/modules/kernel/counters.c
        monetdb5/modules/kernel/logger.c
        monetdb5/modules/kernel/mmath.c
        monetdb5/modules/mal/batcalc.c
        monetdb5/modules/mal/calc.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/pcre.c
        monetdb5/modules/mal/transaction.c
        sql/backends/monet5/datacell/dcsocket.c
        sql/backends/monet5/gsl/gsl.c
        sql/benchmarks/tpch/Tests/11-explain.stable.out
        sql/benchmarks/tpch/Tests/11-plan.stable.out
        sql/benchmarks/tpch/Tests/14-explain.stable.out
        sql/benchmarks/tpch/Tests/14-plan.stable.out
        sql/benchmarks/tpch/Tests/17-explain.stable.out
        sql/benchmarks/tpch/Tests/17-plan.stable.out
        sql/benchmarks/tpch/Tests/20-explain.stable.out
        sql/benchmarks/tpch/Tests/20-plan.stable.out
        sql/benchmarks/tpch/Tests/22-explain.stable.out
        sql/benchmarks/tpch/Tests/22-plan.stable.out
        sql/common/sql_string.c
        sql/server/rel_select.c
        sql/server/sql_parser.y
        
sql/test/BugTracker-2012/Tests/user_defined_decimal_function.Bug-2992.stable.out
        sql/test/BugTracker-2014/Tests/stringfloatshtcompare.Bug-3512.stable.err
        sql/test/BugTracker-2014/Tests/stringfloatshtcompare.Bug-3512.stable.out
        tools/merovingian/daemon/client.c
        tools/merovingian/daemon/connections.c
        tools/merovingian/daemon/controlrunner.c
        tools/merovingian/daemon/merovingian.c
        tools/merovingian/daemon/multiplex-funnel.c
        tools/merovingian/daemon/proxy.c
        tools/merovingian/utils/control.c
Branch: default
Log Message:

merged with Oct2014


diffs (truncated from 2432 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -111,13 +111,6 @@
 /* Define to 1 if you have the <crypt.h> header file. */
 /* #undef HAVE_CRYPT_H */
 
-/* Define to 1 if you have the <cstdio> header file. */
-#if _MSC_VER >= 1300
-#define HAVE_CSTDIO 1
-#else
-/* #undef HAVE_CSTDIO */
-#endif
-
 /* Define to 1 if you have the `ctime_r' function. */
 #define HAVE_CTIME_R 1
 
@@ -229,13 +222,6 @@
 /* Define to 1 if you have the <inttypes.h> header file. */
 #define HAVE_INTTYPES_H 1      /* generated by the Makefile */
 
-/* Define to 1 if you have the <iostream> header file. */
-#if _MSC_VER >= 1300
-#define HAVE_IOSTREAM 1
-#else
-/* #undef HAVE_IOSTREAM */
-#endif
-
 /* Define to 1 if you have the <io.h> header file. */
 #define HAVE_IO_H 1
 
@@ -1041,9 +1027,6 @@ typedef unsigned __int64 uint64_t;
 #define __bool_true_false_are_defined 1
 
 
-#define SLASH_2_DIR_SEP(s) {char *t; for(t=strchr(s, '/'    ); t; 
t=strchr(t+1, '/'    )) *t=DIR_SEP;}
-#define DIR_SEP_2_SLASH(s) {char *t; for(t=strchr(s, DIR_SEP); t; 
t=strchr(t+1, DIR_SEP)) *t='/'    ;}
-
 #ifdef HAVE_LONG_LONG
 typedef long long lng;
 # define SIZEOF_LNG SIZEOF_LONG_LONG
diff --git a/clients/R/MonetDB.R/R/control.R b/clients/R/MonetDB.R/R/control.R
--- a/clients/R/MonetDB.R/R/control.R
+++ b/clients/R/MonetDB.R/R/control.R
@@ -69,10 +69,20 @@ monetdb.server.start <-
 
 
 monetdb.server.stop <-
-  function( correct.pid ){
+  function( correct.pid, wait=T ){
     
     if ( .Platform$OS.type == "unix" ) {
-      system(paste0("kill ",correct.pid))
+      system(paste0("kill ",correct.pid))  
+      waittime <- 2
+      if (!wait) return(TRUE)
+      Sys.sleep(1)
+      repeat {
+        psout <- system(paste0("ps ax | grep \"^", correct.pid, 
".*mserver5\""), ignore.stdout=T) 
+        if (psout != 0) break
+        message("Waiting ",waittime,"s for server shutdown (ESC or CTRL+C to 
abort)")
+        Sys.sleep(waittime)
+        waittime <- waittime * 2
+      }
     } 
     
     if ( .Platform$OS.type == "windows" ) {
diff --git a/clients/R/MonetDB.R/src/mapi.c b/clients/R/MonetDB.R/src/mapi.c
--- a/clients/R/MonetDB.R/src/mapi.c
+++ b/clients/R/MonetDB.R/src/mapi.c
@@ -132,25 +132,25 @@ SEXP mapiConnect(SEXP host, SEXP port, S
 
        for (rp = result; rp != NULL; rp = rp->ai_next) {
                sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
-               if (sock == -1)
+               if (sock == INVALID_SOCKET)
                        continue;
 
                if (setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (const char *) 
&sto,
-                               sizeof(sto)) < 0) {
+                               sizeof(sto)) == SOCKET_ERROR) {
                        error("setsockopt failed");
                }
                if (setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (const char *) 
&sto,
-                               sizeof(sto)) < 0) {
+                               sizeof(sto)) == SOCKET_ERROR) {
                        error("setsockopt failed\n");
                }
                // lets have a 1M buffer on this socket, ok?
                int recvbuf_size = ALLOCSIZE;
 
                if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF,
-                               (const char *) &recvbuf_size, 
sizeof(recvbuf_size))) {
+                               (const char *) &recvbuf_size, 
sizeof(recvbuf_size)) == SOCKET_ERROR) {
                        error("setsockopt failed");
                }
-               if (connect(sock, rp->ai_addr, rp->ai_addrlen) != -1) {
+               if (connect(sock, rp->ai_addr, rp->ai_addrlen) != SOCKET_ERROR) 
{
                        if (DEBUG) {
                                printf("II: Connected to %s:%s\n", hostval, 
portvalstr);
                        }
@@ -183,7 +183,13 @@ size_t sockRead(int fd, void *buf, size_
        ssize_t retval = -1;
        do {
                retval = recv(fd, buf, size, MSG_WAITALL);
-       } while (retval == -1 && errno == EINTR);
+       } while (retval == SOCKET_ERROR &&
+#ifdef _MSC_VER
+                WSAGetLastError() == WSAEINTR
+#else
+                errno == EINTR
+#endif
+               );
        if (retval == -1) {
 #ifdef __WIN32__
                errno = WSAGetLastError();
@@ -198,7 +204,13 @@ size_t sockWrite(int fd, const void *buf
        ssize_t retval = -1;
        do {
                retval = send(fd, buf, size, 0);
-       } while (retval == -1 && errno == EINTR);
+       } while (retval == SOCKET_ERROR &&
+#ifdef _MSC_VER
+                WSAGetLastError() == WSAEINTR
+#else
+                errno == EINTR
+#endif
+               );
        if (retval == -1) {
 #ifdef __WIN32__
                errno = WSAGetLastError();
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -479,7 +479,6 @@ int ptrToStr(str *dst, int *len, const p
 const ptr ptr_nil;
 struct dirent *readdir(DIR *dir);
 void rewinddir(DIR *dir);
-void set_errno(int);
 int shtFromStr(const char *src, int *len, sht **dst);
 int shtToStr(str *dst, int *len, const sht *src);
 const sht sht_nil;
@@ -491,12 +490,12 @@ int strToStr(str *dst, int *len, const c
 const char str_nil[2];
 int void_inplace(BAT *b, oid id, const void *val, bit force);
 BUN void_replace_bat(BAT *b, BAT *u, bit force);
-int *win_errno(void);
 int win_mkdir(const char *, const int mode);
 int win_rename(const char *, const char *);
 int win_rmdir(const char *);
 int win_stat(const char *, struct stat *);
 int win_unlink(const char *);
+int winerror(int);
 const wrd wrd_nil;
 
 # mapi
@@ -597,6 +596,7 @@ MapiMsg mapi_timeout(Mapi mid, unsigned 
 MapiMsg mapi_trace(Mapi mid, int flag);
 char *mapi_unquote(char *msg);
 MapiMsg mapi_virtual_result(MapiHdl hdl, int columns, const char 
**columnnames, const char **columntypes, const int *columnlengths, int 
tuplecount, const char ***tuples);
+const char *wsaerror(int);
 
 # monetdb5
 str AGGRavg12_dbl(bat *retval, const bat *bid, const bat *eid);
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -68,10 +68,6 @@
 #ifdef HAVE_LANGINFO_H
 #include <langinfo.h>
 #endif
-#else
-#ifdef NATIVE_WIN32
-#include <Windows.h>
-#endif
 #endif
 #endif
 
@@ -247,8 +243,8 @@ gettime(void)
                tb.time -= tbbase.time;
                return (timertype) tb.time * 1000000 + (timertype) tb.millitm * 
1000;
        }
-#endif
-#endif
+#endif /* HAVE_FTIME */
+#endif /* HAVE_GETTIMEOFDAY */
 }
 
 static void
@@ -1433,7 +1429,7 @@ SQLrenderer(MapiHdl hdl, char singleinst
 }
 
 static void
-setFormatter(char *s)
+setFormatter(const char *s)
 {
        if (separator)
                free(separator);
@@ -1452,10 +1448,20 @@ setFormatter(char *s)
                separator = strdup(",");
        } else if (strncmp(s, "csv=", 4) == 0) {
                formatter = CSVformatter;
-               separator = strdup(s + 4);
+               if (s[4] == '"') {
+                       separator = strdup(s + 5);
+                       if (separator[strlen(separator) - 1] == '"')
+                               separator[strlen(separator) - 1] = 0;
+               } else
+                       separator = strdup(s + 4);
        } else if (strncmp(s, "csv+", 4) == 0) {
                formatter = CSVformatter;
-               separator = strdup(s + 4);
+               if (s[4] == '"') {
+                       separator = strdup(s + 5);
+                       if (separator[strlen(separator) - 1] == '"')
+                               separator[strlen(separator) - 1] = 0;
+               } else
+                       separator = strdup(s + 4);
                csvheader = 1;
        } else if (strcmp(s, "tab") == 0) {
                formatter = CSVformatter;
diff --git a/clients/mapiclient/mnc.c b/clients/mapiclient/mnc.c
--- a/clients/mapiclient/mnc.c
+++ b/clients/mapiclient/mnc.c
@@ -179,7 +179,7 @@ main(int argc, char **argv)
                        s = socket(rp->ai_family, rp->ai_socktype, 
rp->ai_protocol);
                        if (s == INVALID_SOCKET)
                                continue;
-                       if (connect(s, rp->ai_addr, (socklen_t) rp->ai_addrlen) 
!= -1)
+                       if (connect(s, rp->ai_addr, (socklen_t) rp->ai_addrlen) 
!= SOCKET_ERROR)
                                break;  /* success */
                        closesocket(s);
                }
@@ -209,7 +209,7 @@ main(int argc, char **argv)
                        exit(1);
                }
 
-               if (connect(s, serv, sizeof(server)) < 0) {
+               if (connect(s, serv, sizeof(server)) == SOCKET_ERROR) {
                        fprintf(stderr,
                                 "initiating connection on socket failed: %s\n",
                                 strerror(errno));
@@ -242,7 +242,7 @@ main(int argc, char **argv)
                length = (SOCKLEN) sizeof(server);
 
                server.sin_port = htons((unsigned short) ((port) & 0xFFFF));
-               if (bind(sock, (SOCKPTR) &server, length) < 0) {
+               if (bind(sock, (SOCKPTR) &server, length) == SOCKET_ERROR) {
                        fprintf(stderr, "bind to port %d failed: %s\n",
                                        port, strerror(errno));
                        exit(1);
diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c
--- a/clients/mapilib/mapi.c
+++ b/clients/mapilib/mapi.c
@@ -1099,6 +1099,119 @@ mapi_error_str(Mapi mid)
        return mid->errorstr;
 }
 
+#ifdef _MSC_VER
+static struct {
+       int e;
+       const char *m;
+} wsaerrlist[] = {
+       { WSA_INVALID_HANDLE, "Specified event object handle is invalid" },
+       { WSA_NOT_ENOUGH_MEMORY, "Insufficient memory available" },
+       { WSA_INVALID_PARAMETER, "One or more parameters are invalid" },
+       { WSA_OPERATION_ABORTED, "Overlapped operation aborted" },
+       { WSA_IO_INCOMPLETE, "Overlapped I/O event object not in signaled 
state" },
+       { WSA_IO_PENDING, "Overlapped operations will complete later" },
+       { WSAEINTR, "Interrupted function call" },
+       { WSAEBADF, "File handle is not valid" },
+       { WSAEACCES, "Permission denied" },
+       { WSAEFAULT, "Bad address" },
+       { WSAEINVAL, "Invalid argument" },
+       { WSAEMFILE, "Too many open files" },
+       { WSAEWOULDBLOCK, "Resource temporarily unavailable" },
+       { WSAEINPROGRESS, "Operation now in progress" },
+       { WSAEALREADY, "Operation already in progress" },
+       { WSAENOTSOCK, "Socket operation on nonsocket" },
+       { 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" },
+       { WSAEPFNOSUPPORT, "Protocol family not supported" },
+       { WSAEAFNOSUPPORT, "Address family not supported by protocol family" },
+       { WSAEADDRINUSE, "Address already in use" },
+       { WSAEADDRNOTAVAIL, "Cannot assign requested address" },
+       { WSAENETDOWN, "Network is down" },
+       { WSAENETUNREACH, "Network is unreachable" },
+       { WSAENETRESET, "Network dropped connection on 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, "Cannot send after socket shutdown" },
+       { WSAETOOMANYREFS, "Too many references" },
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to