summaryrefslogtreecommitdiff
path: root/sim/testsuite/sim/cris/c/sysctl2.c
diff options
context:
space:
mode:
Diffstat (limited to 'sim/testsuite/sim/cris/c/sysctl2.c')
-rw-r--r--sim/testsuite/sim/cris/c/sysctl2.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sim/testsuite/sim/cris/c/sysctl2.c b/sim/testsuite/sim/cris/c/sysctl2.c
new file mode 100644
index 00000000000..482e5463f81
--- /dev/null
+++ b/sim/testsuite/sim/cris/c/sysctl2.c
@@ -0,0 +1,38 @@
+/* Check error message for invalid sysctl call.
+#xerror:
+#output: Unimplemented _sysctl syscall *\n
+#output: program stopped with signal 4.\n
+#notarget: cris*-*-elf
+*/
+
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main (void)
+{
+ static int sysctl_args[] = { 99, 99 };
+ size_t x = 8;
+
+ struct __sysctl_args {
+ int *name;
+ int nlen;
+ void *oldval;
+ size_t *oldlenp;
+ void *newval;
+ size_t newlen;
+ unsigned long __unused[4];
+ } scargs
+ =
+ {
+ sysctl_args,
+ sizeof (sysctl_args) / sizeof (sysctl_args[0]),
+ (void *) -1, &x, NULL, 0
+ };
+
+ syscall (SYS__sysctl, &scargs);
+ printf ("xyzzy\n");
+ exit (0);
+}