On Fri, Nov 24, 2017 at 07:12:31AM +0300, Maxim Dounin wrote:
> + if (read(pp[0], buf, 1) != 1) {
> + ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "read() pipe failed");
> + return NGX_ERROR;
> + }
> +
> + if (close(pp[0]) == -1) {
> + ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "close() failed");
"close() pipe failed"
> + return NGX_ERROR;
> + }
> +
> exit(0);
> }
>
> @@ -68,3 +98,26 @@
>
> return NGX_OK;
> }
> +
> +
> +ngx_int_t
> +ngx_daemon_sync(ngx_log_t *log)
> +{
> + if (ngx_daemon_fd == NGX_INVALID_FILE) {
> + return NGX_OK;
> + }
> +
> + if (write(ngx_daemon_fd, "", 1) != 1) {
> + ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "write() failed");
"write() pipe failed"
> + return NGX_ERROR;
> + }
> +
> + if (close(ngx_daemon_fd) == -1) {
> + ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "close() failed");
"close() pipe failed"
> + return NGX_ERROR;
Можно ещё заменить "pp" на "sync_fd" / "sync_pipe".
--
Eugene Berdnikov
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru