source: trunk/libs/newlib/src/libgloss/arm/libcfunc.c @ 509

Last change on this file since 509 was 444, checked in by satin@…, 7 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.1 KB
Line 
1/* Support files for GNU libc.  Files in the C namespace go here.
2   Files in the system namespace (ie those that start with an underscore)
3   go in syscalls.c.
4   
5   Note: These functions are in a seperate file so that OS providers can
6   overrride the system call stubs (defined in syscalls.c) without having
7   to provide libc funcitons as well.  */
8
9#include "swi.h"
10#include <errno.h>
11#include <unistd.h>
12
13unsigned __attribute__((weak))
14alarm (unsigned seconds)
15{
16        (void)seconds;
17        return 0;
18}
19
20clock_t _clock(void);
21clock_t __attribute__((weak))
22clock(void)
23{
24      return _clock();
25}
26
27int _isatty(int fildes);
28int __attribute__((weak))
29isatty(int fildes)
30{
31        return _isatty(fildes);
32}
33
34int __attribute__((weak))
35pause(void)
36{
37        errno = ENOSYS;
38        return -1;
39}
40
41#include <sys/types.h>
42#include <time.h>
43
44unsigned __attribute__((weak))
45sleep(unsigned seconds)
46{
47        clock_t t0 = _clock();
48        clock_t dt = seconds * CLOCKS_PER_SEC;
49
50        while (_clock() - t0  < dt);
51        return 0;
52}
53
54int __attribute__((weak))
55usleep(useconds_t useconds)
56{
57        clock_t t0 = _clock();
58        clock_t dt = useconds / (1000000/CLOCKS_PER_SEC);
59
60        while (_clock() - t0  < dt);
61        return 0;
62}
Note: See TracBrowser for help on using the repository browser.