From 69d7632211e20d05f564e67e0cb9fd98929e5d5a Mon Sep 17 00:00:00 2001 From: Tad Marshall Date: Wed, 19 Jun 2013 19:29:15 -0400 Subject: SERVER-7404 Link to posix_fadvise at runtime for Solaris For the Solaris/SmartOS build, do not make direct calls to posix_fadvise, which is present in Solaris 11 but not in Solaris 10. Instead, see if it is available in a loaded library (which will be libc.so.1) at runtime and either call it or call an emulation. The emulation is a no-op. --- src/mongo/platform/posix_fadvise.h | 41 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/mongo/platform/posix_fadvise.h (limited to 'src/mongo/platform/posix_fadvise.h') diff --git a/src/mongo/platform/posix_fadvise.h b/src/mongo/platform/posix_fadvise.h new file mode 100644 index 00000000000..117b6b917f4 --- /dev/null +++ b/src/mongo/platform/posix_fadvise.h @@ -0,0 +1,41 @@ +/* Copyright 2013 10gen Inc. + * + * 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. + */ + +#pragma once + +#if !defined(_WIN32) + +#include + +#if defined(__sunos__) + +#include + +namespace mongo { + namespace pal { + int posix_fadvise(int fd, off_t offset, off_t len, int advice); + } // namespace pal + using pal::posix_fadvise; +} // namespace mongo + +#elif defined(POSIX_FADV_DONTNEED) + +namespace mongo { + using ::posix_fadvise; +} // namespace mongo + +#endif + +#endif -- cgit v1.2.1