tools/testing/selftests/ptp/testptp.c
Source file repositories/reference/linux-study-clean/tools/testing/selftests/ptp/testptp.c
File Facts
- System
- Linux kernel
- Corpus path
tools/testing/selftests/ptp/testptp.c- Extension
.c- Size
- 17123 bytes
- Lines
- 695
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
errno.hfcntl.hinttypes.hmath.hsignal.hstdio.hstdlib.hstring.hsys/ioctl.hsys/mman.hsys/stat.hsys/time.hsys/timex.hsys/types.htime.hunistd.hlinux/ptp_clock.hsys/syscall.h
Detected Declarations
function Copyrightfunction show_flag_testfunction do_flag_testfunction get_clockidfunction ppb_to_scaled_ppmfunction pctnsfunction usagefunction main
Annotated Snippet
switch (c) {
case 'c':
capabilities = 1;
break;
case 'd':
device = optarg;
break;
case 'e':
extts = atoi(optarg);
break;
case 'E':
edge = atoi(optarg);
edge = (edge & 1 ? PTP_RISING_EDGE : 0) |
(edge & 2 ? PTP_FALLING_EDGE : 0);
break;
case 'f':
adjfreq = atoi(optarg);
break;
case 'F':
channel = atoi(optarg);
break;
case 'g':
gettime = 1;
break;
case 'H':
perout_phase = atoll(optarg);
break;
case 'i':
index = atoi(optarg);
break;
case 'k':
pct_offset = 1;
n_samples = atoi(optarg);
break;
case 'l':
list_pins = 1;
break;
case 'L':
cnt = sscanf(optarg, "%d,%d", &pin_index, &pin_func);
if (cnt != 2) {
usage(progname);
return -1;
}
break;
case 'n':
adjns = atoi(optarg);
break;
case 'o':
adjphase = atoi(optarg);
break;
case 'p':
perout = atoll(optarg);
break;
case 'P':
pps = atoi(optarg);
break;
case 'r':
readonly = 1;
break;
case 's':
settime = 1;
break;
case 'S':
settime = 2;
break;
case 't':
adjtime = atoi(optarg);
break;
case 'T':
settime = 3;
seconds = atoi(optarg);
break;
case 'w':
pulsewidth = atoi(optarg);
break;
case 'x':
getextended = atoi(optarg);
if (getextended < 1 || getextended > PTP_MAX_SAMPLES) {
fprintf(stderr,
"number of extended timestamp samples must be between 1 and %d; was asked for %d\n",
PTP_MAX_SAMPLES, getextended);
return -1;
}
break;
case 'X':
getcross = 1;
break;
case 'y':
if (!strcasecmp(optarg, "realtime"))
ext_clockid = CLOCK_REALTIME;
Annotation
- Immediate include surface: `errno.h`, `fcntl.h`, `inttypes.h`, `math.h`, `signal.h`, `stdio.h`, `stdlib.h`, `string.h`.
- Detected declarations: `function Copyright`, `function show_flag_test`, `function do_flag_test`, `function get_clockid`, `function ppb_to_scaled_ppm`, `function pctns`, `function usage`, `function main`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.