1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // +build dragonfly freebsd netbsd openbsd 6 7 package syscall 8 9 const ImplementsGetwd = true 10 11 func Getwd() (string, error) { 12 var buf [pathMax]byte 13 _, err := getcwd(buf[:]) 14 if err != nil { 15 return "", err 16 } 17 n := clen(buf[:]) 18 if n < 1 { 19 return "", EINVAL 20 } 21 return string(buf[:n]), nil 22 } 23