src/os/unix/ngx_solaris_init.c - nginx-1.7.10

Global variables defined

Functions defined

Source code


  1. /*
  2. * Copyright (C) Igor Sysoev
  3. * Copyright (C) Nginx, Inc.
  4. */


  5. #include <ngx_config.h>
  6. #include <ngx_core.h>


  7. char ngx_solaris_sysname[20];
  8. char ngx_solaris_release[10];
  9. char ngx_solaris_version[50];


  10. static ngx_os_io_t ngx_solaris_io = {
  11.     ngx_unix_recv,
  12.     ngx_readv_chain,
  13.     ngx_udp_unix_recv,
  14.     ngx_unix_send,
  15. #if (NGX_HAVE_SENDFILE)
  16.     ngx_solaris_sendfilev_chain,
  17.     NGX_IO_SENDFILE
  18. #else
  19.     ngx_writev_chain,
  20.     0
  21. #endif
  22. };


  23. ngx_int_t
  24. ngx_os_specific_init(ngx_log_t *log)
  25. {
  26.     if (sysinfo(SI_SYSNAME, ngx_solaris_sysname, sizeof(ngx_solaris_sysname))
  27.         == -1)
  28.     {
  29.         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
  30.                       "sysinfo(SI_SYSNAME) failed");
  31.         return NGX_ERROR;
  32.     }

  33.     if (sysinfo(SI_RELEASE, ngx_solaris_release, sizeof(ngx_solaris_release))
  34.         == -1)
  35.     {
  36.         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
  37.                       "sysinfo(SI_RELEASE) failed");
  38.         return NGX_ERROR;
  39.     }

  40.     if (sysinfo(SI_VERSION, ngx_solaris_version, sizeof(ngx_solaris_version))
  41.         == -1)
  42.     {
  43.         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
  44.                       "sysinfo(SI_SYSNAME) failed");
  45.         return NGX_ERROR;
  46.     }


  47.     ngx_os_io = ngx_solaris_io;

  48.     return NGX_OK;
  49. }


  50. void
  51. ngx_os_specific_status(ngx_log_t *log)
  52. {

  53.     ngx_log_error(NGX_LOG_NOTICE, log, 0, "OS: %s %s",
  54.                   ngx_solaris_sysname, ngx_solaris_release);

  55.     ngx_log_error(NGX_LOG_NOTICE, log, 0, "version: %s",
  56.                   ngx_solaris_version);
  57. }