* http://dce.felk.cvut.cz
* http://www.ocera.org
*
- * Author: Petr Smolik petr.smolik@wo.cz
+ * Author: Petr Smolik petr@smoliku.cz
* Advisor: Pavel Pisa
* Project Responsible: Zdenek Hanzalek
* --------------------------------------------------------------------
#include "orte_all.h"
+#ifdef HAVE_INTTYPES_H
+ #include <inttypes.h>
+ #if defined(PRIx32) && !defined(ORTE_PRI_HostId)
+ #define ORTE_PRI_HostId PRIx32
+ #define ORTE_PRI_AppId PRIx32
+ #endif
+#endif /*HAVE_INTTYPES_H*/
+
+#ifndef ORTE_PRI_HostId
+ #define ORTE_PRI_HostId x
+ #define ORTE_PRI_AppId x
+#endif
+
+#ifdef MAIN_RENAMED
+#define main ortemanager_main
+#define exit return
+#endif
+
#ifndef CONFIG_ORTE_RT
//global variables
-ORTEDomain *d;
-ORTEDomainProp dp;
-int32_t opt,domain=ORTE_DEFAULT_DOMAIN;
-Boolean orteDaemon=ORTE_FALSE;
-Boolean orteWinService=ORTE_FALSE;
-ORTEDomainAppEvents *events=NULL;
+static ORTEDomain *d;
+static ORTEDomainProp dp;
+static int32_t opt,domain=ORTE_DEFAULT_DOMAIN;
+static Boolean orteDaemon=ORTE_FALSE;
+static Boolean orteWinService=ORTE_FALSE;
+static ORTEDomainAppEvents *events=NULL;
//event system
Boolean
onMgrAppRemoteNew(const struct ORTEAppInfo *appInfo, void *param) {
- printf("%s 0x%x-0x%x was accepted\n",
+ printf("%s 0x%"ORTE_PRI_HostId"-0x%"ORTE_PRI_AppId" was accepted\n",
(appInfo->appId & 0x3)==MANAGER ? "manager" : "application",
appInfo->hostId,appInfo->appId);
return ORTE_TRUE;
void
onMgrAppDelete(const struct ORTEAppInfo *appInfo, void *param) {
- printf("%s 0x%x-0x%x was deleted\n",
+ printf("%s 0x%"ORTE_PRI_HostId"-0x%"ORTE_PRI_AppId" was deleted\n",
(appInfo->appId & 0x3)==MANAGER ? "manager" : "application",
appInfo->hostId,appInfo->appId);
}
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
//Windows service support
void serviceDispatchTable(void); //forward declaration
void removeService(void); //forward declaration
#endif
#ifdef CONFIG_ORTE_UNIX
+#ifdef HAVE_SYS_STAT_H
+ #include <sys/stat.h> /* For umask() */
+#endif
//Unix daemon support
void waitForEndingCommand(void) {
sigset_t sigset;
sigemptyset(&sigset);
sigaddset(&sigset, SIGINT);
sigaddset(&sigset, SIGTERM);
- sigwaitinfo(&sigset, NULL);
+ {
+ #ifdef HAVE_SIGWAITINFO
+ sigwaitinfo(&sigset, NULL);
+ #else /*HAVE_SIGWAITINFO*/
+ int sig;
+ sigwait(&sigset, &sig);
+ #endif /*HAVE_SIGWAITINFO*/
+ }
}
static int daemonInit(void) {
pid_t pid;
printf(" -e, --events register event system\n");
printf(" -l, --logfile <filename> set log file name\n");
printf(" -V, --version show version\n");
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
printf(" -i, --install_service install service into service manager on Windows\n");
printf(" -r, --remove_service remove service from service manager on Windows\n");
#endif
case 'D':
orteDaemon=ORTE_TRUE;
break;
- #ifdef _WIN32
+ #if defined(_WIN32) || defined(__CYGWIN__)
case 's':
serviceDispatchTable();
exit(0);