#include #include #include "str.h" #include "xmalloc.h" int cpp_exec(char *in_file, char *out_file, size_t out_len) { char *tmp = xstrdup(in_file); char cmd[256], *base; int ret = 0; base = basename(tmp); slprintf(out_file, out_len, "/tmp/.tmp-%u-%s", rand(), base); slprintf(cmd, sizeof(cmd), "cpp -I" ETCDIRE_STRING " %s > %s", in_file, out_file); if (system(cmd) != 0) ret = -1; xfree(tmp); return ret; } Git repository'/>
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2016-04-22 18:19:15 +0100
committerRalf Baechle <ralf@linux-mips.org>2016-05-13 15:30:25 +0200
commit24e1df664fd3c025664ae0b64a4aec691507959a (patch)
tree38804cbc65c08db6a51d8b5be71e60dca8abf525
parentaab4673b599d8037c713afce40fabae398ca96c4 (diff)
MIPS: malta-time: Take seconds into account
When estimating the clock frequency based on the RTC, take seconds into account in case the Update In Progress (UIP) bit wasn't seen. This can happen in virtual machines (which may get pre-empted by the hypervisor at inopportune times) with QEMU emulating the RTC (and in fact not setting the UIP bit for very long), especially on slow hosts such as FPGA systems and hardware emulators. This results in several seconds actually having elapsed before seeing the UIP bit instead of just one second, and exaggerated timer frequencies. While updating the comments, they're also fixed to match the code in that the rising edge of the update flag is detected first, not the falling edge. The rising edge gives a more precise point to read the counters in a virtualised system than the falling edge, resulting in a more accurate frequency. It does however mean that we have to also wait for the falling edge before doing the read of the RTC seconds register, otherwise it seems to be possible in slow hardware emulation to stray into the interval when the RTC time is undefined during the update (at least 244uS after the rising edge of the update flag). This can result in both seconds values reading the same, and it wrapping to 60 seconds, vastly underestimating the frequency. Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: James Hogan <james.hogan@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/13174/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>