~ubuntu-branches/ubuntu/raring/simgrid/raring

« back to all changes in this revision

Viewing changes to src/xbt/mmalloc/mvalloc.c

  • Committer: Package Import Robot
  • Author(s): Lucas Nussbaum
  • Date: 2012-05-24 16:08:59 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120524160859-vhdlh05p313l5662
Tags: 3.7-1
* New upstream release.
* Bump Standards-Version to 3.9.3. No changes needed.
* debian/rules: Enable the SMPI library in the package. Closes: #656102.
* Build with -O2 on ia64. Closes: #640538.
* Use dpkg-buildflags to generate CFLAGS and LDFLAGS. Enable hardening.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Allocate memory on a page boundary.
2
 
   Copyright (C) 1991 Free Software Foundation, Inc. */
3
 
 
4
 
/* Copyright (c) 2010. The SimGrid Team.
5
 
 * All rights reserved.                                                     */
6
 
 
7
 
/* This program is free software; you can redistribute it and/or modify it
8
 
 * under the terms of the license (GNU LGPL) which comes with this package. */
9
 
 
10
 
 
11
 
#include "mmprivate.h"
12
 
#include <unistd.h>
13
 
 
14
 
/* Cache the pagesize for the current host machine.  Note that if the host
15
 
   does not readily provide a getpagesize() function, we need to emulate it
16
 
   elsewhere, not clutter up this file with lots of kluges to try to figure
17
 
   it out. */
18
 
 
19
 
static size_t cache_pagesize;
20
 
#if NEED_DECLARATION_GETPAGESIZE
21
 
extern int getpagesize PARAMS((void));
22
 
#endif
23
 
 
24
 
void *mvalloc(void *md, size_t size)
25
 
{
26
 
  if (cache_pagesize == 0) {
27
 
    cache_pagesize = getpagesize();
28
 
  }
29
 
 
30
 
  return (mmemalign(md, cache_pagesize, size));
31
 
}
32
 
 
33
 
/* Useless prototype to make gcc happy */
34
 
void *valloc(size_t size);
35
 
 
36
 
void *valloc(size_t size)
37
 
{
38
 
  return mvalloc(NULL, size);
39
 
}