JBoss Native SVN: r1450 - in sandbox/httpd/src/native: mod_manager and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-03-20 12:13:24 -0400 (Thu, 20 Mar 2008)
New Revision: 1450
Modified:
sandbox/httpd/src/native/common/node.c
sandbox/httpd/src/native/common/node.h
sandbox/httpd/src/native/mod_manager/mod_manager.c
sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Add logic to support check of host and context.
Modified: sandbox/httpd/src/native/common/node.c
===================================================================
--- sandbox/httpd/src/native/common/node.c 2008-03-19 15:41:20 UTC (rev 1449)
+++ sandbox/httpd/src/native/common/node.c 2008-03-20 16:13:24 UTC (rev 1450)
@@ -96,7 +96,7 @@
}
return APR_NOTFOUND;
}
-apr_status_t insert_update_node(mem_t *s, nodeinfo_t *node)
+apr_status_t insert_update_node(mem_t *s, nodeinfo_t *node, int *id)
{
apr_status_t rv;
nodeinfo_t *ou;
@@ -105,6 +105,7 @@
node->mess.id = 0;
rv = s->storage->ap_slotmem_do(s->slotmem, insert_update, &node, s->p);
if (node->mess.id != 0 && rv == APR_SUCCESS) {
+ *id = node->mess.id;
return APR_SUCCESS; /* updated */
}
@@ -115,10 +116,11 @@
}
memcpy(ou, node, sizeof(nodeinfo_t));
ou->mess.id = ident;
+ *id = ident;
ou->updatetime = apr_time_sec(apr_time_now());
/* set of offset to the proxy_worker_stat */
- ou->status = sizeof(nodemess_t) + sizeof(unsigned long) + sizeof(ou->balancer) + sizeof(int);
+ ou->offset = sizeof(nodemess_t) + sizeof(unsigned long) + sizeof(ou->balancer) + sizeof(int);
return APR_SUCCESS;
}
Modified: sandbox/httpd/src/native/common/node.h
===================================================================
--- sandbox/httpd/src/native/common/node.h 2008-03-19 15:41:20 UTC (rev 1449)
+++ sandbox/httpd/src/native/common/node.h 2008-03-20 16:13:24 UTC (rev 1450)
@@ -65,7 +65,7 @@
char strtime[8]; /* date when send by the node */
/* part updated in httpd */
- int id; /* id in table and worker it */
+ int id; /* id in table and worker id */
};
typedef struct nodemess nodemess_t;
@@ -78,7 +78,7 @@
/* filled by httpd */
unsigned long updatetime; /* time of last received message */
char balancer[40]; /* name of the balancer */
- int status; /* offset to the proxy_worker_stat structure */
+ int offset; /* offset to the proxy_worker_stat structure */
char stat[SIZEOFSCORE]; /* to store the status */
};
typedef struct nodeinfo nodeinfo_t;
@@ -91,7 +91,7 @@
* @return APR_SUCCESS if all went well
*
*/
-APR_DECLARE(apr_status_t) insert_update_node(mem_t *s, nodeinfo_t *node);
+APR_DECLARE(apr_status_t) insert_update_node(mem_t *s, nodeinfo_t *node, int *id);
/**
* read a node record from the shared table
Modified: sandbox/httpd/src/native/mod_manager/mod_manager.c
===================================================================
--- sandbox/httpd/src/native/mod_manager/mod_manager.c 2008-03-19 15:41:20 UTC (rev 1449)
+++ sandbox/httpd/src/native/mod_manager/mod_manager.c 2008-03-20 16:13:24 UTC (rev 1450)
@@ -79,13 +79,58 @@
{
return(get_max_size_node(nodestatsmem));
}
-static const struct node_storage_method storage =
+static const struct node_storage_method node_storage =
{
loc_read_node,
loc_get_ids_used_node,
loc_get_max_size_node
};
+/*
+ * routines for the context_storage_method
+ */
+static apr_status_t loc_read_context(int ids, contextinfo_t **context)
+{
+ return (get_context(contextstatsmem, context, ids));
+}
+static int loc_get_ids_used_context(int *ids)
+{
+ return(get_ids_used_context(contextstatsmem, ids));
+}
+static int loc_get_max_size_context()
+{
+ return(get_max_size_context(contextstatsmem));
+}
+static const struct context_storage_method context_storage =
+{
+ loc_read_context,
+ loc_get_ids_used_context,
+ loc_get_max_size_context
+};
+
+/*
+ * routines for the host_storage_method
+ */
+static apr_status_t loc_read_host(int ids, hostinfo_t **host)
+{
+ return (get_host(hoststatsmem, host, ids));
+}
+static int loc_get_ids_used_host(int *ids)
+{
+ return(get_ids_used_host(hoststatsmem, ids));
+}
+static int loc_get_max_size_host()
+{
+ return(get_max_size_host(hoststatsmem));
+}
+static const struct host_storage_method host_storage =
+{
+ loc_read_host,
+ loc_get_ids_used_host,
+ loc_get_max_size_host
+};
+
+/* helper for the handling of the Alias: host1,... Context: context1,... */
struct cluster_host {
char *host;
char *context;
@@ -333,7 +378,6 @@
}
phost->context = ptr[i+1];
}
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "manager_handler %s %s", ptr[i], ptr[i+1]);
i++;
i++;
}
@@ -342,9 +386,9 @@
strcpy(nodeinfo.balancer,mconf->balancername);
/* Insert or update node description */
- if (insert_update_node(nodestatsmem, &nodeinfo) != APR_SUCCESS)
+ int id;
+ if (insert_update_node(nodestatsmem, &nodeinfo, &id) != APR_SUCCESS)
return 500;
- int id = nodeinfo.mess.id;
/* Insert the Alias and corresponding Context */
phost = vhost;
@@ -373,7 +417,7 @@
for (i=0; i<size; i++) {
nodeinfo_t *ou;
get_node(nodestatsmem, &ou, id[i]);
- ap_rprintf(r, "node: %d %s %s %s %s %s\n", id[i], ou->mess.JVMRoute, ou->mess.Domain,
+ ap_rprintf(r, "node: [%d:%d] %s %s %s %s %s\n", id[i], ou->mess.id, ou->mess.JVMRoute, ou->mess.Domain,
ou->mess.Host, ou->mess.Port, ou->mess.Type);
}
@@ -456,7 +500,6 @@
ap_get_brigade(r->input_filters, input_brigade, AP_MODE_READBYTES, APR_BLOCK_READ, sizeof(buff));
apr_brigade_flatten(input_brigade, buff, &bufsiz);
buff[bufsiz] = '\0';
- ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "%s %s manager_handler buff %s", r->method, r->uri, buff);
decodeenc(buff);
if (strcasecmp(r->method, "CONFIG") == 0)
return(process_config(r, buff));
@@ -567,8 +610,10 @@
/* Process the request from the ModClusterService */
ap_hook_handler(manager_handler, NULL, NULL, APR_HOOK_MIDDLE);
- /* Register nodes table provider */
- ap_register_provider(p, "manager" , "shared", "0", &storage);
+ /* Register nodes/hosts/contexts table provider */
+ ap_register_provider(p, "manager" , "shared", "0", &node_storage);
+ ap_register_provider(p, "manager" , "shared", "1", &host_storage);
+ ap_register_provider(p, "manager" , "shared", "2", &context_storage);
}
/*
Modified: sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-03-19 15:41:20 UTC (rev 1449)
+++ sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-03-20 16:13:24 UTC (rev 1450)
@@ -1,5 +1,5 @@
/*
- * ALOHA - Apache Httpd Native Java Library
+ * mod_cluster
*
* Copyright(c) 2007 Red Hat Middleware, LLC,
* and individual contributors as indicated by the @authors tag.
@@ -39,10 +39,14 @@
#include "mod_proxy.h"
#include "node.h"
+#include "host.h"
+#include "context.h"
static proxy_balancer_method *lbrprovider = NULL;
static proxy_balancer_method *lbtprovider = NULL;
-static struct node_storage_method *storage = NULL;
+static struct node_storage_method *node_storage = NULL;
+static struct host_storage_method *host_storage = NULL;
+static struct context_storage_method *context_storage = NULL;
/*
* Create/Get the worker before using it
@@ -75,8 +79,9 @@
proxy_worker = (struct proxy_worker *) *worker;
/* Get the shared memory for this worker */
ptr = (char *) node;
- ptr = ptr + node->status;
+ ptr = ptr + node->offset;
proxy_worker->s = (proxy_worker_stat *) ptr;
+ proxy_worker->id = node->mess.id;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"Created: worker for %s", url);
proxy_worker->s->status = PROXY_WORKER_INITIALIZED;
@@ -101,8 +106,8 @@
/* read the ident of the nodes */
- ids = apr_pcalloc(r->pool, sizeof(int) * storage->get_max_size_node());
- num = storage->get_ids_used_node(ids);
+ ids = apr_pcalloc(r->pool, sizeof(int) * node_storage->get_max_size_node());
+ num = node_storage->get_ids_used_node(ids);
/* XXX: How to skip the balancer that aren't controled by mod_manager */
if (conf->workers->nelts<num) {
/* There are more workers in shared area than in the local tables */
@@ -125,7 +130,7 @@
if (ids[j]) {
/* read the node and create the worker */
nodeinfo_t *node;
- storage->read_node(ids[j], &node);
+ node_storage->read_node(ids[j], &node);
proxy_balancer *balancer = ap_proxy_get_balancer(r->pool, conf,
apr_pstrcat(r->pool, "balancer://", node->balancer, NULL));
if (balancer) {
@@ -137,37 +142,150 @@
}
}
}
-}
+}
+/*
+ * Check that the worker will handle the host/context.
+ * The id of the worker is used to find the (slot) node in the shared
+ * memory.
+ */
+static int iscontext_host_ok(request_rec *r, proxy_balancer *balancer,
+ proxy_worker *worker)
+{
+ nodeinfo_t *node;
+
+ node_storage->read_node(worker->id, &node);
+
+ /*
+ * check the hosts and contexts
+ * A node may have several virtual hosts and
+ * each virtual hosts may have several context
+ */
+ int sizevhost = host_storage->get_max_size_host();
+ int *vhosts = apr_palloc(r->pool, sizeof(int)*sizevhost);
+ sizevhost = host_storage->get_ids_used_host(vhosts);
+ int i;
+ for (i=0; i<sizevhost; i++) {
+ hostinfo_t *vhost;
+ host_storage->read_host(vhosts[i], &vhost);
+ if (vhost->node == node->mess.id) {
+ /* XXX Check the virtual host */
+
+ /* Check the contexts */
+ int sizecontext = context_storage->get_max_size_context();
+ int *contexts = apr_palloc(r->pool, sizeof(int)*sizecontext);
+ sizecontext = context_storage->get_ids_used_context(contexts);
+ int j;
+ for (j=0; j<sizecontext; j++) {
+ contextinfo_t *context;
+ context_storage->read_context(contexts[j], &context);
+ if (context->vhost != vhost->vhost)
+ continue;
+
+ /* check for /context[/] in the URL */
+ int len = strlen(context->context);
+ if (strncmp(r->uri, context->context, len) == 0) {
+ if (r->uri[len] == '\0' || r->uri[len] == '/') {
+ /* XXX: Check status */
+ return 1;
+ }
+ }
+ }
+
+ }
+ }
+ return 0;
+}
+
+/*
+ * The ModClusterService from the cluster fills the lbfactor values.
+ * Our logic is a bit different the mod_balancer one. We check the
+ * context and host to prevent to route to application beeing redeploy or
+ * stopped in one node but not in others.
+ */
static proxy_worker *find_best_bytraffic(proxy_balancer *balancer,
request_rec *r)
{
+ int i;
+ apr_off_t mytraffic = 0;
+ apr_off_t curmin = 0;
+ proxy_worker *worker;
proxy_worker *mycandidate = NULL;
+ int cur_lbset = 0;
+ int max_lbset = 0;
+ int checking_standby;
+ int checked_standby;
+
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "proxy: Entering bytraffic for BALANCER (%s)",
+ balancer->name);
+
/* create workers for new nodes */
create_workers_node(r);
- /* call mod_proxy_balancer method */
- mycandidate = lbtprovider->finder(balancer,r);
+ /* First try to see if we have available candidate */
+ do {
+ checking_standby = checked_standby = 0;
+ while (!mycandidate && !checked_standby) {
+ worker = (proxy_worker *)balancer->workers->elts;
+ for (i = 0; i < balancer->workers->nelts; i++, worker++) {
+ if (!checking_standby) { /* first time through */
+ if (worker->s->lbset > max_lbset)
+ max_lbset = worker->s->lbset;
+ }
+ if (worker->s->lbset > cur_lbset)
+ continue;
+ if ( (checking_standby ? !PROXY_WORKER_IS_STANDBY(worker) : PROXY_WORKER_IS_STANDBY(worker)) )
+ continue;
+ /* If the worker is in error state run
+ * retry on that worker. It will be marked as
+ * operational if the retry timeout is elapsed.
+ * The worker might still be unusable, but we try
+ * anyway.
+ */
+ if (!PROXY_WORKER_IS_USABLE(worker))
+ ap_proxy_retry_worker("BALANCER", worker, r->server);
+ /* Take into calculation only the workers that are
+ * not in error state or not disabled.
+ */
+ if (PROXY_WORKER_IS_USABLE(worker) && iscontext_host_ok(r, balancer, worker)) {
+ mytraffic = (worker->s->transferred/worker->s->lbfactor) +
+ (worker->s->read/worker->s->lbfactor);
+ if (!mycandidate || mytraffic < curmin) {
+ mycandidate = worker;
+ curmin = mytraffic;
+ }
+ }
+ }
+ checked_standby = checking_standby++;
+ }
+ cur_lbset++;
+ } while (cur_lbset <= max_lbset && !mycandidate);
+
return mycandidate;
}
-static int proxy_cluster_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
- apr_pool_t *ptemp)
-{
- lbtprovider = ap_lookup_provider(PROXY_LBMETHOD, "bytraffic", "0");
-
- return OK;
-}
-
static int proxy_cluster_post_config(apr_pool_t *p, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{
- storage = ap_lookup_provider("manager" , "shared", "0");
- if (storage == NULL) {
+ node_storage = ap_lookup_provider("manager" , "shared", "0");
+ if (node_storage == NULL) {
ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s,
- "proxy_cluster_post_config: Can't find mod_manager");
+ "proxy_cluster_post_config: Can't find mod_manager for nodes");
return !OK;
}
+ host_storage = ap_lookup_provider("manager" , "shared", "1");
+ if (host_storage == NULL) {
+ ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s,
+ "proxy_cluster_post_config: Can't find mod_manager for hosts");
+ return !OK;
+ }
+ context_storage = ap_lookup_provider("manager" , "shared", "2");
+ if (context_storage == NULL) {
+ ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, s,
+ "proxy_cluster_post_config: Can't find mod_manager for contexts");
+ return !OK;
+ }
return OK;
}
@@ -181,11 +299,9 @@
static void proxy_cluster_hooks(apr_pool_t *p)
{
- ap_hook_pre_config(proxy_cluster_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_post_config(proxy_cluster_post_config, NULL, NULL, APR_HOOK_MIDDLE);
/* create the provider for the proxy logic */
- ap_register_provider(p, PROXY_LBMETHOD, "cluster_byrequests", "0", &byrequests);
ap_register_provider(p, PROXY_LBMETHOD, "cluster_bytraffic", "0", &bytraffic);
}
static void *create_proxy_cluster_dir_config(apr_pool_t *p, char *dir)
16 years, 9 months
JBoss Native SVN: r1449 - sandbox/httpd/src/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-03-19 11:41:20 -0400 (Wed, 19 Mar 2008)
New Revision: 1449
Modified:
sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Remove the by request load balancing.
Modified: sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-03-19 14:45:04 UTC (rev 1448)
+++ sandbox/httpd/src/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-03-19 15:41:20 UTC (rev 1449)
@@ -139,18 +139,6 @@
}
}
-static proxy_worker *find_best_byrequests(proxy_balancer *balancer,
- request_rec *r)
-{
- proxy_worker *mycandidate = NULL;
- /* create workers for new nodes */
- create_workers_node(r);
-
- /* call mod_proxy_balancer method */
- mycandidate = lbrprovider->finder(balancer,r);
- return mycandidate;
-}
-
static proxy_worker *find_best_bytraffic(proxy_balancer *balancer,
request_rec *r)
{
@@ -166,7 +154,6 @@
static int proxy_cluster_pre_config(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp)
{
- lbrprovider = ap_lookup_provider(PROXY_LBMETHOD, "byrequests", "0");
lbtprovider = ap_lookup_provider(PROXY_LBMETHOD, "bytraffic", "0");
return OK;
@@ -185,13 +172,6 @@
return OK;
}
-static const proxy_balancer_method byrequests =
-{
- "byrequests",
- &find_best_byrequests,
- NULL
-};
-
static const proxy_balancer_method bytraffic =
{
"bytraffic",
16 years, 9 months
JBoss Native SVN: r1448 - in sandbox/httpd/src: native/common and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-03-19 10:45:04 -0400 (Wed, 19 Mar 2008)
New Revision: 1448
Added:
sandbox/httpd/src/java/DumpMethod.java
Modified:
sandbox/httpd/src/java/TestHttpClient.java
sandbox/httpd/src/native/common/context.h
sandbox/httpd/src/native/common/host.h
sandbox/httpd/src/native/common/node.h
sandbox/httpd/src/native/mod_manager/Makefile.in
sandbox/httpd/src/native/mod_manager/mod_manager.c
Log:
Add logic to insert Alias and Context.
Added: sandbox/httpd/src/java/DumpMethod.java
===================================================================
--- sandbox/httpd/src/java/DumpMethod.java (rev 0)
+++ sandbox/httpd/src/java/DumpMethod.java 2008-03-19 14:45:04 UTC (rev 1448)
@@ -0,0 +1,9 @@
+import org.apache.commons.httpclient.methods.PostMethod;
+public class DumpMethod extends PostMethod {
+ public String getName() {
+ return "DUMP";
+ }
+ public DumpMethod(String uri) {
+ super(uri);
+ }
+}
Modified: sandbox/httpd/src/java/TestHttpClient.java
===================================================================
--- sandbox/httpd/src/java/TestHttpClient.java 2008-03-19 08:23:13 UTC (rev 1447)
+++ sandbox/httpd/src/java/TestHttpClient.java 2008-03-19 14:45:04 UTC (rev 1448)
@@ -23,22 +23,33 @@
}
runit(args[0], args[1]);
}
- public static int runit(String URL, String Command) throws Exception
+ public static int runit(String URL, String command) throws Exception
{
HttpClient httpClient = new HttpClient();
- DisableMethod pm = new DisableMethod(URL);
+ PostMethod pm = null;
+ if (command.compareToIgnoreCase("DISABLE")==0) {
+ pm = (PostMethod) new DisableMethod(URL);
+ pm.addParameter("JVMRoute","node1");
+ pm.addParameter("context", "/hisapp");
+ }
+ else if (command.compareToIgnoreCase("CONFIG")==0) {
+ pm = (PostMethod) new ConfigMethod(URL);
+ pm.addParameter("JVMRoute","node1");
+ pm.addParameter("Domain", "domain1");
+ pm.addParameter("Host", "jfcpc");
+ pm.addParameter("Port", "8009");
+ pm.addParameter("Type", "ajp");
+ pm.addParameter("Context", "/hisapp,/myapp");
+ }
+ else if (command.compareToIgnoreCase("DUMP")==0) {
+ pm = (PostMethod) new DumpMethod(URL);
+ }
+ else
+ pm = (PostMethod) new InfoMethod(URL);
+
System.out.println("Connecting to " + URL);
- pm.addParameter("firstname","moi");
- pm.addParameter("lastname", "me");
- pm.addParameter("context", "/myapp");
- pm.addParameter("context", "/yourapp");
- pm.addParameter("context", "/hisapp");
-/*
- pm.setRequestEntity(new StringRequestEntity("firstname=moi-meme&lastname=toi-meme&comment=test",
- "application/x-www-form-urlencoded",
- "UTF8"));
- */
+
Integer connectionTimeout = 40000;
pm.getParams().setParameter("http.socket.timeout", connectionTimeout);
pm.getParams().setParameter("http.connection.timeout", connectionTimeout);
@@ -49,6 +60,9 @@
try {
httpResponseCode = httpClient.executeMethod(pm);
System.out.println("response: " + httpResponseCode);
+ System.out.println("response: " + pm.getStatusLine());
+ int len = (int) pm.getResponseContentLength();
+ System.out.println("response: " + pm.getResponseBodyAsString(len));
} catch(HttpException e) {
e.printStackTrace();
}
Modified: sandbox/httpd/src/native/common/context.h
===================================================================
--- sandbox/httpd/src/native/common/context.h 2008-03-19 08:23:13 UTC (rev 1447)
+++ sandbox/httpd/src/native/common/context.h 2008-03-19 14:45:04 UTC (rev 1448)
@@ -39,12 +39,16 @@
#define CONTEXTEXE ".contexts"
+#ifndef MEM_T
typedef struct mem mem_t;
+#define MEM_T
+#endif
/* status of the context as read/store in httpd. */
struct contextinfo {
char context[40]; /* Context where the application is mapped. */
int vhost; /* id of the correspond virtual host in hosts table */
+ int node; /* id of the correspond node in nodes table */
int status; /* status: ENABLED/DISABLED/STOPPED */
unsigned long updatetime; /* time of last received message */
Modified: sandbox/httpd/src/native/common/host.h
===================================================================
--- sandbox/httpd/src/native/common/host.h 2008-03-19 08:23:13 UTC (rev 1447)
+++ sandbox/httpd/src/native/common/host.h 2008-03-19 14:45:04 UTC (rev 1448)
@@ -39,7 +39,10 @@
#define HOSTEXE ".hosts"
+#ifndef MEM_T
typedef struct mem mem_t;
+#define MEM_T
+#endif
/* status of the host as read/store in httpd. */
struct hostinfo {
Modified: sandbox/httpd/src/native/common/node.h
===================================================================
--- sandbox/httpd/src/native/common/node.h 2008-03-19 08:23:13 UTC (rev 1447)
+++ sandbox/httpd/src/native/common/node.h 2008-03-19 14:45:04 UTC (rev 1448)
@@ -39,7 +39,10 @@
#define NODEEXE ".nodes"
+#ifndef MEM_T
typedef struct mem mem_t;
+#define MEM_T
+#endif
/* To support IPv6 (and use IPv4-compatible address). */
struct contact {
Modified: sandbox/httpd/src/native/mod_manager/Makefile.in
===================================================================
--- sandbox/httpd/src/native/mod_manager/Makefile.in 2008-03-19 08:23:13 UTC (rev 1447)
+++ sandbox/httpd/src/native/mod_manager/Makefile.in 2008-03-19 14:45:04 UTC (rev 1448)
@@ -16,7 +16,7 @@
# For .deps.
builddir = @MANAGER_BASE@
-MOD_OBJS_LO=../common/node.lo ../common/sharedmem_util.lo
+MOD_OBJS_LO=../common/node.lo ../common/host.lo ../common/context.lo ../common/sharedmem_util.lo
include $(APACHE_BASE)/build/rules.mk
SH_COMPILE = $(LIBTOOL) --mode=compile $(BASE_CC) -I../common -prefer-pic -c $< && touch $@
Modified: sandbox/httpd/src/native/mod_manager/mod_manager.c
===================================================================
--- sandbox/httpd/src/native/mod_manager/mod_manager.c 2008-03-19 08:23:13 UTC (rev 1447)
+++ sandbox/httpd/src/native/mod_manager/mod_manager.c 2008-03-19 14:45:04 UTC (rev 1448)
@@ -26,13 +26,17 @@
#include "http_core.h"
#include "node.h"
+#include "host.h"
+#include "context.h"
#define DEFMAXCONTEXT 100
#define DEFMAXNODE 10
+#define DEFMAXHOST 20
/* shared memory */
mem_t *contextstatsmem = NULL;
mem_t *nodestatsmem = NULL;
+mem_t *hoststatsmem = NULL;
module AP_MODULE_DECLARE_DATA manager_module;
@@ -50,7 +54,10 @@
int maxcontext;
/* max munber of node supported */
int maxnode;
+ /* max munber of host supported */
+ int maxhost;
/* Balancer name */
+ /* Balancer name */
char *balancername;
/* store the balancer names */
struct baldata *baldata;
@@ -79,6 +86,12 @@
loc_get_max_size_node
};
+struct cluster_host {
+ char *host;
+ char *context;
+ struct cluster_host *next;
+};
+
/*
* read the balancer name from the conf and the port of client address
*/
@@ -112,13 +125,16 @@
{
char *node;
char *context;
+ char *host;
mod_manager_config *mconf = ap_get_module_config(s->module_config, &manager_module);
if (mconf->basefilename) {
node = apr_pstrcat(ptemp, mconf->basefilename, ".node", NULL);
context = apr_pstrcat(ptemp, mconf->basefilename, ".context", NULL);
+ context = apr_pstrcat(ptemp, mconf->basefilename, ".host", NULL);
} else {
node = "manager.node";
context = "manager.context";
+ context = "manager.host";
}
nodestatsmem = create_mem_node(node, &mconf->maxnode, p);
@@ -127,13 +143,17 @@
return !OK;
}
- /* XXX: need the context logic
contextstatsmem = create_mem_context(node, &mconf->maxcontext, p);
if (contextstatsmem == NULL) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, s, "create_mem_context failed");
return !OK;
}
- */
+
+ hoststatsmem = create_mem_host(node, &mconf->maxhost, p);
+ if (hoststatsmem == NULL) {
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, 0, s, "create_mem_host failed");
+ return !OK;
+ }
return OK;
}
static char **process_buff(request_rec *r, char *buff)
@@ -163,8 +183,72 @@
}
return ptr;
}
+/*
+ * Insert the hosts from Alias information
+ */
+static int insert_update_hosts(mem_t *mem, char *str, int node, int vhost)
+{
+ char *ptr = str;
+ char *previous = str;
+ int ret = 0;
+ hostinfo_t info;
+ char empty[1] = {'\0'};
+ info.node = node;
+ info.vhost = vhost;
+ if (ptr == NULL) {
+ ptr = empty;
+ previous = ptr;
+ }
+ while (*ptr) {
+ if (*ptr == ',') {
+ *ptr = '\0';
+ strncpy(info.host, previous, sizeof(info.host));
+ insert_update_host(mem, &info);
+ if (!ret)
+ ret = info.id;
+ previous = ptr + 1;
+ }
+ ptr ++;
+ }
+ strncpy(info.host, previous, sizeof(info.host));
+ insert_update_host(mem, &info);
+ return ret;
+}
/*
+ * Insert the context from Context information
+ */
+static int insert_update_contexts(mem_t *mem, char *str, int node, int vhost)
+{
+ char *ptr = str;
+ char *previous = str;
+ int ret = 0;
+ contextinfo_t info;
+ char empty[2] = {'/','\0'};
+
+ info.node = node;
+ info.vhost = vhost;
+ if (ptr == NULL) {
+ ptr = empty;
+ previous = ptr;
+ }
+ while (*ptr) {
+ if (*ptr == ',') {
+ *ptr = '\0';
+ strncpy(info.context, previous, sizeof(info.context));
+ insert_update_context(mem, &info);
+ if (!ret)
+ ret = info.id;
+ previous = ptr + 1;
+ }
+ ptr ++;
+ }
+ strncpy(info.context, previous, sizeof(info.context));
+ insert_update_context(mem, &info);
+ return ret;
+}
+
+/*
* Process a CONFIG message
* JvmRoute?: <JvmRoute>
* Domain: <Domain>
@@ -187,9 +271,21 @@
char *Port;
char *Type;
/* XXX node conf */
+
+ struct cluster_host *vhost;
+ struct cluster_host *phost;
+
char **ptr = process_buff(r, buff);
if (ptr == NULL)
return 500;
+ vhost = apr_palloc(r->pool, sizeof(struct cluster_host));
+
+ /* Map nothing by default */
+ vhost->host = NULL;
+ vhost->host = NULL;
+ vhost->next = NULL;
+ phost = vhost;
+
int i = 0;
while (ptr[i]) {
if (strcasecmp(ptr[i], "JVMRoute") == 0) {
@@ -217,6 +313,26 @@
return 500;
strcpy(nodeinfo.mess.Type, ptr[i+1]);
}
+ if (strcasecmp(ptr[i], "Alias") == 0) {
+ if (phost->host && !phost->context) {
+ return 500;
+ }
+ if (phost->host) {
+ phost->next = apr_palloc(r->pool, sizeof(struct cluster_host));
+ phost = phost->next;
+ phost->next = NULL;
+ phost->host = ptr[i+1];
+ phost->context = NULL;
+ } else {
+ phost->host = ptr[i+1];
+ }
+ }
+ if (strcasecmp(ptr[i], "Context") == 0) {
+ if (phost->context) {
+ return 500;
+ }
+ phost->context = ptr[i+1];
+ }
ap_log_error(APLOG_MARK, APLOG_ERR, 0, NULL, "manager_handler %s %s", ptr[i], ptr[i+1]);
i++;
i++;
@@ -228,8 +344,61 @@
/* Insert or update node description */
if (insert_update_node(nodestatsmem, &nodeinfo) != APR_SUCCESS)
return 500;
+ int id = nodeinfo.mess.id;
+
+ /* Insert the Alias and corresponding Context */
+ phost = vhost;
+ int vid = 1; /* zero and "" is empty */
+ while (phost) {
+ insert_update_hosts(hoststatsmem, phost->host, id, vid);
+ insert_update_contexts(contextstatsmem, phost->context, id, vid);
+ phost = phost->next;
+ vid++;
+ }
return OK;
}
+/*
+ * Process a DUMP command.
+ */
+static int process_dump(request_rec *r, char *buff)
+{
+ int size, i;
+ int *id;
+
+ ap_set_content_type(r, "text/plain");
+
+ size = get_max_size_node(nodestatsmem);
+ id = apr_palloc(r->pool, sizeof(int) * size);
+ size = get_ids_used_node(nodestatsmem, id);
+ for (i=0; i<size; i++) {
+ nodeinfo_t *ou;
+ get_node(nodestatsmem, &ou, id[i]);
+ ap_rprintf(r, "node: %d %s %s %s %s %s\n", id[i], ou->mess.JVMRoute, ou->mess.Domain,
+ ou->mess.Host, ou->mess.Port, ou->mess.Type);
+ }
+
+ size = get_max_size_host(hoststatsmem);
+ id = apr_palloc(r->pool, sizeof(int) * size);
+ size = get_ids_used_host(hoststatsmem, id);
+ for (i=0; i<size; i++) {
+ hostinfo_t *ou;
+ get_host(hoststatsmem, &ou, id[i]);
+ ap_rprintf(r, "host: %d %s %d %d\n", id[i], ou->host, ou->vhost,
+ ou->node);
+ }
+
+ size = get_max_size_context(contextstatsmem);
+ id = apr_palloc(r->pool, sizeof(int) * size);
+ size = get_ids_used_context(contextstatsmem, id);
+ for (i=0; i<size; i++) {
+ contextinfo_t *ou;
+ get_context(contextstatsmem, &ou, id[i]);
+ ap_rprintf(r, "context: %d [%s] %d %d status: %d\n", id[i], ou->context, ou->vhost,
+ ou->node, ou->status);
+ }
+ return OK;
+}
+
/* Process an enable application message */
static int process_enable(request_rec *r, char *buff)
{
@@ -303,6 +472,8 @@
/* Status handling */
else if (strcasecmp(r->method, "STATUS") == 0)
return(process_status(r, buff));
+ else if (strcasecmp(r->method, "DUMP") == 0)
+ return(process_dump(r, buff));
else {
/* The command is not supported */
r->status_line = apr_psprintf(r->pool, "%3.3u VERSION %d.%d.%d", 500, 0, 0, 0);
@@ -327,6 +498,12 @@
mconf->maxnode = atoi(word);
return NULL;
}
+AP_DECLARE_NONSTD(const char *) cmd_manager_maxhost(cmd_parms *cmd, void *mconfig, const char *word)
+{
+ mod_manager_config *mconf = ap_get_module_config(cmd->server->module_config, &manager_module);
+ mconf->maxhost = atoi(word);
+ return NULL;
+}
AP_DECLARE_NONSTD(const char *) cmd_manager_memmanagerfile(cmd_parms *cmd, void *mconfig, const char *word)
{
mod_manager_config *mconf = ap_get_module_config(cmd->server->module_config, &manager_module);
@@ -346,16 +523,23 @@
cmd_manager_maxcontext,
NULL,
OR_ALL,
- "Maxcontext - number max context support by mod_cluster"
+ "Maxcontext - number max context supported by mod_cluster"
),
AP_INIT_TAKE1(
"Maxnode",
cmd_manager_maxnode,
NULL,
OR_ALL,
- "Maxnode - number max node support by mod_cluster"
+ "Maxnode - number max node supported by mod_cluster"
),
AP_INIT_TAKE1(
+ "Maxhost",
+ cmd_manager_maxhost,
+ NULL,
+ OR_ALL,
+ "Maxhost - number max host (Alias in virtual hosts) supported by mod_cluster"
+ ),
+ AP_INIT_TAKE1(
"MemManagerFile",
cmd_manager_memmanagerfile,
NULL,
@@ -397,6 +581,7 @@
mconf->basefilename = NULL;
mconf->maxcontext = DEFMAXCONTEXT;
mconf->maxnode = DEFMAXNODE;
+ mconf->maxhost = DEFMAXHOST;
mconf->balancername = NULL;
mconf->baldata = NULL;
return mconf;
@@ -440,6 +625,11 @@
else if (mconf1->maxnode != DEFMAXNODE)
mconf->maxnode = mconf1->maxnode;
+ if (mconf2->maxhost != DEFMAXHOST)
+ mconf->maxhost = mconf2->maxhost;
+ else if (mconf1->maxhost != DEFMAXHOST)
+ mconf->maxhost = mconf1->maxhost;
+
if (mconf2->balancername)
mconf->balancername = mconf2->balancername;
else if (mconf1->balancername)
16 years, 9 months
JBoss Native SVN: r1447 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-03-19 04:23:13 -0400 (Wed, 19 Mar 2008)
New Revision: 1447
Modified:
trunk/build/unix/build.sh
Log:
Break the build when one of the "sub" build failed.
Modified: trunk/build/unix/build.sh
===================================================================
--- trunk/build/unix/build.sh 2008-03-19 08:12:59 UTC (rev 1446)
+++ trunk/build/unix/build.sh 2008-03-19 08:23:13 UTC (rev 1447)
@@ -674,9 +674,11 @@
if [ -f ${apr_common_dir}/include/apr-1/apr.h ]; then
echo "Using cached apr in ${apr_common_dir}"
- return
+ return 0
fi
+ echo ""
echo "Configuring apr-${apr_version} with --prefix=${apr_common_dir}"
+ echo ""
if $BUILD_WIN ; then
(cd ${apr_srcdir}
cp -f include/apr.hw include/apr.h
@@ -690,11 +692,11 @@
)
else
(cd ${apr_srcdir}
- ./configure ${add_conf} --prefix=${apr_common_dir}
+ ./configure ${add_conf} --prefix=${apr_common_dir} || exit 1
echo "Building APR ${apr_version} ..."
- make
- make install
- )
+ make || exit 1
+ make install || exit 1
+ ) || return 1
fi
}
@@ -717,7 +719,9 @@
echo "Using cached apr-util in ${apu_common_dir}"
return
fi
+ echo ""
echo "Configuring apr-util-${apu_version} with --prefix=${apu_common_dir}"
+ echo ""
if $BUILD_WIN ; then
(cd ${apu_srcdir}
cp -f include/apu.hw include/apu.h
@@ -733,11 +737,11 @@
)
else
(cd ${apu_srcdir}
- ./configure ${add_conf} --with-apr=${apu_common_dir} --prefix=${apu_common_dir} --with-expat=builtin --with-dbm=sdbm
+ ./configure ${add_conf} --with-apr=${apu_common_dir} --prefix=${apu_common_dir} --with-expat=builtin --with-dbm=sdbm || exit 1
echo "Building APR utilities ${apu_version} ..."
- make
- make install
- )
+ make || exit 1
+ make install || exit 1
+ ) || return 1
fi
}
@@ -758,9 +762,11 @@
if [ -f ${api_common_dir}/include/apr-1/apr_iconv.h ]; then
echo "Using cached apr-iconv in ${api_common_dir}"
- return
+ return 0
fi
+ echo ""
echo "Configuring apr-iconv-${api_version} with --prefix=${api_common_dir}"
+ echo ""
if $BUILD_WIN ; then
(cd ${api_srcdir}
echo "Building APR iconv ${api_version} ..."
@@ -773,11 +779,11 @@
)
else
(cd ${api_srcdir}
- ./configure ${add_conf} --with-apr=${api_common_dir} --prefix=${api_common_dir}
+ ./configure ${add_conf} --with-apr=${api_common_dir} --prefix=${api_common_dir} || exit 1
echo "Building APR iconv ${api_version} ..."
- make
- make install
- )
+ make || exit 1
+ make install || exit 1
+ ) || return 1
fi
}
@@ -796,7 +802,9 @@
any_common_dir=${build_common_dir}
fi
+ echo ""
echo "Configuring ${any_srcdir} with --prefix=${any_common_dir}"
+ echo ""
if $BUILD_WIN ; then
(cd ${any_srcdir}
echo "Building in ${any_srcdir} ..."
@@ -816,10 +824,10 @@
else
add_static=""
fi
- ./configure ${add_conf} --prefix=${any_common_dir} ${add_static}
- make
- make install
- )
+ ./configure ${add_conf} --prefix=${any_common_dir} ${add_static} || exit 1
+ make || exit 1
+ make install || exit 1
+ ) || return 1
fi
}
@@ -842,7 +850,9 @@
echo "Using cached zlib in ${zlib_common_dir}"
return
fi
+ echo ""
echo "Configuring zlib-${zlib_version} with --prefix=${zlib_common_dir}"
+ echo ""
if $BUILD_WIN ; then
(cd ${zlib_srcdir}
echo "Building Zlib ${zlib_version} ..."
@@ -861,10 +871,10 @@
else
add_static="--shared"
fi
- ./configure ${add_conf} --prefix=${zlib_common_dir} ${add_static}
- make
- make install
- )
+ ./configure ${add_conf} --prefix=${zlib_common_dir} ${add_static} || exit 1
+ make || exit 1
+ make install || exit 1
+ ) || return 1
fi
}
16 years, 9 months
JBoss Native SVN: r1446 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-03-19 04:12:59 -0400 (Wed, 19 Mar 2008)
New Revision: 1446
Modified:
trunk/build/unix/build.sh
Log:
It seems our Solaris doesn't have it any more in the default PATH.
Modified: trunk/build/unix/build.sh
===================================================================
--- trunk/build/unix/build.sh 2008-03-18 14:12:42 UTC (rev 1445)
+++ trunk/build/unix/build.sh 2008-03-19 08:12:59 UTC (rev 1446)
@@ -288,7 +288,7 @@
BUILD_SYS="solaris"
# Try to use sun studio.
# we need makedepend for make depend (openssl)
- PATH=/opt/SUNWspro/bin:/usr/X/bin:/usr/local/bin:$PATH
+ PATH=/opt/SUNWspro/bin:/usr/ccs/bin:/usr/X/bin:/usr/local/bin:$PATH
export PATH
CC=cc
export CC
16 years, 9 months
JBoss Native SVN: r1445 - in sandbox/httpd/src/native: mod_manager and 1 other directory.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-03-18 10:12:42 -0400 (Tue, 18 Mar 2008)
New Revision: 1445
Added:
sandbox/httpd/src/native/common/context.c
sandbox/httpd/src/native/common/context.h
sandbox/httpd/src/native/common/host.c
sandbox/httpd/src/native/common/host.h
Modified:
sandbox/httpd/src/native/common/Makefile.in
sandbox/httpd/src/native/mod_manager/configure.in
Log:
Add logic to handle hosts and contexts.
Modified: sandbox/httpd/src/native/common/Makefile.in
===================================================================
--- sandbox/httpd/src/native/common/Makefile.in 2008-03-16 21:29:21 UTC (rev 1444)
+++ sandbox/httpd/src/native/common/Makefile.in 2008-03-18 14:12:42 UTC (rev 1445)
@@ -1,14 +1,21 @@
# Makefile.in for common
-APR_BASE=@APR_BASE@
-top_srcdir = @top_srcdir@
-LOCAL_LIBS=$(APR_BASE)/lib/lib@APR_LIBNAME@.la
+#APR_BASE=@APR_BASE@
+#top_srcdir = @top_srcdir@
+#LOCAL_LIBS=$(APR_BASE)/lib/lib@APR_LIBNAME@.la
-INCLUDES=-I$(APR_BASE)/include/apr-1 -I$(top_srcdir)/include
+#INCLUDES=-I$(APR_BASE)/include/apr-1 -I$(top_srcdir)/include
-include $(APR_BASE)/build-1/apr_rules.mk
+#include $(APR_BASE)/build-1/apr_rules.mk
+APACHE_BASE=@APACHE_BASE@
+top_builddir = @APACHE_BASE@
+builddir = @MANAGER_BASE@
+
+include $(APACHE_BASE)/build/rules.mk
+INCLUDES=-I$(APACHE_BASE)/include/
+
LINK_PROG = $(LIBTOOL) $(LTFLAGS) --mode=link $(LT_LDFLAGS) $(COMPILE) $(ALL_LDFLAGS) -o $@
-OBJS=sharedmem_util.lo node.lo
+OBJS=sharedmem_util.lo node.lo context.lo host.lo
all: $(OBJS)
Added: sandbox/httpd/src/native/common/context.c
===================================================================
--- sandbox/httpd/src/native/common/context.c (rev 0)
+++ sandbox/httpd/src/native/common/context.c 2008-03-18 14:12:42 UTC (rev 1445)
@@ -0,0 +1,227 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+/**
+ * @file context.c
+ * @brief context description Storage Module for Apache
+ *
+ * @defgroup MEM contexts
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_pools.h"
+#include "apr_time.h"
+
+#include "context.h"
+#include "slotmem.h"
+
+struct mem {
+ ap_slotmem_t *slotmem;
+ const slotmem_storage_method *storage;
+ int num;
+ apr_pool_t *p;
+};
+
+static mem_t * create_attach_mem_context(char *string, int *num, int type, apr_pool_t *p) {
+ mem_t *ptr;
+ const char *storename;
+ apr_status_t rv;
+
+ ptr = apr_pcalloc(p, sizeof(mem_t));
+ if (!ptr) {
+ return NULL;
+ }
+ ptr->storage = mem_getstorage(p, "shared");
+ if (!ptr->storage) {
+ return NULL;
+ }
+ storename = apr_pstrcat(p, string, CONTEXTEXE, NULL);
+ if (type)
+ rv = ptr->storage->ap_slotmem_create(&ptr->slotmem, storename, sizeof(contextinfo_t), *num, p);
+ else {
+ apr_size_t size = sizeof(contextinfo_t);
+ rv = ptr->storage->ap_slotmem_attach(&ptr->slotmem, storename, &size, num, p);
+ }
+ if (rv != APR_SUCCESS) {
+ return NULL;
+ }
+ ptr->num = *num;
+ ptr->p = p;
+ return ptr;
+}
+/**
+ * Insert(alloc) and update a context record in the shared table
+ * @param pointer to the shared table.
+ * @param context context to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+static apr_status_t insert_update(void* mem, void **data, int id, apr_pool_t *pool)
+{
+ contextinfo_t *in = (contextinfo_t *)*data;
+ contextinfo_t *ou = (contextinfo_t *)mem;
+ if (strcmp(in->context, ou->context) == 0 && in->vhost == ou->vhost) {
+ memcpy(ou, in, sizeof(contextinfo_t));
+ ou->id = id;
+ ou->updatetime = apr_time_sec(apr_time_now());
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+apr_status_t insert_update_context(mem_t *s, contextinfo_t *context)
+{
+ apr_status_t rv;
+ contextinfo_t *ou;
+ int ident;
+
+ context->id = 0;
+ rv = s->storage->ap_slotmem_do(s->slotmem, insert_update, &context, s->p);
+ if (context->id != 0 && rv == APR_SUCCESS) {
+ return APR_SUCCESS; /* updated */
+ }
+
+ /* we have to insert it */
+ rv = s->storage->ap_slotmem_alloc(s->slotmem, &ident, (void **) &ou);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ memcpy(ou, context, sizeof(contextinfo_t));
+ ou->id = ident;
+ ou->updatetime = apr_time_sec(apr_time_now());
+
+ return APR_SUCCESS;
+}
+
+/**
+ * read a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context context to read from the shared table.
+ * @return address of the read context or NULL if error.
+ */
+static apr_status_t loc_read_context(void* mem, void **data, int id, apr_pool_t *pool) {
+ contextinfo_t *in = (contextinfo_t *)*data;
+ contextinfo_t *ou = (contextinfo_t *)mem;
+ if (strcmp(in->context, ou->context) == 0 && in->vhost == ou->vhost) {
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+APR_DECLARE(contextinfo_t *) read_context(mem_t *s, contextinfo_t *context)
+{
+ apr_status_t rv;
+ contextinfo_t *ou = context;
+
+ if (context->id)
+ rv = s->storage->ap_slotmem_mem(s->slotmem, context->id, (void **) &ou);
+ else {
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_context, &ou, s->p);
+ }
+ if (rv == APR_SUCCESS)
+ return ou;
+ return NULL;
+}
+/**
+ * get a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context address where the context is locate in the shared table.
+ * @param ids in the context table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) get_context(mem_t *s, contextinfo_t **context, int ids)
+{
+ return(s->storage->ap_slotmem_mem(s->slotmem, ids, (void **) context));
+}
+
+/**
+ * remove(free) a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context context to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) remove_context(mem_t *s, contextinfo_t *context)
+{
+ apr_status_t rv;
+ contextinfo_t *ou = context;
+ if (context->id)
+ s->storage->ap_slotmem_free(s->slotmem, context->id, context);
+ else {
+ /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_context, &ou, s->p);
+ if (rv == APR_SUCCESS)
+ rv = s->storage->ap_slotmem_free(s->slotmem, ou->id, context);
+ }
+ return rv;
+}
+
+/*
+ * get the ids for the used (not free) contexts in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of context existing or -1 if error.
+ */
+APR_DECLARE(int) get_ids_used_context(mem_t *s, int *ids)
+{
+ return (s->storage->ap_slotmem_get_used(s->slotmem, ids));
+}
+
+/*
+ * read the size of the table.
+ * @param pointer to the shared table.
+ * @return number of context existing or -1 if error.
+ */
+APR_DECLARE(int) get_max_size_context(mem_t *s)
+{
+ return (s->storage->ap_slotmem_get_max_size(s->slotmem));
+}
+
+/**
+ * attach to the shared context table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * get_mem_context(char *string, int *num, apr_pool_t *p)
+{
+ return(create_attach_mem_context(string, num, 0, p));
+}
+/**
+ * create a shared context table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * create_mem_context(char *string, int *num, apr_pool_t *p)
+{
+ return(create_attach_mem_context(string, num, 1, p));
+}
Added: sandbox/httpd/src/native/common/context.h
===================================================================
--- sandbox/httpd/src/native/common/context.h (rev 0)
+++ sandbox/httpd/src/native/common/context.h 2008-03-18 14:12:42 UTC (rev 1445)
@@ -0,0 +1,143 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+#ifndef CONTEXT_H
+#define CONTEXT_H
+
+/**
+ * @file context.h
+ * @brief context description Storage Module for Apache
+ *
+ * @defgroup MEM contexts
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#define CONTEXTEXE ".contexts"
+
+typedef struct mem mem_t;
+
+/* status of the context as read/store in httpd. */
+struct contextinfo {
+ char context[40]; /* Context where the application is mapped. */
+ int vhost; /* id of the correspond virtual host in hosts table */
+ int status; /* status: ENABLED/DISABLED/STOPPED */
+
+ unsigned long updatetime; /* time of last received message */
+ int id; /* id in table */
+};
+typedef struct contextinfo contextinfo_t;
+
+
+/**
+ * Insert(alloc) and update a context record in the shared table
+ * @param pointer to the shared table.
+ * @param context context to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+APR_DECLARE(apr_status_t) insert_update_context(mem_t *s, contextinfo_t *context);
+
+/**
+ * read a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context context to read from the shared table.
+ * @return address of the read context or NULL if error.
+ */
+APR_DECLARE(contextinfo_t *) read_context(mem_t *s, contextinfo_t *context);
+
+/**
+ * get a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context address of the context read from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) get_context(mem_t *s, contextinfo_t **context, int ids);
+
+/**
+ * remove(free) a context record from the shared table
+ * @param pointer to the shared table.
+ * @param context context to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) remove_context(mem_t *s, contextinfo_t *context);
+
+/*
+ * get the ids for the used (not free) contexts in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of context existing or -1 if error.
+ */
+APR_DECLARE(int) get_ids_used_context(mem_t *s, int *ids);
+
+/*
+ * get the size of the table (max size).
+ * @param pointer to the shared table.
+ * @return size of the existing table or -1 if error.
+ */
+APR_DECLARE(int) get_max_size_context(mem_t *s);
+
+/**
+ * attach to the shared context table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+APR_DECLARE(mem_t *) get_mem_context(char *string, int *num, apr_pool_t *p);
+/**
+ * create a shared context table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+APR_DECLARE(mem_t *) create_mem_context(char *string, int *num, apr_pool_t *p);
+
+/**
+ * provider for the mod_proxy_cluster or mod_jk modules.
+ */
+struct context_storage_method {
+/**
+ * the context corresponding to the ident
+ * @param ids ident of the context to read.
+ * @param context address of pointer to return the context.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) (* read_context)(int ids, contextinfo_t **context);
+/**
+ * read the list of ident of used contexts.
+ * @param ids address to store the idents.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(int) (* get_ids_used_context)(int *ids);
+/**
+ * read the max number of contexts in the shared table
+ */
+APR_DECLARE(int) (*get_max_size_context)();
+};
+#endif /*CONTEXT_H*/
Added: sandbox/httpd/src/native/common/host.c
===================================================================
--- sandbox/httpd/src/native/common/host.c (rev 0)
+++ sandbox/httpd/src/native/common/host.c 2008-03-18 14:12:42 UTC (rev 1445)
@@ -0,0 +1,228 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+/**
+ * @file host.c
+ * @brief host description Storage Module for Apache
+ *
+ * @defgroup MEM hosts
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#include "apr.h"
+#include "apr_strings.h"
+#include "apr_pools.h"
+#include "apr_time.h"
+
+#include "host.h"
+#include "slotmem.h"
+
+struct mem {
+ ap_slotmem_t *slotmem;
+ const slotmem_storage_method *storage;
+ int num;
+ apr_pool_t *p;
+};
+
+static mem_t * create_attach_mem_host(char *string, int *num, int type, apr_pool_t *p) {
+ mem_t *ptr;
+ const char *storename;
+ apr_status_t rv;
+
+ ptr = apr_pcalloc(p, sizeof(mem_t));
+ if (!ptr) {
+ return NULL;
+ }
+ ptr->storage = mem_getstorage(p, "shared");
+ if (!ptr->storage) {
+ return NULL;
+ }
+ storename = apr_pstrcat(p, string, HOSTEXE, NULL);
+ if (type)
+ rv = ptr->storage->ap_slotmem_create(&ptr->slotmem, storename, sizeof(hostinfo_t), *num, p);
+ else {
+ apr_size_t size = sizeof(hostinfo_t);
+ rv = ptr->storage->ap_slotmem_attach(&ptr->slotmem, storename, &size, num, p);
+ }
+ if (rv != APR_SUCCESS) {
+ return NULL;
+ }
+ ptr->num = *num;
+ ptr->p = p;
+ return ptr;
+}
+/**
+ * Insert(alloc) and update a host record in the shared table
+ * @param pointer to the shared table.
+ * @param host host to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+static apr_status_t insert_update(void* mem, void **data, int id, apr_pool_t *pool)
+{
+ hostinfo_t *in = (hostinfo_t *)*data;
+ hostinfo_t *ou = (hostinfo_t *)mem;
+ if (strcmp(in->host, ou->host) == 0 && in->vhost == ou->vhost && in->node == ou->node) {
+ memcpy(ou, in, sizeof(hostinfo_t));
+ ou->id = id;
+ ou->updatetime = apr_time_sec(apr_time_now());
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+apr_status_t insert_update_host(mem_t *s, hostinfo_t *host)
+{
+ apr_status_t rv;
+ hostinfo_t *ou;
+ int ident;
+
+ host->id = 0;
+ rv = s->storage->ap_slotmem_do(s->slotmem, insert_update, &host, s->p);
+ if (host->id != 0 && rv == APR_SUCCESS) {
+ return APR_SUCCESS; /* updated */
+ }
+
+ /* we have to insert it */
+ rv = s->storage->ap_slotmem_alloc(s->slotmem, &ident, (void **) &ou);
+ if (rv != APR_SUCCESS) {
+ return rv;
+ }
+ memcpy(ou, host, sizeof(hostinfo_t));
+ ou->id = ident;
+ ou->updatetime = apr_time_sec(apr_time_now());
+
+ return APR_SUCCESS;
+}
+
+/**
+ * read a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host host to read from the shared table.
+ * @return address of the read host or NULL if error.
+ */
+static apr_status_t loc_read_host(void* mem, void **data, int id, apr_pool_t *pool) {
+ hostinfo_t *in = (hostinfo_t *)*data;
+ hostinfo_t *ou = (hostinfo_t *)mem;
+
+ if (strcmp(in->host, ou->host) == 0 && in->vhost == ou->vhost && in->node == ou->node ) {
+ *data = ou;
+ return APR_SUCCESS;
+ }
+ return APR_NOTFOUND;
+}
+APR_DECLARE(hostinfo_t *) read_host(mem_t *s, hostinfo_t *host)
+{
+ apr_status_t rv;
+ hostinfo_t *ou = host;
+
+ if (host->id)
+ rv = s->storage->ap_slotmem_mem(s->slotmem, host->id, (void **) &ou);
+ else {
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_host, &ou, s->p);
+ }
+ if (rv == APR_SUCCESS)
+ return ou;
+ return NULL;
+}
+/**
+ * get a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host address where the host is locate in the shared table.
+ * @param ids in the host table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) get_host(mem_t *s, hostinfo_t **host, int ids)
+{
+ return(s->storage->ap_slotmem_mem(s->slotmem, ids, (void **) host));
+}
+
+/**
+ * remove(free) a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host host to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) remove_host(mem_t *s, hostinfo_t *host)
+{
+ apr_status_t rv;
+ hostinfo_t *ou = host;
+ if (host->id)
+ s->storage->ap_slotmem_free(s->slotmem, host->id, host);
+ else {
+ /* XXX: for the moment January 2007 ap_slotmem_free only uses ident to remove */
+ rv = s->storage->ap_slotmem_do(s->slotmem, loc_read_host, &ou, s->p);
+ if (rv == APR_SUCCESS)
+ rv = s->storage->ap_slotmem_free(s->slotmem, ou->id, host);
+ }
+ return rv;
+}
+
+/*
+ * get the ids for the used (not free) hosts in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of host existing or -1 if error.
+ */
+APR_DECLARE(int) get_ids_used_host(mem_t *s, int *ids)
+{
+ return (s->storage->ap_slotmem_get_used(s->slotmem, ids));
+}
+
+/*
+ * read the size of the table.
+ * @param pointer to the shared table.
+ * @return number of host existing or -1 if error.
+ */
+APR_DECLARE(int) get_max_size_host(mem_t *s)
+{
+ return (s->storage->ap_slotmem_get_max_size(s->slotmem));
+}
+
+/**
+ * attach to the shared host table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * get_mem_host(char *string, int *num, apr_pool_t *p)
+{
+ return(create_attach_mem_host(string, num, 0, p));
+}
+/**
+ * create a shared host table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+mem_t * create_mem_host(char *string, int *num, apr_pool_t *p)
+{
+ return(create_attach_mem_host(string, num, 1, p));
+}
Added: sandbox/httpd/src/native/common/host.h
===================================================================
--- sandbox/httpd/src/native/common/host.h (rev 0)
+++ sandbox/httpd/src/native/common/host.h 2008-03-18 14:12:42 UTC (rev 1445)
@@ -0,0 +1,143 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2007 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+#ifndef HOST_H
+#define HOST_H
+
+/**
+ * @file host.h
+ * @brief host description Storage Module for Apache
+ *
+ * @defgroup MEM hosts
+ * @ingroup APACHE_MODS
+ * @{
+ */
+
+#define HOSTEXE ".hosts"
+
+typedef struct mem mem_t;
+
+/* status of the host as read/store in httpd. */
+struct hostinfo {
+ char host[40]; /* Alias element of the virtual host */
+ int vhost; /* id of the correspond virtual host */
+ int node; /* id of the node containing the virtual host */
+
+ unsigned long updatetime; /* time of last received message */
+ int id; /* id in table */
+};
+typedef struct hostinfo hostinfo_t;
+
+
+/**
+ * Insert(alloc) and update a host record in the shared table
+ * @param pointer to the shared table.
+ * @param host host to store in the shared table.
+ * @return APR_SUCCESS if all went well
+ *
+ */
+APR_DECLARE(apr_status_t) insert_update_host(mem_t *s, hostinfo_t *host);
+
+/**
+ * read a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host host to read from the shared table.
+ * @return address of the read host or NULL if error.
+ */
+APR_DECLARE(hostinfo_t *) read_host(mem_t *s, hostinfo_t *host);
+
+/**
+ * get a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host address of the host read from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) get_host(mem_t *s, hostinfo_t **host, int ids);
+
+/**
+ * remove(free) a host record from the shared table
+ * @param pointer to the shared table.
+ * @param host host to remove from the shared table.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) remove_host(mem_t *s, hostinfo_t *host);
+
+/*
+ * get the ids for the used (not free) hosts in the table
+ * @param pointer to the shared table.
+ * @param ids array of int to store the used id (must be big enough).
+ * @return number of host existing or -1 if error.
+ */
+APR_DECLARE(int) get_ids_used_host(mem_t *s, int *ids);
+
+/*
+ * get the size of the table (max size).
+ * @param pointer to the shared table.
+ * @return size of the existing table or -1 if error.
+ */
+APR_DECLARE(int) get_max_size_host(mem_t *s);
+
+/**
+ * attach to the shared host table
+ * @param name of an existing shared table.
+ * @param address to store the size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+APR_DECLARE(mem_t *) get_mem_host(char *string, int *num, apr_pool_t *p);
+/**
+ * create a shared host table
+ * @param name to use to create the table.
+ * @param size of the shared table.
+ * @param p pool to use for allocations.
+ * @return address of struct used to access the table.
+ */
+APR_DECLARE(mem_t *) create_mem_host(char *string, int *num, apr_pool_t *p);
+
+/**
+ * provider for the mod_proxy_cluster or mod_jk modules.
+ */
+struct host_storage_method {
+/**
+ * the host corresponding to the ident
+ * @param ids ident of the host to read.
+ * @param host address of pointer to return the host.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(apr_status_t) (* read_host)(int ids, hostinfo_t **host);
+/**
+ * read the list of ident of used hosts.
+ * @param ids address to store the idents.
+ * @return APR_SUCCESS if all went well
+ */
+APR_DECLARE(int) (* get_ids_used_host)(int *ids);
+/**
+ * read the max number of hosts in the shared table
+ */
+APR_DECLARE(int) (*get_max_size_host)();
+};
+#endif /*HOST_H*/
Modified: sandbox/httpd/src/native/mod_manager/configure.in
===================================================================
--- sandbox/httpd/src/native/mod_manager/configure.in 2008-03-16 21:29:21 UTC (rev 1444)
+++ sandbox/httpd/src/native/mod_manager/configure.in 2008-03-18 14:12:42 UTC (rev 1445)
@@ -21,4 +21,4 @@
AC_SUBST(APACHE_BASE)
AC_SUBST(MANAGER_BASE)
-AC_OUTPUT(Makefile)
+AC_OUTPUT(Makefile ../common/Makefile)
16 years, 9 months
JBoss Native SVN: r1444 - trunk/srclib/zlib.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-03-16 17:29:21 -0400 (Sun, 16 Mar 2008)
New Revision: 1444
Modified:
trunk/srclib/zlib/NMAKEmakefile
Log:
Update to new CPU notation.
Modified: trunk/srclib/zlib/NMAKEmakefile
===================================================================
--- trunk/srclib/zlib/NMAKEmakefile 2008-03-16 21:27:02 UTC (rev 1443)
+++ trunk/srclib/zlib/NMAKEmakefile 2008-03-16 21:29:21 UTC (rev 1444)
@@ -36,7 +36,7 @@
CFLAGS = -DZLIB_WINAPI -D_CRT_SECURE_NO_DEPRECATE $(CFLAGS)
!ENDIF
-!IF "$(CPU)" != "I386"
+!IF "$(CPU)" != "X86"
CFLAGS = -GS- $(CFLAGS)
!ENDIF
@@ -64,7 +64,7 @@
!IFDEF ZLIB_ASM
CFLAGS = -DASMV -DASMINF $(CFLAGS)
-!IF "$(CPU)" == "AMD64"
+!IF "$(CPU)" == "X64"
ASM_OBJECTS = \
$(WORKDIR)\inffas8664.obj \
$(WORKDIR)\gvmat64.obj \
@@ -106,7 +106,7 @@
{$(SRCDIR)}.c{$(WORKDIR)}.obj:
$(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $<
-!IF "$(CPU)" == "AMD64"
+!IF "$(CPU)" == "X64"
{$(SRCDIR)/contrib/masmx64}.c{$(WORKDIR)}.obj:
$(CC) $(CFLAGS) $(INCLUDES) $(PDBFLAGS) $<
16 years, 9 months
JBoss Native SVN: r1443 - trunk/httpd/httpd-2.2.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-03-16 17:27:02 -0400 (Sun, 16 Mar 2008)
New Revision: 1443
Modified:
trunk/httpd/httpd-2.2/NMAKEcommon.inc
Log:
Merge from main .inc file
Modified: trunk/httpd/httpd-2.2/NMAKEcommon.inc
===================================================================
--- trunk/httpd/httpd-2.2/NMAKEcommon.inc 2008-03-16 21:26:22 UTC (rev 1442)
+++ trunk/httpd/httpd-2.2/NMAKEcommon.inc 2008-03-16 21:27:02 UTC (rev 1443)
@@ -67,30 +67,34 @@
RC = rc.exe
!ENDIF
+!IF !DEFINED(MT) || "$(MT)" == ""
+MT = mt.exe
+!ENDIF
+
# Read the PROCESSOR_ARCHITECTURE environment value for a CPU type
-!IF "$(BUILDCPU)" == "i386" || "$(BUILDCPU)" == "x86" || "$(BUILDCPU)" == "i686"
-CPU=I386
+!IF "$(BUILD_CPU)" == "i386" || "$(BUILD_CPU)" == "x86" || "$(BUILD_CPU)" == "i686"
+CPU=X86
!ENDIF
-!IF "$(BUILDCPU)" == "amd64" || "$(BUILDCPU)" == "x86_64"
-CPU=AMD64
+!IF "$(BUILD_CPU)" == "amd64" || "$(BUILD_CPU)" == "x86_64" || "$(BUILD_CPU)" == "x64"
+CPU=X64
!ENDIF
-!IF "$(BUILDCPU)" == "ia64"
+!IF "$(BUILD_CPU)" == "ia64"
CPU=IA64
!ENDIF
!IF !DEFINED(CPU) || "$(CPU)" == ""
!IF "$(PROCESSOR_ARCHITECTURE)" == ""
-CPU=I386
+CPU=X86
!ELSE
CPU=$(PROCESSOR_ARCHITECTURE)
!ENDIF
!ENDIF
-!IF "$(CPU)" != "I386"
-!IF "$(CPU)" != "AMD64"
+!IF "$(CPU)" != "X86"
+!IF "$(CPU)" != "X64"
!IF "$(CPU)" != "IA64"
-!ERROR Must specify CPU environment variable (I386, AMD64, IA64) $(CPU)
+!ERROR Must specify CPU environment variable (X86, X64, IA64) $(CPU)
!ENDIF
!ENDIF
!ENDIF
@@ -180,22 +184,22 @@
# Common flags for all platforms
CMN_CFLAGS = -c -nologo -DWIN32 -D_WIN32 -D_WINDOWS $(NMAKE_WINNT) -W3
-!IF "$(CPU)" == "I386"
+!IF "$(CPU)" == "X86"
CPU_CFLAGS = -D_X86_=1
-!ELSEIF "$(CPU)" == "AMD64"
+!ELSEIF "$(CPU)" == "X64"
CPU_CFLAGS = -D_AMD64_=1 -DWIN64 -D_WIN64 -Wp64
!ELSEIF "$(CPU)" == "IA64"
CPU_CFLAGS = -D_IA64_=1 -DWIN64 -D_WIN64 -Wp64
!ENDIF
!IF "$(INCLUDE_PRE64PRA)" == "1"
-!IF "$(CPU)" != "I386"
+!IF "$(CPU)" != "X86"
CPU_CFLAGS = $(CPU_CFLAGS) /FIPRE64PRA.H
!ENDIF
!ENDIF
!IF "$(BUILD)" == "RELEASE"
-!IF "$(CPU)" == "I386"
+!IF "$(CPU)" == "X86"
OPT_CFLAGS = -O2 -Ob2 -Oy- -Zi -DNDEBUG
!ELSE
OPT_CFLAGS = -O2 -Ob2 -Zi -DNDEBUG
@@ -224,7 +228,7 @@
# Linker section
LIBS = kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib $(LIBS)
!IF "$(INCLUDE_BUFFEROVERFLOWU)" == "1"
-!IF "$(CPU)" != "I386"
+!IF "$(CPU)" != "X86"
LIBS = $(LIBS) bufferoverflowu.lib
!ENDIF
!ENDIF
@@ -292,17 +296,17 @@
!IF DEFINED(JAVA_HOME) && "$(JAVA_HOME)" != ""
JAVA_INCLUDES=-I "$(JAVA_HOME)\include"
-!IF "$(CPU)" != "I386"
+!IF "$(CPU)" != "X86"
JAVA_INCLUDES=$(JAVA_INCLUDES) -I "$(JAVA_HOME)\include\win64"
!ENDIF
JAVA_INCLUDES=$(JAVA_INCLUDES) -I "$(JAVA_HOME)\include\win32"
!ENDIF
!IF !DEFINED(ML) || "$(ML)" == ""
-!IF "$(CPU)" == "I386"
+!IF "$(CPU)" == "X86"
ML = ml.exe
AFLAGS = /coff /Zi /c
-!ELSEIF "$(CPU)" == "AMD64"
+!ELSEIF "$(CPU)" == "X64"
ML = ml64.exe
AFLAGS = /Zi /c
!ELSEIF "$(CPU)" == "IA64"
16 years, 9 months
JBoss Native SVN: r1442 - trunk/build.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-03-16 17:26:22 -0400 (Sun, 16 Mar 2008)
New Revision: 1442
Modified:
trunk/build/NMAKEcommon.inc
Log:
Add workdir specifics
Modified: trunk/build/NMAKEcommon.inc
===================================================================
--- trunk/build/NMAKEcommon.inc 2008-03-16 21:21:40 UTC (rev 1441)
+++ trunk/build/NMAKEcommon.inc 2008-03-16 21:26:22 UTC (rev 1442)
@@ -277,6 +277,9 @@
!IF !DEFINED(WORKDIR) || "$(WORKDIR)" == ""
!IF !DEFINED(WORKDIR_EXT) || "$(WORKDIR_EXT)" == ""
WORKDIR = $(WINVER)_$(CPU)_$(TARGET)_$(BUILD)
+WORKDIR_DLL = $(WINVER)_$(CPU)_DLL_$(BUILD)
+WORKDIR_LIB = $(WINVER)_$(CPU)_LIB_$(BUILD)
+WORKDIR_EXE = $(WINVER)_$(CPU)_EXE_$(BUILD)
!ELSE
WORKDIR = $(WINVER)_$(CPU)_$(BUILDIR_EXT)_$(BUILD)
!ENDIF
16 years, 9 months
JBoss Native SVN: r1441 - in trunk/build: unix and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2008-03-16 17:21:40 -0400 (Sun, 16 Mar 2008)
New Revision: 1441
Modified:
trunk/build/NMAKEcommon.inc
trunk/build/unix/build.sh
trunk/build/windows/build.bat
Log:
Use x86, x64 instead i686 and amd64. Amd64 is EMT64 so usable on Intel cpu's as well
Modified: trunk/build/NMAKEcommon.inc
===================================================================
--- trunk/build/NMAKEcommon.inc 2008-03-16 21:00:11 UTC (rev 1440)
+++ trunk/build/NMAKEcommon.inc 2008-03-16 21:21:40 UTC (rev 1441)
@@ -74,10 +74,10 @@
# Read the PROCESSOR_ARCHITECTURE environment value for a CPU type
!IF "$(BUILD_CPU)" == "i386" || "$(BUILD_CPU)" == "x86" || "$(BUILD_CPU)" == "i686"
-CPU=I386
+CPU=X86
!ENDIF
-!IF "$(BUILD_CPU)" == "amd64" || "$(BUILD_CPU)" == "x86_64"
-CPU=AMD64
+!IF "$(BUILD_CPU)" == "amd64" || "$(BUILD_CPU)" == "x86_64" || "$(BUILD_CPU)" == "x64"
+CPU=X64
!ENDIF
!IF "$(BUILD_CPU)" == "ia64"
CPU=IA64
@@ -85,16 +85,16 @@
!IF !DEFINED(CPU) || "$(CPU)" == ""
!IF "$(PROCESSOR_ARCHITECTURE)" == ""
-CPU=I386
+CPU=X86
!ELSE
CPU=$(PROCESSOR_ARCHITECTURE)
!ENDIF
!ENDIF
-!IF "$(CPU)" != "I386"
-!IF "$(CPU)" != "AMD64"
+!IF "$(CPU)" != "X86"
+!IF "$(CPU)" != "X64"
!IF "$(CPU)" != "IA64"
-!ERROR Must specify CPU environment variable (I386, AMD64, IA64) $(CPU)
+!ERROR Must specify CPU environment variable (X86, X64, IA64) $(CPU)
!ENDIF
!ENDIF
!ENDIF
@@ -184,22 +184,22 @@
# Common flags for all platforms
CMN_CFLAGS = -c -nologo -DWIN32 -D_WIN32 -D_WINDOWS $(NMAKE_WINNT) -W3
-!IF "$(CPU)" == "I386"
+!IF "$(CPU)" == "X86"
CPU_CFLAGS = -D_X86_=1
-!ELSEIF "$(CPU)" == "AMD64"
+!ELSEIF "$(CPU)" == "X64"
CPU_CFLAGS = -D_AMD64_=1 -DWIN64 -D_WIN64 -Wp64
!ELSEIF "$(CPU)" == "IA64"
CPU_CFLAGS = -D_IA64_=1 -DWIN64 -D_WIN64 -Wp64
!ENDIF
!IF "$(INCLUDE_PRE64PRA)" == "1"
-!IF "$(CPU)" != "I386"
+!IF "$(CPU)" != "X86"
CPU_CFLAGS = $(CPU_CFLAGS) /FIPRE64PRA.H
!ENDIF
!ENDIF
!IF "$(BUILD)" == "RELEASE"
-!IF "$(CPU)" == "I386"
+!IF "$(CPU)" == "X86"
OPT_CFLAGS = -O2 -Ob2 -Oy- -Zi -DNDEBUG
!ELSE
OPT_CFLAGS = -O2 -Ob2 -Zi -DNDEBUG
@@ -228,7 +228,7 @@
# Linker section
LIBS = kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib $(LIBS)
!IF "$(INCLUDE_BUFFEROVERFLOWU)" == "1"
-!IF "$(CPU)" != "I386"
+!IF "$(CPU)" != "X86"
LIBS = $(LIBS) bufferoverflowu.lib
!ENDIF
!ENDIF
@@ -293,17 +293,17 @@
!IF DEFINED(JAVA_HOME) && "$(JAVA_HOME)" != ""
JAVA_INCLUDES=-I "$(JAVA_HOME)\include"
-!IF "$(CPU)" != "I386"
+!IF "$(CPU)" != "X86"
JAVA_INCLUDES=$(JAVA_INCLUDES) -I "$(JAVA_HOME)\include\win64"
!ENDIF
JAVA_INCLUDES=$(JAVA_INCLUDES) -I "$(JAVA_HOME)\include\win32"
!ENDIF
!IF !DEFINED(ML) || "$(ML)" == ""
-!IF "$(CPU)" == "I386"
+!IF "$(CPU)" == "X86"
ML = ml.exe
AFLAGS = /coff /Zi /c
-!ELSEIF "$(CPU)" == "AMD64"
+!ELSEIF "$(CPU)" == "X64"
ML = ml64.exe
AFLAGS = /Zi /c
!ELSEIF "$(CPU)" == "IA64"
Modified: trunk/build/unix/build.sh
===================================================================
--- trunk/build/unix/build.sh 2008-03-16 21:00:11 UTC (rev 1440)
+++ trunk/build/unix/build.sh 2008-03-16 21:21:40 UTC (rev 1441)
@@ -255,10 +255,10 @@
BUILD_CPU=sparcv9
;;
i86pc*)
- BUILD_CPU=i686
+ BUILD_CPU=x86
;;
x86_64*)
- BUILD_CPU=amd64
+ BUILD_CPU=x64
;;
9000/800*)
BUILD_CPU=parisc2
@@ -577,7 +577,7 @@
solaris-sparcv9)
./Configure ${ssl_target} ${ssl_common_flags} ${ssl_build_flags} solaris-sparcv9-cc || exit 1
;;
- solaris-i686)
+ solaris-x86)
./Configure ${ssl_target} ${ssl_common_flags} ${ssl_build_flags} solaris-x86-cc || exit 1
;;
hpux-parisc2)
@@ -589,11 +589,11 @@
linux2-ppc64)
./Configure ${ssl_target} ${ssl_common_flags} ${ssl_build_flags} linux-ppc64 || exit 1
;;
- windows-i686)
+ windows-x86)
./Configure ${ssl_target} VC-NT
ms/do_masm.bat
;;
- windows-amd64)
+ windows-x64)
./Configure ${ssl_target} VC-WIN64A
ms/do_win64a.bat
;;
Modified: trunk/build/windows/build.bat
===================================================================
--- trunk/build/windows/build.bat 2008-03-16 21:00:11 UTC (rev 1440)
+++ trunk/build/windows/build.bat 2008-03-16 21:21:40 UTC (rev 1441)
@@ -103,9 +103,11 @@
set BUILD_CPU=%1
shift
@if /i "%BUILD_CPU%" == "i686" goto cpuX86
-@if /i "%BUILD_CPU%" == "amd64" goto cpuAMD64
+@if /i "%BUILD_CPU%" == "x86" goto cpuX86
+@if /i "%BUILD_CPU%" == "amd64" goto cpuX64
+@if /i "%BUILD_CPU%" == "x64" goto cpuX86
@if /i "%BUILD_CPU%" == "ia64" goto cpuIA64
-echo Usage: %PROGNAME% CPU where CPU is i686 amd64 or ia64
+echo Usage: %PROGNAME% CPU where CPU is x86 x64 or ia64
echo or : %PROGNAME% sdk CPU if you are cross compiling
goto cmdEnd
@@ -118,7 +120,7 @@
)
goto cmdBuild
-:cpuAMD64
+:cpuX64
@if "%USE_PLATFORM_SDK%" == "1" (
call "%MSWPSDK%\SetEnv" /X64 /RETAIL
) else (
16 years, 9 months