| 1 | /*
|
|---|
| 2 | * shred_mman.h - Shared structures & mnemonics used by the <mman.h> user library.
|
|---|
| 3 | *
|
|---|
| 4 | * Author Alain Greiner (2016,2017,2018,2019)
|
|---|
| 5 | *
|
|---|
| 6 | * Copyright (c) UPMC Sorbonne Universites
|
|---|
| 7 | *
|
|---|
| 8 | * This file is part of ALMOS-MKH.
|
|---|
| 9 | *
|
|---|
| 10 | * ALMOS-MKH is free software; you can redistribute it and/or modify it
|
|---|
| 11 | * under the terms of the GNU General Public License as published by
|
|---|
| 12 | * the Free Software Foundation; version 2.0 of the License.
|
|---|
| 13 | *
|
|---|
| 14 | * ALMOS-MKH is distributed in the hope that it will be useful, but
|
|---|
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 17 | * General Public License for more details.
|
|---|
| 18 | *
|
|---|
| 19 | * You should have received a copy of the GNU General Public License
|
|---|
| 20 | * along with ALMOS-MKH; if not, write to the Free Software Foundation,
|
|---|
| 21 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|---|
| 22 | */
|
|---|
| 23 |
|
|---|
| 24 | #ifndef _SHARED_MMAN_H_
|
|---|
| 25 | #define _SHARED_MMAN_H_
|
|---|
| 26 |
|
|---|
| 27 | /*******************************************************************************************
|
|---|
| 28 | * This structure is used by the mmap() syscall().
|
|---|
| 29 | ******************************************************************************************/
|
|---|
| 30 |
|
|---|
| 31 | typedef enum
|
|---|
| 32 | {
|
|---|
| 33 | PROT_NONE = 0x0, /*! no access */
|
|---|
| 34 | PROT_EXEC = 0x1, /*! executable */
|
|---|
| 35 | PROT_WRITE = 0x2, /*! writable */
|
|---|
| 36 | PROT_READ = 0x4, /*! readable */
|
|---|
| 37 | }
|
|---|
| 38 | mmap_prot_t;
|
|---|
| 39 |
|
|---|
| 40 | typedef enum
|
|---|
| 41 | {
|
|---|
| 42 | MAP_FILE = 0x00000000, /*! map an open file defined by its fdid */
|
|---|
| 43 | MAP_ANON = 0x00000001, /*! map an anonymous vseg in local cluster */
|
|---|
| 44 | MAP_REMOTE = 0x00000002, /*! map an anonymous vseg in remote cluster (cxy == fdid) */
|
|---|
| 45 | MAP_PRIVATE = 0x00000010, /*! modifications are private to the calling process */
|
|---|
| 46 | MAP_SHARED = 0x00000020, /*! modifications are shared */
|
|---|
| 47 | MAP_FIXED = 0x00000100, /*! non supported (user defined base address) */
|
|---|
| 48 | }
|
|---|
| 49 | mmap_flags_t;
|
|---|
| 50 |
|
|---|
| 51 | typedef struct mmap_attr_s
|
|---|
| 52 | {
|
|---|
| 53 | void * addr; /*! buffer for allocated vseg base address (return value) */
|
|---|
| 54 | unsigned int length; /*! requested vseg size (bytes) */
|
|---|
| 55 | unsigned int prot; /*! access modes */
|
|---|
| 56 | unsigned int flags; /*! MAP_FILE / MAP_ANON / MAP_PRIVATE / MAP_SHARED */
|
|---|
| 57 | unsigned int fdid; /*! file descriptor index (if MAP_FILE) */
|
|---|
| 58 | unsigned int offset; /*! file offset (if MAP_FILE) */
|
|---|
| 59 | }
|
|---|
| 60 | mmap_attr_t;
|
|---|
| 61 |
|
|---|
| 62 | #endif
|
|---|