All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xf86drm: only include <sys/sysctl.h> for FreeBSD build case
       [not found] <CGME20200109092903epcas1p49de22b4892ff4c6e205fb098c83c76ae@epcas1p4.samsung.com>
@ 2020-01-09  9:32 ` Seung-Woo Kim
  2020-01-09 15:18   ` Jani Nikula
  0 siblings, 1 reply; 8+ messages in thread
From: Seung-Woo Kim @ 2020-01-09  9:32 UTC (permalink / raw)
  To: dri-devel; +Cc: eric.engestrom, zeising, sw0312.kim

The <sys/sysctl.h> header is only required FreeBSD and GNU libc
2.30 starts to warn about Linux specific <sys/sysctl.h> header
deprecation. Only include <sys/sysctl.h> for FreeBSD.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
 xf86drmMode.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/xf86drmMode.c b/xf86drmMode.c
index 207d7be..ff1d31d 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -42,9 +42,11 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <sys/ioctl.h>
+#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
 #ifdef HAVE_SYS_SYSCTL_H
 #include <sys/sysctl.h>
 #endif
+#endif /* defined (__FreeBSD__) || defined (__FreeBSD_kernel__) */
 #include <stdio.h>
 #include <stdbool.h>
 
-- 
1.7.4.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] xf86drm: only include <sys/sysctl.h> for FreeBSD build case
  2020-01-09  9:32 ` [PATCH] xf86drm: only include <sys/sysctl.h> for FreeBSD build case Seung-Woo Kim
@ 2020-01-09 15:18   ` Jani Nikula
  2020-01-09 15:28     ` Niclas Zeising
  2020-01-10  0:47     ` Seung-Woo Kim
  0 siblings, 2 replies; 8+ messages in thread
From: Jani Nikula @ 2020-01-09 15:18 UTC (permalink / raw)
  To: Seung-Woo Kim, dri-devel; +Cc: eric.engestrom, zeising, sw0312.kim

On Thu, 09 Jan 2020, Seung-Woo Kim <sw0312.kim@samsung.com> wrote:
> The <sys/sysctl.h> header is only required FreeBSD and GNU libc
> 2.30 starts to warn about Linux specific <sys/sysctl.h> header
> deprecation. Only include <sys/sysctl.h> for FreeBSD.
>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
>  xf86drmMode.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/xf86drmMode.c b/xf86drmMode.c
> index 207d7be..ff1d31d 100644
> --- a/xf86drmMode.c
> +++ b/xf86drmMode.c
> @@ -42,9 +42,11 @@
>  #include <stdint.h>
>  #include <stdlib.h>
>  #include <sys/ioctl.h>
> +#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
>  #ifdef HAVE_SYS_SYSCTL_H

Not that I know anything about this, but shouldn't you instead fix
HAVE_SYS_SYSCTL_H definition in configure stage to only be enabled on
FreeBSD?

BR,
Jani.

>  #include <sys/sysctl.h>
>  #endif
> +#endif /* defined (__FreeBSD__) || defined (__FreeBSD_kernel__) */
>  #include <stdio.h>
>  #include <stdbool.h>

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] xf86drm: only include <sys/sysctl.h> for FreeBSD build case
  2020-01-09 15:18   ` Jani Nikula
@ 2020-01-09 15:28     ` Niclas Zeising
  2020-01-10  0:52       ` Seung-Woo Kim
  2020-01-10  0:47     ` Seung-Woo Kim
  1 sibling, 1 reply; 8+ messages in thread
From: Niclas Zeising @ 2020-01-09 15:28 UTC (permalink / raw)
  To: Jani Nikula, Seung-Woo Kim, dri-devel; +Cc: eric.engestrom

On 2020-01-09 16:18, Jani Nikula wrote:
> On Thu, 09 Jan 2020, Seung-Woo Kim <sw0312.kim@samsung.com> wrote:
>> The <sys/sysctl.h> header is only required FreeBSD and GNU libc
>> 2.30 starts to warn about Linux specific <sys/sysctl.h> header
>> deprecation. Only include <sys/sysctl.h> for FreeBSD.
>>
>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>> ---
>>   xf86drmMode.c |    2 ++
>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/xf86drmMode.c b/xf86drmMode.c
>> index 207d7be..ff1d31d 100644
>> --- a/xf86drmMode.c
>> +++ b/xf86drmMode.c
>> @@ -42,9 +42,11 @@
>>   #include <stdint.h>
>>   #include <stdlib.h>
>>   #include <sys/ioctl.h>
>> +#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
>>   #ifdef HAVE_SYS_SYSCTL_H
> 
> Not that I know anything about this, but shouldn't you instead fix
> HAVE_SYS_SYSCTL_H definition in configure stage to only be enabled on
> FreeBSD?
> 
> BR,
> Jani.
> 
>>   #include <sys/sysctl.h>
>>   #endif
>> +#endif /* defined (__FreeBSD__) || defined (__FreeBSD_kernel__) */
>>   #include <stdio.h>
>>   #include <stdbool.h>
> 

