equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2012, 2019, 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. |
857 return realpath(buffer, _exePath); |
857 return realpath(buffer, _exePath); |
858 } |
858 } |
859 |
859 |
860 char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { |
860 char* SystemProcessInterface::SystemProcesses::ProcessIterator::allocate_string(const char* str) const { |
861 if (str != NULL) { |
861 if (str != NULL) { |
862 size_t len = strlen(str); |
862 return os::strdup_check_oom(str, mtInternal); |
863 char* tmp = NEW_C_HEAP_ARRAY(char, len+1, mtInternal); |
|
864 strncpy(tmp, str, len); |
|
865 tmp[len] = '\0'; |
|
866 return tmp; |
|
867 } |
863 } |
868 return NULL; |
864 return NULL; |
869 } |
865 } |
870 |
866 |
871 int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProcess* process_info) { |
867 int SystemProcessInterface::SystemProcesses::ProcessIterator::current(SystemProcess* process_info) { |