--- libaitio/src/bufio.c 2016/08/11 12:51:52 1.9.8.2 +++ libaitio/src/bufio.c 2016/08/15 12:13:47 1.9.8.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: bufio.c,v 1.9.8.2 2016/08/11 12:51:52 misho Exp $ +* $Id: bufio.c,v 1.9.8.3 2016/08/15 12:13:47 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -70,14 +70,23 @@ cf_(struct tagBufIO *buf) return 0; } -#if defined(__NetBSD__) || defined(__linux__) +#ifndef __linux__ +#ifdef __NetBSD__ static off_t sf_lim(struct tagBufIO *buf, off_t pos, int w) #else static fpos_t sf_lim(struct tagBufIO *buf, fpos_t pos, int w) #endif +#else +static off_t +sf_lim(struct tagBufIO *buf, off64_t *ppos, int w) +#endif { +#ifdef __linux__ + off_t pos = (off_t) *ppos; +#endif + if (!buf) goto err; @@ -139,15 +148,23 @@ wf_lim(struct tagBufIO *buf, const char *dat, int siz) return siz; } -#if defined(__NetBSD__) || defined(__linux__) +#ifndef __linux__ +#ifdef __NetBSD__ static off_t sf_inf(struct tagBufIO *buf, off_t pos, int w) #else static fpos_t sf_inf(struct tagBufIO *buf, fpos_t pos, int w) #endif +#else +static off_t +sf_inf(struct tagBufIO *buf, off64_t *ppos, int w) +#endif { void *b; +#ifdef __linux__ + off_t pos = (off_t) *ppos; +#endif if (!buf) goto err; @@ -389,7 +406,7 @@ io_fmapopen(const char *csFile, int mode, int perm, in close(fd); } else if (offset) { basesize = offset; - base = mmap(NULL, basesize, prot, MAP_ANON, -1, 0); + base = mmap(NULL, basesize, prot, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0); if (base == MAP_FAILED) { LOGERR; return NULL;