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

Comparing libeio/eio.c (file contents):
Revision 1.90 by root, Sat Jul 16 16:46:10 2011 UTC vs.
Revision 1.93 by root, Mon Jul 18 01:27:03 2011 UTC

111 #define fsync(fd) (FlushFileBuffers ((HANDLE)EIO_FD_TO_WIN32_HANDLE (fd)) ? 0 : EIO_ERRNO (EBADF, -1)) 111 #define fsync(fd) (FlushFileBuffers ((HANDLE)EIO_FD_TO_WIN32_HANDLE (fd)) ? 0 : EIO_ERRNO (EBADF, -1))
112 #define mkdir(path,mode) _mkdir (path) 112 #define mkdir(path,mode) _mkdir (path)
113 #define link(old,neu) (CreateHardLink (neu, old, 0) ? 0 : EIO_ERRNO (ENOENT, -1)) 113 #define link(old,neu) (CreateHardLink (neu, old, 0) ? 0 : EIO_ERRNO (ENOENT, -1))
114 114
115 #define chmod(path,mode) _chmod (path, mode) 115 #define chmod(path,mode) _chmod (path, mode)
116 #define dup(fd) _dup (fd)
117 #define dup2(fd1,fd2) _dup2 (fd1, fd2)
118
116 #define fchmod(fd,mode) EIO_ENOSYS () 119 #define fchmod(fd,mode) EIO_ENOSYS ()
117 #define chown(path,uid,gid) EIO_ENOSYS () 120 #define chown(path,uid,gid) EIO_ENOSYS ()
118 #define fchown(fd,uid,gid) EIO_ENOSYS () 121 #define fchown(fd,uid,gid) EIO_ENOSYS ()
119 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */ 122 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */
120 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */ 123 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */
138 141
139 return EIO_ERRNO (ENOENT, -1); 142 return EIO_ERRNO (ENOENT, -1);
140 } 143 }
141 144
142 /* POSIX API only */ 145 /* POSIX API only */
143 #define CreateHardLink(neu,old) 0 146 #define CreateHardLink(neu,old,flags) 0
144 #define CreateSymbolicLink(neu,old,flags) 0 147 #define CreateSymbolicLink(neu,old,flags) 0
145 148
146 struct statvfs 149 struct statvfs
147 { 150 {
148 int dummy; 151 int dummy;
149 }; 152 };
153
154 #define DT_DIR EIO_DT_DIR
155 #define DT_REG EIO_DT_REG
156 #define D_NAME(entp) entp.cFileName
157 #define D_TYPE(entp) (entp.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? DT_DIR : DT_REG)
150 158
151#else 159#else
152 160
153 #include <sys/time.h> 161 #include <sys/time.h>
154 #include <sys/select.h> 162 #include <sys/select.h>
159 #include <dirent.h> 167 #include <dirent.h>
160 168
161 #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES 169 #if _POSIX_MEMLOCK || _POSIX_MEMLOCK_RANGE || _POSIX_MAPPED_FILES
162 #include <sys/mman.h> 170 #include <sys/mman.h>
163 #endif 171 #endif
172
173 #define D_NAME(entp) entp->d_name
164 174
165 /* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */ 175 /* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */
166 #if __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ 176 #if __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__
167 #define _DIRENT_HAVE_D_TYPE /* sigh */ 177 #define _DIRENT_HAVE_D_TYPE /* sigh */
168 #define D_INO(de) (de)->d_fileno 178 #define D_INO(de) (de)->d_fileno
206#endif 216#endif
207#ifndef D_INO 217#ifndef D_INO
208# define D_INO(de) 0 218# define D_INO(de) 0
209#endif 219#endif
210#ifndef D_NAMLEN 220#ifndef D_NAMLEN
211# define D_NAMLEN(de) strlen ((de)->d_name) 221# define D_NAMLEN(entp) strlen (D_NAME (entp))
212#endif 222#endif
213 223
214/* used for struct dirent, AIX doesn't provide it */ 224/* used for struct dirent, AIX doesn't provide it */
215#ifndef NAME_MAX 225#ifndef NAME_MAX
216# define NAME_MAX 4096 226# define NAME_MAX 4096
250#define ETP_WORKER_CLEAR(req) \ 260#define ETP_WORKER_CLEAR(req) \
251 if (wrk->dbuf) \ 261 if (wrk->dbuf) \
252 { \ 262 { \
253 free (wrk->dbuf); \ 263 free (wrk->dbuf); \
254 wrk->dbuf = 0; \ 264 wrk->dbuf = 0; \
255 } \
256 \
257 if (wrk->dirp) \
258 { \
259 closedir (wrk->dirp); \
260 wrk->dirp = 0; \
261 } 265 }
262 266
263#define ETP_WORKER_COMMON \ 267#define ETP_WORKER_COMMON \
264 void *dbuf; \ 268 void *dbuf;
265 DIR *dirp;
266 269
267/*****************************************************************************/ 270/*****************************************************************************/
268 271
269#define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1) 272#define ETP_NUM_PRI (ETP_PRI_MAX - ETP_PRI_MIN + 1)
270 273
299/* 302/*
300 * make our pread/pwrite emulation safe against themselves, but not against 303 * make our pread/pwrite emulation safe against themselves, but not against
301 * normal read/write by using a mutex. slows down execution a lot, 304 * normal read/write by using a mutex. slows down execution a lot,
302 * but that's your problem, not mine. 305 * but that's your problem, not mine.
303 */ 306 */
304static xmutex_t preadwritelock = X_MUTEX_INIT; 307static xmutex_t preadwritelock;
305#endif 308#endif
306 309
307typedef struct etp_worker 310typedef struct etp_worker
308{ 311{
309 /* locked by wrklock */ 312 /* locked by wrklock */
315 ETP_REQ *req; /* currently processed request */ 318 ETP_REQ *req; /* currently processed request */
316 319
317 ETP_WORKER_COMMON 320 ETP_WORKER_COMMON
318} etp_worker; 321} etp_worker;
319 322
320static etp_worker wrk_first = { &wrk_first, &wrk_first, 0 }; /* NOT etp */ 323static etp_worker wrk_first; /* NOT etp */
321 324
322#define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock) 325#define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock)
323#define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock) 326#define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock)
324 327
325/* worker threads management */ 328/* worker threads management */
396} etp_reqq; 399} etp_reqq;
397 400
398static etp_reqq req_queue; 401static etp_reqq req_queue;
399static etp_reqq res_queue; 402static etp_reqq res_queue;
400 403
404static void ecb_noinline ecb_cold
405reqq_init (etp_reqq *q)
406{
407 int pri;
408
409 for (pri = 0; pri < ETP_NUM_PRI; ++pri)
410 q->qs[pri] = q->qe[pri] = 0;
411
412 q->size = 0;
413}
414
401static int ecb_noinline 415static int ecb_noinline
402reqq_push (etp_reqq *q, ETP_REQ *req) 416reqq_push (etp_reqq *q, ETP_REQ *req)
403{ 417{
404 int pri = req->pri; 418 int pri = req->pri;
405 req->next = 0; 419 req->next = 0;
439 } 453 }
440 454
441 abort (); 455 abort ();
442} 456}
443 457
444static void ecb_cold 458static int ecb_cold
445etp_thread_init (void) 459etp_init (void (*want_poll)(void), void (*done_poll)(void))
446{ 460{
447#if !HAVE_PREADWRITE
448 X_MUTEX_CREATE (preadwritelock);
449#endif
450 X_MUTEX_CREATE (wrklock); 461 X_MUTEX_CREATE (wrklock);
451 X_MUTEX_CREATE (reslock); 462 X_MUTEX_CREATE (reslock);
452 X_MUTEX_CREATE (reqlock); 463 X_MUTEX_CREATE (reqlock);
453 X_COND_CREATE (reqwait); 464 X_COND_CREATE (reqwait);
454}
455 465
456static void ecb_cold 466 reqq_init (&req_queue);
457etp_atfork_prepare (void) 467 reqq_init (&res_queue);
458{
459}
460 468
461static void ecb_cold 469 wrk_first.next =
462etp_atfork_parent (void) 470 wrk_first.prev = &wrk_first;
463{
464}
465
466static void ecb_cold
467etp_atfork_child (void)
468{
469 ETP_REQ *prv;
470
471 while ((prv = reqq_shift (&req_queue)))
472 ETP_DESTROY (prv);
473
474 while ((prv = reqq_shift (&res_queue)))
475 ETP_DESTROY (prv);
476
477 while (wrk_first.next != &wrk_first)
478 {
479 etp_worker *wrk = wrk_first.next;
480
481 if (wrk->req)
482 ETP_DESTROY (wrk->req);
483
484 etp_worker_clear (wrk);
485 etp_worker_free (wrk);
486 }
487 471
488 started = 0; 472 started = 0;
489 idle = 0; 473 idle = 0;
490 nreqs = 0; 474 nreqs = 0;
491 nready = 0; 475 nready = 0;
492 npending = 0; 476 npending = 0;
493
494 etp_thread_init ();
495}
496
497static void ecb_cold
498etp_once_init (void)
499{
500 etp_thread_init ();
501 X_THREAD_ATFORK (etp_atfork_prepare, etp_atfork_parent, etp_atfork_child);
502}
503
504static int ecb_cold
505etp_init (void (*want_poll)(void), void (*done_poll)(void))
506{
507 static pthread_once_t doinit = PTHREAD_ONCE_INIT;
508
509 pthread_once (&doinit, etp_once_init);
510 477
511 want_poll_cb = want_poll; 478 want_poll_cb = want_poll;
512 done_poll_cb = done_poll; 479 done_poll_cb = done_poll;
513 480
514 return 0; 481 return 0;
1483 1450
1484#define EIO_SORT_CUTOFF 30 /* quite high, but performs well on many filesystems */ 1451#define EIO_SORT_CUTOFF 30 /* quite high, but performs well on many filesystems */
1485#define EIO_SORT_FAST 60 /* when to only use insertion sort */ 1452#define EIO_SORT_FAST 60 /* when to only use insertion sort */
1486 1453
1487static void 1454static void
1488eio_dent_radix_sort (eio_dirent *dents, int size, signed char score_bits, ino_t inode_bits) 1455eio_dent_radix_sort (eio_dirent *dents, int size, signed char score_bits, eio_ino_t inode_bits)
1489{ 1456{
1490 unsigned char bits [9 + sizeof (ino_t) * 8]; 1457 unsigned char bits [9 + sizeof (eio_ino_t) * 8];
1491 unsigned char *bit = bits; 1458 unsigned char *bit = bits;
1492 1459
1493 assert (CHAR_BIT == 8); 1460 assert (CHAR_BIT == 8);
1494 assert (sizeof (eio_dirent) * 8 < 256); 1461 assert (sizeof (eio_dirent) * 8 < 256);
1495 assert (offsetof (eio_dirent, inode)); /* we use bit #0 as sentinel */ 1462 assert (offsetof (eio_dirent, inode)); /* we use bit #0 as sentinel */
1497 1464
1498 if (size <= EIO_SORT_FAST) 1465 if (size <= EIO_SORT_FAST)
1499 return; 1466 return;
1500 1467
1501 /* first prepare an array of bits to test in our radix sort */ 1468 /* first prepare an array of bits to test in our radix sort */
1502 /* try to take endianness into account, as well as differences in ino_t sizes */ 1469 /* try to take endianness into account, as well as differences in eio_ino_t sizes */
1503 /* inode_bits must contain all inodes ORed together */ 1470 /* inode_bits must contain all inodes ORed together */
1504 /* which is used to skip bits that are 0 everywhere, which is very common */ 1471 /* which is used to skip bits that are 0 everywhere, which is very common */
1505 { 1472 {
1506 ino_t endianness; 1473 eio_ino_t endianness;
1507 int i, j; 1474 int i, j;
1508 1475
1509 /* we store the byte offset of byte n into byte n of "endianness" */ 1476 /* we store the byte offset of byte n into byte n of "endianness" */
1510 for (i = 0; i < sizeof (ino_t); ++i) 1477 for (i = 0; i < sizeof (eio_ino_t); ++i)
1511 ((unsigned char *)&endianness)[i] = i; 1478 ((unsigned char *)&endianness)[i] = i;
1512 1479
1513 *bit++ = 0; 1480 *bit++ = 0;
1514 1481
1515 for (i = 0; i < sizeof (ino_t); ++i) 1482 for (i = 0; i < sizeof (eio_ino_t); ++i)
1516 { 1483 {
1517 /* shifting off the byte offsets out of "endianness" */ 1484 /* shifting off the byte offsets out of "endianness" */
1518 int offs = (offsetof (eio_dirent, inode) + (endianness & 0xff)) * 8; 1485 int offs = (offsetof (eio_dirent, inode) + (endianness & 0xff)) * 8;
1519 endianness >>= 8; 1486 endianness >>= 8;
1520 1487
1521 for (j = 0; j < 8; ++j) 1488 for (j = 0; j < 8; ++j)
1522 if (inode_bits & (((ino_t)1) << (i * 8 + j))) 1489 if (inode_bits & (((eio_ino_t)1) << (i * 8 + j)))
1523 *bit++ = offs + j; 1490 *bit++ = offs + j;
1524 } 1491 }
1525 1492
1526 for (j = 0; j < 8; ++j) 1493 for (j = 0; j < 8; ++j)
1527 if (score_bits & (1 << j)) 1494 if (score_bits & (1 << j))
1528 *bit++ = offsetof (eio_dirent, score) * 8 + j; 1495 *bit++ = offsetof (eio_dirent, score) * 8 + j;
1529 } 1496 }
1530 1497
1531 /* now actually do the sorting (a variant of MSD radix sort) */ 1498 /* now actually do the sorting (a variant of MSD radix sort) */
1532 { 1499 {
1533 eio_dirent *base_stk [9 + sizeof (ino_t) * 8], *base; 1500 eio_dirent *base_stk [9 + sizeof (eio_ino_t) * 8], *base;
1534 eio_dirent *end_stk [9 + sizeof (ino_t) * 8], *end; 1501 eio_dirent *end_stk [9 + sizeof (eio_ino_t) * 8], *end;
1535 unsigned char *bit_stk [9 + sizeof (ino_t) * 8]; 1502 unsigned char *bit_stk [9 + sizeof (eio_ino_t) * 8];
1536 int stk_idx = 0; 1503 int stk_idx = 0;
1537 1504
1538 base_stk [stk_idx] = dents; 1505 base_stk [stk_idx] = dents;
1539 end_stk [stk_idx] = dents + size; 1506 end_stk [stk_idx] = dents + size;
1540 bit_stk [stk_idx] = bit - 1; 1507 bit_stk [stk_idx] = bit - 1;
1619 } 1586 }
1620 } 1587 }
1621} 1588}
1622 1589
1623static void 1590static void
1624eio_dent_sort (eio_dirent *dents, int size, signed char score_bits, ino_t inode_bits) 1591eio_dent_sort (eio_dirent *dents, int size, signed char score_bits, eio_ino_t inode_bits)
1625{ 1592{
1626 if (size <= 1) 1593 if (size <= 1)
1627 return; /* our insertion sort relies on size > 0 */ 1594 return; /* our insertion sort relies on size > 0 */
1628 1595
1629 /* first we use a radix sort, but only for dirs >= EIO_SORT_FAST */ 1596 /* first we use a radix sort, but only for dirs >= EIO_SORT_FAST */
1637 1604
1638/* read a full directory */ 1605/* read a full directory */
1639static void 1606static void
1640eio__scandir (eio_req *req, etp_worker *self) 1607eio__scandir (eio_req *req, etp_worker *self)
1641{ 1608{
1642 DIR *dirp;
1643 EIO_STRUCT_DIRENT *entp;
1644 char *name, *names; 1609 char *name, *names;
1645 int namesalloc = 4096; 1610 int namesalloc = 4096 - sizeof (void *) * 4;
1646 int namesoffs = 0; 1611 int namesoffs = 0;
1647 int flags = req->int1; 1612 int flags = req->int1;
1648 eio_dirent *dents = 0; 1613 eio_dirent *dents = 0;
1649 int dentalloc = 128; 1614 int dentalloc = 128;
1650 int dentoffs = 0; 1615 int dentoffs = 0;
1651 ino_t inode_bits = 0; 1616 eio_ino_t inode_bits = 0;
1617#ifdef _WIN32
1618 HANDLE dirp;
1619 WIN32_FIND_DATA entp;
1620#else
1621 DIR *dirp;
1622 EIO_STRUCT_DIRENT *entp;
1623#endif
1652 1624
1653 req->result = -1; 1625 req->result = -1;
1654 1626
1655 if (!(flags & EIO_READDIR_DENTS)) 1627 if (!(flags & EIO_READDIR_DENTS))
1656 flags &= ~(EIO_READDIR_DIRS_FIRST | EIO_READDIR_STAT_ORDER); 1628 flags &= ~(EIO_READDIR_DIRS_FIRST | EIO_READDIR_STAT_ORDER);
1657 1629
1658 X_LOCK (wrklock); 1630#ifdef _WIN32
1659 /* the corresponding closedir is in ETP_WORKER_CLEAR */ 1631 {
1632 int len = strlen ((const char *)req->ptr1);
1633 char *path = malloc (MAX_PATH);
1634 const char *fmt;
1635
1636 if (!len)
1637 fmt = "./*";
1638 else if (((const char *)req->ptr1)[len - 1] == '/' || ((const char *)req->ptr1)[len - 1] == '\\')
1639 fmt = "%s*";
1640 else
1641 fmt = "%s/*";
1642
1643 _snprintf (path, MAX_PATH, fmt, (const char *)req->ptr1);
1644 dirp = FindFirstFile (path, &entp);
1645 free (path);
1646
1647 if (dirp == INVALID_HANDLE_VALUE)
1648 {
1649 dirp = 0;
1650
1651 switch (GetLastError ())
1652 {
1653 case ERROR_FILE_NOT_FOUND:
1654 req->result = 0;
1655 break;
1656
1657 case ERROR_INVALID_NAME:
1658 case ERROR_PATH_NOT_FOUND:
1659 case ERROR_NO_MORE_FILES:
1660 errno = ENOENT;
1661 break;
1662
1663 case ERROR_NOT_ENOUGH_MEMORY:
1664 errno = ENOMEM;
1665 break;
1666
1667 default:
1668 errno = EINVAL;
1669 break;
1670 }
1671 }
1672 }
1673#else
1660 self->dirp = dirp = opendir (req->ptr1); 1674 dirp = opendir (req->ptr1);
1675#endif
1661 1676
1662 if (req->flags & EIO_FLAG_PTR1_FREE) 1677 if (req->flags & EIO_FLAG_PTR1_FREE)
1663 free (req->ptr1); 1678 free (req->ptr1);
1664 1679
1665 req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE; 1680 req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE;
1666 req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0; 1681 req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0;
1667 req->ptr2 = names = malloc (namesalloc); 1682 req->ptr2 = names = malloc (namesalloc);
1668 X_UNLOCK (wrklock);
1669 1683
1670 if (dirp && names && (!flags || dents)) 1684 if (dirp && names && (!flags || dents))
1671 for (;;) 1685 for (;;)
1672 { 1686 {
1687 int done;
1688
1689#ifdef _WIN32
1690 done = !dirp;
1691#else
1673 errno = 0; 1692 errno = 0;
1674 entp = readdir (dirp); 1693 entp = readdir (dirp);
1694 done = !entp;
1695#endif
1675 1696
1676 if (!entp) 1697 if (done)
1677 { 1698 {
1699#ifndef _WIN32
1700 int old_errno = errno;
1701 closedir (dirp);
1702 errno = old_errno;
1703
1678 if (errno) 1704 if (errno)
1679 break; 1705 break;
1706#endif
1680 1707
1681 /* sort etc. */ 1708 /* sort etc. */
1682 req->int1 = flags; 1709 req->int1 = flags;
1683 req->result = dentoffs; 1710 req->result = dentoffs;
1684 1711
1713 1740
1714 break; 1741 break;
1715 } 1742 }
1716 1743
1717 /* now add the entry to our list(s) */ 1744 /* now add the entry to our list(s) */
1718 name = entp->d_name; 1745 name = D_NAME (entp);
1719 1746
1720 /* skip . and .. entries */ 1747 /* skip . and .. entries */
1721 if (name [0] != '.' || (name [1] && (name [1] != '.' || name [2]))) 1748 if (name [0] != '.' || (name [1] && (name [1] != '.' || name [2])))
1722 { 1749 {
1723 int len = D_NAMLEN (entp) + 1; 1750 int len = D_NAMLEN (entp) + 1;
1724 1751
1725 while (ecb_expect_false (namesoffs + len > namesalloc)) 1752 while (ecb_expect_false (namesoffs + len > namesalloc))
1726 { 1753 {
1727 namesalloc *= 2; 1754 namesalloc *= 2;
1728 X_LOCK (wrklock);
1729 req->ptr2 = names = realloc (names, namesalloc); 1755 req->ptr2 = names = realloc (names, namesalloc);
1730 X_UNLOCK (wrklock);
1731 1756
1732 if (!names) 1757 if (!names)
1733 break; 1758 break;
1734 } 1759 }
1735 1760
1740 struct eio_dirent *ent; 1765 struct eio_dirent *ent;
1741 1766
1742 if (ecb_expect_false (dentoffs == dentalloc)) 1767 if (ecb_expect_false (dentoffs == dentalloc))
1743 { 1768 {
1744 dentalloc *= 2; 1769 dentalloc *= 2;
1745 X_LOCK (wrklock);
1746 req->ptr1 = dents = realloc (dents, dentalloc * sizeof (eio_dirent)); 1770 req->ptr1 = dents = realloc (dents, dentalloc * sizeof (eio_dirent));
1747 X_UNLOCK (wrklock);
1748 1771
1749 if (!dents) 1772 if (!dents)
1750 break; 1773 break;
1751 } 1774 }
1752 1775
1832 if (EIO_CANCELLED (req)) 1855 if (EIO_CANCELLED (req))
1833 { 1856 {
1834 errno = ECANCELED; 1857 errno = ECANCELED;
1835 break; 1858 break;
1836 } 1859 }
1860
1861#ifdef _WIN32
1862 if (!FindNextFile (dirp, &entp))
1863 {
1864 FindClose (dirp);
1865 dirp = 0;
1866 }
1867#endif
1837 } 1868 }
1838} 1869}
1839 1870
1840/*****************************************************************************/ 1871/*****************************************************************************/
1841 1872
1857X_THREAD_PROC (etp_proc) 1888X_THREAD_PROC (etp_proc)
1858{ 1889{
1859 ETP_REQ *req; 1890 ETP_REQ *req;
1860 struct timespec ts; 1891 struct timespec ts;
1861 etp_worker *self = (etp_worker *)thr_arg; 1892 etp_worker *self = (etp_worker *)thr_arg;
1862 int timeout;
1863 1893
1864 /* try to distribute timeouts somewhat evenly */ 1894 /* try to distribute timeouts somewhat evenly */
1865 ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); 1895 ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL);
1866 1896
1867 for (;;) 1897 for (;;)
1937/*****************************************************************************/ 1967/*****************************************************************************/
1938 1968
1939int ecb_cold 1969int ecb_cold
1940eio_init (void (*want_poll)(void), void (*done_poll)(void)) 1970eio_init (void (*want_poll)(void), void (*done_poll)(void))
1941{ 1971{
1972#if !HAVE_PREADWRITE
1973 X_MUTEX_CREATE (preadwritelock);
1974#endif
1975
1942 return etp_init (want_poll, done_poll); 1976 return etp_init (want_poll, done_poll);
1943} 1977}
1944 1978
1945ecb_inline void 1979ecb_inline void
1946eio_api_destroy (eio_req *req) 1980eio_api_destroy (eio_req *req)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines