public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: V2 [PATCH 2/2] Add C wrappers for prctl/process_vm_readv/process_vm_writev [BZ #25810]
Date: Wed, 29 Apr 2020 08:29:25 -0700	[thread overview]
Message-ID: <CAMe9rOraBmZBLgAiAJ2r4rVTz0cKMQYekb_2YzVrz-QYckJfng@mail.gmail.com> (raw)
In-Reply-To: <87o8raqpu1.fsf@oldenburg2.str.redhat.com>

On Wed, Apr 29, 2020 at 8:22 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu:
>
> >> > +{
> >> > +  return INLINE_SYSCALL_CALL (prctl, option, arg2, arg3, arg4, arg5);
> >> > +}
> >> > +
> >> > +hidden_def (__prctl)
> >> > +weak_alias (__prctl, prctl)
> >> > +hidden_weak (prctl)
> >>
> >> Can't you use libc_hidden_proto in include/sys/prctl.h and
> >> libc_hidden_proto here?
> >>
> >
> > Since include/sys/prctl.h has
> >
> > extern int __prctl (int __option, ...);
> >
> > it can't be used.
>
> I still don't get it.  What happens if you use libc_hidden_proto and
> libc_hidden_def?

With

extern int __prctl (int __option, ...);
libc_hidden_proto (__prctl)
libc_hidden_proto (prctl)

and

#include <unistd.h>
#include <sysdep.h>
#include <errno.h>
#include <sys/prctl.h>

int
__prctl (int option, unsigned long int arg2, unsigned long int arg3,
unsigned long int arg4, unsigned long int arg5)
{
  return INLINE_SYSCALL_CALL (prctl, option, arg2, arg3, arg4, arg5);
}

libc_hidden_def (__prctl)
weak_alias (__prctl, prctl)
hidden_weak (prctl)

I got

../sysdeps/unix/sysv/linux/prctl.c:25:1: error: conflicting types for ‘__prctl’
   25 | __prctl (int option, unsigned long int arg2, unsigned long int arg3,
      | ^~~~~~~
In file included from <command-line>:
../include/sys/prctl.h:7:20: note: previous declaration of ‘__prctl’ was here
    7 | libc_hidden_proto (__prctl)
      |                    ^~~~~~~
./../include/libc-symbols.h:541:33: note: in definition of macro
‘__hidden_proto’
  541 |   extern thread __typeof (name) name __asm__ (__hidden_asmname
(#internal)) \
      |                                 ^~~~
./../include/libc-symbols.h:624:44: note: in expansion of macro ‘hidden_proto’
  624 | # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
      |                                            ^~~~~~~~~~~~
../include/sys/prctl.h:7:1: note: in expansion of macro ‘libc_hidden_proto’
    7 | libc_hidden_proto (__prctl)
      | ^~~~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/prctl.c:32:22: error: conflicting types for ‘prctl’
   32 | weak_alias (__prctl, prctl)
      |                      ^~~~~
./../include/libc-symbols.h:152:26: note: in definition of macro ‘_weak_alias’
  152 |   extern __typeof (name) aliasname __attribute__ ((weak, alias
(#name))) \
      |                          ^~~~~~~~~
../sysdeps/unix/sysv/linux/prctl.c:32:1: note: in expansion of macro
‘weak_alias’
   32 | weak_alias (__prctl, prctl)
      | ^~~~~~~~~~
../include/sys/prctl.h:8:20: note: previous declaration of ‘prctl’ was here
    8 | libc_hidden_proto (prctl)
      |                    ^~~~~
./../include/libc-symbols.h:541:33: note: in definition of macro
‘__hidden_proto’
  541 |   extern thread __typeof (name) name __asm__ (__hidden_asmname
(#internal)) \
      |                                 ^~~~
./../include/libc-symbols.h:624:44: note: in expansion of macro ‘hidden_proto’
  624 | # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
      |                                            ^~~~~~~~~~~~
../include/sys/prctl.h:8:1: note: in expansion of macro ‘libc_hidden_proto’
    8 | libc_hidden_proto (prctl)
      | ^~~~~~~~~~~~~~~~~
./../include/libc-symbols.h:552:33: error: ‘__EI___prctl’ aliased to
undefined symbol ‘__GI___prctl’
  552 |   extern thread __typeof (name) __EI_##name \
      |                                 ^~~~~
./../include/libc-symbols.h:548:3: note: in expansion of macro ‘__hidden_ver2’
  548 |   __hidden_ver2 (, local, internal, name)
      |   ^~~~~~~~~~~~~
./../include/libc-symbols.h:557:29: note: in expansion of macro ‘__hidden_ver1’
  557 | #  define hidden_def(name)  __hidden_ver1(__GI_##name, name, name);
      |                             ^~~~~~~~~~~~~
./../include/libc-symbols.h:626:32: note: in expansion of macro ‘hidden_def’
  626 | # define libc_hidden_def(name) hidden_def (name)
      |                                ^~~~~~~~~~
../sysdeps/unix/sysv/linux/prctl.c:31:1: note: in expansion of macro
‘libc_hidden_def’
   31 | libc_hidden_def (__prctl)
      | ^~~~~~~~~~~~~~~
./../include/libc-symbols.h:552:33: error: ‘__EI_prctl’ aliased to
undefined symbol ‘__GI_prctl’
  552 |   extern thread __typeof (name) __EI_##name \
      |                                 ^~~~~
./../include/libc-symbols.h:548:3: note: in expansion of macro ‘__hidden_ver2’
  548 |   __hidden_ver2 (, local, internal, name)
      |   ^~~~~~~~~~~~~
./../include/libc-symbols.h:562:2: note: in expansion of macro ‘__hidden_ver1’
  562 |  __hidden_ver1(__GI_##name, name, name) __attribute__((weak));
      |  ^~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/prctl.c:33:1: note: in expansion of macro
‘hidden_weak’
   33 | hidden_weak (prctl)
      | ^~~~~~~~~~~

> > Since the the U marker can only be applied to 2 unsigned long arguments,
> > add a C wrapper for prctl, process_vm_readv and process_vm_writev syscals
> > which have more than 2 unsigned long arguments.
>
> Please add that syscalls.list reference.  Thanks.
>

I have

---
Since the the U marker can only be applied to 2 unsigned long arguments
in syscalls.list files, add a C wrapper for prctl, process_vm_readv and
process_vm_writev syscals which have more than 2 unsigned long arguments.
---

-- 
H.J.

  reply	other threads:[~2020-04-29 15:30 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-29 14:47 [PATCH 1/2] Mark unsigned long arguments with U in more syscalls " H.J. Lu
2020-04-29 14:47 ` [PATCH 2/2] Add C wrappers for prctl/process_vm_readv/process_vm_writev " H.J. Lu
2020-04-29 14:55   ` Florian Weimer
2020-04-29 15:20     ` V2 " H.J. Lu
2020-04-29 15:22       ` Florian Weimer
2020-04-29 15:29         ` H.J. Lu [this message]
2020-04-29 15:35           ` Florian Weimer
2020-04-29 15:41             ` Florian Weimer
2020-04-29 15:32       ` Andreas Schwab
2020-04-29 15:36         ` H.J. Lu
2020-04-29 15:43           ` Florian Weimer
2020-04-29 15:52             ` Add C wrappers for process_vm_readv/process_vm_writev " H.J. Lu
2020-04-29 15:55               ` Florian Weimer
2020-04-29 14:58   ` [PATCH 2/2] Add C wrappers for prctl/process_vm_readv/process_vm_writev " Florian Weimer
2020-04-29 15:10     ` H.J. Lu
2020-04-29 15:18       ` Florian Weimer
2020-04-29 15:22         ` H.J. Lu
2020-04-29 15:25           ` Florian Weimer
2020-04-29 14:57 ` [PATCH 1/2] Mark unsigned long arguments with U in more syscalls " Florian Weimer

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=CAMe9rOraBmZBLgAiAJ2r4rVTz0cKMQYekb_2YzVrz-QYckJfng@mail.gmail.com \
    --to=hjl.tools@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).