Add MAXWRITE constant

Limit the maximum amount of data that a program can write.