tools/iio/lsiio.c
Source file repositories/reference/linux-study-clean/tools/iio/lsiio.c
File Facts
- System
- Linux kernel
- Corpus path
tools/iio/lsiio.c- Extension
.c- Size
- 3802 bytes
- Lines
- 189
- 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
string.hdirent.hstdio.herrno.hstdint.hstdlib.hunistd.hsys/types.hsys/stat.hsys/dir.hiio_utils.h
Detected Declarations
function check_prefixfunction check_postfixfunction dump_channelsfunction dump_one_devicefunction dump_one_triggerfunction dump_devicesfunction main
Annotated Snippet
if (check_prefix(ent->d_name, type_device)) {
char *dev_dir_name;
if (asprintf(&dev_dir_name, "%s%s", iio_dir,
ent->d_name) < 0) {
ret = -ENOMEM;
goto error_close_dir;
}
ret = dump_one_device(dev_dir_name);
if (ret) {
free(dev_dir_name);
goto error_close_dir;
}
free(dev_dir_name);
if (verblevel >= VERBLEVEL_SENSORS)
printf("\n");
}
}
rewinddir(dp);
while (ent = readdir(dp), ent) {
if (check_prefix(ent->d_name, type_trigger)) {
char *dev_dir_name;
if (asprintf(&dev_dir_name, "%s%s", iio_dir,
ent->d_name) < 0) {
ret = -ENOMEM;
goto error_close_dir;
}
ret = dump_one_trigger(dev_dir_name);
if (ret) {
free(dev_dir_name);
goto error_close_dir;
}
free(dev_dir_name);
}
}
return (closedir(dp) == -1) ? -errno : 0;
error_close_dir:
if (closedir(dp) == -1)
perror("dump_devices(): Failed to close directory");
return ret;
}
int main(int argc, char **argv)
{
int c, err = 0;
while ((c = getopt(argc, argv, "v")) != EOF) {
switch (c) {
case 'v':
verblevel++;
break;
case '?':
default:
err++;
break;
}
}
if (err || argc > optind) {
fprintf(stderr, "Usage: lsiio [options]...\n"
"List industrial I/O devices\n"
" -v Increase verbosity (may be given multiple times)\n");
exit(1);
}
return dump_devices();
}
Annotation
- Immediate include surface: `string.h`, `dirent.h`, `stdio.h`, `errno.h`, `stdint.h`, `stdlib.h`, `unistd.h`, `sys/types.h`.
- Detected declarations: `function check_prefix`, `function check_postfix`, `function dump_channels`, `function dump_one_device`, `function dump_one_trigger`, `function dump_devices`, `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.