summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@fingolfin.org>2020-05-03 04:19:27 +0000
committerRobert Mustacchi <rm@fingolfin.org>2020-05-12 05:31:08 +0000
commit4c46c814833d7980b7ebf54590a97d7f91472bd5 (patch)
treea96dbab7e61b3334972c1598202a49b5884a2262 /usr/src
parent0c06d385ea5bbe11d20ecea2e02cdc78733d5359 (diff)
downloadillumos-joyent-4c46c814833d7980b7ebf54590a97d7f91472bd5.tar.gz
12691 Want means of getting the maximum user address in a process
Reviewed by: Yuri Pankov <ypankov@fastmail.com> Reviewed by: Dan McDonald <danmcd@joyent.com> Reviewed by: Patrick Mooney <pmooney@pfmooney.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libc/port/gen/sysconf.c5
-rw-r--r--usr/src/man/man3c/sysconf.3c21
-rw-r--r--usr/src/uts/common/sys/sysconfig.h1
-rw-r--r--usr/src/uts/common/sys/unistd.h25
-rw-r--r--usr/src/uts/common/syscall/sysconfig.c4
5 files changed, 29 insertions, 27 deletions
diff --git a/usr/src/lib/libc/port/gen/sysconf.c b/usr/src/lib/libc/port/gen/sysconf.c
index 8e852ce1c8..904b848027 100644
--- a/usr/src/lib/libc/port/gen/sysconf.c
+++ b/usr/src/lib/libc/port/gen/sysconf.c
@@ -27,7 +27,7 @@
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/* sysconf(3C) - returns system configuration information */
@@ -464,6 +464,9 @@ sysconf(int name)
case _SC_EPHID_MAX:
return (_sysconfig(_CONFIG_EPHID_MAX));
+ case _SC_UADDR_MAX:
+ return (_sysconfig(_CONFIG_UADDR_MAX));
+
/* UNIX 03 names - XPG6/SUSv3/POSIX.1-2001 */
case _SC_REGEXP:
diff --git a/usr/src/man/man3c/sysconf.3c b/usr/src/man/man3c/sysconf.3c
index 570c9709ae..2c5cd02f3a 100644
--- a/usr/src/man/man3c/sysconf.3c
+++ b/usr/src/man/man3c/sysconf.3c
@@ -45,11 +45,10 @@
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright (c) 2013 Gary Mills
.\"
-.TH SYSCONF 3C "Apr 16, 2013"
+.TH SYSCONF 3C "May 04, 2020"
.SH NAME
sysconf \- get configurable system variables
.SH SYNOPSIS
-.LP
.nf
#include <unistd.h>
@@ -57,8 +56,6 @@ sysconf \- get configurable system variables
.fi
.SH DESCRIPTION
-.sp
-.LP
The \fBsysconf()\fR function provides a method for an application to determine
the current value of a configurable system limit or option (variable).
.sp
@@ -319,6 +316,12 @@ _SC_TTY_NAME_MAX TTYNAME_MAX Max length of tty
_SC_TZNAME_MAX TZNAME_MAX Max number of bytes
supported for name
of a time zone
+_SC_UADDR_MAX Maximum valid user
+ address in a process.
+ The returned value
+ should be cast to a
+ uintptr_t before
+ being interpreted.
_SC_V6_ILP32_OFF32 _POSIX_V6_ILP32_OFF32 Supports X/Open
ILP32 w/32-bit
offset build
@@ -424,8 +427,6 @@ l l .
.TE
.SH RETURN VALUES
-.sp
-.LP
Upon successful completion, \fBsysconf()\fR returns the current variable value
on the system. The value returned will not be more restrictive than the
corresponding value described to the application when it was compiled with the
@@ -474,8 +475,6 @@ _SC_SPLIT_CACHE
.in -2
.SH ERRORS
-.sp
-.LP
The \fBsysconf()\fR function will fail if:
.sp
.ne 2
@@ -487,8 +486,6 @@ The value of the \fIname\fR argument is invalid.
.RE
.SH ATTRIBUTES
-.sp
-.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -509,13 +506,9 @@ Standard See \fBstandards\fR(5).
.TE
.SH SEE ALSO
-.sp
-.LP
\fBpooladm\fR(1M), \fBzoneadm\fR(1M), \fBfpathconf\fR(2), \fBseteuid\fR(2),
\fBsetrlimit\fR(2), \fBconfstr\fR(3C), \fBattributes\fR(5), \fBstandards\fR(5)
.SH NOTES
-.sp
-.LP
A call to \fBsetrlimit()\fR can cause the value of \fBOPEN_MAX\fR to change.
.sp
.LP
diff --git a/usr/src/uts/common/sys/sysconfig.h b/usr/src/uts/common/sys/sysconfig.h
index 3a68d76ebe..f34713c59e 100644
--- a/usr/src/uts/common/sys/sysconfig.h
+++ b/usr/src/uts/common/sys/sysconfig.h
@@ -100,6 +100,7 @@ extern int mach_sysconfig(int);
#define _CONFIG_SYMLOOP_MAX 46 /* maximum # of symlinks in pathname */
#define _CONFIG_EPHID_MAX 47 /* maximum ephemeral uid */
+#define _CONFIG_UADDR_MAX 48 /* maximum user address */
#ifdef __cplusplus
}
diff --git a/usr/src/uts/common/sys/unistd.h b/usr/src/uts/common/sys/unistd.h
index f366e99f6a..591a3426f5 100644
--- a/usr/src/uts/common/sys/unistd.h
+++ b/usr/src/uts/common/sys/unistd.h
@@ -106,9 +106,9 @@ extern "C" {
#define _SC_ARG_MAX 1
#define _SC_CHILD_MAX 2
#define _SC_CLK_TCK 3
-#define _SC_NGROUPS_MAX 4
+#define _SC_NGROUPS_MAX 4
#define _SC_OPEN_MAX 5
-#define _SC_JOB_CONTROL 6
+#define _SC_JOB_CONTROL 6
#define _SC_SAVED_IDS 7
#define _SC_VERSION 8
/* SVR4 names */
@@ -151,21 +151,21 @@ extern "C" {
#define _SC_TIMER_MAX 44
/* XPG4 names */
#define _SC_2_C_BIND 45
-#define _SC_2_C_DEV 46
+#define _SC_2_C_DEV 46
#define _SC_2_C_VERSION 47
-#define _SC_2_FORT_DEV 48
-#define _SC_2_FORT_RUN 49
+#define _SC_2_FORT_DEV 48
+#define _SC_2_FORT_RUN 49
#define _SC_2_LOCALEDEF 50
-#define _SC_2_SW_DEV 51
+#define _SC_2_SW_DEV 51
#define _SC_2_UPE 52
#define _SC_2_VERSION 53
#define _SC_BC_BASE_MAX 54
-#define _SC_BC_DIM_MAX 55
+#define _SC_BC_DIM_MAX 55
#define _SC_BC_SCALE_MAX 56
#define _SC_BC_STRING_MAX 57
#define _SC_COLL_WEIGHTS_MAX 58
#define _SC_EXPR_NEST_MAX 59
-#define _SC_LINE_MAX 60
+#define _SC_LINE_MAX 60
#define _SC_RE_DUP_MAX 61
#define _SC_XOPEN_CRYPT 62
#define _SC_XOPEN_ENH_I18N 63
@@ -210,6 +210,7 @@ extern "C" {
#define _SC_NPROCESSORS_MAX 516 /* maximum # of processors */
#define _SC_CPUID_MAX 517 /* maximum CPU id */
#define _SC_EPHID_MAX 518 /* maximum ephemeral id */
+#define _SC_UADDR_MAX 519 /* maximum user address */
/*
* POSIX.1c (pthreads) names. These values are defined above
@@ -351,7 +352,7 @@ extern "C" {
#ifdef _XPG6
#define _POSIX_VERSION 200112L /* Supports IEEE Std 1003.1-2001 */
#else
-#define _POSIX_VERSION 199506L /* Supports POSIX-1c DIS */
+#define _POSIX_VERSION 199506L /* Supports POSIX-1c DIS */
#endif
#endif /* _POSIX_VERSION */
@@ -359,7 +360,7 @@ extern "C" {
#ifdef _XPG6
#define _POSIX2_VERSION 200112L /* Supports IEEE Std 1003.1-2001 */
#else
-#define _POSIX2_VERSION 199209L /* Supports ISO POSIX-2 DIS */
+#define _POSIX2_VERSION 199209L /* Supports ISO POSIX-2 DIS */
#endif
#endif /* _POSIX2_VERSION */
@@ -395,14 +396,14 @@ extern "C" {
#define _POSIX2_FORT_RUN 200112L /* Supports FORTRAN runtime */
#define _POSIX2_LOCALEDEF 200112L /* Supports creation of locales */
#define _POSIX2_SW_DEV 200112L /* Supports S/W Development Utility */
-#define _POSIX2_UPE 200112L /* Supports User Portability Utility */
+#define _POSIX2_UPE 200112L /* Supports User Portability Utility */
#else
#define _POSIX2_C_BIND 1 /* Supports C Language Bindings */
#define _POSIX2_C_DEV 1 /* Supports C language dev utility */
#define _POSIX2_FORT_RUN 1 /* Supports FORTRAN runtime */
#define _POSIX2_LOCALEDEF 1 /* Supports creation of locales */
#define _POSIX2_SW_DEV 1 /* Supports S/W Development Utility */
-#define _POSIX2_UPE 1 /* Supports User Portability Utility */
+#define _POSIX2_UPE 1 /* Supports User Portability Utility */
#endif /* _XPG6 */
/* UNIX 03 names */
diff --git a/usr/src/uts/common/syscall/sysconfig.c b/usr/src/uts/common/syscall/sysconfig.c
index 03f2fabe13..1d4a12ff00 100644
--- a/usr/src/uts/common/syscall/sysconfig.c
+++ b/usr/src/uts/common/syscall/sysconfig.c
@@ -46,6 +46,7 @@
#include <sys/timer.h>
#include <sys/zone.h>
#include <sys/vm_usage.h>
+#include <vm/as.h>
extern rctl_hndl_t rc_process_sigqueue;
@@ -219,6 +220,9 @@ sysconfig(int which)
case _CONFIG_EPHID_MAX:
return (MAXEPHUID);
+ case _CONFIG_UADDR_MAX:
+ return ((long)(uintptr_t)curproc->p_as->a_userlimit);
+
case _CONFIG_SYMLOOP_MAX:
return (MAXSYMLINKS);
}