From: Cyril Hrubis <chrubis@suse.cz>
To: "Zhang Jian(Bamvor)" <bamvor.zhangjian@huawei.com>
Cc: dingtianhong@huawei.com, ltp-list@lists.sourceforge.net,
bintian.wang@huawei.com, apinski@cavium.com,
yangyingliang@huawei.com
Subject: Re: [LTP] [RFC PATCH 2/3] ARM64: ILP32: cast for negtive off_t
Date: Thu, 19 Mar 2015 12:49:03 +0100 [thread overview]
Message-ID: <20150319114902.GA3724@rei> (raw)
In-Reply-To: <1426742198-17967-3-git-send-email-bamvor.zhangjian@huawei.com>
Hi!
> off_t in 64bit in ILP32 ABI while the compiler will default 32bit
> for constant. It lead to pass the negative 32bit integer to kernel,
> and kernel will treat it as 64bit positive integer.
>
> It could also fix in glibc while we think that there are lots of
> advantage if leave off_t remains 64bit.
>
> Signed-off-by: Zhang Jian(Bamvor) <bamvor.zhangjian@huawei.com>
> ---
> testcases/kernel/fs/ftest/ftest02.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/fs/ftest/ftest02.c b/testcases/kernel/fs/ftest/ftest02.c
> index ec70d9b..153bd09 100644
> --- a/testcases/kernel/fs/ftest/ftest02.c
> +++ b/testcases/kernel/fs/ftest/ftest02.c
> @@ -268,7 +268,7 @@ static void crfile(int me, int count)
> val = write(fd, crmsg, sizeof(crmsg) - 1);
> warn(val, "write", 0);
>
> - val = lseek(fd, -(sizeof(crmsg) - 1), 1);
> + val = lseek(fd, -(off_t)(sizeof(crmsg) - 1), 1);
Hmm, this is doing lseek(fd, -size_of_message, SEEK_CUR), wouldn't it be
easier to use the offset we passed to the first lseek() with SEEK_SET
instead?
And I do not really understand why this does not work. All I can see
that the expression is evaluated as: sizeof() returns size of the
message as size_t, which is 32 bit, we decrement it by one and then
negate it. We have negative 32 bit number. Then the compiler should pick
up the lseek() prototype from glibc header and figure out that it should
convert the second parameter to off_t. What I'm missing here?
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next prev parent reply other threads:[~2015-03-19 11:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1426742198-17967-1-git-send-email-bamvor.zhangjian@huawei.com>
[not found] ` <1426742198-17967-2-git-send-email-bamvor.zhangjian@huawei.com>
2015-03-19 11:33 ` [LTP] [RFC PATCH 1/3] ARM64: ILP32: modify struct kernel_sigaction Jan Stancek
2015-03-19 12:40 ` Jan Stancek
2015-03-19 15:18 ` Bamvor Zhang
[not found] ` <1426742198-17967-3-git-send-email-bamvor.zhangjian@huawei.com>
2015-03-19 11:49 ` Cyril Hrubis [this message]
[not found] ` <18FC2E80-AF7B-408C-8863-B4FC532B5CD4@caviumnetworks.com>
2015-03-19 12:00 ` [LTP] [RFC PATCH 2/3] ARM64: ILP32: cast for negtive off_t Cyril Hrubis
[not found] ` <1426742198-17967-4-git-send-email-bamvor.zhangjian@huawei.com>
2015-03-19 12:01 ` [LTP] [RFC PATCH 3/3] ARM64: ILP32: define LTP_USE_64_ABI for ILP32 Cyril Hrubis
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=20150319114902.GA3724@rei \
--to=chrubis@suse.cz \
--cc=apinski@cavium.com \
--cc=bamvor.zhangjian@huawei.com \
--cc=bintian.wang@huawei.com \
--cc=dingtianhong@huawei.com \
--cc=ltp-list@lists.sourceforge.net \
--cc=yangyingliang@huawei.com \
/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