From a94450c2889d209dccb73e699870c7832188343c Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Tue, 31 Jul 2018 14:41:30 +0200 Subject: [PATCH] Fix build for openbsd Signed-off-by: Simon Pasquier --- cmd/prometheus/limits_default.go | 5 ----- cmd/prometheus/vmlimits_default.go | 26 ++++++++++++++++++++++++++ cmd/prometheus/vmlimits_openbsd.go | 25 +++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 cmd/prometheus/vmlimits_default.go create mode 100644 cmd/prometheus/vmlimits_openbsd.go diff --git a/cmd/prometheus/limits_default.go b/cmd/prometheus/limits_default.go index e2c6b10f6..054b72525 100644 --- a/cmd/prometheus/limits_default.go +++ b/cmd/prometheus/limits_default.go @@ -46,8 +46,3 @@ func getLimits(resource int, unit string) string { func FdLimits() string { return getLimits(syscall.RLIMIT_NOFILE, "") } - -// VmLimits returns the soft and hard limits for virtual memory. -func VmLimits() string { - return getLimits(syscall.RLIMIT_AS, "b") -} diff --git a/cmd/prometheus/vmlimits_default.go b/cmd/prometheus/vmlimits_default.go new file mode 100644 index 000000000..5a3a6802d --- /dev/null +++ b/cmd/prometheus/vmlimits_default.go @@ -0,0 +1,26 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build !windows +// +build !openbsd + +package main + +import ( + "syscall" +) + +// VmLimits returns the soft and hard limits for virtual memory. +func VmLimits() string { + return getLimits(syscall.RLIMIT_AS, "b") +} diff --git a/cmd/prometheus/vmlimits_openbsd.go b/cmd/prometheus/vmlimits_openbsd.go new file mode 100644 index 000000000..b033e6421 --- /dev/null +++ b/cmd/prometheus/vmlimits_openbsd.go @@ -0,0 +1,25 @@ +// Copyright 2018 The Prometheus Authors +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// +build openbsd + +package main + +import ( + "syscall" +) + +// VmLimits returns the soft and hard limits for virtual memory. +func VmLimits() string { + return getLimits(syscall.RLIMIT_DATA, "b") +}