doc/SystemTap_Beginners_Guide/testsuite/systemtap.base/at_var_lvalue.c
raw| 1 | #include <sys/time.h> |
| 2 | |
| 3 | struct foo |
| 4 | { |
| 5 | int bar; |
| 6 | }; |
| 7 | |
| 8 | static struct foo foo; |
| 9 | |
| 10 | void sub(const char *file) |
| 11 | { |
| 12 | struct timeval times[2]; |
| 13 | times[0].tv_sec = 1; |
| 14 | times[0].tv_usec = 2; |
| 15 | times[1].tv_sec = 3; |
| 16 | times[1].tv_usec = 4; |
| 17 | utimes (file, times); |
| 18 | foo.bar -= 2; /* 40 */ |
| 19 | } |
| 20 | |
| 21 | int |
| 22 | main (int argc, char **argv) |
| 23 | { |
| 24 | foo.bar = 41 + argc; /* 42 */ |
| 25 | sub(argv[0]); |
| 26 | sub(argv[0]); |
| 27 | sub(argv[0]); |
| 28 | return 0; |
| 29 | } |