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

Comparing libeio/eio.c (file contents):
Revision 1.56 by root, Sun Sep 12 03:36:28 2010 UTC vs.
Revision 1.58 by root, Sat Oct 30 14:36:53 2010 UTC

1435static int 1435static int
1436eio__mlock (void *addr, size_t length) 1436eio__mlock (void *addr, size_t length)
1437{ 1437{
1438 eio_page_align (&addr, &length); 1438 eio_page_align (&addr, &length);
1439 1439
1440 mlock (addr, length); 1440 return mlock (addr, length);
1441} 1441}
1442 1442
1443static int 1443static int
1444eio__mlockall (int flags) 1444eio__mlockall (int flags)
1445{ 1445{
1454 flags = 0 1454 flags = 0
1455 | (flags & EIO_MCL_CURRENT ? MCL_CURRENT : 0) 1455 | (flags & EIO_MCL_CURRENT ? MCL_CURRENT : 0)
1456 | (flags & EIO_MCL_FUTURE ? MCL_FUTURE : 0); 1456 | (flags & EIO_MCL_FUTURE ? MCL_FUTURE : 0);
1457 } 1457 }
1458 1458
1459 mlockall (flags); 1459 return mlockall (flags);
1460} 1460}
1461#endif 1461#endif
1462 1462
1463#if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO) 1463#if !(_POSIX_MAPPED_FILES && _POSIX_SYNCHRONIZED_IO)
1464# define eio__msync(a,b,c) ((errno = ENOSYS), -1) 1464# define eio__msync(a,b,c) ((errno = ENOSYS), -1)
1630 return 0; \ 1630 return 0; \
1631 } 1631 }
1632 1632
1633static void eio_execute (etp_worker *self, eio_req *req) 1633static void eio_execute (etp_worker *self, eio_req *req)
1634{ 1634{
1635 errno = 0;
1636
1637 switch (req->type) 1635 switch (req->type)
1638 { 1636 {
1639 case EIO_READ: ALLOC (req->size); 1637 case EIO_READ: ALLOC (req->size);
1640 req->result = req->offs >= 0 1638 req->result = req->offs >= 0
1641 ? pread (req->int1, req->ptr2, req->size, req->offs) 1639 ? pread (req->int1, req->ptr2, req->size, req->offs)
1691 1689
1692 case EIO_READDIR: eio__scandir (req, self); break; 1690 case EIO_READDIR: eio__scandir (req, self); break;
1693 1691
1694 case EIO_BUSY: 1692 case EIO_BUSY:
1695#ifdef _WIN32 1693#ifdef _WIN32
1696 Sleep (req->nv1 * 1000.); 1694 Sleep (req->nv1 * 1e3);
1697#else 1695#else
1698 { 1696 {
1699 struct timeval tv; 1697 struct timeval tv;
1700 1698
1701 tv.tv_sec = req->nv1; 1699 tv.tv_sec = req->nv1;
1702 tv.tv_usec = (req->nv1 - tv.tv_sec) * 1000000.; 1700 tv.tv_usec = (req->nv1 - tv.tv_sec) * 1e6;
1703 1701
1704 req->result = select (0, 0, 0, 0, &tv); 1702 req->result = select (0, 0, 0, 0, &tv);
1705 } 1703 }
1706#endif 1704#endif
1707 break; 1705 break;
1722 times = tv; 1720 times = tv;
1723 } 1721 }
1724 else 1722 else
1725 times = 0; 1723 times = 0;
1726 1724
1727
1728 req->result = req->type == EIO_FUTIME 1725 req->result = req->type == EIO_FUTIME
1729 ? futimes (req->int1, times) 1726 ? futimes (req->int1, times)
1730 : utimes (req->ptr1, times); 1727 : utimes (req->ptr1, times);
1731 } 1728 }
1732 break; 1729 break;
1741 case EIO_CUSTOM: 1738 case EIO_CUSTOM:
1742 ((void (*)(eio_req *))req->feed) (req); 1739 ((void (*)(eio_req *))req->feed) (req);
1743 break; 1740 break;
1744 1741
1745 default: 1742 default:
1743 errno = ENOSYS;
1746 req->result = -1; 1744 req->result = -1;
1747 break; 1745 break;
1748 } 1746 }
1749 1747
1750 req->errorno = errno; 1748 req->errorno = errno;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines