diff options
author | welinder@troll.com <welinder@troll.com> | 2004-10-02 22:49:30 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-07 21:03:27 -0700 |
commit | 7a52af572ba9e8280cc28e73b575e56ab03214fd (patch) | |
tree | 2558dbdfdd45f91635d13d139bc32002f5ef951a /compat-linux.c | |
parent | Be more lenient in placement of 'asm("reg")' variable hard-register (diff) | |
download | sparse-7a52af572ba9e8280cc28e73b575e56ab03214fd.tar.gz sparse-7a52af572ba9e8280cc28e73b575e56ab03214fd.tar.bz2 sparse-7a52af572ba9e8280cc28e73b575e56ab03214fd.zip |
Add compatibility file for solaris.
Diffstat (limited to 'compat-linux.c')
-rw-r--r-- | compat-linux.c | 52 |
1 files changed, 3 insertions, 49 deletions
diff --git a/compat-linux.c b/compat-linux.c index afa278b..8f621ae 100644 --- a/compat-linux.c +++ b/compat-linux.c @@ -1,53 +1,7 @@ -/* - * Sane compat.c for Linux - */ #define _GNU_SOURCE -#include <stdlib.h> -#include <sys/mman.h> -#include <sys/types.h> -#include <sys/stat.h> - #include "lib.h" -#include "token.h" - -/* - * Allow old BSD naming too, it would be a pity to have to make a - * separate file just for this. - */ -#ifndef MAP_ANONYMOUS -#define MAP_ANONYMOUS MAP_ANON -#endif - -/* - * Our blob allocator enforces the strict CHUNK size - * requirement, as a portability check. - */ -void *blob_alloc(unsigned long size) -{ - void *ptr; - - if (size & ~CHUNK) - die("internal error: bad allocation size (%d bytes)", size); - ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (ptr == MAP_FAILED) - ptr = NULL; - return ptr; -} - -void blob_free(void *addr, unsigned long size) -{ - if (!size || (size & ~CHUNK) || ((unsigned long) addr & 512)) - die("internal error: bad blob free (%d bytes at %p)", size, addr); - munmap(addr, size); -} - -long double string_to_ld(const char *nptr, char **endptr) -{ - return strtold(nptr, endptr); -} -int identical_files(struct stream* s, struct stat *st, const char * name) -{ - return s->dev == st->st_dev && s->ino == st->st_ino; -} +#include "compat/id-files-stat.c" +#include "compat/mmap-blob.c" +#include "compat/strtold.c" |