Ejemplo n.º 1
0
int IsWindows95(){
	CStr(uname,128);

	if( _isWindows95 == 0 ){
		_isWindows95 = -1;
		if( Uname(AVStr(uname)) == 0 )
		if( strcmp(uname,"Windows95") == 0 )
			_isWindows95 = 1;
	}
	return 0 < _isWindows95;
}
Ejemplo n.º 2
0
int IsMacOSX(){
	CStr(uname,128);

	if( _isMacOSX == 0 ){
		_isMacOSX = -1;
		if( Uname(AVStr(uname)) == 0 )
		if( strncmp(uname,"Darwin/",7) == 0 )
			_isMacOSX = 1;
	}
	return 0 < _isMacOSX;
}
Ejemplo n.º 3
0
int IsBOW1_5()
{	CStr(uname,128);

	if( _isBOW1_5 == 0 ){
		_isBOW1_5 = -1;
		if( Uname(AVStr(uname)) == 0 )
		if( strstr(uname,"BSD-BOW") )
			_isBOW1_5 = 1;
	}
	return 0 < _isBOW1_5;
}
Ejemplo n.º 4
0
int IsSolaris(){
	CStr(uname,128);

	if( _isSolaris == 0 ){
		_isSolaris = -1;
		if( getenv("ImNotSolaris") == 0 )
		if( Uname(AVStr(uname)) == 0 )
		if( strncmp(uname,"SunOS/",6) == 0 && '5' <= uname[6] )
			_isSolaris = 1;
	}
	return 0 < _isSolaris;
}
Ejemplo n.º 5
0
int BrokenSocket(FL_PAR,int fd){
	IStr(uname,128);
	IStr(msg,256);
	if( file_ISSOCK(fd) ){
		if( !IsConnected(fd,0) ){
			Uname(AVStr(uname));
			sprintf(msg,"[%s] not OOB: BrokenSocket[%d] <= %s:%d",
				uname,fd,FL_BAR);
			syslog_ERROR("%s ####\n",msg);
			if( enbugSelect ){
				fprintf(stdout,"%s ####\n",msg);
				return 0;
			}
			return 1;
		}
	}
	return 0;
}
Ejemplo n.º 6
0
void Foam::scalarTransportPOD::calcDerivativeCoeffs() const
{
    if (derivativeMatrixPtr_)
    {
        FatalErrorIn
        (
            "void scalarTransportPOD::calcDerivativeCoeffs() const"
        )   << "Derivative matrix already calculated"
            << abort(FatalError);
    }

    // Calculate coefficients for differential equation
    // Get times list
    Time& runTime = const_cast<Time&>(this->mesh().time());

    // Remember time index to restore it
    label origTimeIndex = runTime.timeIndex();

    // Read diffusivity

    IOdictionary transportProperties
    (
        IOobject
        (
            "transportProperties",
            runTime.constant(),
            this->mesh(),
            IOobject::MUST_READ,
            IOobject::NO_WRITE
        )
    );

    Info<< "Reading diffusivity D\n" << endl;

    dimensionedScalar DT
    (
        transportProperties.lookup("DT")
    );

    // Find velocity field

    word Uname(this->dict().lookup("velocity"));

    instantList Times = runTime.times();

    volVectorField* Uptr = NULL;

    forAll (Times, i)
    {
        runTime.setTime(Times[i], i);

        Info<< "Time = " << runTime.timeName() << endl;

        IOobject Uheader
        (
            Uname,
            runTime.timeName(),
            this->mesh(),
            IOobject::MUST_READ
        );

        if (Uheader.headerOk())
        {
            Info<< "    Reading " << Uname << endl;

            Uptr = new volVectorField(Uheader, this->mesh());
            break;
        }
        else
        {
            Info<< "    No " << Uname << endl;
        }
    }
Ejemplo n.º 7
0
void socat_version(FILE *fd) {
   struct utsname ubuf;

   fputs(copyright_socat, fd); fputc('\n', fd);
   fprintf(fd, "socat version %s on %s\n", socatversion, timestamp);
   Uname(&ubuf);
   fprintf(fd, "   running on %s version %s, release %s, machine %s\n",
	   ubuf.sysname, ubuf.version, ubuf.release, ubuf.machine);
   fputs("features:\n", fd);
#ifdef WITH_STDIO
   fprintf(fd, "  #define WITH_STDIO %d\n", WITH_STDIO);
#else
   fputs("  #undef WITH_STDIO\n", fd);
#endif
#ifdef WITH_FDNUM
   fprintf(fd, "  #define WITH_FDNUM %d\n", WITH_FDNUM);
#else
   fputs("  #undef WITH_FDNUM\n", fd);
#endif
#ifdef WITH_FILE
   fprintf(fd, "  #define WITH_FILE %d\n", WITH_FILE);
#else
   fputs("  #undef WITH_FILE\n", fd);
#endif
#ifdef WITH_CREAT
   fprintf(fd, "  #define WITH_CREAT %d\n", WITH_CREAT);
#else
   fputs("  #undef WITH_CREAT\n", fd);
#endif
#ifdef WITH_GOPEN
   fprintf(fd, "  #define WITH_GOPEN %d\n", WITH_GOPEN);
#else
   fputs("  #undef WITH_GOPEN\n", fd);
#endif
#ifdef WITH_TERMIOS
   fprintf(fd, "  #define WITH_TERMIOS %d\n", WITH_TERMIOS);
#else
   fputs("  #undef WITH_TERMIOS\n", fd);
#endif
#ifdef WITH_PIPE
   fprintf(fd, "  #define WITH_PIPE %d\n", WITH_PIPE);
#else
   fputs("  #undef WITH_PIPE\n", fd);
#endif
#ifdef WITH_UNIX
   fprintf(fd, "  #define WITH_UNIX %d\n", WITH_UNIX);
#else
   fputs("  #undef WITH_UNIX\n", fd);
#endif /* WITH_UNIX */
#ifdef WITH_ABSTRACT_UNIXSOCKET
   fprintf(fd, "  #define WITH_ABSTRACT_UNIXSOCKET %d\n", WITH_ABSTRACT_UNIXSOCKET);
#else
   fputs("  #undef WITH_ABSTRACT_UNIXSOCKET\n", fd);
#endif /* WITH_ABSTRACT_UNIXSOCKET */
#ifdef WITH_IP4
   fprintf(fd, "  #define WITH_IP4 %d\n", WITH_IP4);
#else
   fputs("  #undef WITH_IP4\n", fd);
#endif
#ifdef WITH_IP6
   fprintf(fd, "  #define WITH_IP6 %d\n", WITH_IP6);
#else
   fputs("  #undef WITH_IP6\n", fd);
#endif
#ifdef WITH_RAWIP
   fprintf(fd, "  #define WITH_RAWIP %d\n", WITH_RAWIP);
#else
   fputs("  #undef WITH_RAWIP\n", fd);
#endif
#ifdef WITH_GENERICSOCKET
   fprintf(fd, "  #define WITH_GENERICSOCKET %d\n", WITH_GENERICSOCKET);
#else
   fputs("  #undef WITH_GENERICSOCKET\n", fd);
#endif
#ifdef WITH_INTERFACE
   fprintf(fd, "  #define WITH_INTERFACE %d\n", WITH_INTERFACE);
#else
   fputs("  #undef WITH_INTERFACE\n", fd);
#endif
#ifdef WITH_TCP
   fprintf(fd, "  #define WITH_TCP %d\n", WITH_TCP);
#else
   fputs("  #undef WITH_TCP\n", fd);
#endif
#ifdef WITH_UDP
   fprintf(fd, "  #define WITH_UDP %d\n", WITH_UDP);
#else
   fputs("  #undef WITH_UDP\n", fd);
#endif
#ifdef WITH_SCTP
   fprintf(fd, "  #define WITH_SCTP %d\n", WITH_SCTP);
#else
   fputs("  #undef WITH_SCTP\n", fd);
#endif
#ifdef WITH_LISTEN
   fprintf(fd, "  #define WITH_LISTEN %d\n", WITH_LISTEN);
#else
   fputs("  #undef WITH_LISTEN\n", fd);
#endif
#ifdef WITH_SOCKS4
   fprintf(fd, "  #define WITH_SOCKS4 %d\n", WITH_SOCKS4);
#else
   fputs("  #undef WITH_SOCKS4\n", fd);
#endif
#ifdef WITH_SOCKS4A
   fprintf(fd, "  #define WITH_SOCKS4A %d\n", WITH_SOCKS4A);
#else
   fputs("  #undef WITH_SOCKS4A\n", fd);
#endif
#ifdef WITH_PROXY
   fprintf(fd, "  #define WITH_PROXY %d\n", WITH_PROXY);
#else
   fputs("  #undef WITH_PROXY\n", fd);
#endif
#ifdef WITH_SYSTEM
   fprintf(fd, "  #define WITH_SYSTEM %d\n", WITH_SYSTEM);
#else
   fputs("  #undef WITH_SYSTEM\n", fd);
#endif
#ifdef WITH_EXEC
   fprintf(fd, "  #define WITH_EXEC %d\n", WITH_EXEC);
#else
   fputs("  #undef WITH_EXEC\n", fd);
#endif
#ifdef WITH_READLINE
   fprintf(fd, "  #define WITH_READLINE %d\n", WITH_READLINE);
#else
   fputs("  #undef WITH_READLINE\n", fd);
#endif
#ifdef WITH_TUN
   fprintf(fd, "  #define WITH_TUN %d\n", WITH_TUN);
#else
   fputs("  #undef WITH_TUN\n", fd);
#endif
#ifdef WITH_PTY
   fprintf(fd, "  #define WITH_PTY %d\n", WITH_PTY);
#else
   fputs("  #undef WITH_PTY\n", fd);
#endif
#ifdef WITH_OPENSSL
   fprintf(fd, "  #define WITH_OPENSSL %d\n", WITH_OPENSSL);
#else
   fputs("  #undef WITH_OPENSSL\n", fd);
#endif
#ifdef WITH_FIPS
   fprintf(fd, "  #define WITH_FIPS %d\n", WITH_FIPS);
#else
   fputs("  #undef WITH_FIPS\n", fd);
#endif
#ifdef WITH_LIBWRAP
   fprintf(fd, "  #define WITH_LIBWRAP %d\n", WITH_LIBWRAP);
#else
   fputs("  #undef WITH_LIBWRAP\n", fd);
#endif
#ifdef WITH_SYCLS
   fprintf(fd, "  #define WITH_SYCLS %d\n", WITH_SYCLS);
#else
   fputs("  #undef WITH_SYCLS\n", fd);
#endif
#ifdef WITH_FILAN
   fprintf(fd, "  #define WITH_FILAN %d\n", WITH_FILAN);
#else
   fputs("  #undef WITH_FILAN\n", fd);
#endif
#ifdef WITH_RETRY
   fprintf(fd, "  #define WITH_RETRY %d\n", WITH_RETRY);
#else
   fputs("  #undef WITH_RETRY\n", fd);
#endif
#ifdef WITH_MSGLEVEL
   fprintf(fd, "  #define WITH_MSGLEVEL %d /*%s*/\n", WITH_MSGLEVEL,
	   &"debug\0\0\0info\0\0\0\0notice\0\0warn\0\0\0\0error\0\0\0fatal\0\0\0"[WITH_MSGLEVEL<<3]);
#else
   fputs("  #undef WITH_MSGLEVEL\n", fd);
#endif
}
Ejemplo n.º 8
0
void notify_ADMINX(Connection *xConn,PCStr(admin),PCStr(what),PCStr(body))
{   FILE *tmp;
    FILE *bt;
    Connection ConnBuff,*Conn = &ConnBuff;
    CStr(head,1024);
    CStr(me,128);
    CStr(date,128);
    CStr(load,128);
    CStr(cwd,1024);
    CStr(uname,128);
    int now;
    const char *bugbox = "*****@*****.**";
    CStr(msgid,1024);
    CStr(buf,1024);

    if( strncasecmp(what,"sig",3) != 0 )
        if( strncasecmp(what,"failed",6) != 0 )
            if( strncasecmp(what,"modified",8) != 0 )
                if( strncasecmp(what,"approved",8) != 0 )
                    if( strncasecmp(what,"detected",8) != 0 )
                        if( strncasecmp(what,"[",1) != 0 ) /* abort in child process */
                            return;

    if( admin == NULL || *admin == 0 )
        admin = getADMIN1();

    now = time(NULL);
    if( xConn )
        *Conn = *xConn;
    else	bzero(Conn,sizeof(Connection));
    tmp = TMPFILE("NOTIFY");

    head[0] = 0;
    if( gethostname(me,sizeof(me)) != 0 )
        strcpy(me,"?");
    sprintf(msgid,"%d.%d.%d@%s",getpid(),itime(0),getuid(),me);

    StrftimeLocal(AVStr(date),sizeof(date),TIMEFORM_RFC822,now,0);
    Xsprintf(TVStr(head),"Subject: DeleGate-Report: %s\r\n",what);
    Xsprintf(TVStr(head),"From: [%d]@%s\r\n",getuid(),me);
    Xsprintf(TVStr(head),"To: %s (DeleGate ADMIN)\r\n",admin);
    Xsprintf(TVStr(head),"Reply-To: %s\r\n",bugbox);
    Xsprintf(TVStr(head),"Date: %s\r\n",date);
    Xsprintf(TVStr(head),"Message-Id: <%s>\r\n",msgid);
    Xsprintf(TVStr(head),"Content-Type: text/plain\r\n");
    fprintf(tmp,"%s\r\n",head);
    fprintf(tmp,"PLEASE FORWARD THIS MESSAGE TO <%s>.\r\n",bugbox);
    fprintf(tmp,"IT WILL BE HELPFUL FOR DEBUGGING.\r\n");
    fprintf(tmp,"\r\n");
    fprintf(tmp,"%s",head);
    fprintf(tmp,"Event: %s\r\n",what);
    Uname(AVStr(uname));
    fprintf(tmp,"Version: %s (%s)\r\n",DELEGATE_verdate(),uname);
    fprintf(tmp,"Host: %s\r\n",me);
    fprintf(tmp,"Owner: uid=%d/%d, gid=%d/%d\r\n",
            geteuid(),getuid(),getegid(),getgid());
    StrftimeLocal(AVStr(date),sizeof(date),TIMEFORM_RFC822,START_TIME,0);
    fprintf(tmp,"Started: %s\r\n",date);
    fprintf(tmp,"Pid: %d\r\n",getpid());
    cwd[0] = 0;
    IGNRETS getcwd(cwd,sizeof(cwd));
    fprintf(tmp,"Cwd: %s\r\n",cwd);
    strfLoadStat(AVStr(load),sizeof(load),"%L (%l)",now);
    fprintf(tmp,"Load: %s\r\n",load);
    fprintf(tmp,"Stack: %X %d/%d\r\n",p2i(STACK_PEAK),ll2i(STACK_BASE-STACK_PEAK),
            STACK_SIZE);
    fprintf(tmp,"\r\n");

    if( iamServer() ) {
    } else {
        fprintf(tmp,"Client-Proto: %s\r\n",CLNT_PROTO);
        fprintf(tmp,"Client-Host: %s:%d\r\n",Client_Addr(buf),Client_Port);
        if( TeleportHost[0] )
            fprintf(tmp,"Rident-Host: %s:%d..%s:%d\r\n",TelesockHost,TelesockPort,
                    TeleportAddr,TeleportPort);
        fprintf(tmp,"\r\n");
    }
    fprintf(tmp,"%s\r\n",body);

    /*
    	if( strncasecmp(what,"sig",3) == 0 || *what == '[' ){
    */
    if( strncasecmp(what,"sig",3) == 0
            || strncasecmp(what,"failed",6) == 0
            || *what == '[' ) {
        fprintf(tmp,"--iLog--begin\r\n");
        iLOGdump1(tmp,0);
        fprintf(tmp,"--iLog--end\r\n");

        fprintf(tmp,"\r\n");
        fprintf(tmp,"--AbortLog--begin\r\n");
        putAbortLog(tmp);
        fprintf(tmp,"--AbortLog--end\r\n");
    }

    if( strncasecmp(what,"sig",3) == 0 ) {
        int btout[2];
        double Start = Time();
        int rcc;

        fprintf(tmp,"\r\n");
        fprintf(tmp,"--BackTrace--begin\r\n");
        fflush(tmp);

        if( pipe(btout) == 0 ) {
            setNonblockingIO(btout[1],1);
            bt = fdopen(btout[1],"w");
            putBackTrace(bt);
            fclose(bt);
            bt = fdopen(btout[0],"r");
            rcc = file_copyTimeout(bt,tmp,NULL,128*1024,NULL,15);
            fclose(bt);
            sv1log("BatckTrace: %dB / %.1fs\n",rcc,Time()-Start);
        } else {
            bt = TMPFILE("BackTrace");
            putBackTrace(bt);
            fseek(bt,0,0);
            copyfile1(bt,tmp);
            fclose(bt);
        }
        fprintf(tmp,"\r\n");
        fprintf(tmp,"--BackTrace--end\r\n");
    }

    fflush(tmp);
    fseek(tmp,0,0);
    if( curLogFp() ) {
        CStr(line,1024);
        while( fgets(line,sizeof(line),tmp) != NULL )
            fprintf(curLogFp(),"--ABORT-- %s",line);
        fseek(tmp,0,0);
    }
    Conn->co_mask = (CONN_NOPROXY | CONN_NOMASTER);
    sendmail1(Conn,admin,admin,tmp,NULL);
    fclose(tmp);
}