Changeset 6623 for nanoscale


Ignore:
Timestamp:
Nov 14, 2016 1:17:38 PM (8 years ago)
Author:
ldelgass
Message:

Merge selected nanoscale changes from trunk (by hand)

Location:
nanoscale/branches/1.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nanoscale/branches/1.0/Makefile.in

    r6622 r6623  
     1WANT_TRACE      = #yes
    12
    23CC              = @CC@
     
    3334SVN_VERSION     = $(shell svnversion $(srcdir) | sed 's/Unversioned directory/unknown/')
    3435
    35 DEFINES         = -DSERVERSFILE=\"$(libdir)/renderservers.tcl\" \
     36ifdef WANT_TRACE
     37DEFINES         = -DWANT_TRACE
     38endif
     39CONFIGFILE      = renderservers.tcl
     40DEFINES         += -DSERVERSFILE=\"$(libdir)/$(CONFIGFILE)\" \
    3641                -DSVN_VERSION=\"$(SVN_VERSION)\" \
    3742                -DLOGDIR=\"$(LOGDIR)\"
     
    4954        $(CC) $(CC_SWITCHES) -o $@ $^ $(LIBS)
    5055
    51 install: nanoscale renderservers.tcl start_nanoscale.sh
     56install: nanoscale $(CONFIGFILE) start_nanoscale.sh
    5257        $(INSTALL_PROGRAM) -D nanoscale $(bindir)/nanoscale
    5358        $(INSTALL_PROGRAM) start_nanoscale.sh $(bindir)/start_nanoscale.sh
    54         $(INSTALL_SCRIPT) renderservers.tcl $(libdir)
     59        $(INSTALL_DATA) $(CONFIGFILE) $(libdir)
    5560
    5661client: $(CLIENT_OBJS)
     
    6469distclean: clean
    6570        $(RM) -r autom4te.cache
    66         $(RM) Makefile config.cache config.log config.status config.h renderservers.tcl start_nanoscale.sh
     71        $(RM) Makefile config.cache config.log config.status config.h $(CONFIGFILE) start_nanoscale.sh
    6772
  • nanoscale/branches/1.0/server.c

    r6622 r6623  
    11/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
    22/* ======================================================================
    3  *  Copyright (c) 2004-2014  HUBzero Foundation, LLC
     3 *  Copyright (c) 2004-2016  HUBzero Foundation, LLC
    44 * ----------------------------------------------------------------------
    55 *  See the file "license.terms" for information on usage and
     
    4040
    4141#define ERROR(...)      SysLog(LOG_ERR, __FILE__, __LINE__, __VA_ARGS__)
    42 #define TRACE(...)      SysLog(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
    4342#define WARN(...)       SysLog(LOG_WARNING, __FILE__, __LINE__, __VA_ARGS__)
    4443#define INFO(...)       SysLog(LOG_INFO, __FILE__, __LINE__, __VA_ARGS__)
     44#ifdef WANT_TRACE
     45#define TRACE(...)      SysLog(LOG_DEBUG, __FILE__, __LINE__, __VA_ARGS__)
     46#else
     47#define TRACE(...)
     48#endif
    4549
    4650static const char *syslogLevels[] = {
     
    9094
    9195static void
     96Help(const char *program)
     97{
     98    fprintf(stderr,
     99        "Syntax: %s [-d] [-f serversFile] [-x numVideoCards]\n", program);
     100    exit(1);
     101}
     102
     103static void
     104InitLog()
     105{
     106    openlog("nanoscale", LOG_CONS | LOG_PID, LOG_USER);
     107}
     108
     109static void
    92110SysLog(int priority, const char *path, int lineNum, const char* fmt, ...)
    93111{
     
    105123        s++;
    106124    }
    107     length = snprintf(message, MSG_LEN, "nanoscale (%d %d) %s: %s:%d ",
    108         serverPid, getpid(), syslogLevels[priority],  s, lineNum);
     125    if (serverPid != getpid()) {
     126        length = snprintf(message, MSG_LEN, "(%d) %s: %s:%d ",
     127                          serverPid, syslogLevels[priority], s, lineNum);
     128    } else {
     129        length = snprintf(message, MSG_LEN, "%s: %s:%d ",
     130                          syslogLevels[priority], s, lineNum);
     131    }
    109132    length += vsnprintf(message + length, MSG_LEN - length, fmt, lst);
    110133    message[MSG_LEN] = '\0';
     
    114137        syslog(priority, message, length);
    115138    }
    116 }
    117 
    118 static void
    119 Help(const char *program)
    120 {
    121     fprintf(stderr,
    122         "Syntax: %s [-d] [-f serversFile] [-x numVideoCards]\n", program);
    123     exit(1);
    124139}
    125140
     
    360375    Tcl_DeleteInterp(interp);
    361376    return TRUE;
     377}
     378
     379static void
     380InitServerTable()
     381{
     382    Tcl_InitHashTable(&serverTable, TCL_ONE_WORD_KEYS);
    362383}
    363384
     
    388409
    389410    strcpy(display, ":0.0");
    390     Tcl_InitHashTable(&serverTable, TCL_ONE_WORD_KEYS);
     411    InitLog();
     412    InitServerTable();
    391413
    392414    /* Process command line switches. */
     
    438460    serverPid = getpid();
    439461    if (!ParseServersFile(fileName)) {
     462        ERROR("Exiting on invalid configuration");
    440463        exit(1);
    441464    }
     
    645668                /* Set the configured environment */
    646669                for (i = 0; i < serverPtr->numEnvArgs; i += 2) {
     670                    INFO("Env: %s=%s", serverPtr->envArgs[i],
     671                         serverPtr->envArgs[i+1]);
    647672                    setenv(serverPtr->envArgs[i], serverPtr->envArgs[i+1], 1);
    648673                }
    649                 { 
     674                {
    650675                    char *cmd;
    651676
     
    655680                         serverPtr->name, inet_ntoa(newaddr.sin_addr),
    656681                         cmd, serverPtr->inputFd, serverPtr->outputFd, display);
     682                    Tcl_Free(cmd);
    657683                    /* Replace the current process with the render server. */
    658684                    execvp(serverPtr->cmdArgs[0], serverPtr->cmdArgs);
    659                     ERROR("Can't execute \"%s\": %s", cmd, strerror(errno));
    660                     Tcl_Free(cmd);
     685                    ERROR("Can't execute \"%s\": %s", serverPtr->cmdArgs[0],
     686                          strerror(errno));
    661687                    exit(1);
    662688                }
Note: See TracChangeset for help on using the changeset viewer.