]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ctprof_srv/ctprof_srv.git/blobdiff - server/ctoolsprof_srv_main.c
Release 1.0. See the RELEASE_NOTES file for details.
[ctprof_srv/ctprof_srv.git] / server / ctoolsprof_srv_main.c
index c5c79d9d06b812e8aa1812978d4d79a2140b2dca..fd7d03e0637c04594e9084d4efbfaf9091864774 100644 (file)
@@ -293,7 +293,7 @@ int main(int argc, char *argv[])
          * client connects.
          */
         if (global_state.socket_disconnect) {
-            LOGMSG2("%s:global_state.socket_disconnect is true", __func__);
+            LOGMSG1("%s:socket disconnect detected. listening for client connection.", __func__);
             socket_connect();
         }
 
@@ -304,7 +304,7 @@ int main(int argc, char *argv[])
                              "Waiting on pipe to be open for reading.\n",
                              g_whoami);
 
-            LOGMSG2("%s:Opening pipe for writing.", __func__);
+            LOGMSG1("%s:Opening %s for writing.", __func__, fifo_filename);
 
             if ((g_fifo_fd = open(fifo_filename, O_WRONLY)) == -1) {
                 fprintf(g_stderr, "%s:Can't open %s fifo file", g_whoami,
@@ -313,28 +313,24 @@ int main(int argc, char *argv[])
             }
 
             fprintf(g_stdout,"%s:pipe open for reading\n", g_whoami);
-            LOGMSG2("%s:pipe open for reading", __func__);
+            LOGMSG1("%s:%s open for reading", __func__, fifo_filename);
         }
 
         /* If the fifo is used (set by command line -P option) but it is not
          * enabled, time to enable it and send the first message (the server's pid).
          */
-        if ((g_fifo_used == true) && (g_fifo_enabled == false)) {
-            size_t wr_bytecnt;
+        if ((g_fifo_used == true) && (g_fifo_enabled == false)) {         
             g_fifo_enabled = true;
 
             /* First message written is this task's pid */
             pid_t mypid = getpid();
-            wr_bytecnt = write(g_fifo_fd, &mypid, sizeof(pid_t));
 
-            if ((wr_bytecnt == -1) && (errno == EPIPE)) {
-                fprintf(g_stdout,"%s:warning - pipe reading end closed when sending pid.\n"                    
-                                 "%s:  This can be caused by issuing a client operation before\n"
-                                 "%s:  starting the task that opens the pipe's reading end.\n",
-                        g_whoami, g_whoami, g_whoami);
-            } 
+            char * broken_pipe_msg = "ctprof_srv's pid";
+            remote_pipe_write((char *)&mypid, sizeof(pid_t), broken_pipe_msg);
 
-            LOGMSG2("%s:write my pid %d to pipe", __func__, mypid);           
+            LOGMSG1("%s:write to the pipe %d", __func__, mypid);
+
+            LOGMSG1("%s:wrote ctprof_srv pid %d to %s", __func__, mypid, fifo_filename);           
         }
 
 #if DEBUG