All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Andrew Jones <drjones@redhat.com>, kvm@vger.kernel.org
Cc: pbonzini@redhat.com, rkrcmar@redhat.com, lvivier@redhat.com
Subject: Re: [kvm-unit-tests PATCH v3 1/3] arm/arm64: reserve argv[0] for prognam
Date: Mon, 13 Jun 2016 13:13:05 +0200	[thread overview]
Message-ID: <575E9541.2000901@redhat.com> (raw)
In-Reply-To: <1465752571-17627-2-git-send-email-drjones@redhat.com>

On 12.06.2016 19:29, Andrew Jones wrote:
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  arm/selftest.c      | 14 +++++++-------
>  arm/spinlock-test.c |  2 +-
>  lib/argv.c          | 15 +++++++++++++++
>  lib/arm/setup.c     |  4 ++--
>  4 files changed, 25 insertions(+), 10 deletions(-)
> 
> diff --git a/arm/selftest.c b/arm/selftest.c
> index 75dc91faab69a..5656f2bb1cc88 100644
> --- a/arm/selftest.c
> +++ b/arm/selftest.c
> @@ -324,25 +324,25 @@ int main(int argc, char **argv)
>  {
>  	report_prefix_push("selftest");
>  
> -	if (!argc)
> +	if (argc < 2)
>  		report_abort("no test specified");
>  
> -	report_prefix_push(argv[0]);
> +	report_prefix_push(argv[1]);
>  
> -	if (strcmp(argv[0], "setup") == 0) {
> +	if (strcmp(argv[1], "setup") == 0) {
>  
> -		check_setup(argc-1, &argv[1]);
> +		check_setup(argc-2, &argv[2]);
>  
> -	} else if (strcmp(argv[0], "vectors-kernel") == 0) {
> +	} else if (strcmp(argv[1], "vectors-kernel") == 0) {
>  
>  		check_vectors(NULL);
>  
> -	} else if (strcmp(argv[0], "vectors-user") == 0) {
> +	} else if (strcmp(argv[1], "vectors-user") == 0) {
>  
>  		start_usr(check_vectors, NULL,
>  				(unsigned long)thread_stack_alloc());
>  
> -	} else if (strcmp(argv[0], "smp") == 0) {
> +	} else if (strcmp(argv[1], "smp") == 0) {
>  
>  		int cpu;
>  
> diff --git a/arm/spinlock-test.c b/arm/spinlock-test.c
> index fd2af9fd2f4d3..6009ba087e4b4 100644
> --- a/arm/spinlock-test.c
> +++ b/arm/spinlock-test.c
> @@ -69,7 +69,7 @@ int main(int argc, char **argv)
>  {
>  	int cpu;
>  
> -	if (argc && strcmp(argv[0], "bad") != 0) {
> +	if (argc > 1 && strcmp(argv[1], "bad") != 0) {
>  		lock_ops.lock = gcc_builtin_lock;
>  		lock_ops.unlock = gcc_builtin_unlock;
>  	} else {
> diff --git a/lib/argv.c b/lib/argv.c
> index 62dd1fd4cf980..4f6b4f01c4afe 100644
> --- a/lib/argv.c
> +++ b/lib/argv.c
> @@ -40,3 +40,18 @@ void setup_args(char *args)
>      __args = args;
>      __setup_args();
>  }
> +
> +void setup_args_prognam(char *args)
> +{
> +    int i;
> +
> +    if (args) {
> +        __args = args;
> +        __setup_args();
> +
> +        for (i = __argc; i > 0; --i)
> +            __argv[i] = __argv[i-1];
> +    }
> +    __argv[0] = NULL; // just reserve for now
> +    ++__argc;
> +}
> diff --git a/lib/arm/setup.c b/lib/arm/setup.c
> index 8c6172ff94106..c27cc8d052f03 100644
> --- a/lib/arm/setup.c
> +++ b/lib/arm/setup.c
> @@ -22,7 +22,7 @@
>  
>  extern unsigned long stacktop;
>  extern void io_init(void);
> -extern void setup_args(const char *args);
> +extern void setup_args_prognam(const char *args);
>  
>  u32 cpus[NR_CPUS] = { [0 ... NR_CPUS-1] = (~0U) };
>  int nr_cpus;
> @@ -124,5 +124,5 @@ void setup(const void *fdt)
>  
>  	ret = dt_get_bootargs(&bootargs);
>  	assert(ret == 0);
> -	setup_args(bootargs);
> +	setup_args_prognam(bootargs);
>  }
> 

Reviewed-by: Thomas Huth <thuth@redhat.com>


  reply	other threads:[~2016-06-13 11:13 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-12 17:29 [kvm-unit-tests PATCH v3 0/3] arm/powerpc: make argv[0] the program name Andrew Jones
2016-06-12 17:29 ` [kvm-unit-tests PATCH v3 1/3] arm/arm64: reserve argv[0] for prognam Andrew Jones
2016-06-13 11:13   ` Thomas Huth [this message]
2016-06-13 14:12   ` Laurent Vivier
2016-06-12 17:29 ` [kvm-unit-tests PATCH v3 2/3] powerpc/ppc64: " Andrew Jones
2016-06-13 11:18   ` Thomas Huth
2016-06-13 14:16   ` Laurent Vivier
2016-06-12 17:29 ` [kvm-unit-tests PATCH v3 3/3] arm & powerpc: populate argv[0] with prognam Andrew Jones
2016-06-13 14:24   ` Laurent Vivier
2016-06-13 16:09   ` Thomas Huth
2016-07-11 13:05   ` Paolo Bonzini
2016-07-11 13:50     ` Andrew Jones
2016-07-11 14:08       ` Paolo Bonzini
2016-07-12  8:22       ` Andrew Jones
2016-07-12 10:26         ` Paolo Bonzini
2016-06-14 14:40 ` [kvm-unit-tests PATCH v3 0/3] arm/powerpc: make argv[0] the program name Andrew Jones
2016-06-14 14:45   ` Paolo Bonzini
2016-06-29 11:32     ` Andrew Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=575E9541.2000901@redhat.com \
    --to=thuth@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.