|
yast2-storage
|
00001 /* 00002 * Copyright (c) [2004-2009] Novell, Inc. 00003 * 00004 * All Rights Reserved. 00005 * 00006 * This program is free software; you can redistribute it and/or modify it 00007 * under the terms of version 2 of the GNU General Public License as published 00008 * by the Free Software Foundation. 00009 * 00010 * This program is distributed in the hope that it will be useful, but WITHOUT 00011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00013 * more details. 00014 * 00015 * You should have received a copy of the GNU General Public License along 00016 * with this program; if not, contact Novell, Inc. 00017 * 00018 * To contact Novell about this file by physical or electronic mail, you may 00019 * find current contact information at www.novell.com. 00020 */ 00021 00022 00023 #ifndef LOCK_H 00024 #define LOCK_H 00025 00026 00027 #include <stdexcept> 00028 #include <boost/noncopyable.hpp> 00029 00030 00031 namespace storage 00032 { 00033 00034 class LockException : public std::exception 00035 { 00036 00037 public: 00038 00039 LockException(pid_t locker_pid); 00040 virtual ~LockException() throw(); 00041 00042 pid_t getLockerPid() const { return locker_pid; } 00043 00044 protected: 00045 00046 pid_t locker_pid; 00047 00048 }; 00049 00050 00054 class Lock : boost::noncopyable 00055 { 00056 00057 public: 00058 00059 Lock(bool readonly, bool disable = false); 00060 ~Lock() throw(); 00061 00062 private: 00063 00064 const bool disabled; 00065 int fd; 00066 00067 }; 00068 } 00069 00070 00071 #endif
1.7.3