summaryrefslogtreecommitdiff
path: root/nuttx/sched/timer_create.c
diff options
context:
space:
mode:
Diffstat (limited to 'nuttx/sched/timer_create.c')
-rw-r--r--nuttx/sched/timer_create.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/nuttx/sched/timer_create.c b/nuttx/sched/timer_create.c
index c4f3cbd87..b1ad142c7 100644
--- a/nuttx/sched/timer_create.c
+++ b/nuttx/sched/timer_create.c
@@ -1,7 +1,7 @@
/********************************************************************************
* sched/timer_create.c
*
- * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@@ -40,13 +40,14 @@
#include <nuttx/config.h>
#include <stdint.h>
-#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <wdog.h>
#include <errno.h>
+#include <nuttx/kmalloc.h>
+
#include "timer_internal.h"
#ifndef CONFIG_DISABLE_POSIX_TIMERS
@@ -99,7 +100,7 @@ static struct posix_timer_s *timer_allocate(void)
{
/* Allocate a new timer from the heap */
- ret = (struct posix_timer_s*)malloc(sizeof(struct posix_timer_s));
+ ret = (struct posix_timer_s*)kmalloc(sizeof(struct posix_timer_s));
pt_flags = 0;
}
@@ -183,7 +184,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
if (!timerid || clockid != CLOCK_REALTIME)
{
- *get_errno_ptr() = EINVAL;
+ errno = EINVAL;
return ERROR;
}
@@ -192,7 +193,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
wdog = wd_create();
if (!wdog)
{
- *get_errno_ptr() = EAGAIN;
+ errno = EAGAIN;
return ERROR;
}
@@ -201,7 +202,7 @@ int timer_create(clockid_t clockid, FAR struct sigevent *evp, FAR timer_t *timer
ret = timer_allocate();
if (!ret)
{
- *get_errno_ptr() = EAGAIN;
+ errno = EAGAIN;
return ERROR;
}