Send Linux-ha-cvs mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Linux-ha-cvs digest..."


Today's Topics:

   1. Linux-HA CVS: heartbeat by gshi from 
      ([email protected])
   2. Linux-HA CVS: include by gshi from 
      ([email protected])
   3. Linux-HA CVS: lib by gshi from  ([email protected])
   4. Linux-HA CVS: include by gshi from 
      ([email protected])


----------------------------------------------------------------------

Message: 1
Date: Thu, 15 Dec 2005 19:11:59 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: heartbeat by gshi from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : gshi
Host    : 
Project : linux-ha
Module  : heartbeat

Dir     : linux-ha/heartbeat


Modified Files:
        config.c 


Log Message:
add an entry "env" to tell heartbeat to set environment variable
change classic.c quorum module to majority.c
change grant.c tiebreaker module to twonodes.c


===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/heartbeat/config.c,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -3 -r1.187 -r1.188
--- config.c    12 Dec 2005 14:27:45 -0000      1.187
+++ config.c    16 Dec 2005 02:11:59 -0000      1.188
@@ -1,4 +1,4 @@
-/* $Id: config.c,v 1.187 2005/12/12 14:27:45 blaschke Exp $ */
+/* $Id: config.c,v 1.188 2005/12/16 02:11:59 gshi Exp $ */
 /*
  * Parse various heartbeat configuration files...
  *
@@ -90,6 +90,7 @@
 static int set_compression(const char *);
 static int set_compression_threshold(const char *);
 static int set_traditional_compression(const char *);
+static int set_env(const char *);
 static int set_generation_method(const char *);
 static int set_realtime(const char *);
 static int set_debuglevel(const char *);
@@ -157,6 +158,7 @@
 ,{KEY_COMPRESSION,   set_compression, TRUE ,"zlib", "set compression module"}
 ,{KEY_COMPRESSION_THRESHOLD, set_compression_threshold, TRUE, "2", "set 
compression threshold"}
 ,{KEY_TRADITIONAL_COMPRESSION, set_traditional_compression, TRUE, "yes", "set 
traditional_compression"}
+,{KEY_ENV, set_env, FALSE, NULL, "set environment variable"}
 };
 
 static const struct WholeLineDirective {
@@ -2088,6 +2090,61 @@
        return HA_OK;
 }
 
+static int
+set_env(const char * nvpair)
+{              
+
+       int nlen;
+       int vlen;
+       char* env_name;
+       char*   value;
+
+       nlen = strcspn(nvpair, "=");
+       if (nlen >= MAXLINE || nlen <=0){
+               cl_log(LOG_ERR, "%s: invalid nvpair(%s)",
+                      __FUNCTION__, nvpair);
+               return HA_FAIL;
+       }
+       
+       env_name = cl_malloc(nlen + 4);
+       if (env_name == NULL){
+               cl_log(LOG_ERR, "%s: malloc failed",
+                      __FUNCTION__);
+               return HA_FAIL;
+       }
+       
+       memcpy(env_name, "HA_", 3);
+       memcpy(env_name + 3, nvpair, nlen);
+       env_name[nlen + 3] = 0;
+       
+       vlen = strlen(nvpair + nlen + 1);
+       if (vlen >= MAXLINE || nlen <=0){
+               cl_log(LOG_ERR, "%s: invalid value(%s)",
+                      __FUNCTION__, nvpair);
+               return HA_FAIL;
+       }
+       
+       value = cl_malloc(vlen + 1);
+       if (value == NULL){
+               cl_log(LOG_ERR, "%s: malloc failed for value",
+                      __FUNCTION__);
+               return HA_FAIL;
+       }       
+       memcpy(value, nvpair+nlen +1  , vlen);
+       value[vlen] = 0;
+       /*
+        * It is unclear whether any given version of setenv
+        * makes a copy of the name or value, or both.
+        * Therefore it is UNSAFE to free either one.
+        * Fortunately the size of the resulting potential memory leak
+        * is small for this particular situation.
+        */
+       setenv(env_name, value, 1);
+       if (ANYDEBUG){
+               cl_log(LOG_DEBUG, "setting env(%s=%s), nvpair(%s)", env_name, 
value,nvpair);
+       }
+       return HA_OK;
+}
 
 
 #if 0
