Description 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
Patch Set 1 #Patch Set 2 : diff -r a2c0ed4d6198 https://code.google.com/p/leveldb-go #Patch Set 3 : diff -r 0b4dffc91e3b https://code.google.com/p/leveldb-go #Patch Set 4 : diff -r 0b4dffc91e3b https://code.google.com/p/leveldb-go #
MessagesTotal messages: 5
|