Bug 1264226: Don't use '_COARSE' Posix clocks if not defined, r=jld,a=ritu
authorThomas Zimmermann <tdz@users.sourceforge.net>
Thu, 14 Apr 2016 10:12:39 +0200
changeset 324055 9fa5930b05c005ea9738a903372d30063e1397a1
parent 324054 8485c5d3d0908dcf8dd08910d11418c47d9a3757
child 324056 bfffe574ce0c3b0e14df12b7ec20bdfebc7f2409
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjld, ritu
bugs1264226
milestone47.0a2
Bug 1264226: Don't use '_COARSE' Posix clocks if not defined, r=jld,a=ritu Not all systems (i.e., Gonk) support CLOCK_MONOTONIC_COARSE and CLOCK_REALTIME_COARSE. With this patch, we don't refer to them if they are not supported.
security/sandbox/linux/SandboxFilter.cpp
--- a/security/sandbox/linux/SandboxFilter.cpp
+++ b/security/sandbox/linux/SandboxFilter.cpp
@@ -140,20 +140,24 @@ public:
   }
 
   virtual ResultExpr EvaluateSyscall(int sysno) const override {
     switch (sysno) {
       // Timekeeping
     case __NR_clock_gettime: {
       Arg<clockid_t> clk_id(0);
       return If(clk_id == CLOCK_MONOTONIC, Allow())
+#ifdef CLOCK_MONOTONIC_COARSE
         .ElseIf(clk_id == CLOCK_MONOTONIC_COARSE, Allow())
+#endif
         .ElseIf(clk_id == CLOCK_PROCESS_CPUTIME_ID, Allow())
         .ElseIf(clk_id == CLOCK_REALTIME, Allow())
+#ifdef CLOCK_REALTIME_COARSE
         .ElseIf(clk_id == CLOCK_REALTIME_COARSE, Allow())
+#endif
         .ElseIf(clk_id == CLOCK_THREAD_CPUTIME_ID, Allow())
         .Else(InvalidSyscall());
     }
     case __NR_gettimeofday:
 #ifdef __NR_time
     case __NR_time:
 #endif
     case __NR_nanosleep: