diff options
author | couriersud <couriersud@arcor.de> | 2015-01-09 08:55:02 +0100 |
---|---|---|
committer | couriersud <couriersud@arcor.de> | 2015-01-09 08:55:02 +0100 |
commit | b20dd29d62351047381b659f13e8841fe13f0592 (patch) | |
tree | 8d99dc4188796d3a2a871a7b1a2c9b8ba6c24477 /src/osd/modules/lib/osdlib_unix.c | |
parent | 15a5ab001ca0779667f25d8efe59551d81f669b1 (diff) |
Commit missing files. (nw)
Diffstat (limited to 'src/osd/modules/lib/osdlib_unix.c')
-rw-r--r-- | src/osd/modules/lib/osdlib_unix.c | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/src/osd/modules/lib/osdlib_unix.c b/src/osd/modules/lib/osdlib_unix.c new file mode 100644 index 00000000000..f01771dabee --- /dev/null +++ b/src/osd/modules/lib/osdlib_unix.c @@ -0,0 +1,90 @@ + +#include <stdlib.h> +#include <unistd.h> +#include <sys/mman.h> +#include <sys/types.h> +#include <signal.h> + +#include "osdlib.h" + +//============================================================ +// osd_getenv +//============================================================ + +char *osd_getenv(const char *name) +{ + return getenv(name); +} + +//============================================================ +// osd_setenv +//============================================================ + +int osd_setenv(const char *name, const char *value, int overwrite) +{ + return setenv(name, value, overwrite); +} + +//============================================================ +// osd_num_processors +//============================================================ + +int osd_get_num_processors(void) +{ + int processors = 1; + +#if defined(_SC_NPROCESSORS_ONLN) + processors = sysconf(_SC_NPROCESSORS_ONLN); +#endif + return processors; +} + +//============================================================ +// osd_process_kill +//============================================================ + +void osd_process_kill(void) +{ + kill(getpid(), SIGKILL); +} + +//============================================================ +// osd_malloc +//============================================================ + +void *osd_malloc(size_t size) +{ +#ifndef MALLOC_DEBUG + return malloc(size); +#else +#error "MALLOC_DEBUG not yet supported" +#endif +} + + +//============================================================ +// osd_malloc_array +//============================================================ + +void *osd_malloc_array(size_t size) +{ +#ifndef MALLOC_DEBUG + return malloc(size); +#else +#error "MALLOC_DEBUG not yet supported" +#endif +} + + +//============================================================ +// osd_free +//============================================================ + +void osd_free(void *ptr) +{ +#ifndef MALLOC_DEBUG + free(ptr); +#else +#error "MALLOC_DEBUG not yet supported" +#endif +} |