support madvise(MADV_REMOVE) partially

This MADV_REMOVE works with a mapping which is
- created with shmat() and
- not sharing memobj with other mappings.
This commit is contained in:
NAKAMURA Gou
2015-10-28 18:40:18 +09:00
parent c25f8c7a39
commit 0b07dd1b79
3 changed files with 71 additions and 5 deletions

View File

@@ -31,6 +31,7 @@ enum {
/* for memobj.flags */
MF_HAS_PAGER = 0x0001,
MF_SHMDT_OK = 0x0002,
MF_IS_REMOVABLE = 0x0004,
};
struct memobj {
@@ -120,6 +121,11 @@ static inline int memobj_has_pager(struct memobj *obj)
return !!(obj->flags & MF_HAS_PAGER);
}
static inline int memobj_is_removable(struct memobj *obj)
{
return !!(obj->flags & MF_IS_REMOVABLE);
}
int fileobj_create(int fd, struct memobj **objp, int *maxprotp);
struct shmid_ds;
int shmobj_create(struct shmid_ds *ds, struct memobj **objp);