Ensure tsdb can be built on SmartOS/Illumos/Solaris

At the moment tsdb cannot be built on Illumos/Solaris due to

- An exclude tag against Solaris is added in db_unix.go
- We use built-in syscall package, which doesn't have nmmap and munmap support

This PR supports build on Illumos/Solaris by remove the Solaris exclude tag in db_unix.go
At the same time use golang.org/x/sys/unix package instead of syscall package, since it has Solaris nmmap and munmap implementation.
This commit is contained in:
Jingkai He 2017-11-08 23:32:35 +00:00
parent 7337c6a513
commit bfadf72d3f
No known key found for this signature in database
GPG key ID: BF0066A669A78355

View file

@ -11,19 +11,20 @@
// See the License for the specific language governing permissions and
// limitations under the License.
// +build !windows,!plan9,!solaris
// +build !windows,!plan9
package tsdb
import (
"os"
"syscall"
"golang.org/x/sys/unix"
)
func mmap(f *os.File, length int) ([]byte, error) {
return syscall.Mmap(int(f.Fd()), 0, length, syscall.PROT_READ, syscall.MAP_SHARED)
return unix.Mmap(int(f.Fd()), 0, length, unix.PROT_READ, unix.MAP_SHARED)
}
func munmap(b []byte) (err error) {
return syscall.Munmap(b)
return unix.Munmap(b)
}