On Thu, May 13, 2010 at 09:59:24AM -0700, Richard Henderson wrote: > On 05/13/2010 06:17 AM, Martin Jansa wrote: > > @@ -2899,8 +2900,14 @@ int main(int argc, char **argv, char **envp) > > if (fscanf(fp, "%lu", &tmp) == 1) { > > mmap_min_addr = tmp; > > qemu_log("host mmap_min_addr=0x%lx\n", mmap_min_addr); > > + } else { > > + qemu_log("cannot read value from > > /proc/sys/vm/mmap_min_addr, assuming %d\n", MMAP_MIN_ADDR_DEFAULT); > > + mmap_min_addr = MMAP_MIN_ADDR_DEFAULT; > > } > > fclose(fp); > > + } else { > > + qemu_log("cannot open /proc/sys/vm/mmap_min_addr for reading, > > assuming %d\n", MMAP_MIN_ADDR_DEFAULT); > > + mmap_min_addr = MMAP_MIN_ADDR_DEFAULT; > > } > > } > > Perhaps you can combine these two else clauses?
Sure it would be possible, but while trying to find why qemu doesn't work on someone box but works on mine I wanted to distinguish between cannot open and cannot read. Also if I combine it in test ie initialize mmap_min_addr with -1, and then check if it changed after read (because 0 is also valid value), or moving fopen and fscanf to one condition, then it gets IMHO as complicated as those 2 else clauses. BTW: I noticed that qemu-arm works ok when mmap_min_addr is low enough (and doesn't have to be zero). my box had mmap_min_addr 4096 and qemu-arm worked fine even without reading it and the other boxes had mmap_min_addr = 64K and failed later to mmap. Regards, -- uin:136542059 jid:martin.ja...@gmail.com Jansa Martin sip:jama...@voip.wengo.fr JaMa