[PATCH v10] tests/fcntl.c: add test for print_f_owner_ex

Dmitry V. Levin ldv at altlinux.org
Thu May 3 17:18:41 UTC 2018


On Thu, May 03, 2018 at 02:18:32PM +0300, Dmitry V. Levin wrote:
> On Wed, May 02, 2018 at 11:16:57PM +0800, Zhibin Li wrote:
> > *tests/fcntl.c (test_f_owner_ex_type_pid,
> > test_f_owner_ex_umove_or_printaddr, test_f_owner_ex): New functions.
> > (main): Use test_f_owner_ex.
> > ---
> >  tests/fcntl.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 53 insertions(+)
> > 
> > diff --git a/tests/fcntl.c b/tests/fcntl.c
> > index 4f62ca2a..504464e0 100644
> > --- a/tests/fcntl.c
> > +++ b/tests/fcntl.c
> > @@ -69,12 +69,65 @@ test_flock64(void)
> >  #endif
> >  }
> >  
> > +static long
> > +test_f_owner_ex_type_pid(const int cmd, const char *const cmd_name,
> > +			 const int type, const char *const type_name,
> > +			 pid_t pid)
> > +{
> > +	TAIL_ALLOC_OBJECT_CONST_PTR(struct f_owner_ex, fo);
> 
> Another issue I found with this test is it assumes that struct f_owner_ex,
> F_SETOWN_EX, and F_GETOWN_EX are always defined, which is not the case on
> older systems.
> 
> I had to add the following guard to make it more portable:
> 
> /*
>  * F_[GS]ETOWN_EX had conflicting values with F_[SG]ETLK64
>  * in kernel revisions v2.6.32-rc1~96..v2.6.32-rc7~23.
>  */
> #undef TEST_F_OWNER_EX
> #if defined F_GETOWN_EX && defined F_SETOWN_EX \
>  && (F_GETOWN_EX != F_SETLK64) && (F_SETOWN_EX != F_GETLK64)
> # define TEST_F_OWNER_EX
> #endif
> 
> #ifdef TEST_F_OWNER_EX
> ...
> #endif /* TEST_F_OWNER_EX */

Also, struct f_owner_ex appeared to be not portable enough,
so I had to add a workaround for that. too.

I've merged this test now, thanks.


-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180503/4b0c170c/attachment.bin>


More information about the Strace-devel mailing list