Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Unix rlimit support for RLIMIT_DATA #4742

Merged
merged 1 commit into from
Jan 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion include_core/omrport.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2019 IBM Corp. and others
* Copyright (c) 1991, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -153,6 +153,7 @@
#define OMRPORT_RESOURCE_CORE_FILE ((uintptr_t) 3)
#define OMRPORT_RESOURCE_CORE_FLAGS ((uintptr_t) 4)
#define OMRPORT_RESOURCE_FILE_DESCRIPTORS ((uintptr_t) 5)
#define OMRPORT_RESOURCE_DATA ((uintptr_t) 6)
/** @} */

/**
Expand Down
25 changes: 22 additions & 3 deletions port/unix/omrsysinfo.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2015, 2019 IBM Corp. and others
* Copyright (c) 2015, 2020 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -3144,6 +3144,15 @@ omrsysinfo_get_limit(struct OMRPortLibrary *portLibrary, uint32_t resourceID, ui
*limit = OMRPORT_LIMIT_UNKNOWN_VALUE;
Trc_PRT_sysinfo_get_limit_Exit(rc);
return rc;
#endif /* !defined(OMRZTPF) */
} else if (OMRPORT_RESOURCE_DATA == resourceRequested) {
#if !defined(OMRZTPF)
resource = RLIMIT_DATA;
#else /* !defined(OMRZTPF) */
/* Not implemented for z/TPF */
*limit = OMRPORT_LIMIT_UNKNOWN_VALUE;
Trc_PRT_sysinfo_get_limit_Exit(rc);
return rc;
#endif /* !defined(OMRZTPF) */
}

Expand All @@ -3153,7 +3162,9 @@ omrsysinfo_get_limit(struct OMRPortLibrary *portLibrary, uint32_t resourceID, ui
break;
case OMRPORT_RESOURCE_ADDRESS_SPACE:
/* FALLTHROUGH */
case OMRPORT_RESOURCE_CORE_FILE: {
case OMRPORT_RESOURCE_CORE_FILE:
/* FALLTHROUGH */
case OMRPORT_RESOURCE_DATA: {
#if !defined(OMRZTPF)
if (0 == getrlimit(resource, &lim)) {
*limit = (uint64_t)(hardLimitRequested ? lim.rlim_max : lim.rlim_cur);
Expand Down Expand Up @@ -3263,6 +3274,12 @@ omrsysinfo_set_limit(struct OMRPortLibrary *portLibrary, uint32_t resourceID, ui
rc = OMRPORT_LIMIT_UNKNOWN;
#endif /* !defined(OMRZTPF) */
break;
case OMRPORT_RESOURCE_DATA:
#if !defined(OMRZTPF)
resource = RLIMIT_DATA;
#else /* !defined(OMRZTPF) */
rc = OMRPORT_LIMIT_UNKNOWN;
#endif /* !defined(OMRZTPF) */
default:
break;
}
Expand All @@ -3273,7 +3290,9 @@ omrsysinfo_set_limit(struct OMRPortLibrary *portLibrary, uint32_t resourceID, ui
/* FALLTHROUGH */
case OMRPORT_RESOURCE_ADDRESS_SPACE:
/* FALLTHROUGH */
case OMRPORT_RESOURCE_CORE_FILE: {
case OMRPORT_RESOURCE_CORE_FILE:
/* FALLTHROUGH */
case OMRPORT_RESOURCE_DATA: {
#if !defined(OMRZTPF)
rc = getrlimit(resource, &lim);
if (-1 == rc) {
Expand Down