]>
git.ipfire.org Git - thirdparty/systemd.git/blob - klibc/klibc/mmap.c
3d28cba601ed4dea3fbd70c970b3d81bbf1e535c
7 #include <sys/syscall.h>
9 #include <asm/page.h> /* For PAGE_SHIFT */
11 #if defined(__sparc__)
12 # define MMAP2_SHIFT 12 /* Fixed by syscall definition */
14 # define MMAP2_SHIFT PAGE_SHIFT
16 #define MMAP2_MASK ((1UL << MMAP2_SHIFT)-1)
19 * Prefer mmap2() over mmap(), except on the architectures listed
22 #if defined(__NR_mmap2) && !defined(__sparc__) && !defined(__ia64__)
24 /* This architecture uses mmap2() */
26 static inline _syscall6(void *,mmap2
,void *,start
,size_t,length
,int,prot
,int,flags
,int,fd
,off_t
,offset
);
28 /* The Linux mmap2() system call takes a page offset as the offset argument.
29 We need to make sure we have the proper conversion in place. */
31 void *mmap(void *start
, size_t length
, int prot
, int flags
, int fd
, off_t offset
)
33 if ( offset
& MMAP2_MASK
) {
38 return mmap2(start
, length
, prot
, flags
, fd
, (size_t)offset
>> MMAP2_SHIFT
);
43 /* This architecture uses a plain mmap() system call */
44 /* Only use this for architectures where mmap() is a real 6-argument system call! */
46 _syscall6(void *,mmap
,void *,start
,size_t,length
,int,prot
,int,flags
,int,fd
,off_t
,offset
)