189f062b | /* Copyright (C) CJ Affiliate * * You may use, distribute and modify this code under the * terms of the GNU General Public License version 2 or * later. * * You should have received a copy of the license with this * file. If not, you will find a copy in the "LICENSE" file * at https://github.com/cjdev/dual-control. */ |
a8b53afd | #ifndef _SYS_UNISTD_H_ #define _SYS_UNISTD_H_ #include <memory> |
d8adc881 | #include <unistd.h> |
189f062b | class unistd_ifc { public: |
4d825470 | virtual ~unistd_ifc() {} |
bf756dea | virtual long int sysconf (int name) const |
189f062b | { return -1; } |
7d075ab4 | virtual const char *getlogin() const { |
bf756dea | return ""; } |
a8b53afd | }; |
3ae0e083 | class unistd |
189f062b | { public: typedef std::shared_ptr<unistd_ifc> delegate; private: delegate delegate_; public: unistd (delegate delegate): delegate_ (delegate) {} unistd() : delegate_ (delegate (new unistd_ifc)) {} |
bf756dea | long int sysconf (int name) const |
189f062b | { return delegate_->sysconf (name); } |
7d075ab4 | const char *getlogin() const { |
bf756dea | return delegate_->getlogin(); } |
da1b9b25 | static unistd create(); |
a8b53afd | }; #endif |
189f062b |