summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2017-09-27 15:18:17 +1000
committerTony Cook <tony@develop-help.com>2017-10-16 11:17:21 +1100
commit4fd667a8b4c09331100c2a13db9d92f0961dfcf7 (patch)
treea67c74bffd0b2414f53c76bad726b48637147ef7
parentbda53d3ed47d5776c4a1b88c0b7cfb484f5644be (diff)
downloadperl-4fd667a8b4c09331100c2a13db9d92f0961dfcf7.tar.gz
(perl #131982) provide constants for get/setpriority in POSIX.pm
<sys/time.h> isn't necessarily needed, but apparently increases portability, since the rusage structure defined in <sys/resource.h> has struct timeval members.
-rw-r--r--ext/POSIX/Makefile.PL3
-rw-r--r--ext/POSIX/POSIX.xs8
-rw-r--r--ext/POSIX/lib/POSIX.pm4
-rw-r--r--ext/POSIX/lib/POSIX.pod12
-rw-r--r--ext/POSIX/t/export.t4
5 files changed, 29 insertions, 2 deletions
diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL
index bdaa4b6747..6e40f59ab1 100644
--- a/ext/POSIX/Makefile.PL
+++ b/ext/POSIX/Makefile.PL
@@ -66,7 +66,8 @@ my @names =
_SC_ARG_MAX _SC_CHILD_MAX _SC_CLK_TCK _SC_JOB_CONTROL _SC_NGROUPS_MAX
_SC_OPEN_MAX _SC_PAGESIZE _SC_SAVED_IDS _SC_STREAM_MAX _SC_TZNAME_MAX
_SC_VERSION EAI_AGAIN EAI_BADFLAGS EAI_FAIL EAI_FAMILY EAI_MEMORY EAI_NONAME
- EAI_SERVICE EAI_SOCKTYPE EAI_SYSTEM EAI_OVERFLOW),
+ EAI_SERVICE EAI_SOCKTYPE EAI_SYSTEM EAI_OVERFLOW
+ PRIO_PROCESS PRIO_PGRP PRIO_USER),
{name=>"CLK_TCK", not_constant=>1},
{name=>"MB_CUR_MAX", not_constant=>1},
{name=>"EXIT_FAILURE", default=>["IV", "1"]},
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 68b8881233..2d52326176 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -62,6 +62,14 @@ static int not_here(const char *s);
#include <unistd.h>
#endif
+#ifdef I_SYS_TIME
+# include <sys/time.h>
+#endif
+
+#ifdef I_SYS_RESOURCE
+# include <sys/resource.h>
+#endif
+
#if defined(USE_QUADMATH) && defined(I_QUADMATH)
# undef M_E
diff --git a/ext/POSIX/lib/POSIX.pm b/ext/POSIX/lib/POSIX.pm
index 8b1b65760e..2d7238a4ac 100644
--- a/ext/POSIX/lib/POSIX.pm
+++ b/ext/POSIX/lib/POSIX.pm
@@ -4,7 +4,7 @@ use warnings;
our ($AUTOLOAD, %SIGRT);
-our $VERSION = '1.77';
+our $VERSION = '1.78';
require XSLoader;
@@ -437,6 +437,8 @@ my %other_export_tags = ( # cf. exports policy below
stdlib_h_c99 => [ @{$default_export_tags{stdlib_h}}, 'strtold' ],
+ sys_resource_h => [qw(PRIO_PROCESS PRIO_PGRP PRIO_USER)],
+
sys_socket_h => [qw(
MSG_CTRUNC MSG_DONTROUTE MSG_EOR MSG_OOB MSG_PEEK MSG_TRUNC MSG_WAITALL
)],
diff --git a/ext/POSIX/lib/POSIX.pod b/ext/POSIX/lib/POSIX.pod
index 722cf8ea8c..0d7a1a0809 100644
--- a/ext/POSIX/lib/POSIX.pod
+++ b/ext/POSIX/lib/POSIX.pod
@@ -2465,6 +2465,18 @@ C<_POSIX_TZNAME_MAX> C<_POSIX_VDISABLE> C<_POSIX_VERSION>
=back
+=head1 RESOURCE CONSTANTS
+
+Imported with the C<:sys_resource_h> tag.
+
+=over 8
+
+=item Constants
+
+C<PRIO_PROCESS> C<PRIO_PGRP> C<PRIO_USER>
+
+=back
+
=head1 SYSTEM CONFIGURATION
=over 8
diff --git a/ext/POSIX/t/export.t b/ext/POSIX/t/export.t
index 5e07a13afd..6637fa6452 100644
--- a/ext/POSIX/t/export.t
+++ b/ext/POSIX/t/export.t
@@ -178,6 +178,10 @@ my %expect = (
POLL_IN POLL_OUT POLL_MSG POLL_ERR POLL_PRI POLL_HUP
SI_USER SI_QUEUE SI_TIMER SI_ASYNCIO SI_MESGQ
),
+ # added in 5.27
+ qw(
+ PRIO_PROCESS PRIO_PGRP PRIO_USER
+ ),
],
);