* [PATCH iproute2 1/2] lib: fix warning in namespace.h
@ 2015-01-15 10:36 Nicolas Dichtel
2015-01-15 10:36 ` [PATCH iproute2 2/2] lib: fix setns() function when !HAVE_SETNS Nicolas Dichtel
2015-01-15 11:33 ` [PATCH iproute2 1/2] lib: fix warning in namespace.h Vadim Kochan
0 siblings, 2 replies; 3+ messages in thread
From: Nicolas Dichtel @ 2015-01-15 10:36 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel, Vadim Kochan
Warning was:
In file included from bridge.c:16:0:
../include/namespace.h:33:12: warning: ‘setns’ defined but not used [-Wunused-function]
CC: Vadim Kochan <vadim4j@gmail.com>
Fixes: eb67e4498aec ("lib: Add netns_switch func for change network namespace")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
include/namespace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/namespace.h b/include/namespace.h
index b8c5cad6aaa2..28a4223b3eb2 100644
--- a/include/namespace.h
+++ b/include/namespace.h
@@ -30,7 +30,7 @@
#endif
#ifndef HAVE_SETNS
-static int setns(int fd, int nstype)
+static inline int setns(int fd, int nstype)
{
#ifdef __NR_setns
return syscall(__NR_setns, fd, nstype);
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH iproute2 2/2] lib: fix setns() function when !HAVE_SETNS
2015-01-15 10:36 [PATCH iproute2 1/2] lib: fix warning in namespace.h Nicolas Dichtel
@ 2015-01-15 10:36 ` Nicolas Dichtel
2015-01-15 11:33 ` [PATCH iproute2 1/2] lib: fix warning in namespace.h Vadim Kochan
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Dichtel @ 2015-01-15 10:36 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel, Vadim Kochan
When HAVE_SETNS is not set, iproute2 provides a local implementation of this
function based on __NR_setns.
This macro is defined in sys/syscall.h, which was not included, thus the local
implementation always returned -1.
CC: Vadim Kochan <vadim4j@gmail.com>
Fixes: eb67e4498aec ("lib: Add netns_switch func for change network namespace")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
include/namespace.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/namespace.h b/include/namespace.h
index 28a4223b3eb2..52f7fbd7bb8c 100644
--- a/include/namespace.h
+++ b/include/namespace.h
@@ -3,6 +3,7 @@
#include <sched.h>
#include <sys/mount.h>
+#include <sys/syscall.h>
#include <errno.h>
#define NETNS_RUN_DIR "/var/run/netns"
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH iproute2 1/2] lib: fix warning in namespace.h
2015-01-15 10:36 [PATCH iproute2 1/2] lib: fix warning in namespace.h Nicolas Dichtel
2015-01-15 10:36 ` [PATCH iproute2 2/2] lib: fix setns() function when !HAVE_SETNS Nicolas Dichtel
@ 2015-01-15 11:33 ` Vadim Kochan
1 sibling, 0 replies; 3+ messages in thread
From: Vadim Kochan @ 2015-01-15 11:33 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: shemminger, netdev, Vadim Kochan
On Thu, Jan 15, 2015 at 11:36:24AM +0100, Nicolas Dichtel wrote:
> Warning was:
> In file included from bridge.c:16:0:
> ../include/namespace.h:33:12: warning: ‘setns’ defined but not used [-Wunused-function]
>
> CC: Vadim Kochan <vadim4j@gmail.com>
> Fixes: eb67e4498aec ("lib: Add netns_switch func for change network namespace")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
> include/namespace.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/namespace.h b/include/namespace.h
> index b8c5cad6aaa2..28a4223b3eb2 100644
> --- a/include/namespace.h
> +++ b/include/namespace.h
> @@ -30,7 +30,7 @@
> #endif
>
> #ifndef HAVE_SETNS
> -static int setns(int fd, int nstype)
> +static inline int setns(int fd, int nstype)
> {
> #ifdef __NR_setns
> return syscall(__NR_setns, fd, nstype);
> --
> 2.1.0
>
Thank You Nicolas!
I have to do more testing before send a patches.
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-15 11:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-15 10:36 [PATCH iproute2 1/2] lib: fix warning in namespace.h Nicolas Dichtel
2015-01-15 10:36 ` [PATCH iproute2 2/2] lib: fix setns() function when !HAVE_SETNS Nicolas Dichtel
2015-01-15 11:33 ` [PATCH iproute2 1/2] lib: fix warning in namespace.h Vadim Kochan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox