Skip to contentSkip to conversation

fcntl16.c patch

PATCH Applied Helge Deller 2 participants 3 messages Nov 4, 2013 – Nov 7, 2013 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fcntl16.c patch

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.

testcases/kernel/syscalls/fcntl/fcntl16.c renamed from testcases/kernel/syscalls/fcntl/fcntl16.c.org +2 -2
diff -up ./testcases/kernel/syscalls/fcntl/fcntl16.c.org ./testcases/kernel/syscalls/fcntl/fcntl16.c
@@ -66,8 +66,8 @@
 typedef struct {
 	short type;
 	short whence;
-	long start;
-	long len;
+	off_t start;
+	off_t len;
 	short flag;
 } lock;
 

------------------------------------------------------------------------------
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

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

Hi!

Quoted 18 lines

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.

Quoted 4 lines

This fixes the fcntl16_64 testcase on hppa64-linux-gnu with 32bit userspace running on 64bit kernel.

What about using struct flock as defined in bits/fcntl.h instead?

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hi!

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines

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.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

What about using struct flock as defined in bits/fcntl.h instead?

Sure, that's possible.
Patch is attached.

I would be happy if you would apply one of those.

Applied, thanks.

And it would be easier for me if you had send git formatted patch with headline and description (output from git format-patch).

Signature · 13 lines
Cyril Hrubis
[email protected]

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list