public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* samples: kdbus: kdbus-workers: Define dummy prime_new()
@ 2015-04-03 22:17 Chen Gang
  2015-04-03 22:42 ` Richard Weinberger
  2015-04-04  8:26 ` Greg KH
  0 siblings, 2 replies; 5+ messages in thread
From: Chen Gang @ 2015-04-03 22:17 UTC (permalink / raw)
  To: gregkh, daniel, dh.herrmann, tixxdz; +Cc: linux-kernel@vger.kernel.org

Quite a few of architures (e.g. blackfin, cris, frv ...) do not support
memfd_create system call which is used in prime_new(). So define a dummy
one.

The related error (with allmodconfig under blackfin):

    CC [M]  samples/kfifo/inttype-example.o
  samples/kdbus/kdbus-workers.c: In function ‘prime_new’:
  samples/kdbus/kdbus-workers.c:930:18: error: ‘__NR_memfd_create’ undeclared (first use in this function)
    p->fd = syscall(__NR_memfd_create, "prime-area", MFD_CLOEXEC);
                    ^
  samples/kdbus/kdbus-workers.c:930:18: note: each undeclared identifier is reported only once for each function it appears in
  make[2]: *** [samples/kdbus/kdbus-workers] Error 1

Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com>
---
 samples/kdbus/kdbus-workers.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/samples/kdbus/kdbus-workers.c b/samples/kdbus/kdbus-workers.c
index d331e01..0affd23 100644
--- a/samples/kdbus/kdbus-workers.c
+++ b/samples/kdbus/kdbus-workers.c
@@ -910,6 +910,8 @@ exit:
  *
  */
 
+#ifdef __NR_memfd_create
+
 static int prime_new(struct prime **out)
 {
 	struct prime *p;
@@ -954,6 +956,15 @@ error:
 	return r;
 }
 
+#else
+
+static int prime_new(struct prime **out)
+{
+	return err("the architecture does not support memfd_create");
+}
+
+#endif
+
 static void prime_free(struct prime *p)
 {
 	if (!p)
-- 
1.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-04-04 22:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-03 22:17 samples: kdbus: kdbus-workers: Define dummy prime_new() Chen Gang
2015-04-03 22:42 ` Richard Weinberger
2015-04-04 21:18   ` Chen Gang
2015-04-04  8:26 ` Greg KH
2015-04-04 22:25   ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox