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

Zhibin Li 08826794brmt at gmail.com
Wed May 2 23:57:14 UTC 2018


Oh, please accept my apology, I was trying to print out the address to
understand what (void *)fo+1 without uintptr_t is really doing but I was a
little sleepy last night and I forgot to remove the stupid code. I have say
you are so patience and I'm really sorry.

On Thu, May 3, 2018, 07:05 Dmitry V. Levin <ldv at altlinux.org> wrote:

> On Wed, May 02, 2018 at 11:16:57PM +0800, Zhibin Li wrote:
> > *tests/fcntl.c (test_f_owner_ex_type_pid,
>
> There has to be a space between * and the file name.
>
> > 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);
> > +
> > +     fo->type = type;
> > +     fo->pid = pid;
> > +     long rc = invoke_test_syscall(cmd, fo);
> > +     printf("%s(0, %s, {type=%s, pid=%d}) = %s\n",
> > +            TEST_SYSCALL_STR, cmd_name, type_name, fo->pid,
> sprintrc(rc));
> > +
> > +     void *bad_addr = (void *)fo + 1;
> > +     long rc_efault = invoke_test_syscall(cmd, bad_addr);
> > +     printf("%s(0, %s, %p) = %s\n",
> > +            TEST_SYSCALL_STR, cmd_name, bad_addr, sprintrc(rc_efault));
> > +     printf("%p\n", fo);
>
> Sorry, but have you tested this code?
> The last printf seems to be out of place here.
>
>
> --
> ldv
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180502/5b69f9f5/attachment.html>


More information about the Strace-devel mailing list