… | |
… | |
1487 | } |
1487 | } |
1488 | } |
1488 | } |
1489 | |
1489 | |
1490 | errno = ENAMETOOLONG; |
1490 | errno = ENAMETOOLONG; |
1491 | if (res + 1 + len + 1 >= tmp1) |
1491 | if (res + 1 + len + 1 >= tmp1) |
1492 | return; |
1492 | return -1; |
1493 | |
1493 | |
1494 | /* copy one component */ |
1494 | /* copy one component */ |
1495 | *res = '/'; |
1495 | *res = '/'; |
1496 | memcpy (res + 1, beg, len); |
1496 | memcpy (res + 1, beg, len); |
1497 | |
1497 | |
… | |
… | |
1966 | { |
1966 | { |
1967 | if (ent->type == EIO_DT_UNKNOWN) |
1967 | if (ent->type == EIO_DT_UNKNOWN) |
1968 | { |
1968 | { |
1969 | if (*name == '.') /* leading dots are likely directories, and, in any case, rare */ |
1969 | if (*name == '.') /* leading dots are likely directories, and, in any case, rare */ |
1970 | ent->score = 1; |
1970 | ent->score = 1; |
1971 | else if (!strchr (name, '.')) /* absense of dots indicate likely dirs */ |
1971 | else if (!strchr (name, '.')) /* absence of dots indicate likely dirs */ |
1972 | ent->score = len <= 2 ? 4 - len : len <= 4 ? 4 : len <= 7 ? 5 : 6; /* shorter == more likely dir, but avoid too many classes */ |
1972 | ent->score = len <= 2 ? 4 - len : len <= 4 ? 4 : len <= 7 ? 5 : 6; /* shorter == more likely dir, but avoid too many classes */ |
1973 | } |
1973 | } |
1974 | else if (ent->type == EIO_DT_DIR) |
1974 | else if (ent->type == EIO_DT_DIR) |
1975 | ent->score = 0; |
1975 | ent->score = 0; |
1976 | } |
1976 | } |
… | |
… | |
2133 | req->result = -1; \ |
2133 | req->result = -1; \ |
2134 | break; \ |
2134 | break; \ |
2135 | } \ |
2135 | } \ |
2136 | } |
2136 | } |
2137 | |
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 | |
2138 | X_THREAD_PROC (etp_proc) |
2155 | X_THREAD_PROC (etp_proc) |
2139 | { |
2156 | { |
2140 | ETP_REQ *req; |
2157 | ETP_REQ *req; |
2141 | struct timespec ts; |
2158 | struct timespec ts; |
2142 | etp_worker *self = (etp_worker *)thr_arg; |
2159 | etp_worker *self = (etp_worker *)thr_arg; |
2143 | |
2160 | |
2144 | #if HAVE_PRCTL_SET_NAME |
2161 | etp_proc_init (); |
2145 | prctl (PR_SET_NAME, (unsigned long)"eio_thread", 0, 0, 0); |
|
|
2146 | #endif |
|
|
2147 | |
2162 | |
2148 | /* try to distribute timeouts somewhat evenly */ |
2163 | /* try to distribute timeouts somewhat evenly */ |
2149 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
2164 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
2150 | |
2165 | |
2151 | for (;;) |
2166 | for (;;) |