From 82eb3a5e3d9c335dfb4e2704d77ff2259a611aa5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= Date: Tue, 9 Mar 2010 12:16:08 +0000 Subject: [PATCH] Portability patches (FreeBSD). --- org.glite.lb.client/examples/gen_begin | 2 +- org.glite.lb.client/src/connection.c | 1 + org.glite.lb.client/src/prod_proto.c | 5 +++++ org.glite.lb.logger/src/logd.c | 8 +++++++- org.glite.lb.server/src/bkserverd.c | 2 +- org.glite.lb.server/src/db_supp.c | 4 ++-- org.glite.lb.server/src/lcas_lb.c | 5 +++++ org.glite.lb.server/src/store.c.T | 2 +- org.glite.lb.server/src/write2rgma.c | 2 ++ org.glite.lb.utils/src/process_attrs.c | 2 +- org.glite.lb.utils/src/process_attrs2.c.T | 2 +- org.glite.lb.utils/src/statistics.c | 2 +- org.glite.lbjp-common.db/Makefile | 8 +++++++- org.glite.lbjp-common.db/src/db-mysql.c | 6 +++--- org.glite.lbjp-common.maildir/interface/maildir.h | 2 ++ org.glite.lbjp-common.maildir/src/maildir.c | 1 + org.glite.lbjp-common.server-bones/src/srvbones.c | 2 +- org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h | 6 +++--- 18 files changed, 45 insertions(+), 17 deletions(-) diff --git a/org.glite.lb.client/examples/gen_begin b/org.glite.lb.client/examples/gen_begin index fe96c1b..a4df1f6 100755 --- a/org.glite.lb.client/examples/gen_begin +++ b/org.glite.lb.client/examples/gen_begin @@ -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 diff --git a/org.glite.lb.client/src/connection.c b/org.glite.lb.client/src/connection.c index a8f8574..7cedf5e 100644 --- a/org.glite.lb.client/src/connection.c +++ b/org.glite.lb.client/src/connection.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/org.glite.lb.client/src/prod_proto.c b/org.glite.lb.client/src/prod_proto.c index 90f6785..fb1bd20 100644 --- a/org.glite.lb.client/src/prod_proto.c +++ b/org.glite.lb.client/src/prod_proto.c @@ -1,6 +1,7 @@ #ident "$Header$" #include +#include #include #include #include @@ -21,6 +22,10 @@ #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"; /** diff --git a/org.glite.lb.logger/src/logd.c b/org.glite.lb.logger/src/logd.c index f9f8730..3f38d10 100644 --- a/org.glite.lb.logger/src/logd.c +++ b/org.glite.lb.logger/src/logd.c @@ -16,6 +16,10 @@ #include #include +#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; diff --git a/org.glite.lb.server/src/bkserverd.c b/org.glite.lb.server/src/bkserverd.c index 22577e5..ae85faa 100644 --- a/org.glite.lb.server/src/bkserverd.c +++ b/org.glite.lb.server/src/bkserverd.c @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/org.glite.lb.server/src/db_supp.c b/org.glite.lb.server/src/db_supp.c index 98d09b0..28bd450 100644 --- a/org.glite.lb.server/src/db_supp.c +++ b/org.glite.lb.server/src/db_supp.c @@ -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 { diff --git a/org.glite.lb.server/src/lcas_lb.c b/org.glite.lb.server/src/lcas_lb.c index f216755..7dbcf63 100644 --- a/org.glite.lb.server/src/lcas_lb.c +++ b/org.glite.lb.server/src/lcas_lb.c @@ -1,5 +1,10 @@ #ident "$Header$" +#include +#include +#include +#include + #include static char *modname = "lcas_lb"; diff --git a/org.glite.lb.server/src/store.c.T b/org.glite.lb.server/src/store.c.T index b07e572..5abfc98 100644 --- a/org.glite.lb.server/src/store.c.T +++ b/org.glite.lb.server/src/store.c.T @@ -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 */ diff --git a/org.glite.lb.server/src/write2rgma.c b/org.glite.lb.server/src/write2rgma.c index fe9075a..79e7271 100755 --- a/org.glite.lb.server/src/write2rgma.c +++ b/org.glite.lb.server/src/write2rgma.c @@ -7,9 +7,11 @@ #include #include #include +#include #include #include #include +#include #include diff --git a/org.glite.lb.utils/src/process_attrs.c b/org.glite.lb.utils/src/process_attrs.c index 9b03c46..d7ab91d 100644 --- a/org.glite.lb.utils/src/process_attrs.c +++ b/org.glite.lb.utils/src/process_attrs.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include "glite/lbu/trio.h" diff --git a/org.glite.lb.utils/src/process_attrs2.c.T b/org.glite.lb.utils/src/process_attrs2.c.T index 3467d29..d4c208d 100644 --- a/org.glite.lb.utils/src/process_attrs2.c.T +++ b/org.glite.lb.utils/src/process_attrs2.c.T @@ -5,7 +5,7 @@ @@@LANG: C #include -#include +#include #include #include "glite/lbu/trio.h" diff --git a/org.glite.lb.utils/src/statistics.c b/org.glite.lb.utils/src/statistics.c index 5736c4a..a96e35b 100644 --- a/org.glite.lb.utils/src/statistics.c +++ b/org.glite.lb.utils/src/statistics.c @@ -7,10 +7,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include diff --git a/org.glite.lbjp-common.db/Makefile b/org.glite.lbjp-common.db/Makefile index 5775df2..025d1bc 100644 --- a/org.glite.lbjp-common.db/Makefile +++ b/org.glite.lbjp-common.db/Makefile @@ -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 diff --git a/org.glite.lbjp-common.db/src/db-mysql.c b/org.glite.lbjp-common.db/src/db-mysql.c index 60468d7..1896d86 100644 --- a/org.glite.lbjp-common.db/src/db-mysql.c +++ b/org.glite.lbjp-common.db/src/db-mysql.c @@ -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: diff --git a/org.glite.lbjp-common.maildir/interface/maildir.h b/org.glite.lbjp-common.maildir/interface/maildir.h index fbca506..e921ef4 100644 --- a/org.glite.lbjp-common.maildir/interface/maildir.h +++ b/org.glite.lbjp-common.maildir/interface/maildir.h @@ -1,6 +1,8 @@ #ifndef GLITE_LBU_MAILDIR_H #define GLITE_LBU_MAILDIR_H +#include + /* * Functions for reading and writing messages via * maildir protocol. diff --git a/org.glite.lbjp-common.maildir/src/maildir.c b/org.glite.lbjp-common.maildir/src/maildir.c index 78c809f..7948021 100644 --- a/org.glite.lbjp-common.maildir/src/maildir.c +++ b/org.glite.lbjp-common.maildir/src/maildir.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include diff --git a/org.glite.lbjp-common.server-bones/src/srvbones.c b/org.glite.lbjp-common.server-bones/src/srvbones.c index 7e431c8..936ba4a 100644 --- a/org.glite.lbjp-common.server-bones/src/srvbones.c +++ b/org.glite.lbjp-common.server-bones/src/srvbones.c @@ -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 ) diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h index ff11248..7ca5f12 100644 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h +++ b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h @@ -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 -- 1.8.2.3