C - Lstat on /proc/pid/exe
问题 I'm trying to get the size in bytes of a /proc/pid/exe file with lstat. Here's my code: int main(int argc, char *argv[]) { struct stat sb; char *linkname; ssize_t r; if (argc != 2) { fprintf(stderr, "Usage: %s <pathname>\n", argv[0]); exit(EXIT_FAILURE); } if (lstat(argv[1], &sb) == -1) { perror("lstat"); exit(EXIT_FAILURE); } printf("sb.st_size %d\n", sb.st_size); exit(EXIT_SUCCESS); } It seems like sb.st_size is ALWAYS equal to 0, and I don't understand why. Plus, this sample is extracted