diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-02 11:09:04 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-02 11:09:04 +0000 |
commit | 365b0c6330ea607706b708d92da7a46b1ed1fb15 (patch) | |
tree | 67e8136d48e8e7f0c5bdc17b4a2c284dcf202641 /src/sys/sys.cc | |
parent | 6c8446cddb37df732fc9e5fc21f98e31968ce634 (diff) |
introduced libsys
implemented signal handling
Diffstat (limited to 'src/sys/sys.cc')
-rw-r--r-- | src/sys/sys.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/sys/sys.cc b/src/sys/sys.cc new file mode 100644 index 0000000..97da23e --- /dev/null +++ b/src/sys/sys.cc @@ -0,0 +1,42 @@ +/* + sys/sys.cc + This file is part of the Osirion project and is distributed under + the terms of the GNU General Public License version 2 +*/ + +// project headers +#include "sys/sys.h" + +// system headers +#include <signal.h> + +#include <sys/stat.h> +#include <sys/types.h> + + +namespace sys { + +bool mkdir(const char *path) +{ +#ifdef _WIN32 + ::mkdir(path); + // FIXME check return value + return true; +#else + return (::mkdir(path, 0777) == 0); +#endif +} + +void signal(int signum, signalfunc handler) +{ +#ifndef _WIN32 + struct sigaction sa; + + sa.sa_handler = handler; + sa.sa_flags = 0; + + sigaction(signum, &sa, 0); +#endif +} + +} |