… | |
… | |
58 | #include <sys/stat.h> |
58 | #include <sys/stat.h> |
59 | #include <limits.h> |
59 | #include <limits.h> |
60 | #include <fcntl.h> |
60 | #include <fcntl.h> |
61 | #include <assert.h> |
61 | #include <assert.h> |
62 | |
62 | |
63 | #if _POSIX_VERSION >= 200809L |
|
|
64 | # define HAVE_AT 1 |
|
|
65 | #else |
|
|
66 | # define HAVE_AT 0 |
|
|
67 | #endif |
|
|
68 | |
|
|
69 | /* intptr_t comes from unistd.h, says POSIX/UNIX/tradition */ |
63 | /* intptr_t comes from unistd.h, says POSIX/UNIX/tradition */ |
70 | /* intptr_t only comes from stdint.h, says idiot openbsd coder */ |
64 | /* intptr_t only comes from stdint.h, says idiot openbsd coder */ |
71 | #if HAVE_STDINT_H |
65 | #if HAVE_STDINT_H |
72 | # include <stdint.h> |
66 | # include <stdint.h> |
73 | #endif |
67 | #endif |
… | |
… | |
318 | } |
312 | } |
319 | |
313 | |
320 | return buf->ptr; |
314 | return buf->ptr; |
321 | } |
315 | } |
322 | |
316 | |
|
|
317 | struct tmpbuf; |
|
|
318 | |
|
|
319 | #if _POSIX_VERSION >= 200809L |
|
|
320 | #define HAVE_AT 1 |
|
|
321 | #define WD2FD(wd) ((wd) ? (wd)->fd : AT_FDCWD) |
|
|
322 | #ifndef O_SEARCH |
|
|
323 | #define O_SEARCH O_RDONLY |
|
|
324 | #endif |
|
|
325 | #else |
|
|
326 | #define HAVE_AT 0 |
|
|
327 | static const char *wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path); |
|
|
328 | #endif |
|
|
329 | |
|
|
330 | struct eio_pwd |
|
|
331 | { |
|
|
332 | #if HAVE_AT |
|
|
333 | int fd; |
|
|
334 | #endif |
|
|
335 | int len; |
|
|
336 | char str[1]; /* actually, a 0-terminated canonical path */ |
|
|
337 | }; |
|
|
338 | |
323 | /*****************************************************************************/ |
339 | /*****************************************************************************/ |
324 | |
340 | |
325 | #define ETP_PRI_MIN EIO_PRI_MIN |
341 | #define ETP_PRI_MIN EIO_PRI_MIN |
326 | #define ETP_PRI_MAX EIO_PRI_MAX |
342 | #define ETP_PRI_MAX EIO_PRI_MAX |
327 | |
343 | |
… | |
… | |
393 | #define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock) |
409 | #define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock) |
394 | #define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock) |
410 | #define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock) |
395 | |
411 | |
396 | /* worker threads management */ |
412 | /* worker threads management */ |
397 | |
413 | |
398 | static void ecb_cold |
414 | static void |
399 | etp_worker_clear (etp_worker *wrk) |
415 | etp_worker_clear (etp_worker *wrk) |
400 | { |
416 | { |
401 | } |
417 | } |
402 | |
418 | |
403 | static void ecb_cold |
419 | static void ecb_cold |
… | |
… | |
1366 | } |
1382 | } |
1367 | |
1383 | |
1368 | /*****************************************************************************/ |
1384 | /*****************************************************************************/ |
1369 | /* requests implemented outside eio_execute, because they are so large */ |
1385 | /* requests implemented outside eio_execute, because they are so large */ |
1370 | |
1386 | |
1371 | /* copies some absolute path to tmpbuf */ |
|
|
1372 | static char * |
|
|
1373 | eio__getwd (struct tmpbuf *tmpbuf, eio_wd wd) |
|
|
1374 | { |
|
|
1375 | if (wd == EIO_CWD) |
|
|
1376 | return getcwd (tmpbuf->ptr, PATH_MAX); |
|
|
1377 | |
|
|
1378 | #if HAVE_AT |
|
|
1379 | abort (); /*TODO*/ |
|
|
1380 | #else |
|
|
1381 | strcpy (tmpbuf->ptr, wd); |
|
|
1382 | #endif |
|
|
1383 | return tmpbuf->ptr; |
|
|
1384 | } |
|
|
1385 | |
|
|
1386 | /* result will always end up in tmpbuf, there is always space for adding a 0-byte */ |
1387 | /* result will always end up in tmpbuf, there is always space for adding a 0-byte */ |
1387 | static int |
1388 | static int |
1388 | eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) |
1389 | eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) |
1389 | { |
1390 | { |
1390 | const char *rel = path; |
1391 | const char *rel = path; |
… | |
… | |
1394 | int symlinks = SYMLOOP_MAX; |
1395 | int symlinks = SYMLOOP_MAX; |
1395 | #else |
1396 | #else |
1396 | int symlinks = 32; |
1397 | int symlinks = 32; |
1397 | #endif |
1398 | #endif |
1398 | |
1399 | |
1399 | /*D*/ /*TODO: wd ignored */ |
|
|
1400 | |
|
|
1401 | errno = EINVAL; |
1400 | errno = EINVAL; |
1402 | if (!rel) |
1401 | if (!rel) |
1403 | return -1; |
1402 | return -1; |
1404 | |
1403 | |
1405 | errno = ENOENT; |
1404 | errno = ENOENT; |
… | |
… | |
1433 | #endif |
1432 | #endif |
1434 | #endif |
1433 | #endif |
1435 | |
1434 | |
1436 | if (*rel != '/') |
1435 | if (*rel != '/') |
1437 | { |
1436 | { |
1438 | if (!eio__getwd (tmpbuf, wd)) |
1437 | int len; |
|
|
1438 | |
|
|
1439 | errno = ENOENT; |
|
|
1440 | if (wd == EIO_INVALID_WD) |
1439 | return -1; |
1441 | return -1; |
|
|
1442 | |
|
|
1443 | if (wd == EIO_CWD) |
|
|
1444 | { |
|
|
1445 | if (!getcwd (res, PATH_MAX)) |
|
|
1446 | return -1; |
|
|
1447 | |
|
|
1448 | len = strlen (res); |
|
|
1449 | } |
|
|
1450 | else |
|
|
1451 | memcpy (res, wd->str, len = wd->len); |
1440 | |
1452 | |
1441 | if (res [1]) /* only use if not / */ |
1453 | if (res [1]) /* only use if not / */ |
1442 | res += strlen (res); |
1454 | res += len; |
1443 | } |
1455 | } |
1444 | |
1456 | |
1445 | while (*rel) |
1457 | while (*rel) |
1446 | { |
1458 | { |
1447 | eio_ssize_t len, linklen; |
1459 | eio_ssize_t len, linklen; |
… | |
… | |
1694 | eio_dent_insertion_sort (dents, size); |
1706 | eio_dent_insertion_sort (dents, size); |
1695 | } |
1707 | } |
1696 | |
1708 | |
1697 | /* read a full directory */ |
1709 | /* read a full directory */ |
1698 | static void |
1710 | static void |
1699 | eio__scandir (eio_req *req) |
1711 | eio__scandir (eio_req *req, etp_worker *self) |
1700 | { |
1712 | { |
1701 | char *name, *names; |
1713 | char *name, *names; |
1702 | int namesalloc = 4096 - sizeof (void *) * 4; |
1714 | int namesalloc = 4096 - sizeof (void *) * 4; |
1703 | int namesoffs = 0; |
1715 | int namesoffs = 0; |
1704 | int flags = req->int1; |
1716 | int flags = req->int1; |
… | |
… | |
1722 | #ifdef _WIN32 |
1734 | #ifdef _WIN32 |
1723 | { |
1735 | { |
1724 | int len = strlen ((const char *)req->ptr1); |
1736 | int len = strlen ((const char *)req->ptr1); |
1725 | char *path = malloc (MAX_PATH); |
1737 | char *path = malloc (MAX_PATH); |
1726 | const char *fmt; |
1738 | const char *fmt; |
|
|
1739 | const char *reqpath = wd_expand (&self->tmpbuf, req->wd, req->ptr1); |
1727 | |
1740 | |
1728 | if (!len) |
1741 | if (!len) |
1729 | fmt = "./*"; |
1742 | fmt = "./*"; |
1730 | else if (((const char *)req->ptr1)[len - 1] == '/' || ((const char *)req->ptr1)[len - 1] == '\\') |
1743 | else if (reqpath[len - 1] == '/' || reqpath[len - 1] == '\\') |
1731 | fmt = "%s*"; |
1744 | fmt = "%s*"; |
1732 | else |
1745 | else |
1733 | fmt = "%s/*"; |
1746 | fmt = "%s/*"; |
1734 | |
1747 | |
1735 | _snprintf (path, MAX_PATH, fmt, (const char *)req->ptr1); |
1748 | _snprintf (path, MAX_PATH, fmt, reqpath); |
1736 | dirp = FindFirstFile (path, &entp); |
1749 | dirp = FindFirstFile (path, &entp); |
1737 | free (path); |
1750 | free (path); |
1738 | |
1751 | |
1739 | if (dirp == INVALID_HANDLE_VALUE) |
1752 | if (dirp == INVALID_HANDLE_VALUE) |
1740 | { |
1753 | { |
… | |
… | |
1762 | |
1775 | |
1763 | return; |
1776 | return; |
1764 | } |
1777 | } |
1765 | } |
1778 | } |
1766 | #else |
1779 | #else |
|
|
1780 | #if HAVE_AT |
|
|
1781 | if (req->wd) |
|
|
1782 | { |
|
|
1783 | int fd = openat (WD2FD (req->wd), req->ptr1, O_CLOEXEC | O_SEARCH | O_DIRECTORY); |
|
|
1784 | |
|
|
1785 | if (fd < 0) |
|
|
1786 | return; |
|
|
1787 | |
|
|
1788 | dirp = fdopendir (fd); |
|
|
1789 | |
|
|
1790 | if (!dirp) |
|
|
1791 | close (fd); |
|
|
1792 | } |
|
|
1793 | else |
1767 | dirp = opendir (req->ptr1); |
1794 | dirp = opendir (req->ptr1); |
|
|
1795 | #else |
|
|
1796 | dirp = opendir (wd_expand (&self->tmpbuf, req->wd, req->ptr1)); |
|
|
1797 | #endif |
1768 | |
1798 | |
1769 | if (!dirp) |
1799 | if (!dirp) |
1770 | return; |
1800 | return; |
1771 | #endif |
1801 | #endif |
1772 | |
1802 | |
… | |
… | |
1966 | } |
1996 | } |
1967 | } |
1997 | } |
1968 | |
1998 | |
1969 | /*****************************************************************************/ |
1999 | /*****************************************************************************/ |
1970 | /* working directory stuff */ |
2000 | /* working directory stuff */ |
|
|
2001 | /* various deficiencies in the posix 2008 api force us to */ |
|
|
2002 | /* keep the absolute path in string form at all times */ |
|
|
2003 | /* fuck yeah. */ |
|
|
2004 | |
|
|
2005 | #if !HAVE_AT |
|
|
2006 | |
|
|
2007 | /* a bit like realpath, but usually faster because it doesn'T have to return */ |
|
|
2008 | /* an absolute or canonical path */ |
|
|
2009 | static const char * |
|
|
2010 | wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) |
|
|
2011 | { |
|
|
2012 | if (!wd || *path == '/') |
|
|
2013 | return path; |
|
|
2014 | |
|
|
2015 | if (path [0] == '.' && !path [1]) |
|
|
2016 | return wd->str; |
|
|
2017 | |
|
|
2018 | { |
|
|
2019 | int l1 = wd->len; |
|
|
2020 | int l2 = strlen (path); |
|
|
2021 | |
|
|
2022 | char *res = tmpbuf_get (tmpbuf, l1 + l2 + 2); |
|
|
2023 | |
|
|
2024 | memcpy (res, wd->str, l1); |
|
|
2025 | res [l1] = '/'; |
|
|
2026 | memcpy (res + l1 + 1, path, l2 + 1); |
|
|
2027 | |
|
|
2028 | return res; |
|
|
2029 | } |
|
|
2030 | } |
|
|
2031 | |
|
|
2032 | #endif |
|
|
2033 | |
|
|
2034 | static eio_wd |
|
|
2035 | eio__wd_open_sync (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) |
|
|
2036 | { |
|
|
2037 | int fd; |
|
|
2038 | eio_wd res; |
|
|
2039 | int len = eio__realpath (tmpbuf, wd, path); |
|
|
2040 | |
|
|
2041 | if (len < 0) |
|
|
2042 | return EIO_INVALID_WD; |
1971 | |
2043 | |
1972 | #if HAVE_AT |
2044 | #if HAVE_AT |
|
|
2045 | fd = openat (WD2FD (wd), path, O_CLOEXEC | O_SEARCH | O_DIRECTORY); |
1973 | |
2046 | |
1974 | #define WD2FD(wd) ((wd) ? ((int)(long)(wd)) - 1 : AT_FDCWD) |
2047 | if (fd < 0) |
1975 | |
2048 | return EIO_INVALID_WD; |
1976 | #ifndef O_SEARCH |
|
|
1977 | # define O_SEARCH O_RDONLY |
|
|
1978 | #endif |
2049 | #endif |
|
|
2050 | |
|
|
2051 | res = malloc (sizeof (*res) + len); /* one extra 0-byte */ |
|
|
2052 | |
|
|
2053 | #if HAVE_AT |
|
|
2054 | res->fd = fd; |
|
|
2055 | #endif |
|
|
2056 | |
|
|
2057 | res->len = len; |
|
|
2058 | memcpy (res->str, tmpbuf->ptr, len); |
|
|
2059 | res->str [len] = 0; |
|
|
2060 | |
|
|
2061 | return res; |
|
|
2062 | } |
1979 | |
2063 | |
1980 | eio_wd |
2064 | eio_wd |
1981 | eio_wd_open_sync (eio_wd wd, const char *path) |
2065 | eio_wd_open_sync (eio_wd wd, const char *path) |
1982 | { |
2066 | { |
1983 | int fd = openat (WD2FD (wd), path, O_CLOEXEC | O_SEARCH | O_DIRECTORY); |
2067 | struct tmpbuf tmpbuf = { 0 }; |
1984 | |
|
|
1985 | return fd >= 0 ? (eio_wd)(long)(fd + 1) : EIO_INVALID_WD; |
|
|
1986 | } |
|
|
1987 | |
|
|
1988 | static eio_wd |
|
|
1989 | eio__wd_open_sync (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) |
|
|
1990 | { |
|
|
1991 | return eio_wd_open_sync (wd, path); |
2068 | wd = eio__wd_open_sync (&tmpbuf, wd, path); |
|
|
2069 | free (tmpbuf.ptr); |
|
|
2070 | |
|
|
2071 | return wd; |
1992 | } |
2072 | } |
1993 | |
2073 | |
1994 | void |
2074 | void |
1995 | eio_wd_close_sync (eio_wd wd) |
2075 | eio_wd_close_sync (eio_wd wd) |
1996 | { |
2076 | { |
1997 | int fd = WD2FD (wd); |
2077 | if (wd != EIO_INVALID_WD && wd != EIO_CWD) |
1998 | |
2078 | { |
1999 | if (fd >= 0) |
2079 | #if HAVE_AT |
2000 | close (fd); |
2080 | close (wd->fd); |
|
|
2081 | #endif |
|
|
2082 | free (wd); |
|
|
2083 | } |
2001 | } |
2084 | } |
|
|
2085 | |
|
|
2086 | #if HAVE_AT |
|
|
2087 | |
|
|
2088 | /* they forgot these */ |
2002 | |
2089 | |
2003 | static int |
2090 | static int |
2004 | eio__truncateat (int dirfd, const char *path, off_t length) |
2091 | eio__truncateat (int dirfd, const char *path, off_t length) |
2005 | { |
2092 | { |
2006 | int fd = openat (dirfd, path, O_WRONLY | O_CLOEXEC); |
2093 | int fd = openat (dirfd, path, O_WRONLY | O_CLOEXEC); |
… | |
… | |
2025 | |
2112 | |
2026 | res = fstatvfs (fd, buf); |
2113 | res = fstatvfs (fd, buf); |
2027 | close (fd); |
2114 | close (fd); |
2028 | return res; |
2115 | return res; |
2029 | |
2116 | |
2030 | } |
|
|
2031 | |
|
|
2032 | #else |
|
|
2033 | |
|
|
2034 | /* on legacy systems, we represent the working directories simply by their path strings */ |
|
|
2035 | |
|
|
2036 | static const char * |
|
|
2037 | wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) |
|
|
2038 | { |
|
|
2039 | if (!wd || *path == '/') |
|
|
2040 | return path; |
|
|
2041 | |
|
|
2042 | { |
|
|
2043 | int l1 = strlen ((const char *)wd); |
|
|
2044 | int l2 = strlen (path); |
|
|
2045 | |
|
|
2046 | char *res = tmpbuf_get (tmpbuf, l1 + l2 + 2); |
|
|
2047 | |
|
|
2048 | memcpy (res, wd, l1); |
|
|
2049 | res [l1] = '/'; |
|
|
2050 | memcpy (res + l1 + 1, path, l2 + 1); |
|
|
2051 | |
|
|
2052 | return res; |
|
|
2053 | } |
|
|
2054 | } |
|
|
2055 | |
|
|
2056 | static eio_wd |
|
|
2057 | eio__wd_open_sync (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) |
|
|
2058 | { |
|
|
2059 | if (*path == '/') /* absolute paths ignore wd */ |
|
|
2060 | path = strdup (path); |
|
|
2061 | else if (path [0] == '.' && !path [1]) /* special case '.', as it is common */ |
|
|
2062 | return wd; |
|
|
2063 | else |
|
|
2064 | { |
|
|
2065 | int len = eio__realpath (tmpbuf, wd, path); |
|
|
2066 | |
|
|
2067 | path = EIO_INVALID_WD; |
|
|
2068 | |
|
|
2069 | if (len >= 0) |
|
|
2070 | { |
|
|
2071 | ((char *)tmpbuf->ptr)[len] = 0; |
|
|
2072 | path = strdup (tmpbuf->ptr); |
|
|
2073 | } |
|
|
2074 | } |
|
|
2075 | |
|
|
2076 | if (!path) |
|
|
2077 | path = EIO_INVALID_WD; |
|
|
2078 | |
|
|
2079 | return (eio_wd)path; |
|
|
2080 | } |
|
|
2081 | |
|
|
2082 | eio_wd |
|
|
2083 | eio_wd_open_sync (eio_wd wd, const char *path) |
|
|
2084 | { |
|
|
2085 | struct tmpbuf tmpbuf = { 0 }; |
|
|
2086 | wd = eio__wd_open_sync (&tmpbuf, wd, path); |
|
|
2087 | free (tmpbuf.ptr); |
|
|
2088 | |
|
|
2089 | return wd; |
|
|
2090 | } |
|
|
2091 | |
|
|
2092 | void |
|
|
2093 | eio_wd_close_sync (eio_wd wd) |
|
|
2094 | { |
|
|
2095 | if (wd != EIO_INVALID_WD) |
|
|
2096 | free (wd); |
|
|
2097 | } |
2117 | } |
2098 | |
2118 | |
2099 | #endif |
2119 | #endif |
2100 | |
2120 | |
2101 | /*****************************************************************************/ |
2121 | /*****************************************************************************/ |
… | |
… | |
2113 | req->result = -1; \ |
2133 | req->result = -1; \ |
2114 | break; \ |
2134 | break; \ |
2115 | } \ |
2135 | } \ |
2116 | } |
2136 | } |
2117 | |
2137 | |
|
|
2138 | static void ecb_noinline ecb_cold |
|
|
2139 | etp_proc_init (void) |
|
|
2140 | { |
|
|
2141 | #if HAVE_PRCTL_SET_NAME |
|
|
2142 | /* provide a more sensible "thread name" */ |
|
|
2143 | char name[16 + 1]; |
|
|
2144 | const int namelen = sizeof (name) - 1; |
|
|
2145 | int len; |
|
|
2146 | |
|
|
2147 | prctl (PR_GET_NAME, (unsigned long)name, 0, 0, 0); |
|
|
2148 | name [namelen] = 0; |
|
|
2149 | len = strlen (name); |
|
|
2150 | strcpy (name + (len <= namelen - 4 ? len : namelen - 4), "/eio"); |
|
|
2151 | prctl (PR_SET_NAME, (unsigned long)name, 0, 0, 0); |
|
|
2152 | #endif |
|
|
2153 | } |
|
|
2154 | |
2118 | X_THREAD_PROC (etp_proc) |
2155 | X_THREAD_PROC (etp_proc) |
2119 | { |
2156 | { |
2120 | ETP_REQ *req; |
2157 | ETP_REQ *req; |
2121 | struct timespec ts; |
2158 | struct timespec ts; |
2122 | etp_worker *self = (etp_worker *)thr_arg; |
2159 | etp_worker *self = (etp_worker *)thr_arg; |
2123 | |
2160 | |
2124 | #if HAVE_PRCTL_SET_NAME |
2161 | etp_proc_init (); |
2125 | prctl (PR_SET_NAME, (unsigned long)"eio_thread", 0, 0, 0); |
|
|
2126 | #endif |
|
|
2127 | |
2162 | |
2128 | /* try to distribute timeouts somewhat evenly */ |
2163 | /* try to distribute timeouts somewhat evenly */ |
2129 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
2164 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
2130 | |
2165 | |
2131 | for (;;) |
2166 | for (;;) |
… | |
… | |
2304 | case EIO_OPEN: req->result = openat (dirfd, req->ptr1, req->int1, (mode_t)req->int2); break; |
2339 | case EIO_OPEN: req->result = openat (dirfd, req->ptr1, req->int1, (mode_t)req->int2); break; |
2305 | |
2340 | |
2306 | case EIO_UNLINK: req->result = unlinkat (dirfd, req->ptr1, 0); break; |
2341 | case EIO_UNLINK: req->result = unlinkat (dirfd, req->ptr1, 0); break; |
2307 | case EIO_RMDIR: req->result = unlinkat (dirfd, req->ptr1, AT_REMOVEDIR); break; |
2342 | case EIO_RMDIR: req->result = unlinkat (dirfd, req->ptr1, AT_REMOVEDIR); break; |
2308 | case EIO_MKDIR: req->result = mkdirat (dirfd, req->ptr1, (mode_t)req->int2); break; |
2343 | case EIO_MKDIR: req->result = mkdirat (dirfd, req->ptr1, (mode_t)req->int2); break; |
2309 | case EIO_RENAME: req->result = renameat (dirfd, req->ptr1, WD2FD (req->int3), req->ptr2); break; |
2344 | case EIO_RENAME: req->result = renameat (dirfd, req->ptr1, WD2FD ((eio_wd)req->int3), req->ptr2); break; |
2310 | case EIO_LINK: req->result = linkat (dirfd, req->ptr1, WD2FD (req->int3), req->ptr2, 0); break; |
2345 | case EIO_LINK: req->result = linkat (dirfd, req->ptr1, WD2FD ((eio_wd)req->int3), req->ptr2, 0); break; |
2311 | case EIO_SYMLINK: req->result = symlinkat (req->ptr1, dirfd, req->ptr2); break; |
2346 | case EIO_SYMLINK: req->result = symlinkat (req->ptr1, dirfd, req->ptr2); break; |
2312 | case EIO_MKNOD: req->result = mknodat (dirfd, req->ptr1, (mode_t)req->int2, (dev_t)req->offs); break; |
2347 | case EIO_MKNOD: req->result = mknodat (dirfd, req->ptr1, (mode_t)req->int2, (dev_t)req->offs); break; |
2313 | case EIO_READLINK: ALLOC (PATH_MAX); |
2348 | case EIO_READLINK: ALLOC (PATH_MAX); |
2314 | req->result = readlinkat (dirfd, req->ptr1, req->ptr2, PATH_MAX); break; |
2349 | req->result = readlinkat (dirfd, req->ptr1, req->ptr2, PATH_MAX); break; |
2315 | case EIO_STATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS)); |
2350 | case EIO_STATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS)); |
… | |
… | |
2415 | case EIO_MTOUCH: req->result = eio__mtouch (req); break; |
2450 | case EIO_MTOUCH: req->result = eio__mtouch (req); break; |
2416 | case EIO_MLOCK: req->result = eio__mlock (req->ptr2, req->size); break; |
2451 | case EIO_MLOCK: req->result = eio__mlock (req->ptr2, req->size); break; |
2417 | case EIO_MLOCKALL: req->result = eio__mlockall (req->int1); break; |
2452 | case EIO_MLOCKALL: req->result = eio__mlockall (req->int1); break; |
2418 | case EIO_FALLOCATE: req->result = eio__fallocate (req->int1, req->int2, req->offs, req->size); break; |
2453 | case EIO_FALLOCATE: req->result = eio__fallocate (req->int1, req->int2, req->offs, req->size); break; |
2419 | |
2454 | |
2420 | case EIO_READDIR: eio__scandir (req); break; |
2455 | case EIO_READDIR: eio__scandir (req, self); break; |
2421 | |
2456 | |
2422 | case EIO_BUSY: |
2457 | case EIO_BUSY: |
2423 | #ifdef _WIN32 |
2458 | #ifdef _WIN32 |
2424 | Sleep (req->nv1 * 1e3); |
2459 | Sleep (req->nv1 * 1e3); |
2425 | #else |
2460 | #else |
… | |
… | |
2453 | |
2488 | |
2454 | req->errorno = errno; |
2489 | req->errorno = errno; |
2455 | } |
2490 | } |
2456 | |
2491 | |
2457 | #ifndef EIO_NO_WRAPPERS |
2492 | #ifndef EIO_NO_WRAPPERS |
|
|
2493 | |
|
|
2494 | eio_req *eio_wd_open (const char *path, int pri, eio_cb cb, void *data) |
|
|
2495 | { |
|
|
2496 | REQ (EIO_WD_OPEN); PATH; SEND; |
|
|
2497 | } |
|
|
2498 | |
|
|
2499 | eio_req *eio_wd_close (eio_wd wd, int pri, eio_cb cb, void *data) |
|
|
2500 | { |
|
|
2501 | REQ (EIO_WD_CLOSE); req->wd = wd; SEND; |
|
|
2502 | } |
2458 | |
2503 | |
2459 | eio_req *eio_nop (int pri, eio_cb cb, void *data) |
2504 | eio_req *eio_nop (int pri, eio_cb cb, void *data) |
2460 | { |
2505 | { |
2461 | REQ (EIO_NOP); SEND; |
2506 | REQ (EIO_NOP); SEND; |
2462 | } |
2507 | } |