From: Guillaume Nault <g.nault@alphalink.fr>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH libmnl 1/2] socket: introduce mnl_socket_open2()
Date: Mon, 5 Oct 2015 18:33:42 +0200 [thread overview]
Message-ID: <20151005163342.GA2882@alphalink.fr> (raw)
In-Reply-To: <20151005153715.GA22955@salvia>
On Mon, Oct 05, 2015 at 05:37:15PM +0200, Pablo Neira Ayuso wrote:
> On Fri, Oct 02, 2015 at 10:12:33PM +0200, Guillaume Nault wrote:
> > Define mnl_socket_open2() so that user can pass a set of SOCK_* flags
> > at socket creation time.
> >
> > Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
> > ---
> > include/libmnl/libmnl.h | 3 ++-
> > src/libmnl.map | 1 +
> > src/socket.c | 41 ++++++++++++++++++++++++++++++++---------
> > 3 files changed, 35 insertions(+), 10 deletions(-)
> >
> > diff --git a/include/libmnl/libmnl.h b/include/libmnl/libmnl.h
> > index 3a589bc..5adb13c 100644
> > --- a/include/libmnl/libmnl.h
> > +++ b/include/libmnl/libmnl.h
> > @@ -21,7 +21,8 @@ extern "C" {
> >
> > struct mnl_socket;
> >
> > -extern struct mnl_socket *mnl_socket_open(int type);
> > +extern struct mnl_socket *mnl_socket_open(int bus);
> > +extern struct mnl_socket *mnl_socket_open2(int bus, int flags);
>
> Looks good, but we should be using 'unsigned int flags' instead, right?
>
> Or am I missing anything?
Generally speaking, I'd also consider unsigned integers to be more
appropriate for flag parameters.
But all socket() parameters are signed integers, including "type" which
is bitwise OR-ed with "flags". Furthermore, others libc's functions
introduced for the same purpose (race-free setting of CLOEXEC flag),
also use a signed integer as flag parameter (like dup3()).
So I've used int for consistency. But I can repost if you prefer.
next prev parent reply other threads:[~2015-10-05 16:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 20:12 [PATCH libmnl 0/2] Introduce mnl_socket_open2() Guillaume Nault
2015-10-02 20:12 ` [PATCH libmnl 1/2] socket: introduce mnl_socket_open2() Guillaume Nault
2015-10-05 15:37 ` Pablo Neira Ayuso
2015-10-05 16:33 ` Guillaume Nault [this message]
2015-10-05 17:27 ` Jozsef Kadlecsik
2015-10-05 18:11 ` Pablo Neira Ayuso
2015-10-05 18:38 ` Jozsef Kadlecsik
2015-10-05 18:14 ` Guillaume Nault
2015-10-05 18:50 ` Jan Engelhardt
2015-10-12 14:48 ` Pablo Neira Ayuso
2015-10-02 20:12 ` [PATCH libmnl 2/2] examples: use mnl_socket_open2() Guillaume Nault
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=20151005163342.GA2882@alphalink.fr \
--to=g.nault@alphalink.fr \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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 NNTP newsgroup(s).