@@ -748,36 +748,20 @@ static void PrintSystemInformation(JSONWriter* writer) {
748
748
749
749
writer->json_objectstart (" userLimits" );
750
750
struct rlimit limit;
751
- char buf[64 ];
752
751
std::string soft, hard;
753
752
754
753
for (size_t i = 0 ; i < arraysize (rlimit_strings); i++) {
755
754
if (getrlimit (rlimit_strings[i].id , &limit) == 0 ) {
756
- if (limit.rlim_cur == RLIM_INFINITY) {
755
+ if (limit.rlim_cur == RLIM_INFINITY)
757
756
soft = std::string (" unlimited" );
758
- } else {
759
- #if defined(_AIX) || defined(__sun)
760
- snprintf (buf, sizeof (buf), " %ld" , limit.rlim_cur );
761
- soft = std::string (buf);
762
- #elif defined(__linux__) && !defined(__GLIBC__)
763
- snprintf (buf, sizeof (buf), " %ld" , limit.rlim_cur );
764
- soft = std::string (buf);
765
- #else
766
- snprintf (buf, sizeof (buf), " %16" PRIu64, limit.rlim_cur );
767
- soft = std::string (soft);
768
- #endif
769
- }
770
- if (limit.rlim_max == RLIM_INFINITY) {
757
+ else
758
+ soft = std::to_string (limit.rlim_cur );
759
+
760
+ if (limit.rlim_max == RLIM_INFINITY)
771
761
hard = std::string (" unlimited" );
772
- } else {
773
- #ifdef _AIX
774
- snprintf (buf, sizeof (buf), " %lu" , limit.rlim_max );
775
- hard = std::string (buf);
776
- #else
777
- snprintf (buf, sizeof (buf), " %llu" , limit.rlim_max );
778
- hard = std::string (buf);
779
- #endif
780
- }
762
+ else
763
+ hard = std::to_string (limit.rlim_max );
764
+
781
765
writer->json_objectstart (rlimit_strings[i].description );
782
766
writer->json_keyvalue (" soft" , soft);
783
767
writer->json_keyvalue (" hard" , hard);
0 commit comments