* [LTP] [PATCH] fcntl16.c patch
@ 2013-11-04 21:05 Helge Deller
2013-11-06 12:32 ` chrubis
0 siblings, 1 reply; 3+ messages in thread
From: Helge Deller @ 2013-11-04 21:05 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1: Type: text/plain, Size: 850 bytes --]
The fcntl16 testcase is being compiled twice, once normal, and the other
time with the _FILE_OFFSET_BITS=64 define set.
When compiled with 64bit file functions (as fcntl16_64) all
file functions will automatically use their 64bit variants, e.g.
"struct flock64" instead of "struct flock".
So, when in the code e.g.
fcntl(fd, F_SETLK, thislock)
is called, this will automatically be translated into
fcntl64(fd, F_SETLK64, thislock)
and "thislock" needs to be of type "struct flock64".
So, we need to make sure that thislock is of the correct type,
with the start and len fields being of type "off_t" which then
will be translated into "loff_t" during compilation when
_FILE_OFFSET_BITS=64 is set.
This fixes the fcntl16_64 testcase on hppa64-linux-gnu with
32bit userspace running on 64bit kernel.
Signed-off-by: Helge Deller <deller@gmx.de>
[-- Attachment #2: fcntl16.c.patch --]
[-- Type: text/x-patch, Size: 418 bytes --]
diff -up ./testcases/kernel/syscalls/fcntl/fcntl16.c.org ./testcases/kernel/syscalls/fcntl/fcntl16.c
--- ./testcases/kernel/syscalls/fcntl/fcntl16.c.org 2013-11-04 15:25:15.000000000 +0100
+++ ./testcases/kernel/syscalls/fcntl/fcntl16.c 2013-11-04 16:06:33.000000000 +0100
@@ -66,8 +66,8 @@
typedef struct {
short type;
short whence;
- long start;
- long len;
+ off_t start;
+ off_t len;
short flag;
} lock;
[-- Attachment #3: Type: text/plain, Size: 402 bytes --]
------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [LTP] [PATCH] fcntl16.c patch
2013-11-04 21:05 [LTP] [PATCH] fcntl16.c patch Helge Deller
@ 2013-11-06 12:32 ` chrubis
[not found] ` <527A964D.6030004@gmx.de>
0 siblings, 1 reply; 3+ messages in thread
From: chrubis @ 2013-11-06 12:32 UTC (permalink / raw)
To: Helge Deller; +Cc: ltp-list
Hi!
> The fcntl16 testcase is being compiled twice, once normal, and the other
> time with the _FILE_OFFSET_BITS=64 define set.
>
> When compiled with 64bit file functions (as fcntl16_64) all
> file functions will automatically use their 64bit variants, e.g.
> "struct flock64" instead of "struct flock".
>
> So, when in the code e.g.
> fcntl(fd, F_SETLK, thislock)
> is called, this will automatically be translated into
> fcntl64(fd, F_SETLK64, thislock)
> and "thislock" needs to be of type "struct flock64".
>
> So, we need to make sure that thislock is of the correct type,
> with the start and len fields being of type "off_t" which then
> will be translated into "loff_t" during compilation when
> _FILE_OFFSET_BITS=64 is set.
>
> This fixes the fcntl16_64 testcase on hppa64-linux-gnu with
> 32bit userspace running on 64bit kernel.
>
> Signed-off-by: Helge Deller <deller@gmx.de>
What about using struct flock as defined in bits/fcntl.h instead?
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
November Webinars for C, C++, Fortran Developers
Accelerate application performance with scalable programming models. Explore
techniques for threading, error checking, porting, and tuning. Get the most
from the latest Intel processors and coprocessors. See abstracts and register
http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-07 11:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-04 21:05 [LTP] [PATCH] fcntl16.c patch Helge Deller
2013-11-06 12:32 ` chrubis
[not found] ` <527A964D.6030004@gmx.de>
2013-11-07 11:19 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox