JBoss Native SVN: r1110 - trunk/sight/native/os/solaris.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2007-10-14 04:23:17 -0400 (Sun, 14 Oct 2007)
New Revision: 1110
Modified:
trunk/sight/native/os/solaris/module.c
Log:
Arrange porting.
Modified: trunk/sight/native/os/solaris/module.c
===================================================================
--- trunk/sight/native/os/solaris/module.c 2007-10-14 07:52:27 UTC (rev 1109)
+++ trunk/sight/native/os/solaris/module.c 2007-10-14 08:23:17 UTC (rev 1110)
@@ -90,15 +90,15 @@
typedef struct module_enum_t {
int nummodules;
apr_pool_t *pool;
- module *first_module;
- module *current_module;
+ struct module *first_module;
+ struct module *current;
} module_enum_t;
struct module {
char *name;
int base;
int size;
- module *next;
+ struct module *next;
};
SIGHT_CLASS_LDEF(Module)
@@ -132,9 +132,9 @@
module_enum_t *module = ptr;
struct module *current;
// fill first, use current and put next in current...
- if (module->ptr == NULL) {
- module->ptr = apr_palloc(module->pool, sizeof(struct module));
- current = module->ptr;
+ if (module->first_module == NULL) {
+ module->first_module = apr_palloc(module->pool, sizeof(struct module));
+ current = module->first_module;
} else {
current = module->current;
current->next = apr_palloc(module->pool, sizeof(struct module));
@@ -142,8 +142,8 @@
}
current->next = NULL;
current->name = apr_pstrdup(module->pool, car);
- current->base = pr_vaddr;
- current->size = pr_size;
+ current->base = map->pr_vaddr;
+ current->size = map->pr_size;
module->nummodules++;
return 0;
}
@@ -155,6 +155,7 @@
apr_pool_t *pool;
int j;
int ret;
+ apr_status_t rc;
struct ps_prochandle *ph;
module_enum_t *module;
struct module *current;
@@ -186,7 +187,7 @@
module->pool = pool;
module->nummodules = 0;
module->first_module = NULL;
- module->current_module = NULL;
+ module->current = NULL;
Pobject_iter(ph, proc_map_f, module);
if (ret<0) {
throwOSException(_E, Pgrab_error(ret));
17 years, 2 months
JBoss Native SVN: r1109 - trunk/sight/native/os/solaris.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2007-10-14 03:52:27 -0400 (Sun, 14 Oct 2007)
New Revision: 1109
Modified:
trunk/sight/native/os/solaris/module.c
Log:
Port to Solaris.
Modified: trunk/sight/native/os/solaris/module.c
===================================================================
--- trunk/sight/native/os/solaris/module.c 2007-10-12 11:44:30 UTC (rev 1108)
+++ trunk/sight/native/os/solaris/module.c 2007-10-14 07:52:27 UTC (rev 1109)
@@ -35,6 +35,15 @@
#include "sight_types.h"
#include "sight_private.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/mkdev.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <libelf.h>
+#include <procfs.h>
+
/*
* Module
*/
@@ -76,7 +85,22 @@
"J"
};
+extern apr_pool_t *sight_temp_pool;
+typedef struct module_enum_t {
+ int nummodules;
+ apr_pool_t *pool;
+ module *first_module;
+ module *current_module;
+} module_enum_t;
+
+struct module {
+ char *name;
+ int base;
+ int size;
+ module *next;
+};
+
SIGHT_CLASS_LDEF(Module)
{
if (sight_load_class(_E, &_clazzn))
@@ -103,11 +127,97 @@
return NULL;
}
+static int proc_map_f(void *ptr, const prmap_t *map, const char *car)
+{
+ module_enum_t *module = ptr;
+ struct module *current;
+ // fill first, use current and put next in current...
+ if (module->ptr == NULL) {
+ module->ptr = apr_palloc(module->pool, sizeof(struct module));
+ current = module->ptr;
+ } else {
+ current = module->current;
+ current->next = apr_palloc(module->pool, sizeof(struct module));
+ current = current->next;
+ }
+ current->next = NULL;
+ current->name = apr_pstrdup(module->pool, car);
+ current->base = pr_vaddr;
+ current->size = pr_size;
+ module->nummodules++;
+ return 0;
+}
SIGHT_EXPORT_DECLARE(jobjectArray, Module, enum0)(SIGHT_STDARGS,
jint pid)
{
- UNREFERENCED_STDARGS;
- UNREFERENCED(pid);
- return NULL;
+ int mpid = getpid();
+ apr_pool_t *pool;
+ int j;
+ int ret;
+ struct ps_prochandle *ph;
+ module_enum_t *module;
+ struct module *current;
+ jobjectArray mods = NULL;
+
+ UNREFERENCED_O;
+ if (pid >= 0)
+ mpid = pid;
+
+ if ((rc = sight_create_pool(&pool, sight_temp_pool)) != APR_SUCCESS) {
+ throwAprMemoryException(_E, THROW_FMARK, rc);
+ return NULL;
+ }
+ ph = Pgrab(pid, 0, &ret);
+ if (ph == NULL) {
+ throwOSException(_E, Pgrab_error(ret));
+ apr_pool_destroy(pool);
+ return NULL;
+ }
+
+ /* Process all entries */
+ module = apr_palloc(pool, sizeof(module_enum_t));
+ if (module == NULL) {
+ throwAprMemoryException(_E, THROW_FMARK, apr_get_os_error());
+ Prelease(ph, 0);
+ apr_pool_destroy(pool);
+ return NULL;
+ }
+ module->pool = pool;
+ module->nummodules = 0;
+ module->first_module = NULL;
+ module->current_module = NULL;
+ Pobject_iter(ph, proc_map_f, module);
+ if (ret<0) {
+ throwOSException(_E, Pgrab_error(ret));
+ apr_pool_destroy(pool);
+ return NULL;
+ }
+
+ /* Release the proc file system */
+ Prelease(ph, 0);
+
+ /* Fill the java objects */
+ mods = (*_E)->NewObjectArray(_E, module->nummodules, _clazzn.a, NULL);
+ if (!mods || (*_E)->ExceptionCheck(_E)) {
+ apr_pool_destroy(pool);
+ return NULL;
+ }
+ current = module->current;
+ for (j = 0; j < module->nummodules; j++) {
+ jobject m = new_module_class(_E, _O, pid, j);
+ if (!m || (*_E)->ExceptionCheck(_E)) {
+ apr_pool_destroy(pool);
+ return NULL;
+ }
+ SET_IFIELD_S(0000, m, current->name);
+ SET_IFIELD_S(0001, m, current->name); /* should be basename */
+ SET_IFIELD_J(0002, m, current->base);
+ SET_IFIELD_J(0002, m, current->size);
+ (*_E)->SetObjectArrayElement(_E, mods, j, m);
+ (*_E)->DeleteLocalRef(_E, m);
+ }
+ apr_pool_destroy(pool);
+
+ return mods;
}
17 years, 2 months
JBoss Native SVN: r1108 - trunk/sight/java/org/jboss/sight.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-10-12 07:44:30 -0400 (Fri, 12 Oct 2007)
New Revision: 1108
Modified:
trunk/sight/java/org/jboss/sight/Library.java
Log:
Declare known exceptions thrown
Modified: trunk/sight/java/org/jboss/sight/Library.java
===================================================================
--- trunk/sight/java/org/jboss/sight/Library.java 2007-10-12 11:38:01 UTC (rev 1107)
+++ trunk/sight/java/org/jboss/sight/Library.java 2007-10-12 11:44:30 UTC (rev 1108)
@@ -114,7 +114,7 @@
* @param libraryName the name of the library to load
*/
static public boolean initialize(String libraryName)
- throws Exception
+ throws Exception, UnsatisfiedLinkError
{
synchronized(Library.class) {
if (_instance == null) {
@@ -153,7 +153,7 @@
* called for any APR library.
*/
static public void shutdown()
- throws Exception
+ throws Exception, UnsatisfiedLinkError
{
synchronized(Library.class) {
try {
@@ -175,7 +175,7 @@
* called for any APR library.
*/
static public void terminate()
- throws Exception
+ throws Exception, UnsatisfiedLinkError
{
shutdown();
}
@@ -187,7 +187,7 @@
* close all the native objects.
*/
static public void clear()
- throws Exception
+ throws Exception, UnsatisfiedLinkError
{
synchronized(Library.class) {
if (_instance != null) {
17 years, 2 months
JBoss Native SVN: r1107 - trunk/sight/java/org/jboss/sight.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-10-12 07:38:01 -0400 (Fri, 12 Oct 2007)
New Revision: 1107
Modified:
trunk/sight/java/org/jboss/sight/Library.java
Log:
Make Library calls synchronized on Library Class
Modified: trunk/sight/java/org/jboss/sight/Library.java
===================================================================
--- trunk/sight/java/org/jboss/sight/Library.java 2007-10-12 11:35:20 UTC (rev 1106)
+++ trunk/sight/java/org/jboss/sight/Library.java 2007-10-12 11:38:01 UTC (rev 1107)
@@ -35,7 +35,7 @@
/* Default library names */
private static String [] NAMES = {"sight-1", "libsight-1"};
- private static Object lock = new Object();
+
/*
* A handle to the unique Library singleton instance.
*/
@@ -116,7 +116,7 @@
static public boolean initialize(String libraryName)
throws Exception
{
- synchronized(lock) {
+ synchronized(Library.class) {
if (_instance == null) {
if (libraryName == null)
_instance = new Library();
@@ -155,7 +155,7 @@
static public void shutdown()
throws Exception
{
- synchronized(lock) {
+ synchronized(Library.class) {
try {
if (_instance != null) {
terminate0();
@@ -189,7 +189,7 @@
static public void clear()
throws Exception
{
- synchronized(lock) {
+ synchronized(Library.class) {
if (_instance != null) {
clear0();
/* Reinitialize Runtime objects */
17 years, 2 months
JBoss Native SVN: r1106 - trunk/sight/java/org/jboss/sight.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-10-12 07:35:20 -0400 (Fri, 12 Oct 2007)
New Revision: 1106
Modified:
trunk/sight/java/org/jboss/sight/Library.java
Log:
Make Library calls synchronized
Modified: trunk/sight/java/org/jboss/sight/Library.java
===================================================================
--- trunk/sight/java/org/jboss/sight/Library.java 2007-10-12 11:18:09 UTC (rev 1105)
+++ trunk/sight/java/org/jboss/sight/Library.java 2007-10-12 11:35:20 UTC (rev 1106)
@@ -35,7 +35,7 @@
/* Default library names */
private static String [] NAMES = {"sight-1", "libsight-1"};
-
+ private static Object lock = new Object();
/*
* A handle to the unique Library singleton instance.
*/
@@ -116,34 +116,36 @@
static public boolean initialize(String libraryName)
throws Exception
{
- if (_instance == null) {
- if (libraryName == null)
- _instance = new Library();
- else
- _instance = new Library(libraryName);
- SIGHT_MAJOR_VERSION = version(0x01);
- SIGHT_MINOR_VERSION = version(0x02);
- SIGHT_PATCH_VERSION = version(0x03);
- SIGHT_IS_DEV_VERSION = version(0x04);
- APR_MAJOR_VERSION = version(0x11);
- APR_MINOR_VERSION = version(0x12);
- APR_PATCH_VERSION = version(0x13);
- APR_IS_DEV_VERSION = version(0x14);
+ synchronized(lock) {
+ if (_instance == null) {
+ if (libraryName == null)
+ _instance = new Library();
+ else
+ _instance = new Library(libraryName);
+ SIGHT_MAJOR_VERSION = version(0x01);
+ SIGHT_MINOR_VERSION = version(0x02);
+ SIGHT_PATCH_VERSION = version(0x03);
+ SIGHT_IS_DEV_VERSION = version(0x04);
+ APR_MAJOR_VERSION = version(0x11);
+ APR_MINOR_VERSION = version(0x12);
+ APR_PATCH_VERSION = version(0x13);
+ APR_IS_DEV_VERSION = version(0x14);
- if (APR_MAJOR_VERSION < 1) {
- throw new UnsatisfiedLinkError("Unsupported APR Version (" +
- getAprVersionString() + ")");
+ if (APR_MAJOR_VERSION < 1) {
+ throw new UnsatisfiedLinkError("Unsupported APR Version (" +
+ getAprVersionString() + ")");
+ }
+ if (initialize0()) {
+ /* Initialize Runtime objects */
+ File.initializeStdFiles();
+ Service.loadResources();
+ return true;
+ }
+ return false;
}
- if (initialize0()) {
- /* Initialize Runtime objects */
- File.initializeStdFiles();
- Service.loadResources();
+ else
return true;
- }
- return false;
}
- else
- return true;
}
/**
@@ -153,19 +155,19 @@
static public void shutdown()
throws Exception
{
- try {
- if (_instance != null) {
- synchronized(_instance) {
+ synchronized(lock) {
+ try {
+ if (_instance != null) {
terminate0();
}
+ else {
+ throw new UnsatisfiedLinkError("Library was not initialized");
+ }
}
- else {
- throw new UnsatisfiedLinkError("Library was not initialized");
+ finally {
+ _instance = null;
}
}
- finally {
- _instance = null;
- }
}
/**
@@ -184,19 +186,19 @@
* Clear the global APR pool and
* close all the native objects.
*/
- static synchronized public void clear()
+ static public void clear()
throws Exception
{
- if (_instance != null) {
- synchronized(_instance) {
+ synchronized(lock) {
+ if (_instance != null) {
clear0();
/* Reinitialize Runtime objects */
File.initializeStdFiles();
}
+ else {
+ throw new UnsatisfiedLinkError("Library was not initialized");
+ }
}
- else {
- throw new UnsatisfiedLinkError("Library was not initialized");
- }
}
}
17 years, 2 months
JBoss Native SVN: r1105 - trunk/sight/java/org/jboss/sight.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-10-12 07:18:09 -0400 (Fri, 12 Oct 2007)
New Revision: 1105
Modified:
trunk/sight/java/org/jboss/sight/Library.java
trunk/sight/java/org/jboss/sight/Service.java
Log:
Make Service proparities a runtime object loaded on Library.initialize
Modified: trunk/sight/java/org/jboss/sight/Library.java
===================================================================
--- trunk/sight/java/org/jboss/sight/Library.java 2007-10-12 11:09:32 UTC (rev 1104)
+++ trunk/sight/java/org/jboss/sight/Library.java 2007-10-12 11:18:09 UTC (rev 1105)
@@ -137,7 +137,7 @@
if (initialize0()) {
/* Initialize Runtime objects */
File.initializeStdFiles();
-
+ Service.loadResources();
return true;
}
return false;
Modified: trunk/sight/java/org/jboss/sight/Service.java
===================================================================
--- trunk/sight/java/org/jboss/sight/Service.java 2007-10-12 11:09:32 UTC (rev 1104)
+++ trunk/sight/java/org/jboss/sight/Service.java 2007-10-12 11:18:09 UTC (rev 1105)
@@ -53,7 +53,7 @@
private static Properties serviceProperties = null;
private static boolean servicePropertiesLoaded = false;
- private static void setupKnownService(Service service)
+ protected static void loadResources()
{
if (serviceProperties == null) {
serviceProperties = new Properties();
@@ -80,13 +80,15 @@
}
}
}
- if (OS.IS_LINUX || OS.IS_SOLARIS) {
- String pserviceName = serviceProperties.getProperty(service.Name + ".2", service.Name);
- service.DisplayName = serviceProperties.getProperty(pserviceName + ".0", service.DisplayName);
- service.Description = serviceProperties.getProperty(pserviceName + ".1");
- }
}
+ private static void setupKnownService(Service service)
+ {
+ String pserviceName = serviceProperties.getProperty(service.Name + ".2", service.Name);
+ service.DisplayName = serviceProperties.getProperty(pserviceName + ".0", service.DisplayName);
+ service.Description = serviceProperties.getProperty(pserviceName + ".1");
+ }
+
private Service()
{
super(0);
@@ -112,7 +114,9 @@
throw new OperatingSystemException(Error.getError(e));
}
Name = name;
- setupKnownService(this);
+ if (OS.IS_LINUX || OS.IS_SOLARIS) {
+ setupKnownService(this);
+ }
}
protected Service(ServiceControlManager scm, String name,
17 years, 2 months
JBoss Native SVN: r1104 - in trunk/sight: native/include and 4 other directories.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-10-12 07:09:32 -0400 (Fri, 12 Oct 2007)
New Revision: 1104
Modified:
trunk/sight/java/org/jboss/sight/Service.java
trunk/sight/native/include/sight_local.h
trunk/sight/native/os/linux/service.c
trunk/sight/native/os/solaris/service.c
trunk/sight/native/os/windows/service.c
trunk/sight/native/share/error.c
Log:
Throw IllegalArgumentException for APR_EINVAL
Modified: trunk/sight/java/org/jboss/sight/Service.java
===================================================================
--- trunk/sight/java/org/jboss/sight/Service.java 2007-10-12 09:27:59 UTC (rev 1103)
+++ trunk/sight/java/org/jboss/sight/Service.java 2007-10-12 11:09:32 UTC (rev 1104)
@@ -103,7 +103,7 @@
}
protected Service(ServiceControlManager scm, String name)
- throws OutOfMemoryError, OperatingSystemException
+ throws OutOfMemoryError, OperatingSystemException, IllegalArgumentException
{
super(scm.POOL);
int e = open0(this, INSTANCE, scm.INSTANCE,
@@ -117,7 +117,7 @@
protected Service(ServiceControlManager scm, String name,
EnumSet<GenericAccessRights> access)
- throws OutOfMemoryError, OperatingSystemException
+ throws OutOfMemoryError, OperatingSystemException, IllegalArgumentException
{
super(scm.POOL);
int e = open0(this, INSTANCE, scm.INSTANCE,
Modified: trunk/sight/native/include/sight_local.h
===================================================================
--- trunk/sight/native/include/sight_local.h 2007-10-12 09:27:59 UTC (rev 1103)
+++ trunk/sight/native/include/sight_local.h 2007-10-12 11:09:32 UTC (rev 1104)
@@ -118,6 +118,7 @@
void throwIOException(JNIEnv *, const char *);
void throwMemoryException(JNIEnv *, const char *, int, const char *);
void throwNullPointerException(JNIEnv *, const char *, int, const char *);
+void throwArgumentException(JNIEnv *, const char *, int, const char *);
void throwAprException(JNIEnv *, apr_status_t);
void throwAprExceptionEx(JNIEnv *, const char *, int, apr_status_t);
void throwAprIOException(JNIEnv *, apr_status_t);
Modified: trunk/sight/native/os/linux/service.c
===================================================================
--- trunk/sight/native/os/linux/service.c 2007-10-12 09:27:59 UTC (rev 1103)
+++ trunk/sight/native/os/linux/service.c 2007-10-12 11:09:32 UTC (rev 1104)
@@ -151,12 +151,18 @@
UNREFERENCED_O;
UNREFERENCED(access);
+ if (!name) {
+ throwArgumentException(_E, THROW_FMARK, NULL);
+ return APR_EINVAL;
+ }
if (!no || !no->pool) {
SIGHT_FREE_CSTRING(name);
+ throwArgumentException(_E, THROW_FMARK, NULL);
return APR_EINVAL;
}
if (!ns || !ns->native) {
SIGHT_FREE_CSTRING(name);
+ throwArgumentException(_E, THROW_FMARK, NULL);
return APR_EINVAL;
}
SIGHT_LOCAL_TRY(ns) {
@@ -181,7 +187,7 @@
if (!sight_wmatch(sname, smatch)) {
SET_IFIELD_S(0001, thiz, sname);
SET_IFIELD_S(0004, thiz, sent->d_name);
-
+
/* TODO: Launch script with status param
* to figure out the state.
*/
Modified: trunk/sight/native/os/solaris/service.c
===================================================================
--- trunk/sight/native/os/solaris/service.c 2007-10-12 09:27:59 UTC (rev 1103)
+++ trunk/sight/native/os/solaris/service.c 2007-10-12 11:09:32 UTC (rev 1104)
@@ -154,12 +154,18 @@
UNREFERENCED_O;
UNREFERENCED(access);
+ if (!name) {
+ throwArgumentException(_E, THROW_FMARK, NULL);
+ return APR_EINVAL;
+ }
if (!no || !no->pool) {
SIGHT_FREE_CSTRING(name);
+ throwArgumentException(_E, THROW_FMARK, NULL);
return APR_EINVAL;
}
if (!ns || !ns->native) {
SIGHT_FREE_CSTRING(name);
+ throwArgumentException(_E, THROW_FMARK, NULL);
return APR_EINVAL;
}
@@ -185,7 +191,7 @@
if (!sight_wmatch(sname, smatch)) {
SET_IFIELD_S(0001, thiz, sname);
SET_IFIELD_S(0004, thiz, sent->d_name);
-
+
/* TODO: Launch script with status param
* to figure out the state.
*/
Modified: trunk/sight/native/os/windows/service.c
===================================================================
--- trunk/sight/native/os/windows/service.c 2007-10-12 09:27:59 UTC (rev 1103)
+++ trunk/sight/native/os/windows/service.c 2007-10-12 11:09:32 UTC (rev 1104)
@@ -165,12 +165,19 @@
SIGHT_ALLOC_CSTRING(name);
BYTE buf[1024];
UNREFERENCED_O;
+
+ if (!name) {
+ throwArgumentException(_E, THROW_FMARK, NULL);
+ return APR_EINVAL;
+ }
if (!no || !no->pool) {
SIGHT_FREE_CSTRING(name);
+ throwArgumentException(_E, THROW_FMARK, NULL);
return APR_EINVAL;
}
if (!ns || !ns->native) {
SIGHT_FREE_CSTRING(name);
+ throwArgumentException(_E, THROW_FMARK, NULL);
return APR_EINVAL;
}
SIGHT_LOCAL_TRY(ns) {
Modified: trunk/sight/native/share/error.c
===================================================================
--- trunk/sight/native/share/error.c 2007-10-12 09:27:59 UTC (rev 1103)
+++ trunk/sight/native/share/error.c 2007-10-12 11:09:32 UTC (rev 1104)
@@ -115,7 +115,10 @@
if (f != file) {
f++;
}
- sprintf(fmt, "%s (%s)+%d", msg, f, line);
+ if (msg)
+ sprintf(fmt, "%s (%s)+%d", msg, f, line);
+ else
+ sprintf(fmt, "(%s)+%d", msg, f, line);
throwClass(env, clazz, &fmt[0]);
}
else {
@@ -159,6 +162,16 @@
}
/*
+ * Convenience function to help throw an java.lang.IllegalArgumentException.
+ */
+void throwArgumentException(JNIEnv *env, const char *file, int line,
+ const char *msg)
+{
+ throwDebug(env, "java/lang/IllegalArgumentException", file, line, msg);
+}
+
+
+/*
* Convenience function to help throw an java.lang.Exception
* with string representation of APR error code.
*/
17 years, 2 months
JBoss Native SVN: r1103 - in trunk/sight/native/os: solaris and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-10-12 05:27:59 -0400 (Fri, 12 Oct 2007)
New Revision: 1103
Modified:
trunk/sight/native/os/linux/service.c
trunk/sight/native/os/solaris/service.c
trunk/sight/native/os/windows/service.c
Log:
Refcount JNI calls for services
Modified: trunk/sight/native/os/linux/service.c
===================================================================
--- trunk/sight/native/os/linux/service.c 2007-10-12 05:11:54 UTC (rev 1102)
+++ trunk/sight/native/os/linux/service.c 2007-10-12 09:27:59 UTC (rev 1103)
@@ -159,36 +159,41 @@
SIGHT_FREE_CSTRING(name);
return APR_EINVAL;
}
- si = (scm_instance_t *)ns->native;
- sprintf(rlpath, si->rlpath, si->what);
- if ((rd = opendir(rlpath))) {
- struct dirent *sent, sbuf;
- int state = SIGHT_SS_DISABLED;
- while (!readdir_r(rd, &sbuf, &sent)) {
- char sname[PATH_MAX];
- char smatch[PATH_MAX];
- struct stat sb;
- if (!sent)
- break;
- strcpy(sname, rlpath);
- strcat(sname, sent->d_name);
- strcpy(smatch, "*/S??");
- strcat(smatch, J2S(name));
- /* Match the SnnName */
- if (!sight_wmatch(sname, smatch)) {
- SET_IFIELD_S(0001, thiz, sname);
- SET_IFIELD_S(0004, thiz, sent->d_name);
+ SIGHT_LOCAL_TRY(ns) {
+ SIGHT_LOCAL_TRY(no) {
+ si = (scm_instance_t *)ns->native;
+ sprintf(rlpath, si->rlpath, si->what);
- /* TODO: Launch script with status param
- * to figure out the state.
- */
- state = SIGHT_SS_UNKNOWN;
- break;
+ if ((rd = opendir(rlpath))) {
+ struct dirent *sent, sbuf;
+ int state = SIGHT_SS_DISABLED;
+ while (!readdir_r(rd, &sbuf, &sent)) {
+ char sname[PATH_MAX];
+ char smatch[PATH_MAX];
+ struct stat sb;
+ if (!sent)
+ break;
+ strcpy(sname, rlpath);
+ strcat(sname, sent->d_name);
+ strcpy(smatch, "*/S??");
+ strcat(smatch, J2S(name));
+ /* Match the SnnName */
+ if (!sight_wmatch(sname, smatch)) {
+ SET_IFIELD_S(0001, thiz, sname);
+ SET_IFIELD_S(0004, thiz, sent->d_name);
+
+ /* TODO: Launch script with status param
+ * to figure out the state.
+ */
+ state = SIGHT_SS_UNKNOWN;
+ break;
+ }
}
+ closedir(rd);
+ CALL_METHOD1(0000, thiz, state);
}
- closedir(rd);
- CALL_METHOD1(0000, thiz, state);
- }
+ } SIGHT_LOCAL_END(no);
+ } SIGHT_LOCAL_END(ns);
SIGHT_FREE_CSTRING(name);
return APR_FROM_OS_ERROR(rc);
}
Modified: trunk/sight/native/os/solaris/service.c
===================================================================
--- trunk/sight/native/os/solaris/service.c 2007-10-12 05:11:54 UTC (rev 1102)
+++ trunk/sight/native/os/solaris/service.c 2007-10-12 09:27:59 UTC (rev 1103)
@@ -162,43 +162,47 @@
SIGHT_FREE_CSTRING(name);
return APR_EINVAL;
}
- si = (scm_instance_t *)ns->native;
- sprintf(rlpath, si->rlpath, si->what);
+ SIGHT_LOCAL_TRY(ns) {
+ SIGHT_LOCAL_TRY(no) {
+ si = (scm_instance_t *)ns->native;
+ sprintf(rlpath, si->rlpath, si->what);
sretry:
- if ((rd = opendir(rlpath))) {
- struct dirent *sent;
- char sbuf[PATH_MAX + sizeof(struct dirent)];;
- while (!readdir_r(rd, (struct dirent *)sbuf, &sent)) {
- char sname[PATH_MAX];
- char smatch[PATH_MAX];
- struct stat sb;
- if (!sent)
- break;
- strcpy(sname, rlpath);
- strcat(sname, sent->d_name);
- strcpy(smatch, "*/S??");
- strcat(smatch, J2S(name));
- /* Match the SnnName */
- if (!sight_wmatch(sname, smatch)) {
- SET_IFIELD_S(0001, thiz, sname);
- SET_IFIELD_S(0004, thiz, sent->d_name);
-
- /* TODO: Launch script with status param
- * to figure out the state.
- */
- state = SIGHT_SS_UNKNOWN;
- break;
+ if ((rd = opendir(rlpath))) {
+ struct dirent *sent;
+ char sbuf[PATH_MAX + sizeof(struct dirent)];;
+ while (!readdir_r(rd, (struct dirent *)sbuf, &sent)) {
+ char sname[PATH_MAX];
+ char smatch[PATH_MAX];
+ struct stat sb;
+ if (!sent)
+ break;
+ strcpy(sname, rlpath);
+ strcat(sname, sent->d_name);
+ strcpy(smatch, "*/S??");
+ strcat(smatch, J2S(name));
+ /* Match the SnnName */
+ if (!sight_wmatch(sname, smatch)) {
+ SET_IFIELD_S(0001, thiz, sname);
+ SET_IFIELD_S(0004, thiz, sent->d_name);
+
+ /* TODO: Launch script with status param
+ * to figure out the state.
+ */
+ state = SIGHT_SS_UNKNOWN;
+ break;
+ }
}
+ closedir(rd);
+ CALL_METHOD1(0000, thiz, state);
}
- closedir(rd);
- CALL_METHOD1(0000, thiz, state);
- }
- if (state == SIGHT_SS_DISABLED &&
- strcmp(rlpath, "/etc/rcS.d/")) {
- strcpy(rlpath, "/etc/rcS.d/");
- goto sretry;
- }
+ if (state == SIGHT_SS_DISABLED &&
+ strcmp(rlpath, "/etc/rcS.d/")) {
+ strcpy(rlpath, "/etc/rcS.d/");
+ goto sretry;
+ }
+ } SIGHT_LOCAL_END(no);
+ } SIGHT_LOCAL_END(ns);
SIGHT_FREE_CSTRING(name);
return APR_FROM_OS_ERROR(rc);
}
Modified: trunk/sight/native/os/windows/service.c
===================================================================
--- trunk/sight/native/os/windows/service.c 2007-10-12 05:11:54 UTC (rev 1102)
+++ trunk/sight/native/os/windows/service.c 2007-10-12 09:27:59 UTC (rev 1103)
@@ -173,6 +173,7 @@
SIGHT_FREE_CSTRING(name);
return APR_EINVAL;
}
+ SIGHT_LOCAL_TRY(ns) {
SIGHT_LOCAL_TRY(no) {
hscm = ns->native;
if (no->native) {
@@ -183,6 +184,7 @@
if (IS_INVALID_HANDLE(hsvc)) {
rc = GetLastError();
SIGHT_LOCAL_BRK(no);
+ SIGHT_LOCAL_BRK(ns);
goto cleanup;
}
@@ -197,17 +199,20 @@
throwAprMemoryException(_E, THROW_FMARK,
apr_get_os_error());
SIGHT_LOCAL_BRK(no);
+ SIGHT_LOCAL_BRK(ns);
goto cleanup;
}
if (!QueryServiceConfigW(hsvc, lpServiceConfig,
cbBufSize, &cbBytesNeeded)) {
rc = GetLastError();
SIGHT_LOCAL_BRK(no);
+ SIGHT_LOCAL_BRK(ns);
goto cleanup;
}
}
else {
SIGHT_LOCAL_BRK(no);
+ SIGHT_LOCAL_BRK(ns);
goto cleanup;
}
}
@@ -222,6 +227,7 @@
BYTE *lpBuffer;
if (rc != ERROR_INSUFFICIENT_BUFFER) {
SIGHT_LOCAL_BRK(no);
+ SIGHT_LOCAL_BRK(ns);
goto cleanup;
}
cbBufSize = cbBytesNeeded;
@@ -231,6 +237,7 @@
throwAprMemoryException(_E, THROW_FMARK,
apr_get_os_error());
SIGHT_LOCAL_BRK(no);
+ SIGHT_LOCAL_BRK(ns);
goto cleanup;
}
if (!QueryServiceConfig2W(hsvc, SERVICE_CONFIG_DESCRIPTION,
@@ -238,6 +245,7 @@
rc = GetLastError();
free(lpBuffer);
SIGHT_LOCAL_BRK(no);
+ SIGHT_LOCAL_BRK(ns);
goto cleanup;
}
else {
@@ -262,6 +270,7 @@
rc = ERROR_SUCCESS;
}
} SIGHT_LOCAL_END(no);
+ } SIGHT_LOCAL_END(ns);
cleanup:
if (lpServiceConfig)
free(lpServiceConfig);
@@ -389,6 +398,10 @@
timeout_interval = 100000L;
}
do {
+ if (SIGHT_LOCAL_IRQ(no)) {
+ rc = APR_TO_OS_ERROR(APR_TIMEUP);
+ break;
+ }
apr_sleep(timeout_interval);
if (!QueryServiceStatusEx(hsvc, SC_STATUS_PROCESS_INFO,
buf, sizeof(buf), &cbBytesNeeded)) {
@@ -484,6 +497,10 @@
else if (cres > 0) {
timeout_interval = cres * 1000L;
}
+ if (SIGHT_LOCAL_IRQ(no)) {
+ rc = APR_TO_OS_ERROR(APR_TIMEUP);
+ break;
+ }
apr_sleep(timeout_interval);
if (!QueryServiceStatusEx(hsvc, SC_STATUS_PROCESS_INFO,
buf, sizeof(buf), &cbBytesNeeded)) {
17 years, 2 months
JBoss Native SVN: r1102 - trunk/sight.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-10-12 01:11:54 -0400 (Fri, 12 Oct 2007)
New Revision: 1102
Modified:
trunk/sight/build.xml
Log:
Use proper version for generated .jars
Modified: trunk/sight/build.xml
===================================================================
--- trunk/sight/build.xml 2007-10-11 15:50:12 UTC (rev 1101)
+++ trunk/sight/build.xml 2007-10-12 05:11:54 UTC (rev 1102)
@@ -12,8 +12,8 @@
<!-- Initialization properties -->
<property name="name" value="System information gathering hybrid tool"/>
<property name="title" value="JBoss system information gathering hybrid tool library"/>
- <property name="version" value="1.0.0"/>
- <property name="version.number" value="100"/>
+ <property name="version" value="1.0.1"/>
+ <property name="version.number" value="101"/>
<property name="project" value="sight"/>
<property name="build.dir" value="./dist"/>
<property name="build.src" value="${build.dir}/src"/>
17 years, 2 months
JBoss Native SVN: r1101 - trunk/sight/native/os/solaris.
by jbossnative-commits@lists.jboss.org
Author: mladen.turk(a)jboss.com
Date: 2007-10-11 11:50:12 -0400 (Thu, 11 Oct 2007)
New Revision: 1101
Modified:
trunk/sight/native/os/solaris/scm.c
trunk/sight/native/os/solaris/service.c
Log:
Solaris dirent has 1 byte d_name
Modified: trunk/sight/native/os/solaris/scm.c
===================================================================
--- trunk/sight/native/os/solaris/scm.c 2007-10-11 13:52:51 UTC (rev 1100)
+++ trunk/sight/native/os/solaris/scm.c 2007-10-11 15:50:12 UTC (rev 1101)
@@ -122,8 +122,9 @@
i++;
}
if (sd) {
- struct dirent *sent, sbuf;
- while (!readdir_r(sd, &sbuf, &sent)) {
+ struct dirent *sent;
+ char sbuf[PATH_MAX + sizeof(struct dirent)];
+ while (!readdir_r(sd, (struct dirent *)sbuf, &sent)) {
char sname[PATH_MAX];
struct stat sb;
if (!sent)
Modified: trunk/sight/native/os/solaris/service.c
===================================================================
--- trunk/sight/native/os/solaris/service.c 2007-10-11 13:52:51 UTC (rev 1100)
+++ trunk/sight/native/os/solaris/service.c 2007-10-11 15:50:12 UTC (rev 1101)
@@ -167,8 +167,9 @@
sretry:
if ((rd = opendir(rlpath))) {
- struct dirent *sent, sbuf;
- while (!readdir_r(rd, &sbuf, &sent)) {
+ struct dirent *sent;
+ char sbuf[PATH_MAX + sizeof(struct dirent)];;
+ while (!readdir_r(rd, (struct dirent *)sbuf, &sent)) {
char sname[PATH_MAX];
char smatch[PATH_MAX];
struct stat sb;
17 years, 2 months