]> granicus.if.org Git - strace/commitdiff
prctl: implement decoding of PR_SET_FP_MODE and PR_GET_FP_MODE options
authorEugene Syromyatnikov <evgsyr@gmail.com>
Sat, 19 Nov 2016 20:10:01 +0000 (23:10 +0300)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 20 Nov 2016 11:32:34 +0000 (11:32 +0000)
* xlat/pr_fp_mode.in: New file.
* prctl.c: Include "xlat/pr_fp_mode.h".
(SYS_FUNC(prctl)): Add handling for PR_SET_FP_MODE and PR_GET_FP_MODE
options.

prctl.c
xlat/pr_fp_mode.in [new file with mode: 0644]

diff --git a/prctl.c b/prctl.c
index 450b399e58e7ddf5863046660b39cdab45b0160e..32b79d780311d4d9e3ba07ed4a25bd99e2bd3ac8 100644 (file)
--- a/prctl.c
+++ b/prctl.c
@@ -34,6 +34,7 @@
 
 #include "xlat/prctl_options.h"
 #include "xlat/pr_cap_ambient.h"
+#include "xlat/pr_fp_mode.h"
 #include "xlat/pr_mce_kill.h"
 #include "xlat/pr_mce_kill_policy.h"
 #include "xlat/pr_set_mm.h"
@@ -165,6 +166,15 @@ SYS_FUNC(prctl)
                }
                break;
 
+       case PR_GET_FP_MODE:
+               if (entering(tcp))
+                       break;
+               if (syserror(tcp) || tcp->u_rval == 0)
+                       return 0;
+               tcp->auxstr = sprintflags("", pr_fp_mode,
+                                         (unsigned long) tcp->u_rval);
+               return RVAL_STR;
+
        /* PR_TASK_PERF_EVENTS_* take no arguments. */
        case PR_TASK_PERF_EVENTS_DISABLE:
        case PR_TASK_PERF_EVENTS_ENABLE:
@@ -311,6 +321,11 @@ SYS_FUNC(prctl)
                                      (unsigned long) tcp->u_rval);
                return tcp->auxstr ? RVAL_STR : RVAL_UDECIMAL;
 
+       case PR_SET_FP_MODE:
+               tprints(", ");
+               printflags(pr_fp_mode, arg2, "PR_FP_MODE_???");
+               return RVAL_DECODED;
+
        case PR_GET_NO_NEW_PRIVS:
        case PR_GET_THP_DISABLE:
        case PR_MPX_DISABLE_MANAGEMENT:
diff --git a/xlat/pr_fp_mode.in b/xlat/pr_fp_mode.in
new file mode 100644 (file)
index 0000000..8f14454
--- /dev/null
@@ -0,0 +1,2 @@
+PR_FP_MODE_FR          (1 << 0)        /* 64b FP registers */
+PR_FP_MODE_FRE         (1 << 1)        /* 32b compatibility */