Source-Changes-HG archive

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

[src/trunk]: src/lib/librumpuser include pid of rump server in hostname



details:   https://anonhg.NetBSD.org/src/rev/9bb82109e6e4
branches:  trunk
changeset: 761201:9bb82109e6e4
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Jan 20 15:00:12 2011 +0000

description:
include pid of rump server in hostname

diffstat:

 lib/librumpuser/rumpuser.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (37 lines):

diff -r 51fb2bf5fa58 -r 9bb82109e6e4 lib/librumpuser/rumpuser.c
--- a/lib/librumpuser/rumpuser.c        Thu Jan 20 14:54:24 2011 +0000
+++ b/lib/librumpuser/rumpuser.c        Thu Jan 20 15:00:12 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.c,v 1.12 2011/01/05 09:43:00 pooka Exp $      */
+/*     $NetBSD: rumpuser.c,v 1.13 2011/01/20 15:00:12 pooka Exp $      */
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser.c,v 1.12 2011/01/05 09:43:00 pooka Exp $");
+__RCSID("$NetBSD: rumpuser.c,v 1.13 2011/01/20 15:00:12 pooka Exp $");
 #endif /* !lint */
 
 /* thank the maker for this */
@@ -491,8 +491,17 @@
 int
 rumpuser_gethostname(char *name, size_t namelen, int *error)
 {
+       char tmp[MAXHOSTNAMELEN];
 
-       DOCALL(int, (gethostname(name, namelen)));
+       if (gethostname(tmp, sizeof(tmp)) == -1) {
+               snprintf(name, namelen, "rump-%05d.rumpdomain", getpid());
+       } else {
+               snprintf(name, namelen, "rump-%05d.%s.rumpdomain",
+                   getpid(), tmp);
+       }
+
+       *error = 0;
+       return 0;
 }
 
 int



Home | Main Index | Thread Index | Old Index