2 * Copyright (c) 2000 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Contact: Rafal Krypa <r.krypa@samsung.com>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License
20 * @author Sebastian Grabowski (s.grabowski@samsung.com)
22 * @brief Implementation of simple file locking for a service
24 /* vim: set ts=4 et sw=4 tw=78 : */
28 #include <boost/interprocess/sync/file_lock.hpp>
30 #include <dpl/exception.h>
31 #include <dpl/noncopyable.h>
32 #include <tzplatform_config.h>
34 namespace SecurityManager {
36 extern char const * const SERVICE_LOCK_FILE;
45 DECLARE_EXCEPTION_TYPE(SecurityManager::Exception, Base)
46 DECLARE_EXCEPTION_TYPE(Base, LockFailed)
49 FileLocker(const std::string &lockFile, bool blocking = false);
59 std::string m_lockFile;
60 boost::interprocess::file_lock m_flock;
65 } // namespace SecurityManager