In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/7596fda6b1aaa11aff71a817f818bdd61bc2ae62?hp=bda53d3ed47d5776c4a1b88c0b7cfb484f5644be>

- Log -----------------------------------------------------------------
commit 7596fda6b1aaa11aff71a817f818bdd61bc2ae62
Author: Tony Cook <t...@develop-help.com>
Date:   Wed Sep 27 15:27:14 2017 +1000

    (perl #131982) update the set/getpriority documentation too

M       pod/perlfunc.pod

commit 4fd667a8b4c09331100c2a13db9d92f0961dfcf7
Author: Tony Cook <t...@develop-help.com>
Date:   Wed Sep 27 15:18:17 2017 +1000

    (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.

M       ext/POSIX/Makefile.PL
M       ext/POSIX/POSIX.xs
M       ext/POSIX/lib/POSIX.pm
M       ext/POSIX/lib/POSIX.pod
M       ext/POSIX/t/export.t
-----------------------------------------------------------------------

Summary of changes:
 ext/POSIX/Makefile.PL   |  3 ++-
 ext/POSIX/POSIX.xs      |  8 ++++++++
 ext/POSIX/lib/POSIX.pm  |  4 +++-
 ext/POSIX/lib/POSIX.pod | 12 ++++++++++++
 ext/POSIX/t/export.t    |  4 ++++
 pod/perlfunc.pod        |  6 ++++++
 6 files changed, 35 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
+        ),
     ],
 );
 
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod
index 665e07408a..e753d5f010 100644
--- a/pod/perlfunc.pod
+++ b/pod/perlfunc.pod
@@ -2989,6 +2989,9 @@ Returns the current priority for a process, a process 
group, or a user.
 (See L<getpriority(2)>.)  Will raise a fatal exception if used on a
 machine that doesn't implement L<getpriority(2)>.
 
+C<WHICH> can be any of C<PRIO_PROCESS>, C<PRIO_PGRP> or C<PRIO_USER>
+imported from L<POSIX/RESOURCE CONSTANTS>.
+
 Portability issues: L<perlport/getpriority>.
 
 =item getpwnam NAME
@@ -7036,6 +7039,9 @@ Sets the current priority for a process, a process group, 
or a user.
 (See L<setpriority(2)>.)  Raises an exception when used on a machine
 that doesn't implement L<setpriority(2)>.
 
+C<WHICH> can be any of C<PRIO_PROCESS>, C<PRIO_PGRP> or C<PRIO_USER>
+imported from L<POSIX/RESOURCE CONSTANTS>.
+
 Portability issues: L<perlport/setpriority>.
 
 =item setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL

--
Perl5 Master Repository

Reply via email to