Back to index

glibc  2.9
Defines | Typedefs | Functions
mman.h File Reference
#include <features.h>
#include <bits/types.h>
#include <stddef.h>
#include <bits/mman.h>

Go to the source code of this file.

Defines

#define __need_size_t
#define __off_t_defined
#define __mode_t_defined
#define MAP_FAILED   ((void *) -1)

Typedefs

typedef __off_t off_t
typedef __mode_t mode_t

Functions

__BEGIN_DECLS void * mmap (void *__addr, size_t __len, int __prot, int __flags, int __fd, __off_t __offset) __THROW
int munmap (void *__addr, size_t __len) __THROW
int mprotect (void *__addr, size_t __len, int __prot) __THROW
int msync (void *__addr, size_t __len, int __flags)
int mlock (__const void *__addr, size_t __len) __THROW
int munlock (__const void *__addr, size_t __len) __THROW
int mlockall (int __flags) __THROW
int munlockall (void) __THROW
int shm_open (__const char *__name, int __oflag, mode_t __mode)
int shm_unlink (__const char *__name)

Define Documentation

Definition at line 39 of file mman.h.

#define __need_size_t

Definition at line 25 of file mman.h.

#define __off_t_defined

Definition at line 34 of file mman.h.

#define MAP_FAILED   ((void *) -1)

Definition at line 45 of file mman.h.


Typedef Documentation

typedef __mode_t mode_t

Definition at line 38 of file mman.h.

typedef __off_t off_t

Definition at line 30 of file mman.h.


Function Documentation

int mlock ( __const void *  __addr,
size_t  __len 
)
int mlockall ( int  __flags)

Definition at line 29 of file mlockall.c.

{
  __set_errno (ENOSYS);
  return -1;
}
__BEGIN_DECLS void* mmap ( void *  __addr,
size_t  __len,
int  __prot,
int  __flags,
int  __fd,
__off_t  __offset 
)

Definition at line 568 of file memusage.c.

{
  void *result = NULL;

  /* Determine real implementation if not already happened.  */
  if (__builtin_expect (initialized <= 0, 0))
    {
      if (initialized == -1)
       return NULL;
      me ();
    }

  /* Always get a block.  We don't need extra memory.  */
  result = (*mmapp) (start, len, prot, flags, fd, offset);

  if (!not_me && trace_mmap)
    {
      int idx = (flags & MAP_ANON
               ? idx_mmap_a : prot & PROT_WRITE ? idx_mmap_w : idx_mmap_r);

      /* Keep track of number of calls.  */
      catomic_increment (&calls[idx]);
      /* Keep track of total memory consumption for `malloc'.  */
      catomic_add (&total[idx], len);
      /* Keep track of total memory requirement.  */
      catomic_add (&grand_total, len);
      /* Remember the size of the request.  */
      if (len < 65536)
       catomic_increment (&histogram[len / 16]);
      else
       catomic_increment (&large);
      /* Total number of calls of any of the functions.  */
      catomic_increment (&calls_total);

      /* Check for failures.  */
      if (result == NULL)
       catomic_increment (&failed[idx]);
      else if (idx == idx_mmap_w)
       /* Update the allocation data and write out the records if
          necessary.  Note the first parameter is NULL which means
          the size is not tracked.  */
       update_data (NULL, len, 0);
    }

  /* Return the pointer to the user buffer.  */
  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int mprotect ( void *  __addr,
size_t  __len,
int  __prot 
)

Here is the caller graph for this function:

int msync ( void *  __addr,
size_t  __len,
int  __flags 
)
int munlock ( __const void *  __addr,
size_t  __len 
)
int munlockall ( void  )

Definition at line 27 of file munlockall.c.

{
  __set_errno (ENOSYS);
  return -1;
}
int munmap ( void *  __addr,
size_t  __len 
)

Definition at line 737 of file memusage.c.

{
  int result;

  /* Determine real implementation if not already happened.  */
  if (__builtin_expect (initialized <= 0, 0))
    {
      if (initialized == -1)
       return -1;
      me ();
    }

  /* Do the real work.  */
  result = (*munmapp) (start, len);

  if (!not_me && trace_mmap)
    {
      /* Keep track of number of calls.  */
      catomic_increment (&calls[idx_munmap]);

      if (__builtin_expect (result == 0, 1))
       {
         /* Keep track of total memory freed using `free'.  */
         catomic_add (&total[idx_munmap], len);

         /* Update the allocation data and write out the records if
            necessary.  */
         update_data (NULL, 0, len);
       }
      else
       catomic_increment (&failed[idx_munmap]);
    }

  return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int shm_open ( __const char *  __name,
int  __oflag,
mode_t  __mode 
)

Here is the caller graph for this function:

int shm_unlink ( __const char *  __name)

Here is the caller graph for this function: