[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] [UNIKRAFT NGINX 4/5] Add patches



Hi Mihai,

Please see inline.

On 10/9/19 1:42 AM, Mihai Pogonaru wrote:
> The first patch renames the main function in Nginx to nginx_main to
> let the app using this library provide its own main function.
> It also disables the setting of the process title in Nginx.
> 
> The second patch disables semaphore sharing between processes in
> Nginx.
> 
> Signed-off-by: Mihai Pogonaru <pogonarumihai@xxxxxxxxx>
> ---
>  ...e-main-and-force-setproctitle-to-be-a-nop.patch | 39 
> ++++++++++++++++++++++
>  ...edded-does-not-allow-semaphores-shared-be.patch | 27 +++++++++++++++
>  2 files changed, 66 insertions(+)
>  create mode 100644 
> patches/0001-Rename-main-and-force-setproctitle-to-be-a-nop.patch
>  create mode 100644 
> patches/0002-pthread-embedded-does-not-allow-semaphores-shared-be.patch
> 
> diff --git 
> a/patches/0001-Rename-main-and-force-setproctitle-to-be-a-nop.patch 
> b/patches/0001-Rename-main-and-force-setproctitle-to-be-a-nop.patch
> new file mode 100644
> index 0000000..795adbd
> --- /dev/null
> +++ b/patches/0001-Rename-main-and-force-setproctitle-to-be-a-nop.patch
> @@ -0,0 +1,39 @@
> +From f6c9df931cd57fd9670a3ed8218d0fb5e262a03e Mon Sep 17 00:00:00 2001
> +From: Mihai Pogonaru <pogonarumihai@xxxxxxxxx>
> +Date: Sat, 1 Jun 2019 02:03:51 +0300
> +Subject: [PATCH] Rename main and force setproctitle to be a nop
> +
> +---
> + src/core/nginx.c               | 2 +-
> + src/os/unix/ngx_setproctitle.h | 2 +-
> + 2 files changed, 2 insertions(+), 2 deletions(-)
> +
> +diff --git a/src/core/nginx.c b/src/core/nginx.c
> +index 9fcb0eb..a8258d9 100644
> +--- a/src/core/nginx.c
> ++++ b/src/core/nginx.c
> +@@ -192,7 +192,7 @@ static char **ngx_os_environ;
> + 
> + 
> + int ngx_cdecl
> +-main(int argc, char *const *argv)
> ++nginx_main(int argc, char *const *argv)

We can skip doing this if we use the C preprocessor instead. If we
define -Dmain=nginx_main then the preprocessor will do the trick. You
can set this option only for src/core/nginx.c in the Makefile.uk like this:

LIBNGINX_NGINX_FLAGS-y += -Dmain=nginx_main

The rule is: LIBNAME_BASENAME_FLAGS-y += ...

> + {
> +     ngx_buf_t        *b;
> +     ngx_log_t        *log;
> +diff --git a/src/os/unix/ngx_setproctitle.h b/src/os/unix/ngx_setproctitle.h
> +index c363662..0f9acbe 100644
> +--- a/src/os/unix/ngx_setproctitle.h
> ++++ b/src/os/unix/ngx_setproctitle.h
> +@@ -29,7 +29,7 @@
> + ngx_int_t ngx_init_setproctitle(ngx_log_t *log);
> + void ngx_setproctitle(char *title);
> + 
> +-#elif (NGX_LINUX) || (NGX_DARWIN)
> ++#elif 0 //(NGX_LINUX) || (NGX_DARWIN)

Why do we disable setting the "process" title?

> + 
> + #define NGX_SETPROCTITLE_USES_ENV  1
> + #define NGX_SETPROCTITLE_PAD       '\0'
> +-- 
> +2.11.0
> +
> diff --git 
> a/patches/0002-pthread-embedded-does-not-allow-semaphores-shared-be.patch 
> b/patches/0002-pthread-embedded-does-not-allow-semaphores-shared-be.patch
> new file mode 100644
> index 0000000..dc8b94b
> --- /dev/null
> +++ b/patches/0002-pthread-embedded-does-not-allow-semaphores-shared-be.patch
> @@ -0,0 +1,27 @@
> +From 30557083a93221ea1e5817c60bad16d4bd13a16c Mon Sep 17 00:00:00 2001
> +From: Mihai Pogonaru <pogonarumihai@xxxxxxxxx>
> +Date: Fri, 14 Jun 2019 01:31:43 +0300
> +Subject: [PATCH] pthread-embedded does not allow semaphores shared between
> + processes
> +
> +Signed-off-by: Mihai Pogonaru <pogonarumihai@xxxxxxxxx>
> +---
> + src/core/ngx_shmtx.c | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/src/core/ngx_shmtx.c b/src/core/ngx_shmtx.c
> +index a255903..6da5cab 100644
> +--- a/src/core/ngx_shmtx.c
> ++++ b/src/core/ngx_shmtx.c
> +@@ -30,7 +30,7 @@ ngx_shmtx_create(ngx_shmtx_t *mtx, ngx_shmtx_sh_t *addr, 
> u_char *name)
> + 
> +     mtx->wait = &addr->wait;
> + 
> +-    if (sem_init(&mtx->sem, 1, 0) == -1) {
> ++    if (sem_init(&mtx->sem, 0, 0) == -1) {
> +         ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_errno,
> +                       "sem_init() failed");
> +     } else {
> +-- 
> +2.11.0
> +
> 

_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.