fix warnings + errors with clang regarding return types and declarations

With clang:
```
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix
```

I get warnings about open(), read(), and close() not being declared (so that is fixed), and functions without return types (defaulting to int) being returned void (so that is fixed too).