From: Yoni Bettan <ybettan@redhat.com>
To: qemu-devel@nongnu.org
Cc: Yoni Bettan <ybettan@redhat.com>,
Riku Voipio <riku.voipio@iki.fi>,
Laurent Vivier <laurent@vivier.eu>,
Peter Maydell <peter.maydell@linaro.org>,
Gerd Hoffmann <kraxel@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH V3] vl.c && linux-user/main.c : removed **envp from main() arguments
Date: Tue, 19 Dec 2017 12:11:22 +0200 [thread overview]
Message-ID: <20171219101122.31711-1-ybettan@redhat.com> (raw)
it was added on 2008 902b3d5c39 when introduced cache-utils.[ch]
since then cache-utils.[ch] were removed but **envp was left
behind.
By the way "to be portable it is best to write main to take two
arguments, and use the value of environ" according to
https://www.gnu.org/software/libc/manual/html_node/Program-\
Arguments.html#Program-Arguments
Signed-off-by: Yoni Bettan <ybettan@redhat.com>
---
V2 -> V3:
since ui/cocoa.c rename main() is using qemu_main() ,because it uses it
inside its main() function, the function qemu_main() can't be removed
V1 -> V2:
removed the ui/cocoa.c renaming of main() function since i thought that we
no longer need qemu_main()
include/qemu-common.h | 2 +-
linux-user/main.c | 2 +-
ui/cocoa.m | 5 ++---
vl.c | 7 +++----
4 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/include/qemu-common.h b/include/qemu-common.h
index 05319b9ddc..8a5b7ec5ec 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -29,7 +29,7 @@
/* main function, renamed */
#if defined(CONFIG_COCOA)
-int qemu_main(int argc, char **argv, char **envp);
+int qemu_main(int argc, char **argv);
#endif
void qemu_get_timedate(struct tm *tm, int offset);
diff --git a/linux-user/main.c b/linux-user/main.c
index 6286661bd3..fe81d410da 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -4237,7 +4237,7 @@ static int parse_args(int argc, char **argv)
return optind;
}
-int main(int argc, char **argv, char **envp)
+int main(int argc, char **argv)
{
struct target_pt_regs regs1, *regs = ®s1;
struct image_info info1, *info = &info1;
diff --git a/ui/cocoa.m b/ui/cocoa.m
index 330ccebf90..4d18153659 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -25,7 +25,6 @@
#include "qemu/osdep.h"
#import <Cocoa/Cocoa.h>
-#include <crt_externs.h>
#include "qemu-common.h"
#include "ui/console.h"
@@ -1050,7 +1049,7 @@ QemuCocoaView *cocoaView;
COCOA_DEBUG("QemuCocoaAppController: startEmulationWithArgc\n");
int status;
- status = qemu_main(argc, argv, *_NSGetEnviron());
+ status = qemu_main(argc, argv);
exit(status);
}
@@ -1391,7 +1390,7 @@ int main (int argc, const char * argv[]) {
!strcmp(opt, "-curses") ||
!strcmp(opt, "-display") ||
!strcmp(opt, "-qtest")) {
- return qemu_main(gArgc, gArgv, *_NSGetEnviron());
+ return qemu_main(gArgc, gArgv);
}
}
}
diff --git a/vl.c b/vl.c
index fc8bd9372f..ea17cc34f6 100644
--- a/vl.c
+++ b/vl.c
@@ -35,10 +35,10 @@
#ifdef CONFIG_SDL
#if defined(__APPLE__) || defined(main)
#include <SDL.h>
-int qemu_main(int argc, char **argv, char **envp);
+int qemu_main(int argc, char **argv);
int main(int argc, char **argv)
{
- return qemu_main(argc, argv, NULL);
+ return qemu_main(argc, argv);
}
#undef main
#define main qemu_main
@@ -50,7 +50,6 @@ int main(int argc, char **argv)
#define main qemu_main
#endif /* CONFIG_COCOA */
-
#include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "hw/hw.h"
@@ -3044,7 +3043,7 @@ static void register_global_properties(MachineState *ms)
user_register_global_props();
}
-int main(int argc, char **argv, char **envp)
+int main(int argc, char **argv)
{
int i;
int snapshot, linux_boot;
--
2.14.3
next reply other threads:[~2017-12-19 10:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-19 10:11 Yoni Bettan [this message]
2017-12-19 10:16 ` [Qemu-devel] [PATCH V3] vl.c && linux-user/main.c : removed **envp from main() arguments Yoni Bettan
2017-12-19 10:21 ` Laurent Vivier
2017-12-19 13:05 ` Yoni Bettan
2017-12-19 13:16 ` Laurent Vivier
2017-12-19 10:31 ` no-reply
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=20171219101122.31711-1-ybettan@redhat.com \
--to=ybettan@redhat.com \
--cc=kraxel@redhat.com \
--cc=laurent@vivier.eu \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=riku.voipio@iki.fi \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).