// main calls libc through the PLT, each call a system call: a call followed // down, through the stub and libc's wrapper to the kernel, and back up. // Linked for lazy binding: a function's first call runs the loader's // resolver, its second (the second read) goes straight to it. #include #include int main(int argc, char **argv) { char buf[16]; int f = open(argv[0], O_RDONLY); long n = read(f, buf, sizeof buf); n += read(f, buf, sizeof buf); close(f); return n == 2 * sizeof buf ? 0 : 1; }