Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
8a61ef4c
Commit
8a61ef4c
authored
9 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
sys: posix: switch to xtimer for sleep/usleep
parent
26402771
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile.dep
+1
-2
1 addition, 2 deletions
Makefile.dep
sys/posix/include/unistd.h
+0
-119
0 additions, 119 deletions
sys/posix/include/unistd.h
sys/posix/unistd.c
+1
-16
1 addition, 16 deletions
sys/posix/unistd.c
with
2 additions
and
137 deletions
Makefile.dep
+
1
−
2
View file @
8a61ef4c
...
@@ -283,8 +283,7 @@ ifneq (,$(filter uart_stdio,$(USEMODULE)))
...
@@ -283,8 +283,7 @@ ifneq (,$(filter uart_stdio,$(USEMODULE)))
endif
endif
ifneq
(,$(filter posix,$(USEMODULE)))
ifneq
(,$(filter posix,$(USEMODULE)))
USEMODULE
+=
timex
USEMODULE
+=
xtimer
USEMODULE
+=
vtimer
endif
endif
ifneq
(,$(filter posix_semaphore,$(USEMODULE)))
ifneq
(,$(filter posix_semaphore,$(USEMODULE)))
...
...
This diff is collapsed.
Click to expand it.
sys/posix/include/unistd.h
deleted
100644 → 0
+
0
−
119
View file @
26402771
/*
* Copyright (C) 2013 Freie Universität Berlin
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @addtogroup posix
* @{
*/
/**
* @file
* @brief standard symbolic constants and types
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html">
* The Open Group Base Specifications Issue 7, <unistd.h>
* </a>
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef _UNISTD_H
#define _UNISTD_H
#include
<stdint.h>
#include
"timex.h"
#include
"vtimer.h"
#ifdef __cplusplus
extern
"C"
{
#endif
#define STDIN_FILENO 0 ///< stdin file descriptor
#define STDOUT_FILENO 1 ///< stdout file descriptor
#define STDERR_FILENO 2 ///< stderr file descriptor
/**
* @brief Close a file descriptor.
* @details shall deallocate the file descriptor indicated by *fildes*. To
* deallocate means to make the file descriptor available for return
* by subsequent calls to open() or other functions that allocate file
* descriptors. All outstanding record locks owned by the process on
* the file associated with the file descriptor shall be removed (that
* is, unlocked).
*
* @see <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/close.html">
* The Open Group Base Specification Issue 7, close
* </a>
*
* @param[in] fildes The file descriptor to the file which is to close.
* @return Upon successful completion, 0 shall be returned; otherwise, -1
* shall be returned and errno set to indicate the error.
*/
int
close
(
int
fildes
);
/**
* @name Microseconds data type
* @{
*/
#ifndef __USECONDS_T_TYPE
#if !(defined(__MACH__) || defined(__FreeBSD__))
typedef
unsigned
long
__USECONDS_T_TYPE
;
typedef
__USECONDS_T_TYPE
__useconds_t
;
#else
#ifdef __MACH__
typedef
__darwin_useconds_t
__useconds_t
;
#endif
#endif
#endif
typedef
__useconds_t
useconds_t
;
/** @} */
/**
* @brief the caller will sleep for given amount of micro seconds
* @details The usleep() function will cause the calling thread to be
* suspended from execution until either the number of real-time microseconds
* specified by the argument useconds has elapsed or a signal is delivered to
* the calling thread and its action is to invoke a signal-catching function
* or to terminate the process. The suspension time may be longer than
* requested due to the scheduling of other activity by the system.
*
* @see <a href="http://pubs.opengroup.org/onlinepubs/7908799/xsh/usleep.html">
* The Open Group Base Specification Issue 2, usleep
* </a>
*
* @param useconds time to sleep in micro seconds
* @return 0 on success
*/
int
usleep
(
useconds_t
useconds
);
/**
* @brief the caller will sleep for given amount of seconds
* @details The sleep() function shall cause the calling thread to be suspended
* from execution until either the number of realtime seconds
* specified by the argument seconds has elapsed or a signal is
* delivered to the calling thread and its action is to invoke a
* signal-catching function or to terminate the process. The
* suspension time may be longer than requested due to the scheduling
* of other activity by the system.
*
* @see <a href="http://pubs.opengroup.org/onlinepubs/009695399/functions/sleep.html">
* The Open Group Base Specification Issue 6, sleep
* </a>
*
* @param seconds time to sleep in seconds
* @return 0 on success
*/
unsigned
int
sleep
(
unsigned
int
seconds
);
#ifdef __cplusplus
}
#endif
/**
* @}
*/
#endif
/* _UNISTD_H */
This diff is collapsed.
Click to expand it.
sys/posix/unistd.c
+
1
−
16
View file @
8a61ef4c
...
@@ -14,9 +14,9 @@
...
@@ -14,9 +14,9 @@
* @author Christian Mehlis <mehlis@inf.fu-berlin.de>
* @author Christian Mehlis <mehlis@inf.fu-berlin.de>
*/
*/
#include
<errno.h>
#include
<errno.h>
#include
<unistd.h>
#include
"fd.h"
#include
"fd.h"
#include
"unistd.h"
int
close
(
int
fildes
)
int
close
(
int
fildes
)
{
{
...
@@ -37,21 +37,6 @@ int close(int fildes)
...
@@ -37,21 +37,6 @@ int close(int fildes)
return
0
;
return
0
;
}
}
int
usleep
(
useconds_t
useconds
)
{
timex_t
time
=
timex_set
(
0
,
useconds
);
timex_normalize
(
&
time
);
vtimer_sleep
(
time
);
return
0
;
}
unsigned
int
sleep
(
unsigned
int
seconds
)
{
timex_t
time
=
timex_set
(
seconds
,
0
);
vtimer_sleep
(
time
);
return
0
;
}
/**
/**
* @}
* @}
*/
*/
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment