- Refactored site specific stuff into a site module - PSI specific stuff is now in the PSI directory. - The old version has been tagged with pre-ansto SKIPPED: psi/A1931.c psi/A1931.h psi/amor2t.c psi/amor2t.h psi/amor2t.i psi/amor2t.tex psi/amor2t.w psi/amorscan.c psi/amorscan.h psi/amorscan.w psi/amorstat.c psi/amorstat.h psi/amorstat.i psi/amorstat.tex psi/amorstat.w psi/bruker.c psi/bruker.h psi/bruker.w psi/buffer.c psi/buffer.h psi/dilludriv.c psi/dilludriv.h psi/dmc.c psi/dmc.h psi/dmc.w psi/docho.c psi/ecb.c psi/ecb.h psi/ecb.i psi/ecb.w psi/ecbdriv.c psi/ecbdriv.h psi/el734dc.c psi/el734driv.c psi/el755driv.c psi/el755driv.h psi/faverage.c psi/faverage.h psi/faverage.tex psi/faverage.w psi/fowrite.c psi/fowrite.h psi/itc4.c psi/itc4.h psi/itc4.w psi/itc4driv.c psi/ltc11.c psi/ltc11.h psi/nextrics.c psi/nextrics.h psi/nxamor.c psi/nxamor.h psi/nxamor.tex psi/nxamor.w psi/pimotor.c psi/pimotor.h psi/pimotor.tex psi/pimotor.w psi/pipiezo.c psi/polterwrite.c psi/polterwrite.h psi/psi.c psi/ruli.c psi/ruli.h psi/sanscook.c psi/sanswave.c psi/sanswave.h psi/sanswave.tex psi/sanswave.w psi/serial.c psi/serial.h psi/serial.w psi/sinqhmdriv.c psi/sinqhmdriv.i psi/sinqhmdriv.w psi/slsmagnet.c psi/sps.c psi/sps.h psi/sps.i psi/sps.tex psi/sps.w psi/swmotor.c psi/swmotor.h psi/swmotor.i psi/tas.c psi/tas.h psi/tas.tex psi/tas.w psi/tasdrive.c psi/tasinit.c psi/tasscan.c psi/tasu.h psi/tasutil.c psi/tdchm.c psi/tdchm.h psi/tecsdriv.c psi/tecsdriv.h psi/velodorn.c psi/velodorn.h psi/velodorn.w psi/velodornier.c psi/hardsup/README psi/hardsup/StrMatch.c psi/hardsup/asynsrv_def.h psi/hardsup/asynsrv_errcodes.h psi/hardsup/asynsrv_mark.c psi/hardsup/asynsrv_utility.c psi/hardsup/c_interfaces.c psi/hardsup/dillutil.c psi/hardsup/dillutil.h psi/hardsup/el734_def.h psi/hardsup/el734_errcodes.h psi/hardsup/el734_utility.c psi/hardsup/el734fix.h psi/hardsup/el734tcl.c psi/hardsup/el737_def.h psi/hardsup/el737_errcodes.h psi/hardsup/el737_utility.c psi/hardsup/el737fix.h psi/hardsup/el737tcl.c psi/hardsup/el755_def.h psi/hardsup/el755_errcodes.h psi/hardsup/el755_errorlog.c psi/hardsup/el755_utility.c psi/hardsup/err.c psi/hardsup/failinet.c psi/hardsup/geterrno.c psi/hardsup/itc4util.c psi/hardsup/itc4util.h psi/hardsup/make_gen psi/hardsup/makefile_alpha psi/hardsup/makefile_linux psi/hardsup/makeprint.c psi/hardsup/rs232c_def.h psi/hardsup/serialsinq.c psi/hardsup/serialsinq.h psi/hardsup/sinq_defs.h psi/hardsup/sinq_prototypes.h psi/hardsup/sinqhm.c psi/hardsup/sinqhm.h psi/hardsup/sinqhm_def.h psi/hardsup/stredit.c psi/hardsup/strjoin.c psi/hardsup/table.c psi/hardsup/table.h psi/hardsup/velsel_def.h psi/hardsup/velsel_utility.c psi/motor/Makefile psi/motor/el734_test psi/motor/el734_test.c psi/motor/makeprint.c psi/sinqhm/FOCUS_gbl.h psi/sinqhm/FOCUS_srv_main.c psi/sinqhm/Makefile psi/sinqhm/SinqHM_bootParamsConfig.c psi/sinqhm/SinqHM_bootUtil.c psi/sinqhm/SinqHM_def.h psi/sinqhm/SinqHM_gbl.h psi/sinqhm/SinqHM_srv_filler.c psi/sinqhm/SinqHM_srv_main.c psi/sinqhm/SinqHM_srv_routines.c psi/sinqhm/SinqHM_srv_server.c psi/sinqhm/bld psi/sinqhm/bld2 psi/sinqhm/bldmen psi/sinqhm/hist_mem_notes.tex psi/sinqhm/hist_mem_spec.tex psi/sinqhm/hist_mem_spec_fig1.ps psi/sinqhm/hist_mem_spec_fig2.ps psi/sinqhm/hist_mem_spec_fig3.ps psi/sinqhm/hist_mem_spec_fig4.ps psi/sinqhm/lwl_client.c psi/sinqhm/lwl_server.c psi/sinqhm/make_sinqhm.com psi/sinqhm/monitor.c psi/sinqhm/psi_logo.ps psi/sinqhm/sinq_logo.ps psi/sinqhm/sinqhm_bootutil_client.c psi/sinqhm/sinqhm_client.c psi/sinqhm/sinqhm_ctrl.c psi/sinqhm/usrConfig.c psi/sinqhm/usrConfig.c_diffs psi/sinqhm/usrConfig2604.c psi/sinqhm/vmio10_def.h psi/sinqhm/vmio_utility.c psi/tecs/coc_client.c psi/tecs/coc_client.h psi/tecs/coc_logfile.c psi/tecs/coc_logfile.h psi/tecs/coc_server.c psi/tecs/coc_server.h psi/tecs/coc_util.c psi/tecs/coc_util.h psi/tecs/fortify1.c psi/tecs/instr_hosts.c psi/tecs/instr_hosts.h psi/tecs/keep_running.c psi/tecs/make_gen psi/tecs/make_opt psi/tecs/make_opt_alpha psi/tecs/make_opt_llc psi/tecs/makefile psi/tecs/makefile_alpha psi/tecs/makefile_linux psi/tecs/myc_buf.c psi/tecs/myc_buf.h psi/tecs/myc_err.c psi/tecs/myc_err.h psi/tecs/myc_fortran.h psi/tecs/myc_mem.h psi/tecs/myc_str.c psi/tecs/myc_str.h psi/tecs/myc_time.c psi/tecs/myc_time.h psi/tecs/myc_tmp.c psi/tecs/myc_tmp.h psi/tecs/rstart.c psi/tecs/six.c psi/tecs/str.f psi/tecs/sys_cmdpar.f psi/tecs/sys_date.f psi/tecs/sys_env.c psi/tecs/sys_get_key.f psi/tecs/sys_getenv.f psi/tecs/sys_lun.f psi/tecs/sys_open.f psi/tecs/sys_open_alpha.f psi/tecs/sys_rdline.c psi/tecs/sys_select.c psi/tecs/sys_select.h psi/tecs/sys_unix.c psi/tecs/sys_wait.f psi/tecs/tecs.bld psi/tecs/tecs.c psi/tecs/tecs.tcl psi/tecs/tecs_c.c psi/tecs/tecs_c.h psi/tecs/tecs_cli.c psi/tecs/tecs_cli.h psi/tecs/tecs_client.f psi/tecs/tecs_data.c psi/tecs/tecs_data.h psi/tecs/tecs_dlog.inc psi/tecs/tecs_for.f psi/tecs/tecs_lsc.c psi/tecs/tecs_lsc.h psi/tecs/tecs_plot.f psi/tecs/tecs_serial.c psi/tecs/tecs_serial.h psi/tecs/term.c psi/tecs/term.h psi/utils/Makefile psi/utils/SerPortServer.c psi/utils/asynsrv_test.c psi/utils/ecb-load.c psi/utils/el734.c psi/utils/el734_test.c psi/utils/el737.c psi/utils/make.ecb psi/utils/check/amorcheck psi/utils/check/dmccheck psi/utils/check/focuscheck psi/utils/check/focusstatus.tcl psi/utils/check/hrptcheck psi/utils/check/sanscheck psi/utils/check/sicssyntax.tex psi/utils/check/sicssyntaxlib.tcl psi/utils/check/test.tcl psi/utils/check/topsicheck psi/utils/check/tricscheck psi/utils/check/tst
524 lines
13 KiB
C
524 lines
13 KiB
C
/*--------------------------------------------------------------------------
|
|
|
|
THE SICS SERVER
|
|
|
|
|
|
|
|
Mark Koennecke, October 1996
|
|
Revised for use with tasker: Mark Koennecke, September 1997
|
|
|
|
Added code to redirect stdout/sterr to file.
|
|
|
|
Mark Koennecke, May 2000
|
|
|
|
Copyright: see copyright.h
|
|
----------------------------------------------------------------------------*/
|
|
#define NEEDDINTINIT
|
|
#include "fortify.h"
|
|
#include <stdlib.h>
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
#include <time.h>
|
|
#include "sics.h"
|
|
#include "network.h"
|
|
#include "ifile.h"
|
|
#include "status.h"
|
|
#include "devexec.h"
|
|
#include "passwd.h"
|
|
#include "lld.h"
|
|
#include "macro.h"
|
|
#include "perfmon.h"
|
|
#include "nread.h"
|
|
#include "ofac.h"
|
|
#include "telnet.h"
|
|
#include "site.h"
|
|
#include "nserver.h"
|
|
|
|
int ServerSetupInterrupt(int iPort, pNetRead pNet, pTaskMan pTasker);
|
|
/*
|
|
configures a port for listening for interrupts
|
|
*/
|
|
|
|
extern void StopExit(void); /* in SICSmain.c */
|
|
/* ========================= Less dreadful file statics =================== */
|
|
|
|
#define DEFAULTINIFILE "servo.tcl"
|
|
#define DEFAULTSTATUSFILE "sicsstat.tcl"
|
|
|
|
static int iFortifyScope;
|
|
|
|
#include "obdes.h"
|
|
#include "interface.h"
|
|
#include "sicsvar.h"
|
|
#include "emon.h"
|
|
/*----------------------------------------------------------------------*/
|
|
pEnvMon GetEnvMon(SicsInterp *pSics)
|
|
{
|
|
CommandList *pCom;
|
|
|
|
assert(pSics);
|
|
|
|
pCom = FindCommand(pSics,"emon");
|
|
assert(pCom);
|
|
assert(pCom->pData);
|
|
return (pEnvMon)pCom->pData;
|
|
}
|
|
/*-------------------------------------------------------------------------*/
|
|
int InitServer(char *file, pServer *pServ)
|
|
{
|
|
char *pText = NULL;
|
|
int iPort, iRet;
|
|
FILE *fp;
|
|
pSicsVariable pVar;
|
|
char pBueffel[512];
|
|
SConnection *pCon = NULL;
|
|
pServer self = NULL;
|
|
char *pPtr;
|
|
int iCommandTimeOut, iPasswordTimeOut, i;
|
|
pNetRead pReader = NULL;
|
|
pPerfMon pMon = NULL;
|
|
CommandList *pCom;
|
|
pid_t myPid;
|
|
|
|
/* allocate a new server structure */
|
|
self = (pServer)malloc(sizeof(SicsServer));
|
|
if(!self)
|
|
{
|
|
puts("DEADLY ERROR: Cannot allocate server data structure!");
|
|
return 0;
|
|
}
|
|
memset(self,0,sizeof(SicsServer));
|
|
*pServ = self;
|
|
|
|
|
|
/* configure fortify */
|
|
iFortifyScope = Fortify_EnterScope();
|
|
Fortify_CheckAllMemory();
|
|
|
|
/* interpreter */
|
|
self->pSics = InitInterp();
|
|
assert(self->pSics);
|
|
|
|
/* initialise tasker */
|
|
assert(TaskerInit(&self->pTasker));
|
|
|
|
/* initialise the server from script */
|
|
if(file == NULL)
|
|
{
|
|
iRet = InitObjectCommands(self,DEFAULTINIFILE);
|
|
}
|
|
else
|
|
{
|
|
iRet = InitObjectCommands(self,file);
|
|
}
|
|
if(!iRet)
|
|
{
|
|
if(file)
|
|
{
|
|
printf("Error on initialization file --> %s <-- \n",file);
|
|
}
|
|
else
|
|
{
|
|
printf("Error on initialization file --> %s <-- \n",DEFAULTINIFILE);
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
check for option RedirectFile and redirect stout/sterr to it
|
|
if present.
|
|
*/
|
|
pPtr = NULL;
|
|
pPtr = IFindOption(pSICSOptions,"RedirectFile");
|
|
if(pPtr != NULL)
|
|
{
|
|
myPid = getpid();
|
|
sprintf(pBueffel,"%s%5.5d.log",pPtr,(int)myPid);
|
|
fp = freopen(pBueffel,"w",stdout);
|
|
if(!fp)
|
|
{
|
|
printf("Failed to redirect stdout/stderr to %s\n",pBueffel);
|
|
}
|
|
fp = freopen(pBueffel,"w",stderr);
|
|
if(!fp)
|
|
{
|
|
printf("Failed to redirect stdout/stderr to %s\n",pBueffel);
|
|
}
|
|
}
|
|
|
|
|
|
/* initialise net reader */
|
|
pPtr = NULL;
|
|
pPtr = IFindOption(pSICSOptions,"ReadTimeOut");
|
|
if(pPtr != NULL)
|
|
{
|
|
i = atoi(pPtr);
|
|
iCommandTimeOut = i;
|
|
}
|
|
pPtr = NULL;
|
|
pPtr = IFindOption(pSICSOptions,"ReadUserPasswdTimeout");
|
|
if(pPtr != NULL)
|
|
{
|
|
i = atoi(pPtr);
|
|
iPasswordTimeOut = i;
|
|
}
|
|
assert((pReader = CreateNetReader(self,iPasswordTimeOut,iCommandTimeOut)) != NULL);
|
|
TaskRegister(self->pTasker,
|
|
NetReaderTask,
|
|
NetReaderSignal,
|
|
DeleteNetReader,
|
|
pReader,1);
|
|
self->pReader = pReader;
|
|
|
|
/* the socket */
|
|
pText = IFindOption(pSICSOptions,"ServerPort");
|
|
if(!pText)
|
|
{
|
|
printf("Cannot find ServerPort number in options file %s\n",
|
|
"This value is required!");
|
|
IFDeleteOptions(pSICSOptions);
|
|
DeleteInterp(self->pSics);
|
|
return 0;
|
|
}
|
|
iRet = sscanf(pText,"%d",&iPort);
|
|
if( (iRet != 1) || (iPort < 1024) )
|
|
{
|
|
printf("Invalid port number specified in Server initialisation file\n");
|
|
IFDeleteOptions(pSICSOptions);
|
|
DeleteInterp(self->pSics);
|
|
return 0;
|
|
}
|
|
self->pServerPort = NETOpenPort(iPort);
|
|
if(!self->pServerPort)
|
|
{
|
|
printf("Cannot open Server Socket\n");
|
|
IFDeleteOptions(pSICSOptions);
|
|
DeleteInterp(self->pSics);
|
|
return 0;
|
|
}
|
|
NetReadRegister(pReader, self->pServerPort, naccept, NULL);
|
|
|
|
/* the device executor */
|
|
pCom = FindCommand(self->pSics,"stopexe");
|
|
assert(pCom);
|
|
assert(pCom->pData);
|
|
self->pExecutor = (pExeList)pCom->pData;
|
|
|
|
|
|
/* initialize Interrupt Port */
|
|
pText = IFindOption(pSICSOptions,"InterruptPort");
|
|
if(!pText)
|
|
{
|
|
printf("Cannot find InterruptPort number in options file %s\n",
|
|
"This value is required!");
|
|
IFDeleteOptions(pSICSOptions);
|
|
DeleteInterp(self->pSics);
|
|
return 0;
|
|
}
|
|
iRet = sscanf(pText,"%d",&iPort);
|
|
if( (iRet != 1) || (iPort < 1024) )
|
|
{
|
|
printf("Invalid port number specified in Server initialisation file\n");
|
|
IFDeleteOptions(pSICSOptions);
|
|
DeleteInterp(self->pSics);
|
|
return 0;
|
|
}
|
|
iRet = ServerSetupInterrupt(iPort,pReader,self->pTasker);
|
|
if(!iRet)
|
|
{
|
|
SCWrite(pCon,"WARNING: UDP interrupt port not initialized",eWarning);
|
|
}
|
|
/* install a secret fully priviledged entry point for ME */
|
|
AddUser("Achterbahn","Kiel",usInternal);
|
|
|
|
/* install environment monitor */
|
|
self->pMonitor = GetEnvMon(self->pSics);
|
|
TaskRegister(self->pTasker,
|
|
EnvMonTask,
|
|
EnvMonSignal,
|
|
NULL,
|
|
self->pMonitor,1);
|
|
|
|
|
|
/* initialize the last saved status of the system */
|
|
strcpy(pBueffel,"Restore ");
|
|
pText = IFindOption(pSICSOptions,"statusfile");
|
|
if(pText)
|
|
{
|
|
strcat(pBueffel,pText);
|
|
}
|
|
else
|
|
{
|
|
strcat(pBueffel,DEFAULTSTATUSFILE);
|
|
IFAddOption(pSICSOptions,"statusfile",
|
|
DEFAULTSTATUSFILE);
|
|
}
|
|
self->dummyCon = pCon = SCCreateDummyConnection(self->pSics);
|
|
if(pCon)
|
|
{
|
|
InterpExecute(self->pSics,pCon,pBueffel);
|
|
}
|
|
else
|
|
{
|
|
printf("ERROR: Cannot allocate dummy connection, status NOT loaded");
|
|
}
|
|
|
|
/* install performance monitor */
|
|
pMon = CreatePerfMon(20);
|
|
AddCommand(self->pSics,"Performance",PerfMonWrapper,DeletePerfMon,pMon);
|
|
TaskRegister(self->pTasker,
|
|
PerfMonTask,
|
|
PerfMonSignal,
|
|
NULL,
|
|
pMon,1);
|
|
|
|
|
|
/* install telnet port */
|
|
InstallTelnet();
|
|
|
|
/* exit handlers need to be installed here */
|
|
atexit(StopExit);
|
|
Fortify_CheckAllMemory();
|
|
return 1;
|
|
|
|
}
|
|
/*---------------------------------------------------------------------------*/
|
|
void StopServer(pServer self)
|
|
{
|
|
SConnection *pCurrent, *pTemp;
|
|
char pBueffel[512];
|
|
char *pText = NULL;
|
|
SConnection *pCon = NULL;
|
|
pSite site = NULL;
|
|
|
|
/* clear all pending bullshit */
|
|
ClearExecutor(self->pExecutor);
|
|
|
|
/* shut telnet down */
|
|
KillTelnet();
|
|
|
|
/* shut tasker down */
|
|
TaskerDelete(&self->pTasker);
|
|
|
|
/* save status */
|
|
if(!self->simMode)
|
|
{
|
|
strcpy(pBueffel,"Backup ");
|
|
pText = IFindOption(pSICSOptions,"statusfile");
|
|
if(pText)
|
|
{
|
|
strcat(pBueffel,pText);
|
|
}
|
|
else
|
|
{
|
|
strcat(pBueffel,DEFAULTSTATUSFILE);
|
|
}
|
|
if(self->dummyCon)
|
|
{
|
|
InterpExecute(self->pSics,self->dummyCon,pBueffel);
|
|
SCDeleteConnection(self->dummyCon);
|
|
}
|
|
else
|
|
{
|
|
printf("ERROR: Cannot allocate dummy connection, status NOT saved");
|
|
}
|
|
}
|
|
|
|
/* close redirection file if present */
|
|
pText = NULL;
|
|
pText = IFindOption(pSICSOptions,"RedirectFile");
|
|
if(pText)
|
|
{
|
|
fclose(stderr);
|
|
}
|
|
|
|
/* clean out */
|
|
if(pSICSOptions)
|
|
IFDeleteOptions(pSICSOptions);
|
|
if(self->pSics)
|
|
DeleteInterp(self->pSics);
|
|
|
|
/* close the server port */
|
|
if(self->pServerPort)
|
|
{
|
|
NETClosePort(self->pServerPort);
|
|
free(self->pServerPort);
|
|
}
|
|
|
|
|
|
/* remove the in memory password database */
|
|
KillPasswd();
|
|
|
|
|
|
/* close Interrupt system */
|
|
ServerStopInterrupt();
|
|
|
|
/* Remove Status Callback */
|
|
KillStatus(NULL);
|
|
|
|
/* close the List system */
|
|
LLDsystemClose();
|
|
|
|
/*
|
|
kill the site data structure
|
|
*/
|
|
site = getSite();
|
|
if(site != NULL)
|
|
{
|
|
site->KillSite(site);
|
|
}
|
|
|
|
/* make fortify print his findings */
|
|
Fortify_DumpAllMemory(iFortifyScope);
|
|
Fortify_LeaveScope();
|
|
|
|
free(self);
|
|
}
|
|
/*------------------------------------------------------------------------*/
|
|
void RunServer(pServer self)
|
|
{
|
|
TaskSchedule(self->pTasker);
|
|
}
|
|
/*------------------------------------------------------------------------*/
|
|
typedef struct {
|
|
time_t tFinish;
|
|
int iEnd;
|
|
} WaitStruct, *pWaitStruct;
|
|
/*-------------------------------------------------------------------------*/
|
|
static int WaitTask(void *pData)
|
|
{
|
|
time_t tNow;
|
|
pWaitStruct self = NULL;
|
|
|
|
self = (pWaitStruct)pData;
|
|
if(self->iEnd)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
tNow = time(NULL);
|
|
if(tNow >= self->tFinish)
|
|
{
|
|
return 0; /* done */
|
|
}
|
|
else
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
/*-----------------------------------------------------------------------*/
|
|
static void WaitSignal(void *pUser, int iSignal, void *pEventData)
|
|
{
|
|
pWaitStruct self = NULL;
|
|
int *iInt;
|
|
|
|
self = (pWaitStruct)pUser;
|
|
assert(self);
|
|
iInt = (int *)pEventData;
|
|
|
|
if(iSignal == SICSINT)
|
|
{
|
|
iInt = (int *)pEventData;
|
|
if(*iInt > eContinue)
|
|
{
|
|
self->iEnd = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
/*--------------------------------------------------------------------------
|
|
UserWait: the user command for waiting, expects one arg:
|
|
time to wait in seconds
|
|
*/
|
|
int UserWait(SConnection *pCon, SicsInterp *pSics, void *pData,
|
|
int argc, char *argv[])
|
|
{
|
|
int i;
|
|
char pBueffel[80];
|
|
float fVal;
|
|
Status eOld;
|
|
time_t tNow;
|
|
WaitStruct sWait;
|
|
pTaskMan pTask;
|
|
long lID;
|
|
|
|
assert(pCon);
|
|
assert(pSics);
|
|
assert(pData);
|
|
|
|
pTask = GetTasker();
|
|
|
|
if(argc < 2)
|
|
{
|
|
sprintf(pBueffel,"Insufficient number of args to %s",argv[0]);
|
|
SCWrite(pCon,pBueffel,eError);
|
|
return 0;
|
|
}
|
|
|
|
/* try convert to a number */
|
|
i = sscanf(argv[1],"%f",&fVal);
|
|
if(i < 1)
|
|
{
|
|
sprintf(pBueffel,"Expected numeric argument to %s, got %s",
|
|
argv[0], argv[1]);
|
|
SCWrite(pCon,pBueffel,eInError);
|
|
return 0;
|
|
}
|
|
|
|
if(pServ->simMode)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
eOld = GetStatus();
|
|
SetStatus(eUserWait);
|
|
tNow = time(NULL);
|
|
sWait.tFinish = tNow + (time_t)fVal;
|
|
sWait.iEnd = 0;
|
|
lID = TaskRegister(pTask,WaitTask,WaitSignal,NULL,&sWait,1);
|
|
TaskWait(pTask,lID);
|
|
SetStatus(eOld);
|
|
if(SCGetInterrupt(pCon) != eContinue)
|
|
{
|
|
return 0;
|
|
}
|
|
else
|
|
{
|
|
return 1;
|
|
}
|
|
}
|
|
/*------------------------------------------------------------------------*/
|
|
int SicsWait(long lTime)
|
|
{
|
|
WaitStruct sWait;
|
|
pTaskMan pTasker = NULL;
|
|
time_t tNow;
|
|
long lID;
|
|
|
|
if(pServ->simMode)
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
pTasker = GetTasker();
|
|
tNow = time(NULL);
|
|
sWait.tFinish = tNow + lTime;
|
|
sWait.iEnd = 0;
|
|
lID = TaskRegister(pTasker,WaitTask,WaitSignal,NULL,&sWait,1);
|
|
TaskWait(pTasker,lID);
|
|
return 1;
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
void ServerWriteGlobal(char *pMessage,int iOut)
|
|
{
|
|
pTaskMan pTasker = NULL;
|
|
|
|
pTasker = GetTasker();
|
|
|
|
TaskSignal(pTasker,SICSBROADCAST,pMessage);
|
|
}
|
|
|