On Tue, Nov 24, 2009 at 11:36 PM, Mike Frysinger <[email protected]> wrote:
> On Wednesday 25 November 2009 01:26:20 Garrett Cooper wrote:
>> On Tue, Nov 24, 2009 at 9:33 PM, Mike Frysinger <[email protected]> wrote:
>> > On Wednesday 25 November 2009 00:17:16 Garrett Cooper wrote:
>> >> --- regen.sh  19 Nov 2009 19:35:15 -0000      1.12
>> >> +++ regen.sh  25 Nov 2009 05:12:13 -0000
>> >> @@ -32,8 +32,13 @@ static void cleanup(void);
>> >>               tst_brkm(TCONF, cleanup, "syscall " #NR " not supported on
>> >> your arch"); \\ errno = ENOSYS; \\
>> >>               __ret = -1; \\
>> >> -     } else \\
>> >> +     } else { \\
>> >>               __ret = syscall(NR, ##__VA_ARGS__); \\
>> >> +             if (__ret == -1 && errno == ENOSYS) { \\
>> >> +                     tst_brkm(TCONF, cleanup, "syscall " #NR " not
>> >> supported on your arch"); \\ +                 errno = ENOSYS; \\
>> >> +             } \\
>> >> +     } \\
>> >>       __ret; \\
>> >>  })
>> >>  EOF
>> >
>> > i'd prefer this change
>> > --- testcases/kernel/include/regen.sh   9 Oct 2009 17:55:48 -0000
>> > 1.11 +++ testcases/kernel/include/regen.sh   25 Nov 2009 05:28:27 -0000
>> > @@ -30,11 +30,12 @@ static void cleanup(void);
>> >  #define syscall(NR, ...) ({ \\
>> >        int __ret; \\
>> >        if (NR == 0) { \\
>> > -               tst_brkm(TCONF, cleanup, "syscall " #NR " not supported
>> > on your arch"); \\ errno = ENOSYS; \\
>> >                __ret = -1; \\
>> >        } else \\
>> >                __ret = syscall(NR, ##__VA_ARGS__); \\
>> > +       if (__ret == -1 && errno == ENOSYS) \\
>> > +               tst_brkm(TCONF, cleanup, "syscall " #NR " not supported
>> > on your arch"); \\ __ret; \\
>> >  })
>> >  EOF
>>
>>     Ok -- that makes more sense.. besides, I think gcc was optimizing
>> out the first branch with -O2 if it always evaluated to false. Here's
>> the new patch (I'm keeping the errno = ENOSYS part because I want to
>> make sure that tst_brkm doesn't mess up the errno value if a write(2)
>> fails or something).
>
> i thought tst_brkm exited when called with a cleanup func like we do here

    tst_brkm exits when cleanup is non-NULL:

        /*
         * If no cleanup function was specified, just return to the caller.
         * Otherwise call the specified function.  If specified function
         * returns, call tst_exit().
         */
        if (func != NULL) {
                (*func)();
                tst_exit();
        }

    It's always defined for us in linux_syscall_numbers.h, thus it
always exits...
Cheers,
-Garrett

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to