[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 01/30: exec: fix setting the name of early servers
From: |
Samuel Thibault |
Subject: |
[hurd] 01/30: exec: fix setting the name of early servers |
Date: |
Tue, 22 Sep 2015 21:51:57 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 827915ca4a4d61ae5b50596e46f5aaf7d402a2c0
Author: Justus Winter <address@hidden>
Date: Sun Jul 12 14:46:50 2015 +0200
exec: fix setting the name of early servers
Previously, the exec server did not set the name of the servers
started before the proc server. Instead this was done by the startup
server, but this was merely a workaround, missing notably the startup
server itself.
* exec/exec.c (set_name): New function.
(do_exec): Move the code setting the name to a new function, and also
call it if the proc server is not started yet.
* startup/startup.c (run): Drop hack.
---
exec/exec.c | 50 +++++++++++++++++++++++++++++++++-----------------
startup/startup.c | 1 -
2 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/exec/exec.c b/exec/exec.c
index ee500d7..3b63b7f 100644
--- a/exec/exec.c
+++ b/exec/exec.c
@@ -686,6 +686,36 @@ finish (struct execdata *e, int dealloc_file)
}
}
+/* Set the name of the new task so that the kernel can use it in error
+ messages. If PID is not zero, it will be included the name. */
+static void
+set_name (task_t task, const char *exec_name, pid_t pid)
+{
+ char *name;
+ int size;
+
+ if (pid)
+ size = asprintf (&name, "%s(%d)", exec_name, pid);
+ else
+ size = asprintf (&name, "%s", exec_name);
+
+ if (size == 0)
+ return;
+
+ /* This is an internal implementational detail of the GNU Mach kernel. */
+#define TASK_NAME_SIZE 32
+ if (size < TASK_NAME_SIZE)
+ task_set_name (task, name);
+ else
+ {
+ char *abbr = name + size - TASK_NAME_SIZE + 1;
+ abbr[0] = abbr[1] = abbr[2] = '.';
+ task_set_name (task, abbr);
+ }
+#undef TASK_NAME_SIZE
+
+ free (name);
+}
/* Load the file. */
static void
@@ -1173,24 +1203,10 @@ do_exec (file_t file,
if (e.error)
goto out;
- char *name;
- int size = asprintf (&name, "%s(%d)", argv, pid);
- if (size > 0)
- {
-/* This is an internal implementational detail of the gnumach kernel. */
-#define TASK_NAME_SIZE 32
- if (size < TASK_NAME_SIZE)
- task_set_name (newtask, name);
- else
- {
- char *abbr = name + size - TASK_NAME_SIZE + 1;
- abbr[0] = abbr[1] = abbr[2] = '.';
- task_set_name (newtask, abbr);
- }
-#undef TASK_NAME_SIZE
- free (name);
- }
+ set_name (newtask, argv, pid);
}
+ else
+ set_name (newtask, argv, 0);
/* Create the initial thread. */
e.error = thread_create (newtask, &thread);
diff --git a/startup/startup.c b/startup/startup.c
index da78b13..e916768 100644
--- a/startup/startup.c
+++ b/startup/startup.c
@@ -377,7 +377,6 @@ run (const char *server, mach_port_t *ports, task_t *task)
printf ("Pausing for %s\n", prog);
getchar ();
}
- task_set_name (*task, (char *) prog);
err = file_exec (file, *task, 0,
(char *)prog, strlen (prog) + 1, /* Args. */
startup_envz, startup_envz_len,
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 13/30: Fix build against glibc 2.21, (continued)
- [hurd] 13/30: Fix build against glibc 2.21, Samuel Thibault, 2015/09/22
- [hurd] 18/30: umount: Do not report errors on making the device go away, Samuel Thibault, 2015/09/22
- [hurd] 20/30: libshouldbeinlibc/maptime: use memory fences, Samuel Thibault, 2015/09/22
- [hurd] 21/30: Do not install libtrivfs mig stub headers, Samuel Thibault, 2015/09/22
- [hurd] 22/30: Install port-deref-deferred.h header for ports.h, Samuel Thibault, 2015/09/22
- [hurd] 19/30: pflocal: avoid nested function, Samuel Thibault, 2015/09/22
- [hurd] 24/30: Fix closure of local server sockets, Samuel Thibault, 2015/09/22
- [hurd] 23/30: Fix sock_bind(sock,NULL) support, Samuel Thibault, 2015/09/22
- [hurd] 29/30: Define TIME_VALUE_TO_TIMESPEC only when not defined already, Samuel Thibault, 2015/09/22
- [hurd] 25/30: Fix detection of terminated dgram pflocal server, Samuel Thibault, 2015/09/22
- [hurd] 01/30: exec: fix setting the name of early servers,
Samuel Thibault <=
- [hurd] 12/30: libdiskfs: rename `error' variable, Samuel Thibault, 2015/09/22
- [hurd] 26/30: Add support for ANSI.SYS SCP/RCP escape codes, Samuel Thibault, 2015/09/22
- [hurd] 27/30: Fix build warning, Samuel Thibault, 2015/09/22
- [hurd] 14/30: Fix race condition in ext2fs when remounting, Samuel Thibault, 2015/09/22
- [hurd] 30/30: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2015/09/22
- [hurd] 28/30: Turn EADDRNOTAVAIL to more commonly-understood ECONNREFUSED, Samuel Thibault, 2015/09/22