Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/mman.h
Show First 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
#define SHM_ANON ((char *)1) | #define SHM_ANON ((char *)1) | ||||
/* | /* | ||||
* shmflags for shm_open2() | * shmflags for shm_open2() | ||||
*/ | */ | ||||
#define SHM_ALLOW_SEALING 0x00000001 | #define SHM_ALLOW_SEALING 0x00000001 | ||||
#define SHM_GROW_ON_WRITE 0x00000002 | #define SHM_GROW_ON_WRITE 0x00000002 | ||||
#define SHM_LARGEPAGE 0x00000004 | |||||
#define SHM_LARGEPAGE_ALLOC_DEFAULT 0 | |||||
#define SHM_LARGEPAGE_ALLOC_NOWAIT 1 | |||||
#define SHM_LARGEPAGE_ALLOC_HARD 2 | |||||
struct shm_largepage_conf { | |||||
int psind; | |||||
int alloc_policy; | |||||
int pad[10]; | |||||
}; | |||||
/* | /* | ||||
* Flags for memfd_create(). | * Flags for memfd_create(). | ||||
*/ | */ | ||||
#define MFD_CLOEXEC 0x00000001 | #define MFD_CLOEXEC 0x00000001 | ||||
#define MFD_ALLOW_SEALING 0x00000002 | #define MFD_ALLOW_SEALING 0x00000002 | ||||
/* UNSUPPORTED */ | |||||
#define MFD_HUGETLB 0x00000004 | #define MFD_HUGETLB 0x00000004 | ||||
#define MFD_HUGE_MASK 0xFC000000 | #define MFD_HUGE_MASK 0xFC000000 | ||||
#define MFD_HUGE_SHIFT 26 | #define MFD_HUGE_SHIFT 26 | ||||
#define MFD_HUGE_64KB (16 << MFD_HUGE_SHIFT) | #define MFD_HUGE_64KB (16 << MFD_HUGE_SHIFT) | ||||
#define MFD_HUGE_512KB (19 << MFD_HUGE_SHIFT) | #define MFD_HUGE_512KB (19 << MFD_HUGE_SHIFT) | ||||
#define MFD_HUGE_1MB (20 << MFD_HUGE_SHIFT) | #define MFD_HUGE_1MB (20 << MFD_HUGE_SHIFT) | ||||
#define MFD_HUGE_2MB (21 << MFD_HUGE_SHIFT) | #define MFD_HUGE_2MB (21 << MFD_HUGE_SHIFT) | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | struct shmfd { | ||||
struct label *shm_label; /* MAC label */ | struct label *shm_label; /* MAC label */ | ||||
const char *shm_path; | const char *shm_path; | ||||
struct rangelock shm_rl; | struct rangelock shm_rl; | ||||
struct mtx shm_mtx; | struct mtx shm_mtx; | ||||
int shm_flags; | int shm_flags; | ||||
int shm_seals; | int shm_seals; | ||||
/* largepage config */ | |||||
int shm_lp_psind; | |||||
markj: I prefer not to have a custom domain policy if possible. We already have general mechanisms for… | |||||
int shm_lp_alloc_policy; | |||||
}; | }; | ||||
#endif | #endif | ||||
#ifdef _KERNEL | #ifdef _KERNEL | ||||
int shm_map(struct file *fp, size_t size, off_t offset, void **memp); | int shm_map(struct file *fp, size_t size, off_t offset, void **memp); | ||||
int shm_unmap(struct file *fp, void *mem, size_t size); | int shm_unmap(struct file *fp, void *mem, size_t size); | ||||
int shm_access(struct shmfd *shmfd, struct ucred *ucred, int flags); | int shm_access(struct shmfd *shmfd, struct ucred *ucred, int flags); | ||||
struct shmfd *shm_alloc(struct ucred *ucred, mode_t mode); | struct shmfd *shm_alloc(struct ucred *ucred, mode_t mode, bool largepage); | ||||
struct shmfd *shm_hold(struct shmfd *shmfd); | struct shmfd *shm_hold(struct shmfd *shmfd); | ||||
void shm_drop(struct shmfd *shmfd); | void shm_drop(struct shmfd *shmfd); | ||||
int shm_dotruncate(struct shmfd *shmfd, off_t length); | int shm_dotruncate(struct shmfd *shmfd, off_t length); | ||||
extern struct fileops shm_ops; | extern struct fileops shm_ops; | ||||
#define MAP_32BIT_MAX_ADDR ((vm_offset_t)1 << 31) | |||||
#else /* !_KERNEL */ | #else /* !_KERNEL */ | ||||
__BEGIN_DECLS | __BEGIN_DECLS | ||||
/* | /* | ||||
* XXX not yet implemented: posix_mem_offset(), posix_typed_mem_get_info(), | * XXX not yet implemented: posix_mem_offset(), posix_typed_mem_get_info(), | ||||
* posix_typed_mem_open(). | * posix_typed_mem_open(). | ||||
*/ | */ | ||||
#if __BSD_VISIBLE | #if __BSD_VISIBLE | ||||
Show All 17 Lines | |||||
#if __POSIX_VISIBLE >= 199309 | #if __POSIX_VISIBLE >= 199309 | ||||
int mlockall(int); | int mlockall(int); | ||||
int munlockall(void); | int munlockall(void); | ||||
int shm_open(const char *, int, mode_t); | int shm_open(const char *, int, mode_t); | ||||
int shm_unlink(const char *); | int shm_unlink(const char *); | ||||
#endif | #endif | ||||
#if __BSD_VISIBLE | #if __BSD_VISIBLE | ||||
int memfd_create(const char *, unsigned int); | int memfd_create(const char *, unsigned int); | ||||
int shm_open_largepage(const char *, int, int, int, mode_t); | |||||
int shm_rename(const char *, const char *, int); | int shm_rename(const char *, const char *, int); | ||||
#endif | #endif | ||||
__END_DECLS | __END_DECLS | ||||
#endif /* !_KERNEL */ | #endif /* !_KERNEL */ | ||||
#endif /* !_SYS_MMAN_H_ */ | #endif /* !_SYS_MMAN_H_ */ |
I prefer not to have a custom domain policy if possible. We already have general mechanisms for defining this policy, we should use that unless there is some specific use-case to motivate a custom interface, and in this case the policy should be expressed using a domainset. It is also kind of fragile to specify policy using a single domain ID; it is possible for system to have empty NUMA domains, and this actually happens in practice.