let to_string ?r =
      function
      | None -> "infinity"
      | Some l ->
          (match r with
           | None -> Int64.to_string l
           | Some RLIMIT_CORE | Some RLIMIT_DATA | Some RLIMIT_FSIZE |
               Some RLIMIT_STACK | Some RLIMIT_AS -> string_of_bytes l
           | Some RLIMIT_NOFILE -> Int64.to_string l
           | Some RLIMIT_CPU -> Printf.sprintf "%Ld s" l)