00001 #define DAEMON_IP_PORT 12396
00002
00003
00004
00005
00006 #define DAEMON_MAXPATHLEN 512
00007 #define DAEMON_MAXENV 256
00008 typedef struct {
00009 char pgm[DAEMON_MAXPATHLEN];
00010 char cwd[DAEMON_MAXPATHLEN];
00011
00012 char env[DAEMON_MAXENV];
00013
00014 #define DAEMON_MAGIC 0x7AF2893C
00015 ChMessageInt_t magic;
00016
00017 ChMessageInt_t argLength;
00018 } taskStruct;
00019
00020
00021
00022
00023
00024
00025 #ifndef _WIN32
00026
00027 #define ERROR_FILE_NOT_FOUND EACCES
00028 #define ERROR_NOT_ENOUGH_MEMORY ENOMEM
00029 #define ERROR_OUTOFMEMORY E2BIG
00030 #define ERROR_ACCESS_DENIED -1000
00031 #define ERROR_SHARING_VIOLATION -1000
00032 #define ERROR_BAD_EXE_FORMAT ENOEXEC
00033 #endif
00034 const static struct {
00035 int errorCode;
00036 char statusCode;
00037 const char *reason;
00038 } daemon_errtab[]= {
00039 {ERROR_FILE_NOT_FOUND,'F',"executable not found."},
00040 {-1,'D',"directory not found."},
00041 {ERROR_NOT_ENOUGH_MEMORY,'M',"not enough memory."},
00042 {ERROR_OUTOFMEMORY,'M',"not enough memory."},
00043 {ERROR_ACCESS_DENIED,'A',"access denied."},
00044 {ERROR_SHARING_VIOLATION,'S',"sharing violation."},
00045 {ERROR_BAD_EXE_FORMAT,'E',"not an executable."},
00046 {-1,'N',"could not contact daemon-- is it running?"},
00047 {0,0,NULL}
00048 };
00049
00050
00051 char daemon_err2status(int err)
00052 {
00053 int i;
00054 for (i=0;daemon_errtab[i].reason;i++)
00055 if (daemon_errtab[i].errorCode==err)
00056 return daemon_errtab[i].statusCode;
00057 return 'U';
00058 }
00059
00060
00061 const char *daemon_status2msg(char statusCode)
00062 {
00063 int i;
00064 for (i=0;daemon_errtab[i].reason;i++)
00065 if (daemon_errtab[i].statusCode==statusCode)
00066 return daemon_errtab[i].reason;
00067 return "unknown error.";
00068 }
00069
00070
00071
00072
00073