Hi!
This fix looks OK on FreeBSD (I haven't had time to test), however, as 
has been pointed out, perhaps the change should go into the meson build 
script or configure instead.
I don't know if other OSes (other BSDs primarily) need this as well. 
I'm pretty sure it's needed on DragonflyBSD at least.
Perhaps keep the include for everything except Linux for the time being?
Regards
-- 
Niclas Zeising
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] xf86drm: only include <sys/sysctl.h> for FreeBSD build case
  2020-01-09 15:18   ` Jani Nikula
  2020-01-09 15:28     ` Niclas Zeising
@ 2020-01-10  0:47     ` Seung-Woo Kim
  1 sibling, 0 replies; 8+ messages in thread
From: Seung-Woo Kim @ 2020-01-10  0:47 UTC (permalink / raw)
  To: Jani Nikula; +Cc: eric.engestrom, zeising, Seung-Woo Kim, dri-devel

Hi,

On 2020년 01월 10일 00:18, Jani Nikula wrote:
> On Thu, 09 Jan 2020, Seung-Woo Kim <sw0312.kim@samsung.com> wrote:
>> The <sys/sysctl.h> header is only required FreeBSD and GNU libc
>> 2.30 starts to warn about Linux specific <sys/sysctl.h> header
>> deprecation. Only include <sys/sysctl.h> for FreeBSD.
>>
>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>> ---
>>  xf86drmMode.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/xf86drmMode.c b/xf86drmMode.c
>> index 207d7be..ff1d31d 100644
>> --- a/xf86drmMode.c
>> +++ b/xf86drmMode.c
>> @@ -42,9 +42,11 @@
>>  #include <stdint.h>
>>  #include <stdlib.h>
>>  #include <sys/ioctl.h>
>> +#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
>>  #ifdef HAVE_SYS_SYSCTL_H
> 
> Not that I know anything about this, but shouldn't you instead fix
> HAVE_SYS_SYSCTL_H definition in configure stage to only be enabled on
> FreeBSD?

That seems better even in the xf86drmMode.c, <sys/sysctl.h> is required
for sysctlbyname() called from drmCheckModesettingSupported() with
FeeBSD build macro.

Unfortunately, I am not the meson build expert so if there is someone to
fix, then I am okay. Anyway, I will try to fix with HAVE_SYS_SYSCTL_H.

Best Regards,
- Seung-Woo Kim

> 
> BR,
> Jani.
> 
>>  #include <sys/sysctl.h>
>>  #endif
>> +#endif /* defined (__FreeBSD__) || defined (__FreeBSD_kernel__) */
>>  #include <stdio.h>
>>  #include <stdbool.h>
> 

-- 
Seung-Woo Kim
Samsung Research
--

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] xf86drm: only include <sys/sysctl.h> for FreeBSD build case
  2020-01-09 15:28     ` Niclas Zeising
