[PATCH] Workaround for systems that does not have PATH_MAX, like hurd.

Emil Velikov emil.l.velikov at gmail.com
Sun Apr 24 20:03:42 UTC 2016


Hi Tobias,

A couple of suggestions I missed the first time around.

On 24 April 2016 at 08:57, Tobias Frost <tobi at coldtobi.de> wrote:
> It is safe to define it here, as the code is only using it for string
> manipulation and not for syscalls that might make different assumptions.
> ---
>  xf86drm.c | 7 +++++++
>  xf86drm.h | 4 ++++
>  2 files changed, 11 insertions(+)
>
> diff --git a/xf86drm.c b/xf86drm.c
> index 45aa5fc..4dac7a4 100644
> --- a/xf86drm.c
> +++ b/xf86drm.c
> @@ -103,6 +103,13 @@
>
>  #define memclear(s) memset(&s, 0, sizeof(s))
>
> +/* for systems like hurd, which does not have PATH_MAX.
> + Usage is only for string manipulation, so it is save to define it.
> + 1kB will be plenty space.*/
> +#ifndef PATH_MAX
> +#define PATH_MAX (1024)
The brackets do not seem necessary.

> +#endif
> +
>  static drmServerInfoPtr drm_server_info;
>
>  void drmSetServerInfo(drmServerInfoPtr info)
> diff --git a/xf86drm.h b/xf86drm.h
> index 481d882..1d45f02 100644
> --- a/xf86drm.h
> +++ b/xf86drm.h
> @@ -58,7 +58,11 @@ extern "C" {
>
>  #else /* One of the *BSDs */
>
> +#if defined(__GNU__)
> +#include <mach/i386/ioccom.h>
The porting guidelines [1] does mention that ioctl.h is available
(although in the context of _IOT/_IOTS), so I'm wondering how come the
IOC_* symbols are not in there. Is there any documentation that says
that which header should be used ?

With the "i386" in the path, the above does look rather hacky. And
looking at the current code - can you please move the "one of the
BSDs" include at the top (before the extern C guard). The GNU one
should also be there.

Thanks
Emil


More information about the dri-devel mailing list