gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r32450 - msh/src


From: gnunet
Subject: [GNUnet-SVN] r32450 - msh/src
Date: Fri, 21 Feb 2014 16:04:38 +0100

Author: harsha
Date: 2014-02-21 16:04:38 +0100 (Fri, 21 Feb 2014)
New Revision: 32450

Removed:
   msh/src/setproctitle.c
   msh/src/setproctitle.h
Modified:
   msh/src/Makefile.am
   msh/src/mshd.c
Log:
Revert 32445 as relocating argv is causing nuisance with MPI_init().


Modified: msh/src/Makefile.am
===================================================================
--- msh/src/Makefile.am 2014-02-21 14:40:35 UTC (rev 32449)
+++ msh/src/Makefile.am 2014-02-21 15:04:38 UTC (rev 32450)
@@ -5,8 +5,7 @@
 mshd_SOURCES = mshd.c mshd.h util.c util.h mtypes.h \
   common.h bitmap.c bitmap.h addressmap.c addressmap.h reduce.h reduce.c \
   server.c pmonitor.c pmonitor.h \
-  ttymodes.h ttymodes.c \
-  setproctitle.h setproctitle.c
+  ttymodes.h ttymodes.c
 mshd_LDADD = -lgnunetutil -lm
 
 msh_SOURCES = msh.c mtypes.h ttymodes.c ttymodes.h

Modified: msh/src/mshd.c
===================================================================
--- msh/src/mshd.c      2014-02-21 14:40:35 UTC (rev 32449)
+++ msh/src/mshd.c      2014-02-21 15:04:38 UTC (rev 32450)
@@ -14,7 +14,6 @@
 #include "reduce.h"
 #include "pmonitor.h"
 #include "server.h"
-#include "setproctitle.h"
 
 #define LOG(kind,...)                           \
   GNUNET_log (kind, __VA_ARGS__)
@@ -553,7 +552,6 @@
   GNUNET_assert (0 == sigprocmask (SIG_SETMASK, &sigset, NULL));
   client_conn = GNUNET_CONNECTION_create_from_existing (sock);
   sock = NULL;
-  setproctitle ("mshd: worker");
   GNUNET_log_setup ("mshd-worker", NULL, NULL);
   /* cleanup child processes as we are now not their parent */
   while (NULL != (chld = chld_head))
@@ -806,7 +804,6 @@
                                         GNUNET_OS_INHERIT_STD_ALL,
                                         NULL,
                                         NULL,
-                                        NULL,
                                         run_args[0],
                                         run_args);
     if (NULL == proc)
@@ -896,7 +893,7 @@
   }
   if (0 == pid)
   {
-    setproctitle ("mshd: local-serv");
+    
     GNUNET_break (0 == sigemptyset (&sigset));
     GNUNET_assert (0 == sigprocmask (SIG_SETMASK, &sigset, NULL));
     GNUNET_DISK_file_close (write_end);
@@ -1499,7 +1496,6 @@
     LOG_ERROR ("Cannot determine our MPI rank\n");
     goto fail;
   }
-  compat_init_setproctitle (argc, argv);
   if (GNUNET_OK != GNUNET_PROGRAM_run (argc, argv, "mshd", "mshd: MSH daemon",
                                        options, &run, NULL))
   {

Deleted: msh/src/setproctitle.c
===================================================================
--- msh/src/setproctitle.c      2014-02-21 14:40:35 UTC (rev 32449)
+++ msh/src/setproctitle.c      2014-02-21 15:04:38 UTC (rev 32450)
@@ -1,117 +0,0 @@
-/**
- * @file setproctitle.c
- * @brief BSD style setproctitle implementation
- * @author Sree Harsha Totakura <address@hidden> 
- */
-
-/* This file is adapted from openssh bsd-compat sources
- * Copyright 2003 Damien Miller
- * Copyright (c) 1983, 1995-1997 Eric P. Allman
- * Copyright (c) 1988, 1993
- *     The Regents of the University of California.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "common.h"
-
-static char *argv_start = NULL;
-static size_t argv_env_len = 0;
-
-/**
- * Initialize the setproctitle buffers.
- *
- * @param argc the argc given to main()
- * @param argv the argv given to main()
- */
-void
-compat_init_setproctitle (int argc, char *argv[])
-{
-  extern char **environ;
-  char *lastargv = NULL;
-  char **envp = environ;
-  int i;
-
-  /*
-   * NB: This assumes that argv has already been copied out of the
-   * way. This is true for sshd, but may not be true for other 
-   * programs. Beware.
-   */
-
-  if (argc == 0 || argv[0] == NULL)
-    return;
-
-  /* Fail if we can't allocate room for the new environment */
-  for (i = 0; envp[i] != NULL; i++)
-    ;
-  if ((environ = calloc(i + 1, sizeof(*environ))) == NULL) {
-    environ = envp;    /* put it back */
-    return;
-  }
-
-  /*
-   * Find the last argv string or environment variable within 
-   * our process memory area.
-   */
-  for (i = 0; i < argc; i++) {
-    if (lastargv == NULL || lastargv + 1 == argv[i])
-      lastargv = argv[i] + strlen(argv[i]);
-  }
-  for (i = 0; envp[i] != NULL; i++) {
-    if (lastargv + 1 == envp[i])
-      lastargv = envp[i] + strlen(envp[i]);
-  }
-
-  argv[1] = NULL;
-  argv_start = argv[0];
-  argv_env_len = lastargv - argv[0] - 1;
-
-  /* 
-   * Copy environment 
-   * XXX - will truncate env on strdup fail
-   */
-  for (i = 0; envp[i] != NULL; i++)
-    environ[i] = strdup(envp[i]);
-  environ[i] = NULL;
-}
-
-
-/**
- * Set the process's title
- *
- * @param ptitle the new title for the process
- */
-void
-setproctitle(const char *ptitle)
-{
-  size_t len;
-
-  if (argv_env_len <= 0)
-    return;
-  len = snprintf(argv_start, argv_env_len, "%s", ptitle);
-  for(; len < argv_env_len - 1 ; len++)
-    argv_start[len] = '\0';
-  argv_start[len] = '\0';
-}

Deleted: msh/src/setproctitle.h
===================================================================
--- msh/src/setproctitle.h      2014-02-21 14:40:35 UTC (rev 32449)
+++ msh/src/setproctitle.h      2014-02-21 15:04:38 UTC (rev 32450)
@@ -1,28 +0,0 @@
-/**
- * @file setproctitle.h
- * @brief BSD style setproctitle implementation
- * @author Sree Harsha Totakura <address@hidden> 
- */
-
-#ifndef SETPROCTITLE_H_
-#define SETPROCTITLE_H_
-
-/**
- * Initialize the setproctitle buffers.
- *
- * @param argc the argc given to main()
- * @param argv the argv given to main()
- */
-void
-compat_init_setproctitle (int argc, char *argv[]);
-
-
-/**
- * Set the process's title to the given string
- *
- * @param ptitle the new title for the process
- */
-void
-setproctitle(const char *ptitle);
-
-#endif  /* SETPROCTITLE_H_ */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]