diff options
author | Roland McGrath <roland@gnu.org> | 2000-02-05 12:48:25 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2000-02-05 12:48:25 +0000 |
commit | 89bb63265284a87bff987ece3afb77f8400cf5a2 (patch) | |
tree | c7439047ea9dcb7b03faa9710d33391a4adf888e | |
parent | 9f3e44843d354432de49e01a1c954d556c678e20 (diff) |
2000-02-05 Roland McGrath <roland@baalperazim.frob.com>
* linux-src (many files): Merge Linux 2.2.13 and 2.2.14 code.
* glue-include/linux/mm.h (PAGE_SIZE, num_physpages): New macros.
(__get_free_pages): New inline function.
-rw-r--r-- | pfinet/glue-include/linux/mm.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/pfinet/glue-include/linux/mm.h b/pfinet/glue-include/linux/mm.h index a6f28e00..546776e8 100644 --- a/pfinet/glue-include/linux/mm.h +++ b/pfinet/glue-include/linux/mm.h @@ -15,4 +15,24 @@ #define GFP_BUFFER 0 #define __GFP_WAIT 0 +#include <mach.h> +#include <sys/mman.h> +#include <stdint.h> + +#define PAGE_SIZE (1 << PAGE_SHIFT) + +/* The one use of this is by net/ipv4/tcp.c::tcp_init, which + uses the power of two above `num_physpages >> (20 - PAGE_SHIFT)' + as a starting point and halves from there the number of pages + it tries to allocate for the hash table of TCP connections. */ +#define num_physpages (64 << 20 >> PAGE_SHIFT) /* XXX calculate for 32MB */ + +static inline uintptr_t +__get_free_pages (int gfp_mask, unsigned long int order) +{ + void *ptr = mmap (0, PAGE_SIZE << order, + PROT_READ|PROT_WRITE, MAP_ANON, 0, 0); + return ptr == MAP_FAILED ? 0 : (uintptr_t) ptr; +} + #endif |