ensure that needed headers are included for chmod() and mkdir() (bug #3937)