Mercurial > hg > truffle
comparison src/os/posix/vm/os_posix.cpp @ 17937:78bbf4d43a14
8037816: Fix for 8036122 breaks build with Xcode5/clang
8043029: Change 8037816 breaks HS build with older GCC versions which don't support diagnostic pragmas
8043164: Format warning in traceStream.hpp
Summary: Backport of main fix + two corrections, enables clang compilation, turns on format attributes, corrects/mutes warnings
Reviewed-by: kvn, coleenp, iveresov, twisti
author | drchase |
---|---|
date | Thu, 22 May 2014 15:52:41 -0400 |
parents | bbfbe9b06038 |
children | 52b4284cb496 833b0f92429a |
comparison
equal
deleted
inserted
replaced
17935:7384f6a12fc1 | 17937:78bbf4d43a14 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
33 #include <sys/resource.h> | 33 #include <sys/resource.h> |
34 #include <sys/utsname.h> | 34 #include <sys/utsname.h> |
35 #include <pthread.h> | 35 #include <pthread.h> |
36 #include <signal.h> | 36 #include <signal.h> |
37 | 37 |
38 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC | |
39 | |
38 // Todo: provide a os::get_max_process_id() or similar. Number of processes | 40 // Todo: provide a os::get_max_process_id() or similar. Number of processes |
39 // may have been configured, can be read more accurately from proc fs etc. | 41 // may have been configured, can be read more accurately from proc fs etc. |
40 #ifndef MAX_PID | 42 #ifndef MAX_PID |
41 #define MAX_PID INT_MAX | 43 #define MAX_PID INT_MAX |
42 #endif | 44 #endif |
189 void os::Posix::print_uname_info(outputStream* st) { | 191 void os::Posix::print_uname_info(outputStream* st) { |
190 // kernel | 192 // kernel |
191 st->print("uname:"); | 193 st->print("uname:"); |
192 struct utsname name; | 194 struct utsname name; |
193 uname(&name); | 195 uname(&name); |
194 st->print(name.sysname); st->print(" "); | 196 st->print("%s ", name.sysname); |
195 st->print(name.release); st->print(" "); | 197 st->print("%s ", name.release); |
196 st->print(name.version); st->print(" "); | 198 st->print("%s ", name.version); |
197 st->print(name.machine); | 199 st->print("%s", name.machine); |
198 st->cr(); | 200 st->cr(); |
199 } | 201 } |
200 | 202 |
201 bool os::has_allocatable_memory_limit(julong* limit) { | 203 bool os::has_allocatable_memory_limit(julong* limit) { |
202 struct rlimit rlim; | 204 struct rlimit rlim; |
550 | 552 |
551 // Prints one-line description of a signal set. | 553 // Prints one-line description of a signal set. |
552 void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set) { | 554 void os::Posix::print_signal_set_short(outputStream* st, const sigset_t* set) { |
553 char buf[NUM_IMPORTANT_SIGS + 1]; | 555 char buf[NUM_IMPORTANT_SIGS + 1]; |
554 os::Posix::describe_signal_set_short(set, buf, sizeof(buf)); | 556 os::Posix::describe_signal_set_short(set, buf, sizeof(buf)); |
555 st->print(buf); | 557 st->print("%s", buf); |
556 } | 558 } |
557 | 559 |
558 // Writes one-line description of a combination of sigaction.sa_flags into a user | 560 // Writes one-line description of a combination of sigaction.sa_flags into a user |
559 // provided buffer. Returns that buffer. | 561 // provided buffer. Returns that buffer. |
560 const char* os::Posix::describe_sa_flags(int flags, char* buffer, size_t size) { | 562 const char* os::Posix::describe_sa_flags(int flags, char* buffer, size_t size) { |
610 | 612 |
611 // Prints one-line description of a combination of sigaction.sa_flags. | 613 // Prints one-line description of a combination of sigaction.sa_flags. |
612 void os::Posix::print_sa_flags(outputStream* st, int flags) { | 614 void os::Posix::print_sa_flags(outputStream* st, int flags) { |
613 char buffer[0x100]; | 615 char buffer[0x100]; |
614 os::Posix::describe_sa_flags(flags, buffer, sizeof(buffer)); | 616 os::Posix::describe_sa_flags(flags, buffer, sizeof(buffer)); |
615 st->print(buffer); | 617 st->print("%s", buffer); |
616 } | 618 } |
617 | 619 |
618 // Helper function for os::Posix::print_siginfo_...(): | 620 // Helper function for os::Posix::print_siginfo_...(): |
619 // return a textual description for signal code. | 621 // return a textual description for signal code. |
620 struct enum_sigcode_desc_t { | 622 struct enum_sigcode_desc_t { |