From: Alexey Kodanev <alexey.kodanev@oracle.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] syscalls/fstatat01: fix test on x86_64 arch
Date: Wed, 09 Mar 2016 13:14:08 +0300 [thread overview]
Message-ID: <56DFF770.9030105@oracle.com> (raw)
In-Reply-To: <475199963.7200678.1457516997100.JavaMail.zimbra@redhat.com>
On 03/09/2016 12:49 PM, Jan Stancek wrote:
>
> ----- Original Message -----
>> From: "Alexey Kodanev" <alexey.kodanev@oracle.com>
>> To: "Jan Stancek" <jstancek@redhat.com>
>> Cc: ltp@lists.linux.it, "vasily isaenko" <vasily.isaenko@oracle.com>
>> Sent: Wednesday, 9 March, 2016 10:47:11 AM
>> Subject: Re: [LTP] [PATCH] syscalls/fstatat01: fix test on x86_64 arch
>>
>> Hi,
>> On 03/09/2016 12:18 PM, Jan Stancek wrote:
>>> ...
>>> -/* TODO (garrcoop): properly port to fstatat64. */
>>> -#if (defined __NR_fstatat64) && (__NR_fstatat64 != 0)
>>> -struct stat64 statbuf;
>>> -#else
>>> -struct stat statbuf;
>>> -#endif
>>> -
>>> -/*
>>> - * XXX (garrcoop): NO NO NO NO NO NO NO NO NO ... use
>>> linux_syscall_numbers.h!
>>> - */
>>> -/* __NR_fstatat64 and __NR_fstatat64 if not defined are ALWAYS stubbed by
>>> - * linux_syscall_numbers.h Need to check for 0 to avoid testing with
>>> stubs
>>> */
>>> -#if (defined __NR_fstatat64) && (__NR_fstatat64 != 0)
>>> -int myfstatat(int dirfd, const char *filename, struct stat64 *statbuf,
>>> - int flags)
>>> +#if !defined(HAVE_FSTATAT)
>>> +#if (defined __NR_fstatat64) && (__NR_fstatat64 > 0)
>>> +static struct stat64 statbuf;
>>> +int fstatat(int dirfd, const char *filename, struct stat64 *statbuf, int
>>> flags)
>>> {
>>> return ltp_syscall(__NR_fstatat64, dirfd, filename, statbuf, flags);
>>> }
>>> -#elif (defined __NR_newfstatat) && (__NR_newfstatat != 0)
>>> -int myfstatat(int dirfd, const char *filename, struct stat *statbuf, int
>>> flags)
>>> +#else
>>> Shouldn't we check that __NR_newfstatat is defined? There seem to be
>>> architectures,
>>> that don't define both fstatat64 and newfstatat.
>> It seems unnecessary... it should be defined in linux_syscall_numbers.h
>> whether
>> it is supported or not. In the last case __NR_newfstatat is defined as
>> __LTP_NR_INVALID_SYSCALL,eventually we'll get TCONF for ltp_syscall(-1,
>> ...).
> You're right, regen.sh will add common stub as long as at least one arch
> defines it (which we do).
Looking at aarch64, it only defines "fstatat 79" and it neither has
fstatat64
nor newfstatat, so may be we should additionally check _NR_newfstatat in
the same
way we do for fstatat64. And if both < 0 invoke ltp_syscall with
__NR_fstatat.
Thanks,
Alexey
> Regards,
> Jan
>
>> Thanks,
>> Alexey
>>
>>> Regards,
>>> Jan
>>>
>>>> +static struct stat statbuf;
>>>> +int fstatat(int dirfd, const char *filename, struct stat *statbuf, int
>>>> flags)
>>>> {
>>>> return ltp_syscall(__NR_newfstatat, dirfd, filename, statbuf, flags);
>>>> }
>>>> +#endif
>>>> #else
>>>> -/* stub - will never run */
>>>> -int myfstatat(int dirfd, const char *filename, struct stat *statbuf, int
>>>> flags)
>>>> -{
>>>> - return ltp_syscall(0, dirfd, filename, statbuf, flags);
>>>> -}
>>>> +static struct stat statbuf;
>>>> #endif
>>>>
>>>> int main(int ac, char **av)
>>>> @@ -104,8 +92,7 @@ int main(int ac, char **av)
>>>> tst_count = 0;
>>>>
>>>> for (i = 0; i < TST_TOTAL; i++) {
>>>> - TEST(myfstatat
>>>> - (fds[i], filenames[i], &statbuf, flags[i]));
>>>> + TEST(fstatat(fds[i], filenames[i], &statbuf, flags[i]));
>>>>
>>>> if (TEST_ERRNO == expected_errno[i]) {
>>>> tst_resm(TPASS | TTERRNO,
>>>> --
>>>> 1.7.1
>>>>
>>>>
>>>> --
>>>> Mailing list info: http://lists.linux.it/listinfo/ltp
>>>>
>>
prev parent reply other threads:[~2016-03-09 10:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 8:23 [LTP] [PATCH] syscalls/fstatat01: fix test on x86_64 arch Alexey Kodanev
2016-03-09 9:18 ` Jan Stancek
2016-03-09 9:47 ` Alexey Kodanev
2016-03-09 9:49 ` Jan Stancek
2016-03-09 10:14 ` Alexey Kodanev [this message]
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=56DFF770.9030105@oracle.com \
--to=alexey.kodanev@oracle.com \
--cc=ltp@lists.linux.it \
/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.