## poisondisk

#### OS/161 Reference Manual

### Name

poisondisk - write known "poison" values to a disk image

### Synopsis

`/testbin/poisondisk` disk-device
`hostbin/host-poisondisk` disk-image

### Description

`poisondisk` writes known poison values to a disk image. This allows (mostly) reliable detection of reads from uninitialized disk blocks: they produce the poison value. (Otherwise, uninitialized disk blocks tend to be zeroed; this is much harder to detect and much harder to distinguish from an intentional condition.)

`poisondisk` will overwrite any data already on the disk, so run it prior to running mksfs when creating a new volume.

A host version of poisondisk is build (like with the SFS tools) so it can be run outside OS/161. This version understands System/161 disk image headers and will only overwrite System/161 disk images.

The poison value is 0xa9.

### Requirements

`poisondisk` uses the following system calls:

- open
- fstat
- lseek
- read
- write
- close
- _exit

`poisondisk` will work once you have implemented the system calls it uses (including fstat, which is typically not part of the basic system calls assignment), but is only really useful for working on the file system.