| 2176 | } |
| 2177 | |
| 2178 | static char *fd_mode_str(int fd) |
| 2179 | { |
| 2180 | struct stat finfo; |
| 2181 | if (0 != fstat(fd, &finfo)) |
| 2182 | return "invalid fd"; |
| 2183 | if (S_ISBLK(finfo.st_mode)) |
| 2184 | return "block special"; |
| 2185 | if (S_ISCHR(finfo.st_mode)) |
| 2186 | return "char special"; |
| 2187 | if (S_ISDIR(finfo.st_mode)) |
| 2188 | return "directory"; |
| 2189 | if (S_ISFIFO(finfo.st_mode)) |
| 2190 | return "fifo or socket"; |
| 2191 | if (S_ISREG(finfo.st_mode)) |
| 2192 | return "regular file"; |
| 2193 | if (S_ISLNK(finfo.st_mode)) |
| 2194 | return "symbolic link"; |
| 2195 | if (S_ISSOCK(finfo.st_mode)) |
| 2196 | return "socket"; |
| 2197 | return "unknown"; |
| 2198 | } |
| 2199 | |
| 2200 | static void dev_report_fds(struct daemon *daemon, const u8 *msg) |
| 2201 | { |