leveldb: A+C: Markus Sonderegger (individual CLA).

R=dsymonds, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/51710043
leveldb: switch defaultcc to golang-codereviews.

R=dsymonds
CC=golang-codereviews
https://codereview.appspot.com/51710044
leveldb-go: implement file lock on openbsd/amd64.

R=nigeltao
CC=golang-codereviews, nigeltao
https://codereview.appspot.com/50920043

Committer: Nigel Tao <nigeltao@golang.org>
leveldb: C: Bill Theide (Google CLA).

LGTM=dsymonds
R=adg, dsymonds
CC=golang-codereviews
https://codereview.appspot.com/65310044
    leveldb-go: implement file lock on FreeBSD.

I do not believe FreeBSD requires a 32-bit and 64-bit version like Linux
for the following reasons (although I don't have a 32-bit FreeBSD box to
test on).

According to this, off_t is the same size on 32 and 64-bit, and not like linux's two APIs for everything to support LARGEFILE:

http://freecode.com/articles/largefile-support-problems

pid_t is an __int32_t, independent of arch AFAICT https://github.com/freebsd/freebsd/blob/master/sys/sys/_types.h

Type and Whence being shorts made me a bit nervous. This test on my 64-bit machines:

    $ cat short.c

    #include

    int main() {
        printf("sizeof short %lu\n", sizeof(short));
    }

    $ rm short; make CC=gcc short; ./short; rm short; make CC=clang short; ./short
    gcc -O2 -pipe -fno-omit-frame-pointer   short.c  -o short
    sizeof short 2
    clang -O2 -pipe -fno-omit-frame-pointer   short.c  -o short
    sizeof short 2

Makes me think we're safe, as I believe short would be 16-bit on 32-bit, and was unsure about its size on 64-bit.

    $ cat int.c
    #include <stdio.h>

    int main() {
        printf("sizeof int %lu\n", sizeof(int));
    }

    $ rm int; make CC=gcc int; ./int; rm int; make CC=clang int; ./int
    gcc -O2 -pipe -fno-omit-frame-pointer   int.c  -o int
    sizeof int 4
    clang -O2 -pipe -fno-omit-frame-pointer   int.c  -o int
    sizeof int 4

So int is 32-bit on FreeBSD even on 64-bit machines.

Running go test code.google.com/p/leveldb-go/... passes, as does filelock, i.e.:

    $ go run main.go /tmp/lock
    Locking /tmp/lock
    Unlocking /tmp/lock
    OK

LGTM=nigeltao
R=golang-codereviews, nigeltao, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/59220048

Committer: Nigel Tao <nigeltao@golang.org>
    leveldb/db: move manualtest/filelock to standard go test. A by-product
of this is that developers no longer need to run multiple copies of
filelock, the test spawns additional lockers as necessary.

LGTM=nigeltao
R=golang-codereviews, gobot, nigeltao, bradfitz
CC=golang-codereviews
https://codereview.appspot.com/65870043

Committer: Nigel Tao <nigeltao@golang.org>