2015-04-03 22:17:29

by Chen Gang

[permalink] [raw]
Subject: samples: kdbus: kdbus-workers: Define dummy prime_new()

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 <[email protected]>
---
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


2015-04-03 22:42:11

by Richard Weinberger

[permalink] [raw]
Subject: Re: samples: kdbus: kdbus-workers: Define dummy prime_new()

On Sat, Apr 4, 2015 at 12:17 AM, Chen Gang <[email protected]> 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 <[email protected]>
Date: Thu Dec 25 19:58:50 2014 +0100

avr32: wire up missing syscalls

--
Thanks,
//richard

2015-04-04 08:26:37

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: samples: kdbus: kdbus-workers: Define dummy prime_new()

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 <[email protected]>
> ---
> 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

2015-04-04 21:18:23

by Chen Gang

[permalink] [raw]
Subject: Re: samples: kdbus: kdbus-workers: Define dummy prime_new()

On 4/4/15 06:42, Richard Weinberger wrote:
> On Sat, Apr 4, 2015 at 12:17 AM, Chen Gang <[email protected]> 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 <[email protected]>
> 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

2015-04-04 22:25:22

by Chen Gang

[permalink] [raw]
Subject: Re: samples: kdbus: kdbus-workers: Define dummy prime_new()

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 <[email protected]>
>> ---
>> 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