Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eatonphil/badio
https://github.com/eatonphil/badio
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/eatonphil/badio
- Owner: eatonphil
- Created: 2023-09-29T19:58:13.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-30T17:27:10.000Z (about 1 year ago)
- Last Synced: 2024-10-13T04:13:06.182Z (about 1 month ago)
- Language: Zig
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# badio
ptrace layer for triggering bad IO behavior.
Example:
```
$ make
$ (cd test && go build main.go)
$ cat test/main.go
package mainimport (
"os"
)func main() {
f, err := os.OpenFile("test.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0755)
if err != nil {
panic(err)
}text := "some great stuff"
_, _ = f.Write([]byte(text))_ = f.Close()
}
$ ./main test/main
Got a write on 3: some great stu
$ cat test.txt
some great stu
```## Notes
* https://nullprogram.com/blog/2018/06/23/
* https://webdocs.cs.ualberta.ca/~paullu/C498/meng.ptrace.slides.pdf
* https://linux.die.net/man/2/ptrace
* https://man7.org/linux/man-pages/man2/write.2.html
* Calling convention https://stackoverflow.com/questions/2535989/what-are-the-calling-conventions-for-unix-linux-system-calls-and-user-space-fOn Go writes on Linux:
* https://cs.opensource.google/go/go/+/refs/tags/go1.21.1:src/internal/poll/fd_unix.go