From c4d7cef8887d2038f303faf5fe0c852f1483b4a4 Mon Sep 17 00:00:00 2001 From: Enrico Scholz Date: Tue, 30 Dec 2003 13:49:17 +0000 Subject: [PATCH] * s!ctx_t!xid_t! * use native vc_ctx_kill() only when legacy-API is disabled * fixed help-msg git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/branches/SYSCALL_SWITCH@502 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- util-vserver/src/vkill.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/util-vserver/src/vkill.c b/util-vserver/src/vkill.c index f30da6f..dfb4d61 100644 --- a/util-vserver/src/vkill.c +++ b/util-vserver/src/vkill.c @@ -52,7 +52,7 @@ CMDLINE_OPTIONS[] = { struct Arguments { - ctx_t ctx; + xid_t ctx; int sig; }; @@ -77,7 +77,7 @@ showHelp(int fd, char const *cmd, int res) WRITE_MSG(fd, "Usage: "); WRITE_STR(fd, cmd); WRITE_MSG(fd, - " [-c ] [-s ] [--] []+\n" + " [-c ] [-s ] [--] *\n" "Please report bugs to " PACKAGE_BUGREPORT "\n"); exit(res); } @@ -113,8 +113,9 @@ str2sig(char const *str) return res; } -static int -kill_wrapper_legacy(ctx_t ctx, char const *proc, int sig) +#if defined(VC_ENABLE_API_LEGACY) +inline static ALWAYSINLINE int +kill_wrapper_legacy(xid_t ctx, char const *proc, int sig) { pid_t pid = fork(); if (pid==-1) { @@ -136,7 +137,7 @@ kill_wrapper_legacy(ctx_t ctx, char const *proc, int sig) } static int -kill_wrapper(ctx_t ctx, char const *pid, int sig) +kill_wrapper(xid_t ctx, char const *pid, int sig) { //printf("kill_wrapper(%u, %s, %i)\n", ctx, pid, sig); if (vc_ctx_kill(ctx,atoi(pid),sig)==-1) { @@ -152,6 +153,18 @@ kill_wrapper(ctx_t ctx, char const *pid, int sig) return 0; } +#else // VC_ENABLE_API_LEGACY +inline static int +kill_wrapper(xid_t ctx, char const *pid, int sig) +{ + if (vc_ctx_kill(ctx,atoi(pid),sig)==-1) { + perror("vc_ctx_kill()"); + return 1; + } + return 0; +} +#endif + int main(int argc, char *argv[]) { -- 1.8.1.5