view src/os/win32/ngx_errno.h @ 6133:af7eba90645d

Win32: shared memory base addresses and remapping. Two mechanisms are implemented to make it possible to store pointers in shared memory on Windows, in particular on Windows Vista and later versions with ASLR: - The ngx_shm_remap() function added to allow remapping of a shared memory zone to the address originally used for it in the master process. While important, it doesn't solve the problem by itself as in many cases it's not possible to use the address because of conflicts with other allocations. - We now create mappings at the same address in all processes by starting mappings at predefined addresses normally unused by newborn processes. These two mechanisms combined allow to use shared memory on Windows almost without problems, including reloads. Based on the patch by Sergey Brester: http://mailman.nginx.org/pipermail/nginx-devel/2015-April/006836.html
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 27 Apr 2015 18:25:42 +0300
parents 3c5ddf0575d8
children a5897d360977
line wrap: on
line source


/*
 * Copyright (C) Igor Sysoev
 * Copyright (C) Nginx, Inc.
 */


#ifndef _NGX_ERRNO_H_INCLUDED_
#define _NGX_ERRNO_H_INCLUDED_


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


typedef DWORD                      ngx_err_t;

#define ngx_errno                  GetLastError()
#define ngx_set_errno(err)         SetLastError(err)
#define ngx_socket_errno           WSAGetLastError()
#define ngx_set_socket_errno(err)  WSASetLastError(err)

#define NGX_EPERM                  ERROR_ACCESS_DENIED
#define NGX_ENOENT                 ERROR_FILE_NOT_FOUND
#define NGX_ENOPATH                ERROR_PATH_NOT_FOUND
#define NGX_ENOMEM                 ERROR_NOT_ENOUGH_MEMORY
#define NGX_EACCES                 ERROR_ACCESS_DENIED
/* it's seems that ERROR_FILE_EXISTS is not appropriate error code */
#define NGX_EEXIST                 ERROR_ALREADY_EXISTS
/*
 * could not found cross volume directory move error code,
 * so use ERROR_WRONG_DISK as stub one
 */
#define NGX_EXDEV                  ERROR_WRONG_DISK
#define NGX_ENOTDIR                ERROR_PATH_NOT_FOUND
#define NGX_EISDIR                 ERROR_CANNOT_MAKE
#define NGX_ENOSPC                 ERROR_DISK_FULL
#define NGX_EPIPE                  EPIPE
#define NGX_EAGAIN                 WSAEWOULDBLOCK
#define NGX_EINPROGRESS            WSAEINPROGRESS
#define NGX_ENOPROTOOPT            WSAENOPROTOOPT
#define NGX_EOPNOTSUPP             WSAEOPNOTSUPP
#define NGX_EADDRINUSE             WSAEADDRINUSE
#define NGX_ECONNABORTED           WSAECONNABORTED
#define NGX_ECONNRESET             WSAECONNRESET
#define NGX_ENOTCONN               WSAENOTCONN
#define NGX_ETIMEDOUT              WSAETIMEDOUT
#define NGX_ECONNREFUSED           WSAECONNREFUSED
#define NGX_ENAMETOOLONG           ERROR_BAD_PATHNAME
#define NGX_ENETDOWN               WSAENETDOWN
#define NGX_ENETUNREACH            WSAENETUNREACH
#define NGX_EHOSTDOWN              WSAEHOSTDOWN
#define NGX_EHOSTUNREACH           WSAEHOSTUNREACH
#define NGX_ENOMOREFILES           ERROR_NO_MORE_FILES
#define NGX_EILSEQ                 ERROR_NO_UNICODE_TRANSLATION
#define NGX_ELOOP                  0
#define NGX_EBADF                  WSAEBADF

#define NGX_EALREADY               WSAEALREADY
#define NGX_EINVAL                 WSAEINVAL
#define NGX_EMFILE                 WSAEMFILE
#define NGX_ENFILE                 WSAEMFILE


u_char *ngx_strerror(ngx_err_t err, u_char *errstr, size_t size);
ngx_int_t ngx_strerror_init(void);


#endif /* _NGX_ERRNO_H_INCLUDED_ */