RFR: 8146115 - Improve docker container detection and resource configuration usage
Bob Vandette
bob.vandette at oracle.com
Mon Oct 23 18:28:31 UTC 2017
Thanks Kim!
Bob.
> On Oct 23, 2017, at 12:52 AM, Kim Barrett <kim.barrett at oracle.com> wrote:
>
>> On Sep 27, 2017, at 9:20 PM, David Holmes <david.holmes at oracle.com> wrote:
>>>> 62 void set_subsystem_path(char *cgroup_path) {
>>>>
>>>> If this takes a "const char*" will it save you from casting string literals to "char*" elsewhere?
>>> I tried several different ways of declaring the container accessor functions and
>>> always ended up with warnings due to scanf not being able to validate arguments
>>> since the format string didn’t end up being a string literal. I originally was using templates
>>> and then ended up with the macros. I tried several different casts but could resolve the problem.
>>
>> Sounds like something Kim Barrett should take a look at :)
>
> Fortunately, I just happened by.
>
> The warnings are because we compile with -Wformat=2, which enables
> -Wformat-nonliteral (among other things).
>
> Use PRAGMA_FORMAT_NONLITERAL_IGNORED, e.g.
>
> PRAGMA_DIAG_PUSH
> PRAGMA_FORMAT_NONLITERAL_IGNORED
> <function definition>
> PRAGMA_DIAG_POP
>
> That will silence warnings about sscanf (or anything else!) with a
> non-literal format string within that <function definition>.
>
> Also, while I was looking at this, I noticed that in
> get_subsytem_file_contents_##return_name, if the sum of the lengths of
> get_subsystem_path() and filename is >= MAXBUF, then we can end up
> reading from a file other than the one intended, if such a file
> exists. That seems like it might be bad.
>
> Also, the filename argument should be const char*.
>
More information about the hotspot-dev
mailing list