123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- /*
- This file is part of ethash.
- ethash is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- ethash is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with ethash. If not, see <http://www.gnu.org/licenses/>.
- */
- /** @file mmap.h
- * @author Lefteris Karapetsas <lefteris@ethdev.com>
- * @date 2015
- */
- #pragma once
- #if defined(__MINGW32__) || defined(_WIN32)
- #include <sys/types.h>
- #define PROT_READ 0x1
- #define PROT_WRITE 0x2
- /* This flag is only available in WinXP+ */
- #ifdef FILE_MAP_EXECUTE
- #define PROT_EXEC 0x4
- #else
- #define PROT_EXEC 0x0
- #define FILE_MAP_EXECUTE 0
- #endif
- #define MAP_SHARED 0x01
- #define MAP_PRIVATE 0x02
- #define MAP_ANONYMOUS 0x20
- #define MAP_ANON MAP_ANONYMOUS
- #define MAP_FAILED ((void *) -1)
- void* mmap(void* start, size_t length, int prot, int flags, int fd, off_t offset);
- void munmap(void* addr, size_t length);
- #else // posix, yay! ^_^
- #include <sys/mman.h>
- #endif
|