diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2022-02-07 10:48:25 +0000 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2022-02-07 10:48:25 +0000 |
| commit | 55ef0b702bc2c90c3c4ed97f97676d8f139e5ca1 (patch) | |
| tree | 661c14d00b6ff67248d57b697e1feb1355f72048 /linux-user/main.c | |
| parent | 0d564a3e32ba8494014c67cdd2ebf0fb71860dff (diff) | |
| parent | 244fd08323088db73590ff2317dfe86f810b51d7 (diff) | |
| download | focaccia-qemu-55ef0b702bc2c90c3c4ed97f97676d8f139e5ca1.tar.gz focaccia-qemu-55ef0b702bc2c90c3c4ed97f97676d8f139e5ca1.zip | |
Merge remote-tracking branch 'remotes/lvivier-gitlab/tags/linux-user-for-7.0-pull-request' into staging
Linux-user pull request 20220207 Fix target rlimits for alpha Add startime in /proc/self/stat # gpg: Signature made Mon 07 Feb 2022 08:27:27 GMT # gpg: using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C # gpg: issuer "laurent@vivier.eu" # gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full] # gpg: aka "Laurent Vivier <laurent@vivier.eu>" [full] # gpg: aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full] # Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F 5173 F30C 38BD 3F2F BE3C * remotes/lvivier-gitlab/tags/linux-user-for-7.0-pull-request: linux-user/syscall: Translate TARGET_RLIMIT_RTTIME linux-user: Move generic TARGET_RLIMIT* definitions to generic/target_resource.h linux-user: Implement starttime field in self stat emulation linux-user: sigprocmask check read perms first linux-user: rt_sigprocmask, check read perms first linux-user: Fix inotify on aarch64 linux-user/alpha: Fix target rlimits for alpha and rearrange for clarity linux-user: Remove unnecessary 'aligned' attribute from TaskState Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'linux-user/main.c')
| -rw-r--r-- | linux-user/main.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/linux-user/main.c b/linux-user/main.c index 16def5215d..fbc9bcfd5f 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -190,12 +190,26 @@ void stop_all_tasks(void) /* Assumes contents are already zeroed. */ void init_task_state(TaskState *ts) { + long ticks_per_sec; + struct timespec bt; + ts->used = 1; ts->sigaltstack_used = (struct target_sigaltstack) { .ss_sp = 0, .ss_size = 0, .ss_flags = TARGET_SS_DISABLE, }; + + /* Capture task start time relative to system boot */ + + ticks_per_sec = sysconf(_SC_CLK_TCK); + + if ((ticks_per_sec > 0) && !clock_gettime(CLOCK_BOOTTIME, &bt)) { + /* start_boottime is expressed in clock ticks */ + ts->start_boottime = bt.tv_sec * (uint64_t) ticks_per_sec; + ts->start_boottime += bt.tv_nsec * (uint64_t) ticks_per_sec / + NANOSECONDS_PER_SECOND; + } } CPUArchState *cpu_copy(CPUArchState *env) |