[stsf-commit] stsf/STClientLibrary/src STText.c, 1.2, 1.3 STTypeEnv.c, 1.2, 1.3 serverconnection.c, 1.1.1.1, 1.2

Alexander Gelfenbain stsf-commit at pdx.freedesktop.org
Fri Apr 23 06:56:34 EST 2004


Committed by: adg


Index: STText.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/STText.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/STText.c	9 Apr 2004 03:08:27 -0000	1.2
+++ b/STText.c	22 Apr 2004 20:56:32 -0000	1.3
@@ -391,16 +391,16 @@
         return ST_NULL_POINTER;
     }
 
-#ifdef DEBUG
+#ifdef STSF_DEBUG
 {
     int i;
     byte *ptr = iChars;
     
-    fprintf(stderr, "STTextSetText: <");
+    fprintf(DebugFile, "STTextSetText: <");
     for (i = 0; i < iCharCount*2; i += 2) {
-        fprintf(stderr, "%02X%02X ", ptr[i], ptr[i+1]);
+        fprintf(DebugFile, "%02X%02X ", ptr[i], ptr[i+1]);
     }
-    fprintf(stderr, "\n");
+    fprintf(DebugFile, "\n");
 }
 #endif
     
@@ -1104,16 +1104,16 @@
         goto done;
     }
 
-#ifdef DEBUG
+#ifdef STSF_DEBUG
     {
         int i;
         byte *ptr = iChars;
         
-        fprintf(stderr, "STTextSetText: <");
+        fprintf(DebugFile, "STTextSetText: <");
         for (i = 0; i < iCharCount*2; i += 2) {
-            fprintf(stderr, "%02X%02X ", ptr[i], ptr[i+1]);
+            fprintf(DebugFile, "%02X%02X ", ptr[i], ptr[i+1]);
         }
-        fprintf(stderr, "\n");
+        fprintf(DebugFile, "\n");
     }
 #endif
 

