unix: add Getcwd to support Getwd on all BSDs

All BSDs provide the SYS___GETCWD syscall which can be used to implement
Getwd.

Also add a test based on TestChdirAndGetwd from os/os_test.go

Change-Id: I243eae3e02a40e92afad317eb1f8a28b6032c131
Reviewed-on: https://go-review.googlesource.com/83755
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/unix/types_dragonfly.go b/unix/types_dragonfly.go
index d6ccfba..0c63304 100644
--- a/unix/types_dragonfly.go
+++ b/unix/types_dragonfly.go
@@ -127,6 +127,12 @@
 
 type Fsid C.struct_fsid
 
+// File system limits
+
+const (
+	PathMax = C.PATH_MAX
+)
+
 // Sockets
 
 type RawSockaddrInet4 C.struct_sockaddr_in