Call fdatasync/fsync after writing out non-meta pages

This avoids a case where writes can be reordered so meta page is
written before a page it refers to, potentially causing a corrupt
database after a power loss or kernel crash.
fix 32bit build fails: bucket.go#67
Merge pull request #75 from Slacken/32bit_build_fails_bucket_go_67

Fix 32bit build
Merge branch 'fdatasync' of https://github.com/tv42/bolt into fsync
Consolidate syscall files.
Merge pull request #76 from benbjohnson/fsync

fdatasync
Mark Do()/With() transaction as managed.

Transaction created from Do() and With() are now considered "managed".
Managed transactions cannot be manually committed or rolled back since
the Do() and With() functions provide that functionally automatically.
Previously, a Tx could be manually committed and then any changes after
that would be lost.
Merge pull request #78 from benbjohnson/tx-managed

Mark Do()/With() transaction as managed.
Add ErrTxClosed error.

Commit/Rollback and mutable calls on Tx and Bucket now return ErrTxClosed
if the transaction has already been committed or rolled back. Non-mutable
calls have added an assertion to check if the transaction is closed which
will cause a panic. I don't want to introduce an error return for accessor
methods that are being used improperly so I think the panic is appropriate.
Merge pull request #81 from benbjohnson/tx-closed

Add ErrTxClosed error.
Check meta page write error in Commit
Check spill error in Commit
Check errors from file close in DB.CopyFile

Write errors are often delayed and reported only by the close.

The extra close in defer on success is harmless, (*os.File).Close
protects itself against multiple closes, and this way it's immediately
obvious there is no code path that would leak open files.
Resolve remaining errcheck warnings.
Re-add tests for write failures

Commit d2173f5f0ecbf4ed93c768e975435b04df3186ec removed the complete
os & syscall mocking layer as overly complex. This commit adds back
the simplest possible thing: hooks to control the database file
writes.

Missing tests: TestDBOpenMetaFileError, TestDBMmapStatError.
These are harder to test without more extensive mocking.

Conflicts:
	db_test.go
Merge pull request #86 from benbjohnson/mock

Re-add tests for write failures
Error refactoring.

Fixed up a few error issues and refactored out the Error type.
Merge pull request #87 from benbjohnson/errors

Error refactoring
Make DB/Tx API more consistent.

I consolidated the DB.Tx() and DB.RWTx() calls into a single
DB.Begin(writable bool) call. This is more consistent with the
database/sql library.

I also changed the DB.Do() and DB.With() call to DB.Update() and
DB.View(), respectively. This is more intuitive and more inline with
other database verbiage.
Merge pull request #88 from benbjohnson/tx-rename

Make DB/Tx API more consistent.