samples/acrn/vm-sample.c
Source file repositories/reference/linux-study-clean/samples/acrn/vm-sample.c
File Facts
- System
- Linux kernel
- Corpus path
samples/acrn/vm-sample.c- Extension
.c- Size
- 3649 bytes
- Lines
- 133
- Domain
- Support Tooling And Documentation
- Bucket
- samples
- 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
stdio.hstdint.hstdlib.hstring.hfcntl.hunistd.hsignal.hsys/ioctl.hlinux/acrn.h
Detected Declarations
function vm_exitfunction main
Annotated Snippet
if (io_req->type == ACRN_IOREQ_TYPE_PORTIO) {
int bytes, port, in;
port = io_req->reqs.pio_request.address;
bytes = io_req->reqs.pio_request.size;
in = (io_req->reqs.pio_request.direction == ACRN_IOREQ_DIR_READ);
printf("Guest VM %s PIO[%x] with size[%x]\n", in ? "read" : "write", port, bytes);
notify.vmid = vmid;
notify.vcpu = vcpu_id;
ioctl(hsm_fd, ACRN_IOCTL_NOTIFY_REQUEST_FINISH, ¬ify);
}
}
}
ret = ioctl(hsm_fd, ACRN_IOCTL_DESTROY_VM, NULL);
printf("Destroy VM! [%d]\n", ret);
close(hsm_fd);
free(guest_memory);
return 0;
}
Annotation
- Immediate include surface: `stdio.h`, `stdint.h`, `stdlib.h`, `string.h`, `fcntl.h`, `unistd.h`, `signal.h`, `sys/ioctl.h`.
- Detected declarations: `function vm_exit`, `function main`.
- Atlas domain: Support Tooling And Documentation / samples.
- 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.