Portability patches (FreeBSD).
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 9 Mar 2010 12:16:08 +0000 (12:16 +0000)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Tue, 9 Mar 2010 12:16:08 +0000 (12:16 +0000)
18 files changed:
org.glite.lb.client/examples/gen_begin
org.glite.lb.client/src/connection.c
org.glite.lb.client/src/prod_proto.c
org.glite.lb.logger/src/logd.c
org.glite.lb.server/src/bkserverd.c
org.glite.lb.server/src/db_supp.c
org.glite.lb.server/src/lcas_lb.c
org.glite.lb.server/src/store.c.T
org.glite.lb.server/src/write2rgma.c
org.glite.lb.utils/src/process_attrs.c
org.glite.lb.utils/src/process_attrs2.c.T
org.glite.lb.utils/src/statistics.c
org.glite.lbjp-common.db/Makefile
org.glite.lbjp-common.db/src/db-mysql.c
org.glite.lbjp-common.maildir/interface/maildir.h
org.glite.lbjp-common.maildir/src/maildir.c
org.glite.lbjp-common.server-bones/src/srvbones.c
org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h

index fe96c1b..a4df1f6 100755 (executable)
@@ -42,7 +42,7 @@ done
 
 test \( -z "$BKSERVER_HOST" \) -a \( -z "$EDG_JOBID" \) && usage
 
-if [[ $0 =~ "cream_" ]]; then TYPE=-c; fi
+if echo "$0" | grep "cream_" >/dev/null; then TYPE=-c; fi
 
 if [ -z "$EDG_JOBID" ] 
 then
index a8f8574..7cedf5e 100644 (file)
@@ -8,6 +8,7 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/stat.h>
 #include <sys/un.h>
 #include <netinet/in.h>
 #include <netdb.h>
index 90f6785..fb1bd20 100644 (file)
@@ -1,6 +1,7 @@
 #ident "$Header$"
 
 #include <sys/types.h>
+#include <sys/socket.h>
 #include <sys/un.h>
 #include <time.h>
 #include <unistd.h>
 #include "producer.h"
 #include "connection.h"
 
+#if defined(FREEBSD) || defined(__FreeBSD__) && !defined(TCP_CORK)
+#define TCP_CORK TCP_NOPUSH
+#endif
+
 static const char* socket_path="/tmp/lb_proxy_store.sock";
 
 /**
index f9f8730..3f38d10 100644 (file)
 #include <assert.h>
 #include <errno.h>
 
+#if defined(FREEBSD) || defined(__FreeBSD__)
+#define TCP_CORK TCP_NOPUSH
+#endif
+
 #include "glite/lbu/log.h"
 #include "glite/lb/context-int.h"
 #include "glite/lb/timeouts.h"
@@ -27,6 +31,8 @@
 
 #define DEFAULT_PIDFILE "/var/glite/glite-lb-logd.pid"
 
+typedef void (*logd_handler_t)(int);
+
 static const char rcsid[] = "@(#)$Id$";
 static int debug = 0;
 static int port = EDG_WLL_LOG_PORT_DEFAULT;
@@ -93,7 +99,7 @@ usage(char *program_name) {
                program_name,program_name);
 }
 
-static sighandler_t mysignal(int num,sighandler_t handler)
+static logd_handler_t mysignal(int num,logd_handler_t handler)
 {
        struct sigaction        sa,osa;
 
index 22577e5..ae85faa 100644 (file)
@@ -5,7 +5,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <getopt.h>
-#include <linux/limits.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
index 98d09b0..28bd450 100644 (file)
@@ -16,8 +16,8 @@ int edg_wll_SetErrorDB(edg_wll_Context ctx) {
 
        if (ctx->dbctx) {
                code = glite_lbu_DBError(ctx->dbctx, NULL, &ed);
-               if (code == EDEADLOCK) code = EDG_WLL_ERROR_DB_TRANS_DEADLOCK;
-               if (code == ERESTART) code = EDG_WLL_ERROR_DB_LOST_CONNECTION;
+               if (code == EDEADLK) code = EDG_WLL_ERROR_DB_TRANS_DEADLOCK;
+               if (code == ENOTCONN) code = EDG_WLL_ERROR_DB_LOST_CONNECTION;
                edg_wll_SetError(ctx, code, ed);
                free(ed);
        } else {
index f216755..7dbcf63 100644 (file)
@@ -1,5 +1,10 @@
 #ident "$Header$"
 
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include <glite/security/lcas/lcas_modules.h>
 
 static char *modname = "lcas_lb";
index b07e572..5abfc98 100644 (file)
@@ -719,7 +719,7 @@ int register_subjobs_embryonic(edg_wll_Context ctx,const edg_wll_RegJobEvent *e)
 
                /* save jobid-userid relation into jobs table */
                if ((err = store_job(ctx, subjobs[i], userid, proxy, server, 0, 0)))
-                       if (edg_wll_Error(ctx,&et,&ed) == EDEADLOCK) goto err;
+                       if (edg_wll_Error(ctx,&et,&ed) == EDEADLK) goto err;
 
                /* interchange variable parts (jobids) in values */
                /* there are only two occurences of subjob jobid */
