00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __libutilxx__sella__util__ResourceLimit_H__
00010 #define __libutilxx__sella__util__ResourceLimit_H__
00011
00012 #include "../../common.h"
00013 #include "ResourceLimitException.h"
00014
00015 #include <unistd.h>
00016 #include <sys/types.h>
00017
00018 #include <string>
00019 #include <memory>
00020
00021 namespace sella {
00022 namespace util {
00023 class ResourceLimit;
00024 }
00025 }
00026
00027 class sella::util::ResourceLimit {
00028 public:
00029 typedef std::shared_ptr<ResourceLimit> shared;
00030 typedef ResourceLimit *ptr;
00031
00032 enum Type { Soft = 0, Hard, Both, SOFT = Soft, HARD = Hard, BOTH = Both };
00033
00034 public:
00035 ResourceLimit() throw ();
00036 ResourceLimit(const ResourceLimit &other);
00037 virtual ~ResourceLimit();
00038
00039 ResourceLimit& operator=(const ResourceLimit &other) throw ();
00040 bool operator==(const ResourceLimit &other) const throw () = delete;
00041 bool operator!=(const ResourceLimit &other) const throw () = delete;
00042
00043 void setCoredumpSize(unsigned long size = 0, Type type = Both) throw (ResourceLimitException);
00044
00045 unsigned long getCoredumpSize(Type type = Hard) throw (ResourceLimitException);
00046
00047 void clear(void) throw ();
00048
00049 static const ResourceLimit::shared shared_ptr(void) throw ();
00050
00051 private:
00052 };
00053
00054 #endif
00055
00056
00057
00058