mescc: Support gcc-3.0: Implement alarm, setitimer.
This commit is contained in:
parent
ef0a39547c
commit
a70bc92857
|
@ -90,14 +90,6 @@ perror (char const *message)
|
|||
fprintf (stderr, "%s: %s\n", strerror (errno), message);
|
||||
}
|
||||
|
||||
int
|
||||
setitimer (int which, struct itimerval const *new,
|
||||
struct itimerval *old)
|
||||
{
|
||||
eputs ("setitimer stub\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sigsetmask (int x)
|
||||
{
|
||||
|
|
17
lib/gcc.c
17
lib/gcc.c
|
@ -22,6 +22,7 @@
|
|||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
FILE *
|
||||
freopen (char const *file_name, char const *opentype, FILE *stream)
|
||||
|
@ -88,3 +89,19 @@ atexit (void (*function) (void))
|
|||
__call_at_exit = function;
|
||||
}
|
||||
|
||||
unsigned int
|
||||
alarm (unsigned int seconds)
|
||||
{
|
||||
#if !__MESC__
|
||||
struct itimerval old;
|
||||
struct itimerval new;
|
||||
new.it_interval.tv_usec = 0;
|
||||
new.it_interval.tv_sec = 0;
|
||||
new.it_value.tv_usec = 0;
|
||||
new.it_value.tv_sec = (long int) seconds;
|
||||
if (setitimer (ITIMER_REAL, &new, &old) < 0)
|
||||
return 0;
|
||||
return old.it_value.tv_sec;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#define SYS_dup2 0x3f
|
||||
#define SYS_getrusage 0x4d
|
||||
#define SYS_lstat 0x6b
|
||||
#define SYS_setitimer 0x68
|
||||
#define SYS_fstat 0x6c
|
||||
#define SYS_nanosleep 0xa2
|
||||
|
||||
|
@ -137,6 +138,13 @@ nanosleep (const struct timespec *requested_time,
|
|||
return _sys_call2 (SYS_nanosleep, (int)requested_time, (int)remaining);
|
||||
}
|
||||
|
||||
int
|
||||
setitimer (int which, struct itimerval const *new,
|
||||
struct itimerval *old)
|
||||
{
|
||||
return _sys_call3 (SYS_setitimer, (int)which, (int)new, (int)old);
|
||||
}
|
||||
|
||||
int
|
||||
fstat (int fd, struct stat *statbuf)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue