[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdelibs/kinit
From:       Dirk Mueller <mueller () kde ! org>
Date:       2004-11-13 0:01:45
Message-ID: 20041113000145.30CD216CD1 () office ! kde ! org
[Download RAW message or body]

CVS commit by mueller: 

implement suggestion by Waldo: add [kdeinit] behind the process name
if the kernel supports it


  M +13 -7     kinit.cpp   1.145
  M +0 -4      setproctitle.cpp   1.12


--- kdelibs/kinit/kinit.cpp  #1.144:1.145
@@ -507,4 +507,5 @@ static pid_t launch(int argc, const char
 #endif
      {
+       int r;
        QCString procTitle( name );
        d.argv = (char **) malloc(sizeof(char *) * (argc+1));
@@ -521,8 +522,13 @@ static pid_t launch(int argc, const char
 
        /** Give the process a new name **/
-       kdeinit_setproctitle( "%s", procTitle.data() );
 #ifdef Q_OS_LINUX
        /* set the process name, so that killall works like intended */
-       prctl(PR_SET_NAME, (unsigned long) name.data(), 0, 0, 0);
+       r = prctl(PR_SET_NAME, (unsigned long) name.data(), 0, 0, 0);
+       if ( r == 0 )
+           kdeinit_setproctitle( "%s [kdeinit] %s", name.data(), procTitle.data() );
+       else
+           kdeinit_setproctitle( "kdeinit: %s", procTitle.data() );
+#else
+       kdeinit_setproctitle( "kdeinit: %s", procTitle.data() );
 #endif
      }
@@ -1689,5 +1695,5 @@ int main(int argc, char **argv, char **e
    /** Prepare to change process name **/
    kdeinit_initsetproctitle(argc, argv, envp);
-   kdeinit_setproctitle("Starting up...");
+   kdeinit_setproctitle("kdeinit Starting up...");
    kdeinit_library_path();
    // don't change envvars before kdeinit_initsetproctitle()
@@ -1823,5 +1829,5 @@ int main(int argc, char **argv, char **e
    free (safe_argv);
 
-   kdeinit_setproctitle("Running...");
+   kdeinit_setproctitle("kdeinit Running...");
 
    if (!keep_running)

--- kdelibs/kinit/setproctitle.cpp  #1.11:1.12
@@ -205,8 +205,4 @@ setproctitle(const char *fmt, ...)
         p = buf;
 
-        /* print kdeinit: heading for grep */
-        (void) strcpy(p, "kdeinit: ");
-        p += strlen(p);
-
         /* print the argument string */
         va_start(ap, fmt);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic