summaryrefslogtreecommitdiff
path: root/nuttx/sched/timer_create.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-03 20:41:49 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-04-03 20:41:49 +0000
commit758d4800642060f50cdf26f7063c9825ea635d15 (patch)
treee689f42a002a2fd57548de0a3eb2aab98fe8f0f0 /nuttx/sched/timer_create.c
parentc5ec7c478098273586b7a5716e30dc82c1e6aba5 (diff)
downloadpx4-nuttx-758d4800642060f50cdf26f7063c9825ea635d15.tar.gz
px4-nuttx-758d4800642060f50cdf26f7063c9825ea635d15.tar.bz2
px4-nuttx-758d4800642060f50cdf26f7063c9825ea635d15.zip
Move memory manager into user space
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3460 42af7a65-404d-4744-a932-0658087f49c3
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;
}