Index: STTypeEnv.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/STTypeEnv.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- a/STTypeEnv.c	6 Apr 2004 02:40:38 -0000	1.2
+++ b/STTypeEnv.c	22 Apr 2004 20:56:32 -0000	1.3
@@ -74,7 +74,7 @@
 static void STTypeEnvRepDispose(STTypeEnvRep *p)
 {
     if (p != NULL) {
-	if (p->langTrans) {
+        if (p->langTrans) {
             LangTransDispose(p->langTrans);
         }
         if (p->session != NULL) FSSessionClose(p->session);
@@ -115,7 +115,7 @@
 
 
     if ((res->langTrans = LangTransNew()) == NULL) {
-	ErrorStr("STSF fatal error: Internal Error %d.\n", ST_MEMORY);
+        ErrorStr("STSF fatal error: Internal Error %d.\n", ST_MEMORY);
         *errcode = ST_INTERNAL_ERROR;
         goto cleanup;
     }
@@ -164,13 +164,13 @@
     STTypeEnvRep *p = t->p;
 
 
-    printf("STTypeEnv: %X\n"
+    fprintf(DebugFile, "STTypeEnv: %X\n"
            "\tdefaultStyle: %X\n"
            "\tdefaultText: %X\n"
            "\tp: %X\n", (unsigned int) t, (unsigned int) t->defaultStyle, (unsigned int) t->defaultText, (unsigned int) t->p);
 
     if (p != NULL) {
-        printf("\t\trefCnt: %d\n"
+        fprintf(DebugFile, "\t\trefCnt: %d\n"
                "\t\tfbPolicy: %d\n"
                "\t\tSTServerSession %X\n", p->refCnt, p->fbPolicy, (unsigned int) p->session);
 
@@ -733,7 +733,7 @@
 }
 
 STStatus STTypeEnvCreateFonts(STTypeEnv iEnv,
-			      STCount iDataCount,
+                              STCount iDataCount,
                               byte **iData,
                               size_t *iDataLength,
                               STCount *oFontCount,

Index: serverconnection.c
===================================================================
RCS file: /cvs/stsf/stsf/STClientLibrary/src/serverconnection.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- a/serverconnection.c	26 Mar 2004 19:19:56 -0000	1.1.1.1
+++ b/serverconnection.c	22 Apr 2004 20:56:32 -0000	1.2
@@ -72,6 +72,8 @@
 #include <sys/utsname.h>
 #include <alloca.h>
 
+#include <signal.h>
+
 #include <rpc/rpc.h>        /* for RPC stfsloader */
 #include "stfsloader.h"
 
@@ -247,40 +249,50 @@
 
 /* There should be HLENGTH bytes allocated before the buffer 
  */
-int fsexchange(int doorfd, byte *buf, int bufsize, int sopcode, int snbytes, int *ropcode, int *rnbytes)
+int fsexchange(int doorfd, byte **buf, int bufsize, int sopcode, int snbytes, int *ropcode, int *rnbytes)
 {
     door_arg_t arg;
+    int ret;
 
     if (snbytes > bufsize) return 1;
 
-    SET_OPCODE(buf - HLENGTH, sopcode);
-    SET_PACKLEN(buf - HLENGTH, B2C32U(snbytes));
+    SET_OPCODE(*buf - HLENGTH, sopcode);
+    SET_PACKLEN(*buf - HLENGTH, B2C32U(snbytes));
 
-    arg.data_ptr = (char *) buf - HLENGTH;
+    arg.data_ptr = (char *) *buf - HLENGTH;
     arg.data_size = snbytes + HLENGTH;
     arg.desc_ptr = NULL;
     arg.desc_num = 0;
-    arg.rbuf = (char *) buf - HLENGTH;
+    arg.rbuf = (char *) (*buf) - HLENGTH;
     arg.rsize = bufsize + HLENGTH;
 
-    door_call(doorfd, &arg);
+    sighold(SIGINT); sighold(SIGPIPE); sighold(SIGALRM); sighold(SIGPOLL);
+    ret = door_call(doorfd, &arg);
+    sigrelse(SIGINT); sigrelse(SIGPIPE); sigrelse(SIGALRM); sigrelse(SIGPOLL);
+
+
+    if (ret == -1) {
+        ErrorStr("%s: door_call error.", __func__);
+        perror("door_call");
+        return 1;
+    }
 
     *rnbytes = C32U2B(GET_PACKLEN(arg.rbuf));
     *ropcode = GET_OPCODE(arg.rbuf) & OPCODEMASK;
 
-    if (arg.rbuf != (char *) buf - HLENGTH) {
+    if (arg.rbuf != (char *) (*buf) - HLENGTH) {
        DebugStr(1, "door_call allocated rbuf");
-       munmap((char *) buf - HLENGTH, bufsize + HLENGTH);
-       buf = (byte *) arg.rbuf + HLENGTH;
+       munmap((char *) (*buf) - HLENGTH, bufsize + HLENGTH);
+       *buf = (byte *) arg.rbuf + HLENGTH;
        bufsize = arg.rsize - HLENGTH;
     }
     
-    DebugStr(2, "fsexhange2: sopcode: %s, snbytes: %d, ropcode: %s, rnbytes: %d", 
-                ProtoOpcodeName(sopcode), snbytes, ProtoOpcodeName(*ropcode), *rnbytes);
+    DebugStr(2, "%s: sopcode: %s, snbytes: %d, ropcode: %s, rnbytes: %d", 
+                __func__, ProtoOpcodeName(sopcode), snbytes, ProtoOpcodeName(*ropcode), *rnbytes);
 
 #ifdef STSF_DEBUG
     if (DebugLevel > 2) {
-        HexDump(buf + HLENGTH, *rnbytes);
+        HexDump(*buf + HLENGTH, *rnbytes);
     }
 #endif
 
@@ -304,7 +316,7 @@
             ErrorStr("PACK_%s: insufficient buffer size: sn: %d, bufsize: %d.", #proto, sn, s->pbufsize); \
                 goto packerror; \
         } \
-        if ((fsexchange(s->fd, s->pbuf, s->pbufsize, STFS_ ## proto, sn, &opcode, &rn)) != 0) { \
+        if ((fsexchange(s->fd, &(s->pbuf), s->pbufsize, STFS_ ## proto, sn, &opcode, &rn)) != 0) { \
             goto protoerror; \
         } \
         if (opcode != STFS_ ## rproto) { \
@@ -321,7 +333,7 @@
     { \
         int rn; \
         int opcode; \
-        if ((fsexchange(s->fd, s->pbuf, s->pbufsize, STFS_ ## proto, 0, &opcode, &rn)) != 0) { \
+        if ((fsexchange(s->fd, &(s->pbuf), s->pbufsize, STFS_ ## proto, 0, &opcode, &rn)) != 0) { \
             goto protoerror; \
         } \
         if (opcode != STFS_ ## rproto) { \
@@ -408,7 +420,7 @@
 #ifndef SOLARIS_DOORS
     fssend(s->fd, | STFS_TERMINATE, 0, 0);
 #else
-    fsexchange(s->fd, s->pbuf, s->pbufsize, STFS_TERMINATE, 0, &opcode, &nbytes);
+    fsexchange(s->fd, &(s->pbuf), s->pbufsize, STFS_TERMINATE, 0, &opcode, &nbytes);
 #endif
 
 }
@@ -432,6 +444,7 @@
 #ifdef SOLARIS_DOORS
     char doorpath[PATH_MAX];
     door_arg_t darg;
+    int ret;
 #endif
 
     D1;
@@ -485,7 +498,13 @@
     darg.rbuf = NULL;
     darg.rsize = 0;
 
-    if (door_call(fd, &darg) == -1) {
+    sighold(SIGINT); sighold(SIGPIPE); sighold(SIGALRM); sighold(SIGPOLL);
+    ret = door_call(fd, &darg);
+    sigrelse(SIGINT); sigrelse(SIGPIPE); sigrelse(SIGALRM); sigrelse(SIGPOLL);
+
+    if (ret == -1) {
+        ErrorStr("%s: door_call() error", __func__);
+        perror("door_call");
         t = ST_PROTO_ERROR;
         goto cleanup2;
     }
@@ -576,7 +595,7 @@
     fssend(fd, STFS_VERSION, 0, 0);
     if (fsreceive(fd, &opcode, &nbytes, pbuf, pbufsize) != 0 || opcode != STFS_VERSION_R) {
 #else
-    fsexchange(fd, pbuf, pbufsize, STFS_VERSION, 0, &opcode, &nbytes);
+    fsexchange(fd, &pbuf, pbufsize, STFS_VERSION, 0, &opcode, &nbytes);
     if (opcode != STFS_VERSION_R) {
 #endif
         t = ST_PROTO_ERROR;
@@ -669,12 +688,13 @@
     conn_close(s->fd);
     free(s->pbuf);
 #else
-    fsexchange(s->fd, s->pbuf, s->pbufsize, STFS_CLOSE, 0, &opcode, &nbytes);
+    fsexchange(s->fd, &(s->pbuf), s->pbufsize, STFS_CLOSE, 0, &opcode, &nbytes);
     close(s->fd);
     munmap((char *) s->pbuf - HLENGTH, s->pbufsize + HLENGTH);
 #endif
 
     free(s->ibuf);
+    munmap(s->shmaddr, s->shmlen);
     free(s);
     s = NULL;
 
@@ -1124,7 +1144,7 @@
             ErrorStr("PACK_RENDERGLYPH: insufficient buffer size: sn: %d, bufsize: %d.", sn, s->pbufsize); 
                 goto packerror; 
         } 
-        if ((fsexchange(s->fd, s->pbuf, s->pbufsize, STFS_RENDERGLYPH, sn, &opcode, &rn)) != 0) { 
+        if ((fsexchange(s->fd, &(s->pbuf), s->pbufsize, STFS_RENDERGLYPH, sn, &opcode, &rn)) != 0) { 
             goto protoerror; 
         } 
         if (opcode != STFS_RENDERGLYPH_R) { 
@@ -1180,11 +1200,11 @@
 
 #ifdef STSF_DEBUG
               if (DebugLevel >= 3) {
-                  printf("PREFETCHGLYPHS: %d ==>", iCount);
+                  fprintf(DebugFile, "PREFETCHGLYPHS: %d ==>", iCount);
                   for (i=0; i<iCount; i++) {
-                      printf("[%d %d %d %d] ", ioGlyphs[i].scalerID, ioGlyphs[i].instanceID, ioGlyphs[i].glyphID, ioGlyphs[i].fracdelta);
+                      fprintf(DebugFile, "[%d %d %d %d] ", ioGlyphs[i].scalerID, ioGlyphs[i].instanceID, ioGlyphs[i].glyphID, ioGlyphs[i].fracdelta);
                   }
-                  printf("\n");
+                  fprintf(DebugFile, "\n");
               }
 #endif
 




More information about the stsf-commit mailing list