File:  [DVB] / dietlibc / lib / __mmap.c
Revision 1.1: download - view: text, annotated - select for diffs
Thu Mar 3 18:40:05 2011 UTC (13 years, 3 months ago) by leitner
Branches: MAIN
CVS tags: HEAD
get rid of lots of socket cruft

#include <errno.h>
#include <sys/mman.h>
#include <syscalls.h>

#ifndef __NR_mmap
void*__mmap2(void*start,size_t length,int prot,int flags,int fd,off_t
pgoffset);
void *mmap(void *addr, size_t length, int prot, int flags, int fd,
          off_t offset)
{
  size_t pgsz = 4096;	/* TODO: fix for dynamic PAGESIZEs needed? */
  void *res;

  if (__unlikely(offset & (pgsz - 1))) {
    errno = -EINVAL;
    res = MAP_FAILED;
  } else
    res = __mmap2(addr, length, prot, flags, fd, offset / pgsz);
  return res;
}
#endif


LinuxTV legacy CVS <linuxtv.org/cvs>