Source file src/runtime/defs_linux_arm.go

     1  // Copyright 2014 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package runtime
     6  
     7  import "unsafe"
     8  
     9  // Constants
    10  const (
    11  	_EINTR  = 0x4
    12  	_ENOMEM = 0xc
    13  	_EAGAIN = 0xb
    14  	_ENOSYS = 0x26
    15  
    16  	_PROT_NONE  = 0
    17  	_PROT_READ  = 0x1
    18  	_PROT_WRITE = 0x2
    19  	_PROT_EXEC  = 0x4
    20  
    21  	_MAP_ANON    = 0x20
    22  	_MAP_PRIVATE = 0x2
    23  	_MAP_FIXED   = 0x10
    24  
    25  	_MADV_DONTNEED   = 0x4
    26  	_MADV_FREE       = 0x8
    27  	_MADV_HUGEPAGE   = 0xe
    28  	_MADV_NOHUGEPAGE = 0xf
    29  	_MADV_COLLAPSE   = 0x19
    30  
    31  	_SA_RESTART     = 0x10000000
    32  	_SA_ONSTACK     = 0x8000000
    33  	_SA_RESTORER    = 0 // unused on ARM
    34  	_SA_SIGINFO     = 0x4
    35  	_SI_KERNEL      = 0x80
    36  	_SI_TIMER       = -0x2
    37  	_SIGHUP         = 0x1
    38  	_SIGINT         = 0x2
    39  	_SIGQUIT        = 0x3
    40  	_SIGILL         = 0x4
    41  	_SIGTRAP        = 0x5
    42  	_SIGABRT        = 0x6
    43  	_SIGBUS         = 0x7
    44  	_SIGFPE         = 0x8
    45  	_SIGKILL        = 0x9
    46  	_SIGUSR1        = 0xa
    47  	_SIGSEGV        = 0xb
    48  	_SIGUSR2        = 0xc
    49  	_SIGPIPE        = 0xd
    50  	_SIGALRM        = 0xe
    51  	_SIGSTKFLT      = 0x10
    52  	_SIGCHLD        = 0x11
    53  	_SIGCONT        = 0x12
    54  	_SIGSTOP        = 0x13
    55  	_SIGTSTP        = 0x14
    56  	_SIGTTIN        = 0x15
    57  	_SIGTTOU        = 0x16
    58  	_SIGURG         = 0x17
    59  	_SIGXCPU        = 0x18
    60  	_SIGXFSZ        = 0x19
    61  	_SIGVTALRM      = 0x1a
    62  	_SIGPROF        = 0x1b
    63  	_SIGWINCH       = 0x1c
    64  	_SIGIO          = 0x1d
    65  	_SIGPWR         = 0x1e
    66  	_SIGSYS         = 0x1f
    67  	_SIGRTMIN       = 0x20
    68  	_FPE_INTDIV     = 0x1
    69  	_FPE_INTOVF     = 0x2
    70  	_FPE_FLTDIV     = 0x3
    71  	_FPE_FLTOVF     = 0x4
    72  	_FPE_FLTUND     = 0x5
    73  	_FPE_FLTRES     = 0x6
    74  	_FPE_FLTINV     = 0x7
    75  	_FPE_FLTSUB     = 0x8
    76  	_BUS_ADRALN     = 0x1
    77  	_BUS_ADRERR     = 0x2
    78  	_BUS_OBJERR     = 0x3
    79  	_SEGV_MAPERR    = 0x1
    80  	_SEGV_ACCERR    = 0x2
    81  	_ITIMER_REAL    = 0
    82  	_ITIMER_PROF    = 0x2
    83  	_ITIMER_VIRTUAL = 0x1
    84  	_O_RDONLY       = 0
    85  	_O_WRONLY       = 0x1
    86  	_O_CREAT        = 0x40
    87  	_O_TRUNC        = 0x200
    88  	_O_NONBLOCK     = 0x800
    89  	_O_CLOEXEC      = 0x80000
    90  
    91  	_CLOCK_THREAD_CPUTIME_ID = 0x3
    92  
    93  	_SIGEV_THREAD_ID = 0x4
    94  
    95  	_AF_UNIX    = 0x1
    96  	_SOCK_DGRAM = 0x2
    97  )
    98  
    99  // The timespec structs and types are defined in Linux in
   100  // include/uapi/linux/time_types.h and include/uapi/asm-generic/posix_types.h.
   101  type timespec32 struct {
   102  	tv_sec  int32
   103  	tv_nsec int32
   104  }
   105  
   106  //go:nosplit
   107  func (ts *timespec32) setNsec(ns int64) {
   108  	ts.tv_sec = int32(ns / 1e9)
   109  	ts.tv_nsec = int32(ns % 1e9)
   110  }
   111  
   112  type timespec struct {
   113  	tv_sec  int64
   114  	tv_nsec int64
   115  }
   116  
   117  //go:nosplit
   118  func (ts *timespec) setNsec(ns int64) {
   119  	ts.tv_sec = int64(ns / 1e9)
   120  	ts.tv_nsec = int64(ns % 1e9)
   121  }
   122  
   123  type stackt struct {
   124  	ss_sp    *byte
   125  	ss_flags int32
   126  	ss_size  uintptr
   127  }
   128  
   129  type sigcontext struct {
   130  	trap_no       uint32
   131  	error_code    uint32
   132  	oldmask       uint32
   133  	r0            uint32
   134  	r1            uint32
   135  	r2            uint32
   136  	r3            uint32
   137  	r4            uint32
   138  	r5            uint32
   139  	r6            uint32
   140  	r7            uint32
   141  	r8            uint32
   142  	r9            uint32
   143  	r10           uint32
   144  	fp            uint32
   145  	ip            uint32
   146  	sp            uint32
   147  	lr            uint32
   148  	pc            uint32
   149  	cpsr          uint32
   150  	fault_address uint32
   151  }
   152  
   153  type ucontext struct {
   154  	uc_flags    uint32
   155  	uc_link     *ucontext
   156  	uc_stack    stackt
   157  	uc_mcontext sigcontext
   158  	uc_sigmask  uint32
   159  	__unused    [31]int32
   160  	uc_regspace [128]uint32
   161  }
   162  
   163  type timeval struct {
   164  	tv_sec  int32
   165  	tv_usec int32
   166  }
   167  
   168  func (tv *timeval) set_usec(x int32) {
   169  	tv.tv_usec = x
   170  }
   171  
   172  type itimerspec32 struct {
   173  	it_interval timespec32
   174  	it_value    timespec32
   175  }
   176  
   177  type itimerspec struct {
   178  	it_interval timespec
   179  	it_value    timespec
   180  }
   181  
   182  type itimerval struct {
   183  	it_interval timeval
   184  	it_value    timeval
   185  }
   186  
   187  type sigeventFields struct {
   188  	value  uintptr
   189  	signo  int32
   190  	notify int32
   191  	// below here is a union; sigev_notify_thread_id is the only field we use
   192  	sigev_notify_thread_id int32
   193  }
   194  
   195  type sigevent struct {
   196  	sigeventFields
   197  
   198  	// Pad struct to the max size in the kernel.
   199  	_ [_sigev_max_size - unsafe.Sizeof(sigeventFields{})]byte
   200  }
   201  
   202  type siginfoFields struct {
   203  	si_signo int32
   204  	si_errno int32
   205  	si_code  int32
   206  	// below here is a union; si_addr is the only field we use
   207  	si_addr uint32
   208  }
   209  
   210  type siginfo struct {
   211  	siginfoFields
   212  
   213  	// Pad struct to the max size in the kernel.
   214  	_ [_si_max_size - unsafe.Sizeof(siginfoFields{})]byte
   215  }
   216  
   217  type sigactiont struct {
   218  	sa_handler  uintptr
   219  	sa_flags    uint32
   220  	sa_restorer uintptr
   221  	sa_mask     uint64
   222  }
   223  
   224  type sockaddr_un struct {
   225  	family uint16
   226  	path   [108]byte
   227  }
   228  

View as plain text