OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [sim/] [testsuite/] [sim/] [cris/] [c/] [sysctl2.c] - Blame information for rev 842

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
/* Check error message for invalid sysctl call.
2
#xerror:
3
#output: Unimplemented _sysctl syscall *\n
4
#output: program stopped with signal 4.\n
5
#notarget: cris*-*-elf
6
*/
7
 
8
#include <unistd.h>
9
#include <sys/syscall.h>
10
#include <errno.h>
11
#include <stdio.h>
12
#include <stdlib.h>
13
#include <errno.h>
14
 
15
int main (void)
16
{
17
  static int sysctl_args[] = { 99, 99 };
18
  size_t x = 8;
19
 
20
  struct __sysctl_args {
21
    int *name;
22
    int nlen;
23
    void *oldval;
24
    size_t *oldlenp;
25
    void *newval;
26
    size_t newlen;
27
    unsigned long __unused[4];
28
  } scargs
29
      =
30
   {
31
     sysctl_args,
32
     sizeof (sysctl_args) / sizeof (sysctl_args[0]),
33
     (void *) -1, &x, NULL, 0
34
   };
35
 
36
  int err = syscall (SYS__sysctl, &scargs);
37
  if (err == -1 && errno == ENOSYS)
38
    printf ("ENOSYS\n");
39
 printf ("xyzzy\n");
40
 exit (0);
41
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.