| 2224 | } |
| 2225 | |
| 2226 | static char *fd_mode_str(int fd) |
| 2227 | { |
| 2228 | struct stat finfo; |
| 2229 | if (0 != fstat(fd, &finfo)) |
| 2230 | return "invalid fd"; |
| 2231 | if (S_ISBLK(finfo.st_mode)) |
| 2232 | return "block special"; |
| 2233 | if (S_ISCHR(finfo.st_mode)) |
| 2234 | return "char special"; |
| 2235 | if (S_ISDIR(finfo.st_mode)) |
| 2236 | return "directory"; |
| 2237 | if (S_ISFIFO(finfo.st_mode)) |
| 2238 | return "fifo or socket"; |
| 2239 | if (S_ISREG(finfo.st_mode)) |
| 2240 | return "regular file"; |
| 2241 | if (S_ISLNK(finfo.st_mode)) |
| 2242 | return "symbolic link"; |
| 2243 | if (S_ISSOCK(finfo.st_mode)) |
| 2244 | return "socket"; |
| 2245 | return "unknown"; |
| 2246 | } |
| 2247 | |
| 2248 | static void dev_report_fds(struct daemon *daemon, const u8 *msg) |
| 2249 | { |