From: David E. Eisenstat Date: Sun, 20 May 2007 12:45:00 +0000 (+0000) Subject: Change "slice suspended" and "not been allocated resources" messages to include hostname. X-Git-Tag: after-util-vserver-0_30_213-merge~9 X-Git-Url: http://git.onelab.eu/?p=util-vserver.git;a=commitdiff_plain;h=e7d6ce5978c3486a585b0acb2f759db0e1615e83 Change "slice suspended" and "not been allocated resources" messages to include hostname. --- diff --git a/src/vsh.c b/src/vsh.c index 7e8360e..b80b8d8 100644 --- a/src/vsh.c +++ b/src/vsh.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -198,19 +199,26 @@ static int sandbox_processes(xid_t ctx, char *context) #else int ctx_is_new; struct sliver_resources slr; + char hostname[HOST_NAME_MAX+1]; pl_get_limits(context,&slr); + if (gethostname(hostname, sizeof hostname) == -1) + { + PERROR("gethostname(...)"); + exit(1); + } + /* check whether the slice has been taken off of the whitelist */ if (slr.vs_whitelisted==0) { - fprintf(stderr, "*** %s has not been allocated resources on this node ***\n", context); + fprintf(stderr, "*** %s: %s has not been allocated resources on this node ***\n", hostname, context); exit(0); } /* check whether the slice has been suspended */ if (slr.vs_cpu==0) { - fprintf(stderr, "*** %s has zero cpu resources and presumably it has been disabled/suspended ***\n"); + fprintf(stderr, "*** %s: %s has zero cpu resources and presumably it has been disabled/suspended ***\n", hostname, context); exit(0); }