@@ -2402,6 +2459,11 @@
 
 /*
  * $Log: config.c,v $
+ * Revision 1.188  2005/12/16 02:11:59  gshi
+ * add an entry "env" to tell heartbeat to set environment variable
+ * change classic.c quorum module to majority.c
+ * change grant.c tiebreaker module to twonodes.c
+ *
  * Revision 1.187  2005/12/12 14:27:45  blaschke
  *
  * Fix BEAM "errors" from bug 990




------------------------------

Message: 2
Date: Thu, 15 Dec 2005 19:12:00 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: include by gshi from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : gshi
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include/clplumbing


Modified Files:
        cl_misc.h 


Log Message:
add an entry "env" to tell heartbeat to set environment variable
change classic.c quorum module to majority.c
change grant.c tiebreaker module to twonodes.c


===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/clplumbing/cl_misc.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- cl_misc.h   10 Sep 2005 21:50:15 -0000      1.3
+++ cl_misc.h   16 Dec 2005 02:11:59 -0000      1.4
@@ -21,4 +21,7 @@
 int    cl_str_to_boolean(const char*, int*);
 
 int    cl_file_exists(const char* filename);
+
+char*  cl_get_env(const char* env_name);
+
 #endif




------------------------------

Message: 3
Date: Thu, 15 Dec 2005 19:12:00 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: lib by gshi from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : gshi
Host    : 
Project : linux-ha
Module  : lib

Dir     : linux-ha/lib/clplumbing


Modified Files:
        cl_misc.c 


Log Message:
add an entry "env" to tell heartbeat to set environment variable
change classic.c quorum module to majority.c
change grant.c tiebreaker module to twonodes.c


===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/lib/clplumbing/cl_misc.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -3 -r1.5 -r1.6
--- cl_misc.c   10 Sep 2005 21:50:15 -0000      1.5
+++ cl_misc.c   16 Dec 2005 02:11:59 -0000      1.6
@@ -23,6 +23,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <stdlib.h>
 
 int
 cl_str_to_boolean(const char * s, int * ret)
@@ -67,3 +68,15 @@
        
        return FALSE;
 }
+
+char*
+cl_get_env(const char* env_name)
+{      
+       if (env_name == NULL){
+               cl_log(LOG_ERR, "%s: null name",
+                      __FUNCTION__);
+               return NULL;
+       }
+       
+       return getenv(env_name);
+}




------------------------------

Message: 4
Date: Thu, 15 Dec 2005 19:12:00 -0700 (MST)
From: [email protected]
Subject: [Linux-ha-cvs] Linux-HA CVS: include by gshi from 
To: [EMAIL PROTECTED]
Message-ID: <[EMAIL PROTECTED]>

linux-ha CVS committal

Author  : gshi
Host    : 
Project : linux-ha
Module  : include

Dir     : linux-ha/include


Modified Files:
        hb_api.h 


Log Message:
add an entry "env" to tell heartbeat to set environment variable
change classic.c quorum module to majority.c
change grant.c tiebreaker module to twonodes.c


===================================================================
RCS file: /home/cvs/linux-ha/linux-ha/include/hb_api.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -3 -r1.39 -r1.40
--- hb_api.h    17 Oct 2005 19:47:44 -0000      1.39
+++ hb_api.h    16 Dec 2005 02:11:59 -0000      1.40
@@ -1,4 +1,4 @@
-/* $Id: hb_api.h,v 1.39 2005/10/17 19:47:44 gshi Exp $ */
+/* $Id: hb_api.h,v 1.40 2005/12/16 02:11:59 gshi Exp $ */
 /*
  * Client-side Low-level clustering API for heartbeat.
  *
@@ -423,6 +423,7 @@
 #define KEY_REL2       "crm"
 #define KEY_AUTOJOIN   "autojoin"
 #define KEY_UUIDFROM   "uuidfrom"
+#define KEY_ENV                "env"
 
 ll_cluster_t*  ll_cluster_new(const char * llctype);
 #endif /* __HB_API_H */




------------------------------

_______________________________________________
Linux-ha-cvs mailing list
[email protected]
http://lists.community.tummy.com/mailman/listinfo/linux-ha-cvs


End of Linux-ha-cvs Digest, Vol 25, Issue 36
********************************************

Reply via email to