tools/gpio/gpio-hammer.c
Source file repositories/reference/linux-study-clean/tools/gpio/gpio-hammer.c
File Facts
- System
- Linux kernel
- Corpus path
tools/gpio/gpio-hammer.c- Extension
.c- Size
- 3876 bytes
- Lines
- 177
- 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
unistd.hstdlib.hstdbool.hstdio.hdirent.herrno.hstring.hpoll.hfcntl.hgetopt.hsys/ioctl.hlinux/gpio.hgpio-utils.h
Detected Declarations
function Copyrightfunction print_usagefunction main
Annotated Snippet
switch (c) {
case 'c':
loops = strtoul(optarg, NULL, 10);
break;
case 'n':
device_name = optarg;
break;
case 'o':
/*
* Avoid overflow. Do not immediately error, we want to
* be able to accurately report on the amount of times
* '-o' was given to give an accurate error message
*/
if (i < GPIOHANDLES_MAX)
lines[i] = strtoul(optarg, NULL, 10);
i++;
break;
case '?':
print_usage();
return -1;
}
}
if (i >= GPIOHANDLES_MAX) {
fprintf(stderr,
"Only %d occurrences of '-o' are allowed, %d were found\n",
GPIOHANDLES_MAX, i + 1);
return -1;
}
num_lines = i;
if (!device_name || !num_lines) {
print_usage();
return -1;
}
return hammer_device(device_name, lines, num_lines, loops);
}
Annotation
- Immediate include surface: `unistd.h`, `stdlib.h`, `stdbool.h`, `stdio.h`, `dirent.h`, `errno.h`, `string.h`, `poll.h`.
- Detected declarations: `function Copyright`, `function print_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.