@ 2020-01-10  0:52       ` Seung-Woo Kim
  0 siblings, 0 replies; 8+ messages in thread
From: Seung-Woo Kim @ 2020-01-10  0:52 UTC (permalink / raw)
  To: Niclas Zeising; +Cc: eric.engestrom, Seung-Woo Kim, dri-devel

Hi

On 2020년 01월 10일 00:28, Niclas Zeising wrote:
> On 2020-01-09 16:18, Jani Nikula wrote:
>> On Thu, 09 Jan 2020, Seung-Woo Kim <sw0312.kim@samsung.com> wrote:
>>> The <sys/sysctl.h> header is only required FreeBSD and GNU libc
>>> 2.30 starts to warn about Linux specific <sys/sysctl.h> header
>>> deprecation. Only include <sys/sysctl.h> for FreeBSD.
>>>
>>> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
>>> ---
>>>   xf86drmMode.c |    2 ++
>>>   1 files changed, 2 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/xf86drmMode.c b/xf86drmMode.c
>>> index 207d7be..ff1d31d 100644
>>> --- a/xf86drmMode.c
>>> +++ b/xf86drmMode.c
>>> @@ -42,9 +42,11 @@
>>>   #include <stdint.h>
>>>   #include <stdlib.h>
>>>   #include <sys/ioctl.h>
>>> +#if defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
>>>   #ifdef HAVE_SYS_SYSCTL_H
>>
>> Not that I know anything about this, but shouldn't you instead fix
>> HAVE_SYS_SYSCTL_H definition in configure stage to only be enabled on
>> FreeBSD?
>>
>> BR,
>> Jani.
>>
>>>   #include <sys/sysctl.h>
>>>   #endif
>>> +#endif /* defined (__FreeBSD__) || defined (__FreeBSD_kernel__) */
>>>   #include <stdio.h>
>>>   #include <stdbool.h>
>>
> 
> Hi!
> This fix looks OK on FreeBSD (I haven't had time to test), however, as
> has been pointed out, perhaps the change should go into the meson build
> script or configure instead.

Ok, I will try to fix in build side instead of include itself.

> I don't know if other OSes (other BSDs primarily) need this as well. I'm
> pretty sure it's needed on DragonflyBSD at least.
> Perhaps keep the include for everything except Linux for the time being?

As far as I checked, sysctlbyname() called only with FreeBSD build flag
is only function defined in <sys/sysctl.h> at least for xf86drmMode.c,
but I missed something. The header deprecation is done from Linux, so it
seems fine removing the header include only for Linux.

Best Regards,
- Seung-Woo Kim

> Regards

-- 
Seung-Woo Kim
Samsung Research
--

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* [PATCH libdrm] meson.build: Don't detect <sys/sysctl.h> header for linux
       [not found] <CGME20200110042734epcas1p1a80d5c2c9dd1fb3c2be7bb869cdc4311@epcas1p1.samsung.com>
@ 2020-01-10  4:30 ` Seung-Woo Kim
  2020-01-29  9:53   ` Eric Engestrom
  0 siblings, 1 reply; 8+ messages in thread
From: Seung-Woo Kim @ 2020-01-10  4:30 UTC (permalink / raw)
  To: dri-devel; +Cc: eric.engestrom, zeising, sw0312.kim

The <sys/sysctl.h> header is not required for Linux and GNU libc
2.30 starts to warn about Linux specific <sys/sysctl.h> header
deprecation. Don't detect <sys/sysctl.h> header for linux.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
Fix meson.build script instead of code itself as commented below:
https://patchwork.kernel.org/patch/11325345/
---
 meson.build |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 782b1a3..b1c557a 100644
--- a/meson.build
+++ b/meson.build
@@ -183,10 +183,17 @@ else
   dep_rt = []
 endif
 dep_m = cc.find_library('m', required : false)
-# From Niclas Zeising:
-# FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
-# includes when checking for headers.
-foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
+if not ['linux'].contains(host_machine.system())
+  # From Niclas Zeising:
+  # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
+  # includes when checking for headers.
+  foreach header : ['sys/sysctl.h']
+    config.set('HAVE_' + header.underscorify().to_upper(),
+      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
+  endforeach
+endif
+endforeach
+foreach header : ['sys/select.h', 'alloca.h']
   config.set('HAVE_' + header.underscorify().to_upper(),
     cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
 endforeach
-- 
1.7.4.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH libdrm] meson.build: Don't detect <sys/sysctl.h> header for linux
  2020-01-10  4:30 ` [PATCH libdrm] meson.build: Don't detect <sys/sysctl.h> header for linux Seung-Woo Kim
@ 2020-01-29  9:53   ` Eric Engestrom
  2020-03-29 21:05     ` Eric Engestrom
  0 siblings, 1 reply; 8+ messages in thread
From: Eric Engestrom @ 2020-01-29  9:53 UTC (permalink / raw)
  To: Seung-Woo Kim; +Cc: zeising, dri-devel

On Friday, 2020-01-10 13:30:41 +0900, Seung-Woo Kim wrote:
> The <sys/sysctl.h> header is not required for Linux and GNU libc
> 2.30 starts to warn about Linux specific <sys/sysctl.h> header
> deprecation. Don't detect <sys/sysctl.h> header for linux.
> 
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
> Fix meson.build script instead of code itself as commented below:
> https://patchwork.kernel.org/patch/11325345/
> ---
>  meson.build |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 782b1a3..b1c557a 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -183,10 +183,17 @@ else
>    dep_rt = []
>  endif
>  dep_m = cc.find_library('m', required : false)
> -# From Niclas Zeising:
> -# FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> -# includes when checking for headers.
> -foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
> +if not ['linux'].contains(host_machine.system())
> +  # From Niclas Zeising:
> +  # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> +  # includes when checking for headers.
> +  foreach header : ['sys/sysctl.h']
> +    config.set('HAVE_' + header.underscorify().to_upper(),
> +      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
> +  endforeach
> +endif
> +endforeach

Stray `endforeach`.

Could you post your patch as a Merge Request [1] instead of on the mailing list?
The automatic testing there means it would instantly catch mistakes like these :)

[1] https://gitlab.freedesktop.org/mesa/drm/merge_requests

> +foreach header : ['sys/select.h', 'alloca.h']
>    config.set('HAVE_' + header.underscorify().to_upper(),
>      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))

