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

* Re: samples: kdbus: kdbus-workers: Define dummy prime_new()
  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
  1 sibling, 1 reply; 5+ messages in thread
From: Richard Weinberger @ 2015-04-03 22:42 UTC (permalink / raw)
  To: Chen Gang
  Cc: Greg KH, daniel, dh.herrmann, Djalal Harouni,
	linux-kernel@vger.kernel.org

On Sat, Apr 4, 2015 at 12:17 AM, Chen Gang <xili_gchen_5257@hotmail.com> wrote:
> 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.

Don't paper over the issue, just wire up the system call on blackfin.

For an example see:
commit f3240c1f6d18591b2c1ef33ed18d5ca91e62c104
Author: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Date:   Thu Dec 25 19:58:50 2014 +0100

    avr32: wire up missing syscalls

-- 
Thanks,
//richard

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

* Re: samples: kdbus: kdbus-workers: Define dummy prime_new()
  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  8:26 ` Greg KH
  2015-04-04 22:25   ` Chen Gang
  1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2015-04-04  8:26 UTC (permalink / raw)
  To: Chen Gang; +Cc: daniel, dh.herrmann, tixxdz, linux-kernel@vger.kernel.org

On Sat, Apr 04, 2015 at 06:17:23AM +0800, Chen Gang wrote:
> 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(+)

As Richard said, please hook up these syscalls to those architectures.
Don't you want to use the feature there?  Why hasn't it been added yet?

thanks,

greg k-h

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

* Re: samples: kdbus: kdbus-workers: Define dummy prime_new()
  2015-04-03 22:42 ` Richard Weinberger
@ 2015-04-04 21:18   ` Chen Gang
  0 siblings, 0 replies; 5+ messages in thread
From: Chen Gang @ 2015-04-04 21:18 UTC (permalink / raw)
  To: Richard Weinberger
  Cc: Greg KH, daniel, dh.herrmann, Djalal Harouni,
	linux-kernel@vger.kernel.org

On 4/4/15 06:42, Richard Weinberger wrote:
> On Sat, Apr 4, 2015 at 12:17 AM, Chen Gang <xili_gchen_5257@hotmail.com> wrote:
>> 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.
> 
> Don't paper over the issue, just wire up the system call on blackfin.
> 
> For an example see:
> commit f3240c1f6d18591b2c1ef33ed18d5ca91e62c104
> Author: Hans-Christian Egtvedt <egtvedt@samfundet.no>
> Date:   Thu Dec 25 19:58:50 2014 +0100
> 
>     avr32: wire up missing syscalls
> 

OK, thanks. I shall try to send patch v2 for it within this month.


Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

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

* Re: samples: kdbus: kdbus-workers: Define dummy prime_new()
  2015-04-04  8:26 ` Greg KH
@ 2015-04-04 22:25   ` Chen Gang
  0 siblings, 0 replies; 5+ messages in thread
From: Chen Gang @ 2015-04-04 22:25 UTC (permalink / raw)
  To: Greg KH; +Cc: daniel, dh.herrmann, tixxdz, linux-kernel@vger.kernel.org

On 4/4/15 16:26, Greg KH wrote:
> On Sat, Apr 04, 2015 at 06:17:23AM +0800, Chen Gang wrote:
>> 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(+)
> 
> As Richard said, please hook up these syscalls to those architectures.
> Don't you want to use the feature there?  Why hasn't it been added yet?
> 

OK, thanks. I shall try to finish blackfin within this month. And try
the other archs within next month.

Thanks.
-- 
Chen Gang

Open, share, and attitude like air, water, and life which God blessed

^ permalink raw reply	[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