Changeset 1970 for trunk/packages/vizservers/pymolproxy
- Timestamp:
- Dec 1, 2010, 3:51:19 PM (14 years ago)
- Location:
- trunk/packages/vizservers/pymolproxy
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/pymolproxy/Makefile.in
r1944 r1970 30 30 OBJS = pymolproxy.o 31 31 LIBS = $(TCL_LIB_SPEC) 32 32 33 SCRIPTS = $(srcdir)/scripts/box.py 33 34 … … 50 51 $(MKDIR_P) -m 0755 $(libdir)/pymol/rappture 51 52 for i in $(SCRIPTS) ; do \ 52 $(INSTALL) -m 555 $$i $(libdir)/pymol/rappture; \53 $(INSTALL) -m 0555 $$i $(libdir)/pymol/rappture; \ 53 54 done 54 55 -
trunk/packages/vizservers/pymolproxy/pymolproxy.c
r1830 r1970 96 96 97 97 static FILE *flog; 98 static int debug = FALSE;98 static int debug = TRUE; 99 99 static FILE *scriptFile; 100 100 static int savescript = FALSE; … … 149 149 * are in the front of the list. */ 150 150 151 int s erverInput, serverOutput, serverError;/* Server file descriptors. */152 int c lientInput, clientOutput;/* Client file descriptors. */151 int sin, sout, serr; /* Server file descriptors. */ 152 int cin, cout; /* Client file descriptors. */ 153 153 ReadBuffer client; /* Read buffer for client input. */ 154 154 ReadBuffer server; /* Read buffer for server output. */ … … 651 651 /* Write the command out to the server. */ 652 652 length = strlen(buffer); 653 nWritten = write(proxyPtr->s erverInput, buffer, length);653 nWritten = write(proxyPtr->sin, buffer, length); 654 654 if (nWritten != length) { 655 655 trace("short write to pymol (wrote=%d, should have been %d)", … … 1837 1837 1838 1838 static int 1839 ProxyInit(int c _in, int c_out, char *const *argv)1839 ProxyInit(int cin, int cout, char *const *argv) 1840 1840 { 1841 1841 int status, result = 0; 1842 int s erverIn[2];1843 int s erverOut[2];1844 int ser verErr[2];1842 int sin[2]; 1843 int sout[2]; 1844 int serr[2]; 1845 1845 Tcl_Interp *interp; 1846 1846 int child; … … 1851 1851 * each for the applications's: stdin, stdout, and stderr */ 1852 1852 1853 if (pipe(s erverIn) == -1)1853 if (pipe(sin) == -1) 1854 1854 return -1; 1855 1855 1856 if (pipe(s erverOut) == -1) {1857 close(s erverIn[0]);1858 close(s erverIn[1]);1856 if (pipe(sout) == -1) { 1857 close(sin[0]); 1858 close(sin[1]); 1859 1859 return -1; 1860 1860 } 1861 1861 1862 if (pipe(ser verErr) == -1) {1863 close(s erverIn[0]);1864 close(s erverIn[1]);1865 close(s erverOut[0]);1866 close(s erverOut[1]);1862 if (pipe(serr) == -1) { 1863 close(sin[0]); 1864 close(sin[1]); 1865 close(sout[0]); 1866 close(sout[1]); 1867 1867 return -1; 1868 1868 } … … 1889 1889 /* Redirect stdin, stdout, and stderr to pipes before execing */ 1890 1890 1891 dup2(s erverIn[0], 0); // stdin1892 dup2(s erverOut[1],1); // stdout1893 dup2(ser verErr[1],2); // stderr1891 dup2(sin[0], 0); // stdin 1892 dup2(sout[1],1); // stdout 1893 dup2(serr[1],2); // stderr 1894 1894 1895 1895 /* Close all other descriptors */ … … 1905 1905 1906 1906 /* close opposite end of pipe, these now belong to the child process */ 1907 close(s erverIn[0]);1908 close(s erverOut[1]);1909 close(ser verErr[1]);1907 close(sin[0]); 1908 close(sout[1]); 1909 close(serr[1]); 1910 1910 1911 1911 signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE (e.g. nanoscale terminates)*/ 1912 1912 1913 1913 memset(&proxy, 0, sizeof(PymolProxy)); 1914 proxy.s erverInput = serverIn[1];1915 proxy.s erverOutput = serverOut[0];1916 proxy.ser verError = serverErr[0];1917 proxy.c lientInput = c_in;1918 proxy.c lientOutput = 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; 1919 1919 proxy.flags = CAN_UPDATE; 1920 1920 proxy.frame = 1; … … 1958 1958 PollForEvents(&proxy); 1959 1959 1960 close(proxy.c lientOutput);1961 close(proxy.s erverOutput);1962 close(proxy.ser verError);1963 close(proxy.c lientInput);1964 close(proxy.s erverInput);1960 close(proxy.cout); 1961 close(proxy.sout); 1962 close(proxy.serr); 1963 close(proxy.cin); 1964 close(proxy.sin); 1965 1965 1966 1966 status = waitpid(child, &result, WNOHANG); … … 2025 2025 int flags; 2026 2026 2027 flags = fcntl(proxyPtr->c lientInput, F_GETFL);2028 fcntl(proxyPtr->c lientInput, F_SETFL, flags|O_NONBLOCK);2029 2030 pollResults[0].fd = proxyPtr->c lientOutput;2031 pollResults[1].fd = proxyPtr->s erverOutput;2032 pollResults[2].fd = proxyPtr->ser verError;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; 2033 2033 pollResults[0].events = pollResults[1].events = 2034 2034 pollResults[2].events = POLLIN; 2035 2035 2036 pollResults[3].fd = proxyPtr->c lientInput;2036 pollResults[3].fd = proxyPtr->cin; 2037 2037 pollResults[3].events = POLLOUT; 2038 2038 2039 InitBuffer(&proxyPtr->client, proxyPtr->c lientOutput);2040 InitBuffer(&proxyPtr->server, proxyPtr->s erverOutput);2039 InitBuffer(&proxyPtr->client, proxyPtr->cout); 2040 InitBuffer(&proxyPtr->server, proxyPtr->sout); 2041 2041 2042 2042 Tcl_DStringInit(&clientCmds); … … 2180 2180 return; 2181 2181 } 2182
Note: See TracChangeset
for help on using the changeset viewer.