SHORE API
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
umask.hpp
1 
2 /*
3  * Copyright 2008,2009,2010,2011,2012 Stephan Ossowski, Korbinian Schneeberger,
4  * Felix Ott, Joerg Hagmann, Alf Scotland, Sebastian Bender
5  *
6  * This file is part of SHORE.
7  *
8  * SHORE is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * SHORE is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with SHORE. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 
23 #ifndef SHORE_MISC_UMASK_HPP__
24 #define SHORE_MISC_UMASK_HPP__
25 
26 #include <string>
27 
28 #include <boost/thread/mutex.hpp>
29 
30 namespace shore {
31 
33 class umask_ts
34 {
35  private:
36 
37  typedef boost::mutex mutex_t;
38  typedef boost::mutex::scoped_lock lock_t;
39 
40  static mutex_t m_mutex;
41 
42  public:
43 
44  static void set(int modemask);
45  static int get();
46 
48  static void reset_permissions(const std::string& path);
50  static void reset_permissions(const int fd);
51 };
52 
53 } // namespace
54 
55 #endif // SHORE_MISC_UMASK_HPP__
56