X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fvserver-info.c;h=765828d5fc17a18ae49690d824eed0f8b2dedc7e;hb=4fc0d7c31dd9fb6bae2e77ba37d8a08ab26dd65c;hp=16eba18683d31e1ac951209aaf15b7fce5be29b1;hpb=3f07789059091c2c1605956da4ba05e2d04cdff7;p=util-vserver.git diff --git a/util-vserver/src/vserver-info.c b/util-vserver/src/vserver-info.c index 16eba18..765828d 100644 --- a/util-vserver/src/vserver-info.c +++ b/util-vserver/src/vserver-info.c @@ -33,8 +33,9 @@ typedef enum { tgNONE,tgCONTEXT, tgRUNNING, tgVDIR, tgNAME, tgCFGDIR, tgAPPDIR, + tgAPIVER, tgINITPID, tgINITPID_PID, - tgXID, + tgXID, tgUTS, } VserverTag; static struct { @@ -51,10 +52,12 @@ static struct { { "INITPID", tgINITPID, "gives out the initpid of the given context" }, { "INITPID_PID", tgINITPID_PID, "gives out the initpid of the given pid" }, { "XID", tgXID, "gives out the context-id of the given pid" }, + { "APIVER", tgAPIVER, "gives out the version of the kernel API" }, + { "UTS", tgUTS, ("gives out an uts-entry; possible entries are " + "context, sysname, nodename, release, version, " + "machine and domainname") }, }; -#define TAGS_COUNT (sizeof(TAGS)/sizeof(TAGS[0])) - int wrapper_exit_code = 1; static struct option const @@ -71,7 +74,7 @@ showHelp(int fd, char const *cmd, int res) WRITE_MSG(fd, "Usage: "); WRITE_STR(fd, cmd); WRITE_MSG(fd, - " [-q] || \n" + " [-ql] || \n" "Please report bugs to " PACKAGE_BUGREPORT "\n"); exit(res); } @@ -94,7 +97,7 @@ showTags() size_t i; WRITE_MSG(1, "Valid tags are: "); - for (i=0; i0) { + vc_uts_type type = utsText2Tag(argv[0]); + if (vc_get_vhi_name(xid, type, buf, sizeof(buf)-1)==-1) + perror("vc_get_vhi_name()"); + else + res=buf; + } + else { + bool is_passed = false; + char tmp[128]; +#define APPEND_UTS(TYPE) \ + (((vc_get_vhi_name(xid, TYPE, tmp, sizeof(tmp)-1)!=-1) && (strcat(buf, tmp), strcat(buf, " "), is_passed=true)) || \ + (strcat(buf, "??? "))) + + APPEND_UTS(vcVHI_CONTEXT) && + APPEND_UTS(vcVHI_SYSNAME) && + APPEND_UTS(vcVHI_NODENAME) && + APPEND_UTS(vcVHI_RELEASE) && + APPEND_UTS(vcVHI_VERSION) && + APPEND_UTS(vcVHI_MACHINE) && + APPEND_UTS(vcVHI_DOMAINNAME) && + is_passed && + (res = buf); + + if (!is_passed) + perror("vc_get_vhi_name()"); + +#undef APPEND_UTS + } + break; + } + default : assert(false); abort(); // TODO }