summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/time/__time.c8
-rw-r--r--src/time/_time.h4
-rw-r--r--src/time/asctime.c8
-rw-r--r--src/time/asctime_s.c13
-rw-r--r--src/time/clock.c8
-rw-r--r--src/time/clock_getres.c7
-rw-r--r--src/time/clock_gettime.c7
-rw-r--r--src/time/clock_settime.c7
-rw-r--r--src/time/ctime.c8
-rw-r--r--src/time/ctime_s.c12
-rw-r--r--src/time/daylight.c7
-rw-r--r--src/time/difftime.c7
-rw-r--r--src/time/getdate.c7
-rw-r--r--src/time/getdate_err.c7
-rw-r--r--src/time/gmtime.c8
-rw-r--r--src/time/gmtime_s.c10
-rw-r--r--src/time/localtime.c9
-rw-r--r--src/time/localtime_s.c10
-rw-r--r--src/time/mktime.c8
-rw-r--r--src/time/nanosleep.c7
-rw-r--r--src/time/strftime.c8
-rw-r--r--src/time/strptime.c7
-rw-r--r--src/time/time.c8
-rw-r--r--src/time/timer_create.c7
-rw-r--r--src/time/timer_delete.c7
-rw-r--r--src/time/timer_getoverrun.c7
-rw-r--r--src/time/timer_gettime.c7
-rw-r--r--src/time/timer_settime.c7
-rw-r--r--src/time/timespec_get.c8
-rw-r--r--src/time/timezone.c6
-rw-r--r--src/time/tzname.c7
-rw-r--r--src/time/tzset.c8
32 files changed, 82 insertions, 167 deletions
diff --git a/src/time/__time.c b/src/time/__time.c
index a8d9cfb9..de0c93fe 100644
--- a/src/time/__time.c
+++ b/src/time/__time.c
@@ -1,8 +1,8 @@
-#if 0
-
#include "_time.h"
struct __time __time;
-
-#endif
+/*
+STDC(-1)
+SIGNAL_SAFE(0)
+*/
diff --git a/src/time/_time.h b/src/time/_time.h
index 85620e0f..b6d05212 100644
--- a/src/time/_time.h
+++ b/src/time/_time.h
@@ -31,4 +31,8 @@ struct __time {
extern struct __time __time;
+/*
+STDC(0)
+*/
+
#endif
diff --git a/src/time/asctime.c b/src/time/asctime.c
index a67cb603..44ce130c 100644
--- a/src/time/asctime.c
+++ b/src/time/asctime.c
@@ -1,7 +1,6 @@
-#if 0
-
#include <stdio.h>
#include <time.h>
+#include "_safety.h"
/** convert broken down time to string **/
@@ -16,6 +15,8 @@ char * asctime(const struct tm * timeptr)
};
static char result[26];
+ SIGNAL_SAFE(0);
+
sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
days[timeptr->tm_wday], months[timeptr->tm_mon],
timeptr->tm_mday, timeptr->tm_hour, timeptr->tm_min,
@@ -37,6 +38,3 @@ hour of the day (in the range (0,23)), LITERAL(mm) is the minute of the hour
RETURN_ALWAYS(a pointer to the string)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/asctime_s.c b/src/time/asctime_s.c
index a9b69f47..8a551c1f 100644
--- a/src/time/asctime_s.c
+++ b/src/time/asctime_s.c
@@ -1,12 +1,10 @@
-#if 0
-
#include <time.h>
#include <stdio.h>
+#include "_safety.h"
/** convert broken down time to string **/
errno_t asctime_s(char *s, rsize_t maxsize, const struct tm * timeptr)
{
- __C_EXT(1, 201112L);
static const char days[7][3] = {
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
};
@@ -14,13 +12,13 @@ errno_t asctime_s(char *s, rsize_t maxsize, const struct tm * timeptr)
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
- static char result[26];
+ SIGNAL_SAFE(0);
- sprintf(result, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
+ snprintf(s, maxsize, "%.3s %.3s%3d %.2d:%.2d:%.2d %d\n",
days[timeptr->tm_wday], months[timeptr->tm_mon],
timeptr->tm_mday, timeptr->tm_hour, timeptr->tm_min,
timeptr->tm_sec, timeptr->tm_year + 1900);
- return result;
+ return 0;
}
/***
@@ -43,6 +41,3 @@ str(yyyy) is the year.
/*
CEXT1(201112)
*/
-
-
-#endif
diff --git a/src/time/clock.c b/src/time/clock.c
index 5ba6dce8..7f129e83 100644
--- a/src/time/clock.c
+++ b/src/time/clock.c
@@ -1,11 +1,12 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
+#undef clock
/** get processor time **/
clock_t clock(void)
{
+ SIGNAL_SAFE(0);
return (clock_t)-1;
}
@@ -20,6 +21,3 @@ RETURN_FAILURE(CAST(TYPEDEF(clock_t), -1))
RETURN_SUCCESS(the processor time of the current program)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/clock_getres.c b/src/time/clock_getres.c
index 0e2165f3..647cd8b4 100644
--- a/src/time/clock_getres.c
+++ b/src/time/clock_getres.c
@@ -1,9 +1,9 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int clock_getres(clockid_t clock_id, struct timespec *res)
{
+ SIGNAL_SAFE(0);
return 0;
}
@@ -11,6 +11,3 @@ int clock_getres(clockid_t clock_id, struct timespec *res)
POSIX(199309)
LINK(rt)
*/
-
-
-#endif
diff --git a/src/time/clock_gettime.c b/src/time/clock_gettime.c
index 7eed951e..8461988d 100644
--- a/src/time/clock_gettime.c
+++ b/src/time/clock_gettime.c
@@ -1,9 +1,9 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int clock_gettime(clockid_t clock_id, struct timespec *tp)
{
+ SIGNAL_SAFE(0);
return 0;
}
@@ -11,6 +11,3 @@ int clock_gettime(clockid_t clock_id, struct timespec *tp)
POSIX(199309)
LINK(rt)
*/
-
-
-#endif
diff --git a/src/time/clock_settime.c b/src/time/clock_settime.c
index 1876a1b3..f678d7c6 100644
--- a/src/time/clock_settime.c
+++ b/src/time/clock_settime.c
@@ -1,9 +1,9 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int clock_settime(clockid_t clock_id, const struct timespec *tp)
{
+ SIGNAL_SAFE(0);
return 0;
}
@@ -11,6 +11,3 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp)
POSIX(199309)
LINK(rt)
*/
-
-
-#endif
diff --git a/src/time/ctime.c b/src/time/ctime.c
index 6502c0ab..4d0402a5 100644
--- a/src/time/ctime.c
+++ b/src/time/ctime.c
@@ -1,11 +1,12 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
/** convert arithmetic time to string **/
char * ctime(const time_t * timer)
{
+ SIGNAL_SAFE(0);
+
#ifdef _POSIX_SOURCE
tzset();
#endif
@@ -22,6 +23,3 @@ FUNCTION(asctime).
RETURN_ALWAYS(a pointer to the string)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/ctime_s.c b/src/time/ctime_s.c
index c86ba1ce..aff8a533 100644
--- a/src/time/ctime_s.c
+++ b/src/time/ctime_s.c
@@ -1,12 +1,13 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
/** convert arithmetic time to string **/
errno_t ctime_s(char *s, rsize_t maxsize, const time_t *timer)
{
- __C_EXT(1, 201112L);
- return asctime(localtime(timer));
+ SIGNAL_SAFE(0);
+ (void)s; (void)maxsize;
+ asctime(localtime(timer));
+ return 0;
}
/***
@@ -24,6 +25,3 @@ fn(asctime).
/*
CEXT1(201112)
*/
-
-
-#endif
diff --git a/src/time/daylight.c b/src/time/daylight.c
index 420f8d99..f51a6ac6 100644
--- a/src/time/daylight.c
+++ b/src/time/daylight.c
@@ -1,10 +1,7 @@
-#if 0
-
#include <time.h>
int daylight;
+
/*
XOPEN(4)
+SIGNAL_SAFE(0);
*/
-
-
-#endif
diff --git a/src/time/difftime.c b/src/time/difftime.c
index f9c44df0..9550306c 100644
--- a/src/time/difftime.c
+++ b/src/time/difftime.c
@@ -1,11 +1,11 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
/** find difference between two times **/
double difftime(time_t time1, time_t time0)
{
+ SIGNAL_SAFE(0);
return (double)time1 - (double)time0;
}
@@ -17,6 +17,3 @@ subtracts ARGUMENT(time0) from ARGUMENT(time1).
RETURN_ALWAYS(the difference in seconds)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/getdate.c b/src/time/getdate.c
index a181326f..7840b2ef 100644
--- a/src/time/getdate.c
+++ b/src/time/getdate.c
@@ -1,15 +1,12 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
struct tm *getdate(const char *string)
{
+ SIGNAL_SAFE(0);
return NULL;
}
/*
XOPEN(400)
*/
-
-
-#endif
diff --git a/src/time/getdate_err.c b/src/time/getdate_err.c
index 16dd33fe..9dc056ce 100644
--- a/src/time/getdate_err.c
+++ b/src/time/getdate_err.c
@@ -1,11 +1,8 @@
-#if 0
-
#include <time.h>
+
int getdate_err;
/*
XOPEN(400)
+SIGNAL_SAFE(0);
*/
-
-
-#endif
diff --git a/src/time/gmtime.c b/src/time/gmtime.c
index d1660c6f..3ed5081a 100644
--- a/src/time/gmtime.c
+++ b/src/time/gmtime.c
@@ -1,7 +1,5 @@
-#if 0
-
#include <time.h>
-#include "_assert.h"
+#include "_safety.h"
#include "_time.h"
/** convert arithmetic time to broken down time **/
@@ -12,6 +10,7 @@ struct tm * gmtime(const time_t * timer)
time_t seconds = 0;
int days = 0;
+ SIGNAL_SAFE(0);
ASSERT_NONNULL(timer);
seconds = *timer;
@@ -61,6 +60,3 @@ RETURN_FAILURE(CONSTANT(NULL))
RETURN_SUCCESS(a pointer to the converted time)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/gmtime_s.c b/src/time/gmtime_s.c
index e8cb6a9c..2eb02309 100644
--- a/src/time/gmtime_s.c
+++ b/src/time/gmtime_s.c
@@ -1,12 +1,13 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
/** convert arithmetic time to borken down time **/
struct tm * gmtime_s(const time_t * restrict timer, struct tm * restrict result)
{
- __C_EXT(1, 201112L);
/* TODO */
+ SIGNAL_SAFE(0);
+ (void)timer; (void)result;
+
return NULL;
}
@@ -26,6 +27,3 @@ type(struct tm).
/*
CEXT1(201112)
*/
-
-
-#endif
diff --git a/src/time/localtime.c b/src/time/localtime.c
index 310638c6..afcc35db 100644
--- a/src/time/localtime.c
+++ b/src/time/localtime.c
@@ -1,13 +1,13 @@
-#if 0
-
#include <time.h>
-#include "_assert.h"
+#include "_safety.h"
/** convert arithmetic time to broken down time **/
struct tm * localtime(const time_t * timer)
{
static struct tm tm = {0};
+
+ SIGNAL_SAFE(0);
ASSERT_NONNULL(timer);
#ifdef _POSIX_SOURCE
@@ -28,6 +28,3 @@ converts the locale time at ARGUMENT(timer) to a filled out STRUCTDEF(tm).
RETURN_ALWAYS(a pointer to the converted object)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/localtime_s.c b/src/time/localtime_s.c
index bce984b6..c444b464 100644
--- a/src/time/localtime_s.c
+++ b/src/time/localtime_s.c
@@ -1,12 +1,11 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
/** convert arithmetic time to broken down time **/
struct tm * localtime_s(const time_t * restrict timer, struct tm * restrict result)
{
- __C_EXT(1, 201112L);
- /* TODO */
+ SIGNAL_SAFE(0);
+ (void)timer; (void)result;
return NULL;
}
@@ -25,6 +24,3 @@ out type(struct tm).
/*
CEXT1(201112)
*/
-
-
-#endif
diff --git a/src/time/mktime.c b/src/time/mktime.c
index 4b2be09b..c6d5ae03 100644
--- a/src/time/mktime.c
+++ b/src/time/mktime.c
@@ -1,8 +1,6 @@
-#if 0
-
#include <time.h>
#include "_time.h"
-#include "_assert.h"
+#include "_safety.h"
/** convert time structure to arithmetic type **/
@@ -10,6 +8,7 @@ time_t mktime(struct tm * timeptr)
{
int i;
+ SIGNAL_SAFE(0);
ASSERT_NONNULL(timeptr);
#ifdef _POSIX_SOURCE
@@ -93,6 +92,3 @@ RETURN_FAILURE(CAST(TYPEDEF(time_t), -1))
RETURN_SUCCESS(the converted time)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/nanosleep.c b/src/time/nanosleep.c
index 2e76fa6a..4519b915 100644
--- a/src/time/nanosleep.c
+++ b/src/time/nanosleep.c
@@ -1,16 +1,13 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
#include "_syscall.h"
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{
+ SIGNAL_SAFE(0);
SYSCALL(nanosleep, int, -1, rqtp, rmtp, 0, 0, 0, 0);
}
/*
POSIX(199309)
*/
-
-
-#endif
diff --git a/src/time/strftime.c b/src/time/strftime.c
index 4c6630dc..949ae79b 100644
--- a/src/time/strftime.c
+++ b/src/time/strftime.c
@@ -1,9 +1,7 @@
-#if 0
-
#include <locale.h>
#include <stdio.h>
#include <time.h>
-#include "_assert.h"
+#include "_safety.h"
#include "locale/_locale.h"
/** convert time to a formatted string **/
@@ -14,6 +12,7 @@ size_t strftime(char * restrict s, size_t maxsize, const char * restrict format,
char buf[64];
struct __locale_t *lc = __get_locale();
+ SIGNAL_SAFE(0);
ASSERT_NONNULL(s);
ASSERT_NONNULL(format);
ASSERT_NONNULL(timeptr);
@@ -193,6 +192,3 @@ RETURN_FAILURE(ZERO)
RETURN_SUCCESS(the length of the converted string, not counting the terminating null)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/strptime.c b/src/time/strptime.c
index f1d07bb2..5520684d 100644
--- a/src/time/strptime.c
+++ b/src/time/strptime.c
@@ -1,15 +1,12 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
char *strptime(const char *restrict buf, const char *restrict format, struct tm *restrict tm)
{
+ SIGNAL_SAFE(0);
return (char*)buf;
}
/*
XOPEN(4)
*/
-
-
-#endif
diff --git a/src/time/time.c b/src/time/time.c
index d5f76abe..4c4a384a 100644
--- a/src/time/time.c
+++ b/src/time/time.c
@@ -1,13 +1,14 @@
-#if 0
-
#include <time.h>
#include <errno.h>
#include "_syscall.h"
+#include "_safety.h"
/** get current time **/
time_t time(time_t * timer)
{
+ SIGNAL_SAFE(0);
+
long int now;
SYSCALL_NUMBER(sc, time, 0);
@@ -31,6 +32,3 @@ RETURN_FAILURE(CAST(TYPEDEF(time_t), -1))
RETURN_SUCCESS(the current calndar time)
STDC(1)
*/
-
-
-#endif
diff --git a/src/time/timer_create.c b/src/time/timer_create.c
index 6122e6f9..ae5003f9 100644
--- a/src/time/timer_create.c
+++ b/src/time/timer_create.c
@@ -1,9 +1,9 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int timer_create(clockid_t clockid, struct sigevent *restrict evp, timer_t *restrict timerid)
{
+ SIGNAL_SAFE(0);
return 0;
}
@@ -11,6 +11,3 @@ int timer_create(clockid_t clockid, struct sigevent *restrict evp, timer_t *rest
POSIX(199309)
LINK(rt)
*/
-
-
-#endif
diff --git a/src/time/timer_delete.c b/src/time/timer_delete.c
index d3d36359..e44030cb 100644
--- a/src/time/timer_delete.c
+++ b/src/time/timer_delete.c
@@ -1,9 +1,9 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int timer_delete(timer_t timerid)
{
+ SIGNAL_SAFE(0);
return 0;
}
@@ -11,6 +11,3 @@ int timer_delete(timer_t timerid)
POSIX(199309)
LINK(rt)
*/
-
-
-#endif
diff --git a/src/time/timer_getoverrun.c b/src/time/timer_getoverrun.c
index 627076ef..a8189ab8 100644
--- a/src/time/timer_getoverrun.c
+++ b/src/time/timer_getoverrun.c
@@ -1,9 +1,9 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int timer_getoverrun(timer_t timerid)
{
+ SIGNAL_SAFE(0);
return 0;
}
@@ -11,6 +11,3 @@ int timer_getoverrun(timer_t timerid)
POSIX(199309)
LINK(rt)
*/
-
-
-#endif
diff --git a/src/time/timer_gettime.c b/src/time/timer_gettime.c
index 34a866b3..ba4f916f 100644
--- a/src/time/timer_gettime.c
+++ b/src/time/timer_gettime.c
@@ -1,9 +1,9 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int timer_gettime(timer_t timerid, struct itimerspec *value)
{
+ SIGNAL_SAFE(0);
return 0;
}
@@ -11,6 +11,3 @@ int timer_gettime(timer_t timerid, struct itimerspec *value)
POSIX(199309)
LINK(rt)
*/
-
-
-#endif
diff --git a/src/time/timer_settime.c b/src/time/timer_settime.c
index 94d1b81c..14213d39 100644
--- a/src/time/timer_settime.c
+++ b/src/time/timer_settime.c
@@ -1,9 +1,9 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int timer_settime(timer_t timerid, int flags, const struct itimerspec * restrict value, struct itimerspec * restrict ovalue)
{
+ SIGNAL_SAFE(0);
return 0;
}
@@ -11,6 +11,3 @@ int timer_settime(timer_t timerid, int flags, const struct itimerspec * restrict
POSIX(199309)
LINK(rt)
*/
-
-
-#endif
diff --git a/src/time/timespec_get.c b/src/time/timespec_get.c
index a8ca1fdf..3fa578b3 100644
--- a/src/time/timespec_get.c
+++ b/src/time/timespec_get.c
@@ -1,15 +1,13 @@
-#if 0
-
#include <time.h>
+#include "_safety.h"
int timespec_get(struct timespec *ts, int base)
{
+ SIGNAL_SAFE(0);
+ (void)ts;
return base;
}
/*
STDC(201112)
*/
-
-
-#endif
diff --git a/src/time/timezone.c b/src/time/timezone.c
index 82d0cc06..a429f8d6 100644
--- a/src/time/timezone.c
+++ b/src/time/timezone.c
@@ -1,11 +1,7 @@
-#if 0
-
#include <time.h>
long timezone;
/*
XOPEN(4)
+SIGNAL_SAFE(0)
*/
-
-
-#endif
diff --git a/src/time/tzname.c b/src/time/tzname.c
index 02a4beaa..4630dd4e 100644
--- a/src/time/tzname.c
+++ b/src/time/tzname.c
@@ -1,10 +1,7 @@
-#if 0
-
#include <time.h>
char * tzname[2];
+
/*
POSIX(1)
+SIGNAL_SAFE(0);
*/
-
-
-#endif
diff --git a/src/time/tzset.c b/src/time/tzset.c
index 694a0731..cbc94968 100644
--- a/src/time/tzset.c
+++ b/src/time/tzset.c
@@ -1,12 +1,13 @@
-#if 0
-
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include "_time.h"
+#include "_safety.h"
void tzset(void)
{
+ SIGNAL_SAFE(0);
+
char buf[TZNAMELEN * 3]; /* one for std, one for dst, plus dst rule */
char *tzstr = getenv("TZ");
if (tzstr == NULL) {
@@ -42,6 +43,3 @@ void tzset(void)
/*
POSIX(1)
*/
-
-
-#endif