syscall_time: Handle by McKernel

refs: #1036
Change-Id: Ifa81b613c7ee8d95ae7cdf3dd54643f60526fa73
This commit is contained in:
Ken Sato
2018-09-05 16:07:43 +09:00
committed by Masamichi Takagi
parent 5e760db417
commit c23bc8d401
11 changed files with 332 additions and 52 deletions

47
test/issues/1036/CT_001.c Normal file
View File

@ -0,0 +1,47 @@
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <sys/syscall.h>
#include "./test_chk.h"
#define TEST_NAME "CT_001"
int main(int argc, char *argv[])
{
time_t now;
long sys_ret;
int ng_flag = 0;
printf("*** %s start *******************************\n", TEST_NAME);
/* get seconds since the Epoch by glibc time() */
now = time(NULL);
/* get seconds since the Epoch by syscall_time */
sys_ret = syscall(__NR_time, NULL);
if (now != sys_ret) {
/* check again only once */
now = time(NULL);
if (now != sys_ret) {
ng_flag = 1;
}
}
printf("glibc time(): %ld seconds\n", now);
printf("sys_time : %ld seconds\n", sys_ret);
OKNG(ng_flag != 0, "check seconds since the Epoch");
printf("*** %s PASSED\n\n", TEST_NAME);
return 0;
fn_fail:
printf("*** %s FAILED\n\n", TEST_NAME);
return -1;
}