Changeset 1970


Ignore:
Timestamp:
Dec 1, 2010, 3:51:19 PM (14 years ago)
Author:
gah
Message:
 
Location:
trunk/packages/vizservers/pymolproxy
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/pymolproxy/Makefile.in

    r1944 r1970  
    3030OBJS            = pymolproxy.o
    3131LIBS            = $(TCL_LIB_SPEC)
     32
    3233SCRIPTS         = $(srcdir)/scripts/box.py
    3334
     
    5051        $(MKDIR_P) -m 0755 $(libdir)/pymol/rappture
    5152        for i in $(SCRIPTS) ; do \
    52             $(INSTALL) -m 555 $$i $(libdir)/pymol/rappture; \
     53            $(INSTALL) -m 0555 $$i $(libdir)/pymol/rappture; \
    5354        done
    5455
  • trunk/packages/vizservers/pymolproxy/pymolproxy.c

    r1830 r1970  
    9696
    9797static FILE *flog;
    98 static int debug = FALSE;
     98static int debug = TRUE;
    9999static FILE *scriptFile;
    100100static int savescript = FALSE;
     
    149149                                         * are in the front of the list. */
    150150
    151     int serverInput, serverOutput, serverError;  /* Server file descriptors. */
    152     int clientInput, clientOutput;      /* Client file descriptors. */
     151    int sin, sout, serr;                /* Server file descriptors. */
     152    int cin, cout;                      /* Client file descriptors. */
    153153    ReadBuffer client;                  /* Read buffer for client input. */
    154154    ReadBuffer server;                  /* Read buffer for server output. */
     
    651651    /* Write the command out to the server. */
    652652    length = strlen(buffer);
    653     nWritten = write(proxyPtr->serverInput, buffer, length);
     653    nWritten = write(proxyPtr->sin, buffer, length);
    654654    if (nWritten != length) {
    655655        trace("short write to pymol (wrote=%d, should have been %d)",
     
    18371837       
    18381838static int
    1839 ProxyInit(int c_in, int c_out, char *const *argv)
     1839ProxyInit(int cin, int cout, char *const *argv)
    18401840{
    18411841    int status, result = 0;
    1842     int serverIn[2];
    1843     int serverOut[2];
    1844     int serverErr[2];
     1842    int sin[2];
     1843    int sout[2];
     1844    int serr[2];
    18451845    Tcl_Interp *interp;
    18461846    int child;
     
    18511851     * each for the applications's: stdin, stdout, and stderr  */
    18521852
    1853     if (pipe(serverIn) == -1)
     1853    if (pipe(sin) == -1)
    18541854        return -1;
    18551855
    1856     if (pipe(serverOut) == -1) {
    1857         close(serverIn[0]);
    1858         close(serverIn[1]);
     1856    if (pipe(sout) == -1) {
     1857        close(sin[0]);
     1858        close(sin[1]);
    18591859        return -1;
    18601860    }
    18611861
    1862     if (pipe(serverErr) == -1) {
    1863         close(serverIn[0]);
    1864         close(serverIn[1]);
    1865         close(serverOut[0]);
    1866         close(serverOut[1]);
     1862    if (pipe(serr) == -1) {
     1863        close(sin[0]);
     1864        close(sin[1]);
     1865        close(sout[0]);
     1866        close(sout[1]);
    18671867        return -1;
    18681868    }
     
    18891889        /* Redirect stdin, stdout, and stderr to pipes before execing */
    18901890
    1891         dup2(serverIn[0], 0);  // stdin
    1892         dup2(serverOut[1],1);  // stdout
    1893         dup2(serverErr[1],2);  // stderr
     1891        dup2(sin[0], 0);  // stdin
     1892        dup2(sout[1],1);  // stdout
     1893        dup2(serr[1],2);  // stderr
    18941894       
    18951895        /* Close all other descriptors  */       
     
    19051905
    19061906    /* close opposite end of pipe, these now belong to the child process  */
    1907     close(serverIn[0]);
    1908     close(serverOut[1]);
    1909     close(serverErr[1]);
     1907    close(sin[0]);
     1908    close(sout[1]);
     1909    close(serr[1]);
    19101910
    19111911    signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE (e.g. nanoscale terminates)*/
    19121912
    19131913    memset(&proxy, 0, sizeof(PymolProxy));
    1914     proxy.serverInput  = serverIn[1];
    1915     proxy.serverOutput = serverOut[0];
    1916     proxy.serverError = serverErr[0];
    1917     proxy.clientInput  = c_in;
    1918     proxy.clientOutput = c_out;
     1914    proxy.sin  = sin[1];
     1915    proxy.sout = sout[0];
     1916    proxy.serr = serr[0];
     1917    proxy.cin  = cin;
     1918    proxy.cout = cout;
    19191919    proxy.flags = CAN_UPDATE;
    19201920    proxy.frame = 1;
     
    19581958    PollForEvents(&proxy);
    19591959
    1960     close(proxy.clientOutput);
    1961     close(proxy.serverOutput);
    1962     close(proxy.serverError);
    1963     close(proxy.clientInput);
    1964     close(proxy.serverInput);
     1960    close(proxy.cout);
     1961    close(proxy.sout);
     1962    close(proxy.serr);
     1963    close(proxy.cin);
     1964    close(proxy.sin);
    19651965
    19661966    status = waitpid(child, &result, WNOHANG);
     
    20252025    int flags;
    20262026
    2027     flags = fcntl(proxyPtr->clientInput, F_GETFL);
    2028     fcntl(proxyPtr->clientInput, F_SETFL, flags|O_NONBLOCK);
    2029 
    2030     pollResults[0].fd = proxyPtr->clientOutput;
    2031     pollResults[1].fd = proxyPtr->serverOutput;
    2032     pollResults[2].fd = proxyPtr->serverError;
     2027    flags = fcntl(proxyPtr->cin, F_GETFL);
     2028    fcntl(proxyPtr->cin, F_SETFL, flags|O_NONBLOCK);
     2029
     2030    pollResults[0].fd = proxyPtr->cout;
     2031    pollResults[1].fd = proxyPtr->sout;
     2032    pollResults[2].fd = proxyPtr->serr;
    20332033    pollResults[0].events = pollResults[1].events =
    20342034        pollResults[2].events = POLLIN;
    20352035
    2036     pollResults[3].fd = proxyPtr->clientInput;
     2036    pollResults[3].fd = proxyPtr->cin;
    20372037    pollResults[3].events = POLLOUT;
    20382038
    2039     InitBuffer(&proxyPtr->client, proxyPtr->clientOutput);
    2040     InitBuffer(&proxyPtr->server, proxyPtr->serverOutput);
     2039    InitBuffer(&proxyPtr->client, proxyPtr->cout);
     2040    InitBuffer(&proxyPtr->server, proxyPtr->sout);
    20412041
    20422042    Tcl_DStringInit(&clientCmds);
     
    21802180    return;
    21812181}
     2182
Note: See TracChangeset for help on using the changeset viewer.