mirror of
https://github.com/clearlinux/hyperstart.git
synced 2026-08-26 09:35:49 +00:00
sync hardware time to system time when start pod
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
This commit is contained in:
@@ -620,6 +620,7 @@ static int hyper_start_pod(char *json, int length)
|
||||
if (pod->init_pid)
|
||||
fprintf(stdout, "pod init_pid exist %d\n", pod->init_pid);
|
||||
|
||||
hyper_sync_time_hctosys();
|
||||
if (hyper_parse_pod(pod, json, length) < 0) {
|
||||
fprintf(stderr, "parse pod json failed\n");
|
||||
return -1;
|
||||
|
||||
+12
@@ -99,6 +99,18 @@ int hyper_copy_dir(char *src, char *dest) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
void hyper_sync_time_hctosys() {
|
||||
int pid;
|
||||
pid = fork();
|
||||
if (pid < 0) {
|
||||
perror("fail to fork to copy directory");
|
||||
} else if (pid == 0) {
|
||||
execlp("/busybox", "hwclock", "-s", NULL);
|
||||
perror("exec hwclock -s command failed");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
int hyper_find_sd(char *addr, char **dev) {
|
||||
struct dirent **list;
|
||||
struct dirent *dir;
|
||||
|
||||
@@ -19,6 +19,7 @@ int hyper_setup_env(struct env *envs, int num);
|
||||
int hyper_find_sd(char *addr, char **dev);
|
||||
int hyper_list_dir(char *path);
|
||||
int hyper_copy_dir(char *src, char *dst);
|
||||
void hyper_sync_time_hctosys();
|
||||
void online_cpu(void);
|
||||
void online_memory(void);
|
||||
int hyper_mkdir(char *path);
|
||||
|
||||
Reference in New Issue
Block a user