Can you drop the `#include <sys/types.h>\n` now that sys/sysctl.h is
being split out?

Note that since https://gitlab.freedesktop.org/mesa/drm/merge_requests/8
we now use config.set10(), which means you'll need to refactor a tiny
bit (move the !linux condition inside the config.set10() call).

The new code block should look like this:

  # From Niclas Zeising:
  # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
  # includes when checking for headers.
  foreach header : ['sys/sysctl.h']
    config.set10('HAVE_' + header.underscorify().to_upper(),
       not ['linux'].contains(host_machine.system()) and
       cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
  endforeach

With that:
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH libdrm] meson.build: Don't detect <sys/sysctl.h> header for linux
  2020-01-29  9:53   ` Eric Engestrom
@ 2020-03-29 21:05     ` Eric Engestrom
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Engestrom @ 2020-03-29 21:05 UTC (permalink / raw)
  To: Seung-Woo Kim; +Cc: zeising, dri-devel

On Wednesday, 2020-01-29 09:53:16 +0000, Eric Engestrom wrote:
> On Friday, 2020-01-10 13:30:41 +0900, Seung-Woo Kim wrote:
> > The <sys/sysctl.h> header is not required for Linux and GNU libc
> > 2.30 starts to warn about Linux specific <sys/sysctl.h> header
> > deprecation. Don't detect <sys/sysctl.h> header for linux.
> > 
> > Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> > ---
> > Fix meson.build script instead of code itself as commented below:
> > https://patchwork.kernel.org/patch/11325345/
> > ---
> >  meson.build |   15 +++++++++++----
> >  1 files changed, 11 insertions(+), 4 deletions(-)
> > 
> > diff --git a/meson.build b/meson.build
> > index 782b1a3..b1c557a 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -183,10 +183,17 @@ else
> >    dep_rt = []
> >  endif
> >  dep_m = cc.find_library('m', required : false)
> > -# From Niclas Zeising:
> > -# FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> > -# includes when checking for headers.
> > -foreach header : ['sys/sysctl.h', 'sys/select.h', 'alloca.h']
> > +if not ['linux'].contains(host_machine.system())
> > +  # From Niclas Zeising:
> > +  # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
> > +  # includes when checking for headers.
> > +  foreach header : ['sys/sysctl.h']
> > +    config.set('HAVE_' + header.underscorify().to_upper(),
> > +      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
> > +  endforeach
> > +endif
> > +endforeach
> 
> Stray `endforeach`.
> 
> Could you post your patch as a Merge Request [1] instead of on the mailing list?
> The automatic testing there means it would instantly catch mistakes like these :)
> 
> [1] https://gitlab.freedesktop.org/mesa/drm/merge_requests
> 
> > +foreach header : ['sys/select.h', 'alloca.h']
> >    config.set('HAVE_' + header.underscorify().to_upper(),
> >      cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
> 
> Can you drop the `#include <sys/types.h>\n` now that sys/sysctl.h is
> being split out?
> 
> Note that since https://gitlab.freedesktop.org/mesa/drm/merge_requests/8
> we now use config.set10(), which means you'll need to refactor a tiny
> bit (move the !linux condition inside the config.set10() call).
> 
> The new code block should look like this:
> 
>   # From Niclas Zeising:
>   # FreeBSD requires sys/types.h for sys/sysctl.h, add it as part of the
>   # includes when checking for headers.
>   foreach header : ['sys/sysctl.h']
>     config.set10('HAVE_' + header.underscorify().to_upper(),
>        not ['linux'].contains(host_machine.system()) and
>        cc.compiles('#include <sys/types.h>\n#include <@0@>'.format(header), name : '@0@ works'.format(header)))
>   endforeach

FYI, I have posted a variant of the above as a merge request:
https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/53
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-03-29 21:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20200109092903epcas1p49de22b4892ff4c6e205fb098c83c76ae@epcas1p4.samsung.com>
2020-01-09  9:32 ` [PATCH] xf86drm: only include <sys/sysctl.h> for FreeBSD build case Seung-Woo Kim
2020-01-09 15:18   ` Jani Nikula
2020-01-09 15:28     ` Niclas Zeising
2020-01-10  0:52       ` Seung-Woo Kim
2020-01-10  0:47     ` Seung-Woo Kim
     [not found] <CGME20200110042734epcas1p1a80d5c2c9dd1fb3c2be7bb869cdc4311@epcas1p1.samsung.com>
2020-01-10  4:30 ` [PATCH libdrm] meson.build: Don't detect <sys/sysctl.h> header for linux Seung-Woo Kim
2020-01-29  9:53   ` Eric Engestrom
2020-03-29 21:05     ` Eric Engestrom

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.