Replace mknod() with chmod()

Using mknod() can be troublesome on Macs since the underlying system
call requires super-user privileges. Since its main use here
is to set the mode of the file (the subsequent call to open() is
enough to create it), we remove it and replace it with the less
troublesome chmod().

Partial-Bug: #1329077

Change-Id: I30c767792f44d27c6c0179474112015c5ab9bac3
Merge "Replace mknod() with chmod()"