index fe9075a..79e7271 100755 (executable)
@@ -7,9 +7,11 @@
 #include <sys/file.h>
 #include <sys/socket.h>
 #include <sys/types.h>
+#include <sys/stat.h>
 #include <sys/un.h>
 #include <sys/uio.h>
 #include <errno.h>
+#include <string.h>
 
 
 #include <cclassad.h>
index 9b03c46..d7ab91d 100644 (file)
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 #include "glite/lbu/trio.h"
index 3467d29..d4c208d 100644 (file)
@@ -5,7 +5,7 @@
 @@@LANG: C
 
 #include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
 #include <unistd.h>
 
 #include "glite/lbu/trio.h"
index 5736c4a..a96e35b 100644 (file)
@@ -7,10 +7,10 @@
 #include <string.h>
 #include <errno.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <sys/time.h>
 #include <time.h>
 #include <dlfcn.h>
-#include <malloc.h>
 #include <unistd.h>
 #include <getopt.h>
 #include <sys/stat.h>
index 5775df2..025d1bc 100644 (file)
@@ -25,6 +25,12 @@ VPATH=${top_srcdir}/interface:${top_srcdir}/src:${top_srcdir}/examples
 
 DEBUG:=-g -O0 -W -Wall
 
+os=${shell uname}
+DL_LIBS:=
+ifeq (${os},Linux)
+  DL_LIBS:=-ldl
+endif
+
 MYSQL_SONAME:=$(shell ../project/get_soname.sh mysqlclient ${mysql-devel_prefix}/${libdir} ${mysql_prefix}/${libdir} ${mysql-devel_prefix}/lib ${mysql_prefix}/lib)
 PSQL_SONAME:=$(shell ../project/get_soname.sh pq ${postgresql_prefix}/${libdir} ${postgresql_prefix}/lib)
 
@@ -62,7 +68,7 @@ COMPILE:=libtool --mode=compile ${CC} ${CFLAGS}
 LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} 
 INSTALL:=libtool --mode=install install
 
-EXT_LIBS:=-lglite_lbu_trio -lpthread -ldl
+EXT_LIBS:=-lglite_lbu_trio -lpthread ${DL_LIBS}
 TESTOBJS:=${OBJS} dbtest.o
 OBJS:=${OBJS} db.o
 HDRS:=db.h
index 60468d7..1896d86 100644 (file)
@@ -418,7 +418,7 @@ int glite_lbu_QueryIndicesMysql(glite_lbu_DBContext ctx_gen, const char *table,
        size_t  i,j,ret;
 
 /* XXX: "show index from" columns. Matches at least MySQL 4.0.11 */
-       char    *sql, *showcol[12];
+       char    *sql, *showcol[13];
        int     Key_name,Seq_in_index,Column_name,Sub_part;
 
        char    **keys = NULL;
@@ -549,14 +549,14 @@ int glite_lbu_ExecSQLMysql(glite_lbu_DBContext ctx_gen, const char *cmd, glite_l
                                case CR_SERVER_LOST:
                                case CR_SERVER_GONE_ERROR:
                                        if (ctx->in_transaction) {
-                                               ERR(ctx, ERESTART, mysql_module.mysql_error(ctx->mysql));
+                                               ERR(ctx, ENOTCONN, mysql_module.mysql_error(ctx->mysql));
                                                return -1;
                                        }
                                        else if (retry_nr <= 0) 
                                                do_reconnect = 1;
                                        break;
                                case ER_LOCK_DEADLOCK:
-                                       ERR(ctx, EDEADLOCK, mysql_module.mysql_error(ctx->mysql));
+                                       ERR(ctx, EDEADLK, mysql_module.mysql_error(ctx->mysql));
                                        return -1;
                                        break;  
                                default:
index fbca506..e921ef4 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef GLITE_LBU_MAILDIR_H
 #define GLITE_LBU_MAILDIR_H
 
+#include <time.h>
+
 /*
  * Functions for reading and writing messages via
  * maildir protocol.
index 78c809f..7948021 100644 (file)
@@ -4,6 +4,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
+#include <limits.h>
 #include <time.h>
 #include <fcntl.h>
 #include <sys/time.h>
index 7e431c8..936ba4a 100644 (file)
@@ -275,7 +275,7 @@ int glite_srvbones_daemonize(const char *servername, const char *custom_pidfile,
        } else {
                pidfile = strdup(custom_pidfile);
        }
-       setpgrp(); /* needs for signalling */
+       setpgid(0, 0); /* needs for signalling */
        master = getpid();
        fpid = fopen(pidfile,"r");
        if ( fpid )
index ff11248..7ca5f12 100644 (file)
@@ -292,9 +292,9 @@ A commercial use license is available from Genivia, Inc., contact@genivia.com
 #  define HAVE_STRRCHR
 #  define HAVE_STRTOD
 #  define HAVE_SSCANF
-#  define HAVE_STRTOD_L
-#  define HAVE_SSCANF_L
-#  define HAVE_SPRINTF_L
+//#  define HAVE_STRTOD_L
+//#  define HAVE_SSCANF_L
+//#  define HAVE_SPRINTF_L
 #  define HAVE_STRTOL
 #  define HAVE_STRTOUL
 #  define HAVE_STRTOLL