http://codereview.appspot.com/41044/diff/1/2 File src/process-manager/libc-global-variables.c (left): http://codereview.appspot.com/41044/diff/1/2#oldcode11 Line 11: int optind = 0, opterr = 0, optopt ...
14 years, 11 months ago
(2009-04-17 12:03:38 UTC)
#4
http://codereview.appspot.com/41044/diff/1/2
File src/process-manager/libc-global-variables.c (left):
http://codereview.appspot.com/41044/diff/1/2#oldcode11
Line 11: int optind = 0, opterr = 0, optopt = 0;
On 2009/04/15 15:38:54, Hajime Tazaki wrote:
> This modification came from the case when I ran multiple processes with
> process-manager. How can we share these opt* variables in multi-processes?
If you have two processes (A,B), within a single node (N), A and B should have a
different version of these global variables and the current ELF loader does
ensure that. Of course, if you have multiple threads (TA1, TA2) within process
A, they will share the _same_ global variables which are different from the
variables seen by TB1, TB2.
http://codereview.appspot.com/41044/diff/1/2 File src/process-manager/libc-global-variables.c (left): http://codereview.appspot.com/41044/diff/1/2#oldcode11 Line 11: int optind = 0, opterr = 0, optopt ...
14 years, 11 months ago
(2009-04-17 16:06:42 UTC)
#5
http://codereview.appspot.com/41044/diff/1/2
File src/process-manager/libc-global-variables.c (left):
http://codereview.appspot.com/41044/diff/1/2#oldcode11
Line 11: int optind = 0, opterr = 0, optopt = 0;
On 2009/04/17 12:03:38, Mathieu Lacage wrote:
> If you have two processes (A,B), within a single node (N), A and B should have
a
> different version of these global variables and the current ELF loader does
> ensure that. Of course, if you have multiple threads (TA1, TA2) within process
> A, they will share the _same_ global variables which are different from the
> variables seen by TB1, TB2.
Okay, I got the point.
So how about the following diff ?
src/process-manager/libc.c:
extern "C" void LIBSETUP (const struct Libc *fn)
{
:
+ optarg = fn->optarg;
+ optind = fn->optind;
+ opterr = fn->opterr;
+ optopt = fn->optopt;
}
src/proces-manager/libc.h:
struct Libc
{
:
+ char *optarg;
+ int optind;
+ int opterr;
+ int optopt;
Issue 41044: Add simu_getopt_long_r
Created 14 years, 11 months ago by Hajime Tazaki
Modified 14 years, 11 months ago
Reviewers: Mathieu Lacage
Base URL:
Comments: 4