ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/eio.c
(Generate patch)

Comparing libeio/eio.c (file contents):
Revision 1.59 by root, Wed Dec 1 07:30:39 2010 UTC vs.
Revision 1.60 by root, Fri Jan 7 21:45:42 2011 UTC

79# include <unistd.h> 79# include <unistd.h>
80# include <utime.h> 80# include <utime.h>
81# include <signal.h> 81# include <signal.h>
82# include <dirent.h> 82# include <dirent.h>
83 83
84#if _POSIX_MEMLOCK || _POSIX_MAPPED_FILES 84#if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
85# include <sys/mman.h> 85# include <sys/mman.h>
86#endif 86#endif
87 87
88/* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */ 88/* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */
89# if __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ 89# if __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
1431 /* round up length */ 1431 /* round up length */
1432 *length = (*length + mask) & ~mask; 1432 *length = (*length + mask) & ~mask;
1433} 1433}
1434 1434
1435#if !_POSIX_MEMLOCK 1435#if !_POSIX_MEMLOCK
1436# define eio__mlock(a,b) ((errno = ENOSYS), -1)
1437# define eio__mlockall(a) ((errno = ENOSYS), -1) 1436# define eio__mlockall(a) ((errno = ENOSYS), -1)
1438#else 1437#else
1439
1440static int
1441eio__mlock (void *addr, size_t length)
1442{
1443 eio_page_align (&addr, &length);
1444
1445 return mlock (addr, length);
1446}
1447 1438
1448static int 1439static int
1449eio__mlockall (int flags) 1440eio__mlockall (int flags)
1450{ 1441{
1451 #if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 7 1442 #if __GLIBC__ == 2 && __GLIBC_MINOR__ <= 7
1461 | (flags & EIO_MCL_FUTURE ? MCL_FUTURE : 0); 1452 | (flags & EIO_MCL_FUTURE ? MCL_FUTURE : 0);
1462 } 1453 }
1463 1454
1464 return mlockall (flags); 1455 return mlockall (flags);
1465} 1456}
1457#endif
1458
1459#if !_POSIX_MEMLOCK_RANGE
1460# define eio__mlock(a,b) ((errno = ENOSYS), -1)
1461#else
1462
1463static int
1464eio__mlock (void *addr, size_t length)
1465{
1466 eio_page_align (&addr, &length);
1467
1468 return mlock (addr, length);
1469}
1470
1466#endif 1471#endif
1467 1472
1468#if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO) 1473#if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO)
1469# define eio__msync(a,b,c) ((errno = ENOSYS), -1) 1474# define eio__msync(a,b,c) ((errno = ENOSYS), -1)
1470#else 1475#else

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines