[PATCH]: Improve Haiku build

Maxim Dounin mdounin at mdounin.ru
Fri Sep 24 02:52:26 UTC 2021


Hello!

On Thu, Sep 23, 2021 at 06:29:21PM +0100, David CARLIER wrote:

> Hi dear list,
> 
> here a patch proposal for the haiku os.
> 
> Kind regards.

> changeset:   7930:96ffec978b80
> tag:         improve_haiku_support_disable_unsupported_code_paths_adding_specific_build_
> tag:         qbase
> tag:         qtip
> tag:         tip
> user:        David Carlier <devnexen at gmail.com>
> date:        Thu Sep 23 18:13:21 2021 +0000
> summary:     Improve Haiku support/disable unsupported code paths, adding specific build config components.
> 
> diff -r bfad703459b4 -r 96ffec978b80 auto/os/conf
> --- a/auto/os/conf	Wed Sep 22 10:20:00 2021 +0300
> +++ b/auto/os/conf	Thu Sep 23 18:13:21 2021 +0000
> @@ -27,6 +27,10 @@
>          . auto/os/win32
>      ;;
>  
> +    Haiku:*)
> +        . auto/os/haiku
> +    ;;
> +
>      DragonFly:*)
>          have=NGX_FREEBSD . auto/have_headers
>          CORE_INCS="$UNIX_INCS"
> diff -r bfad703459b4 -r 96ffec978b80 auto/sources
> --- a/auto/sources	Wed Sep 22 10:20:00 2021 +0300
> +++ b/auto/sources	Thu Sep 23 18:13:21 2021 +0000
> @@ -208,6 +208,8 @@
>  DARWIN_SRCS=src/os/unix/ngx_darwin_init.c
>  DARWIN_SENDFILE_SRCS=src/os/unix/ngx_darwin_sendfile_chain.c
>  
> +HAIKU_DEPS="src/os/unix/ngx_haiku_config.h"
> +
>  
>  WIN32_INCS="$CORE_INCS $EVENT_INCS src/os/win32"
>  
> diff -r bfad703459b4 -r 96ffec978b80 src/core/ngx_config.h
> --- a/src/core/ngx_config.h	Wed Sep 22 10:20:00 2021 +0300
> +++ b/src/core/ngx_config.h	Thu Sep 23 18:13:21 2021 +0000
> @@ -37,6 +37,8 @@
>  #elif (NGX_WIN32)
>  #include <ngx_win32_config.h>
>  
> +#elif (NGX_HAIKU)
> +#include <ngx_haiku_config.h>
>  
>  #else /* POSIX */
>  #include <ngx_posix_config.h>
> diff -r bfad703459b4 -r 96ffec978b80 src/os/unix/ngx_process.c
> --- a/src/os/unix/ngx_process.c	Wed Sep 22 10:20:00 2021 +0300
> +++ b/src/os/unix/ngx_process.c	Thu Sep 23 18:13:21 2021 +0000
> @@ -87,7 +87,9 @@
>  ngx_spawn_process(ngx_cycle_t *cycle, ngx_spawn_proc_pt proc, void *data,
>      char *name, ngx_int_t respawn)
>  {
> +#if !(NGX_HAIKU)
>      u_long     on;
> +#endif
>      ngx_pid_t  pid;
>      ngx_int_t  s;
>  
> @@ -142,6 +144,7 @@
>              return NGX_INVALID_PID;
>          }
>  
> +#if !(NGX_HAIKU)
>          on = 1;
>          if (ioctl(ngx_processes[s].channel[0], FIOASYNC, &on) == -1) {
>              ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
> @@ -156,6 +159,7 @@
>              ngx_close_channel(ngx_processes[s].channel, cycle->log);
>              return NGX_INVALID_PID;
>          }
> +#endif
>  
>          if (fcntl(ngx_processes[s].channel[0], F_SETFD, FD_CLOEXEC) == -1) {
>              ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
> 

Thanks for the patch.  It looks broken though, as it lacks the 
ngx_haiku_config.h file.  Further, it might be a better idea to 
avoid introducing HaikuOS-specific files and defines, and keep 
changes you want to introduce to better support HaikuOS under 
generic POSIX support instead.

Note well that simply disabling FIOASYNC isn't a good solution.  
While it might not be used now, it is certainly will be important 
when interprocess communications via channels will used for 
additional things, such as passing open file descriptors of log 
files from master to worker processes 
(https://trac.nginx.org/nginx/ticket/376).

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list