Source file src/runtime/defs_linux_386.go

     1  // created by cgo -cdefs and then converted to Go
     2  // cgo -cdefs defs2_linux.go
     3  
     4  package runtime
     5  
     6  import "unsafe"
     7  
     8  const (
     9  	_EINTR  = 0x4
    10  	_EAGAIN = 0xb
    11  	_ENOMEM = 0xc
    12  	_ENOSYS = 0x26
    13  
    14  	_PROT_NONE  = 0x0
    15  	_PROT_READ  = 0x1
    16  	_PROT_WRITE = 0x2
    17  	_PROT_EXEC  = 0x4
    18  
    19  	_MAP_ANON    = 0x20
    20  	_MAP_PRIVATE = 0x2
    21  	_MAP_FIXED   = 0x10
    22  
    23  	_MADV_DONTNEED   = 0x4
    24  	_MADV_FREE       = 0x8
    25  	_MADV_HUGEPAGE   = 0xe
    26  	_MADV_NOHUGEPAGE = 0xf
    27  	_MADV_COLLAPSE   = 0x19
    28  
    29  	_SA_RESTART  = 0x10000000
    30  	_SA_ONSTACK  = 0x8000000
    31  	_SA_RESTORER = 0x4000000
    32  	_SA_SIGINFO  = 0x4
    33  
    34  	_SI_KERNEL = 0x80
    35  	_SI_TIMER  = -0x2
    36  
    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  
    68  	_SIGRTMIN = 0x20
    69  
    70  	_FPE_INTDIV = 0x1
    71  	_FPE_INTOVF = 0x2
    72  	_FPE_FLTDIV = 0x3
    73  	_FPE_FLTOVF = 0x4
    74  	_FPE_FLTUND = 0x5
    75  	_FPE_FLTRES = 0x6
    76  	_FPE_FLTINV = 0x7
    77  	_FPE_FLTSUB = 0x8
    78  
    79  	_BUS_ADRALN = 0x1
    80  	_BUS_ADRERR = 0x2
    81  	_BUS_OBJERR = 0x3
    82  
    83  	_SEGV_MAPERR = 0x1
    84  	_SEGV_ACCERR = 0x2
    85  
    86  	_ITIMER_REAL    = 0x0
    87  	_ITIMER_VIRTUAL = 0x1
    88  	_ITIMER_PROF    = 0x2
    89  
    90  	_CLOCK_THREAD_CPUTIME_ID = 0x3
    91  
    92  	_SIGEV_THREAD_ID = 0x4
    93  
    94  	_O_RDONLY   = 0x0
    95  	_O_WRONLY   = 0x1
    96  	_O_CREAT    = 0x40
    97  	_O_TRUNC    = 0x200
    98  	_O_NONBLOCK = 0x800
    99  	_O_CLOEXEC  = 0x80000
   100  
   101  	_AF_UNIX    = 0x1
   102  	_SOCK_DGRAM = 0x2
   103  )
   104  
   105  type fpreg struct {
   106  	significand [4]uint16
   107  	exponent    uint16
   108  }
   109  
   110  type fpxreg struct {
   111  	significand [4]uint16
   112  	exponent    uint16
   113  	padding     [3]uint16
   114  }
   115  
   116  type xmmreg struct {
   117  	element [4]uint32
   118  }
   119  
   120  type fpstate struct {
   121  	cw        uint32
   122  	sw        uint32
   123  	tag       uint32
   124  	ipoff     uint32
   125  	cssel     uint32
   126  	dataoff   uint32
   127  	datasel   uint32
   128  	_st       [8]fpreg
   129  	status    uint16
   130  	magic     uint16
   131  	_fxsr_env [6]uint32
   132  	mxcsr     uint32
   133  	reserved  uint32
   134  	_fxsr_st  [8]fpxreg
   135  	_xmm      [8]xmmreg
   136  	padding1  [44]uint32
   137  	anon0     [48]byte
   138  }
   139  
   140  // The timespec structs and types are defined in Linux in
   141  // include/uapi/linux/time_types.h and include/uapi/asm-generic/posix_types.h.
   142  type timespec32 struct {
   143  	tv_sec  int32
   144  	tv_nsec int32
   145  }
   146  
   147  //go:nosplit
   148  func (ts *timespec32) setNsec(ns int64) {
   149  	ts.tv_sec = int32(ns / 1e9)
   150  	ts.tv_nsec = int32(ns % 1e9)
   151  }
   152  
   153  type timespec struct {
   154  	tv_sec  int64
   155  	tv_nsec int32
   156  	_       [4]byte // the C ABI aligns int64 to 8 bytes
   157  }
   158  
   159  //go:nosplit
   160  func (ts *timespec) setNsec(ns int64) {
   161  	ts.tv_sec = ns / 1e9
   162  	ts.tv_nsec = int32(ns % 1e9)
   163  }
   164  
   165  type timeval struct {
   166  	tv_sec  int32
   167  	tv_usec int32
   168  }
   169  
   170  func (tv *timeval) set_usec(x int32) {
   171  	tv.tv_usec = x
   172  }
   173  
   174  type sigactiont struct {
   175  	sa_handler  uintptr
   176  	sa_flags    uint32
   177  	sa_restorer uintptr
   178  	sa_mask     uint64
   179  }
   180  
   181  type siginfoFields struct {
   182  	si_signo int32
   183  	si_errno int32
   184  	si_code  int32
   185  	// below here is a union; si_addr is the only field we use
   186  	si_addr uint32
   187  }
   188  
   189  type siginfo struct {
   190  	siginfoFields
   191  
   192  	// Pad struct to the max size in the kernel.
   193  	_ [_si_max_size - unsafe.Sizeof(siginfoFields{})]byte
   194  }
   195  
   196  type stackt struct {
   197  	ss_sp    *byte
   198  	ss_flags int32
   199  	ss_size  uintptr
   200  }
   201  
   202  type sigcontext struct {
   203  	gs            uint16
   204  	__gsh         uint16
   205  	fs            uint16
   206  	__fsh         uint16
   207  	es            uint16
   208  	__esh         uint16
   209  	ds            uint16
   210  	__dsh         uint16
   211  	edi           uint32
   212  	esi           uint32
   213  	ebp           uint32
   214  	esp           uint32
   215  	ebx           uint32
   216  	edx           uint32
   217  	ecx           uint32
   218  	eax           uint32
   219  	trapno        uint32
   220  	err           uint32
   221  	eip           uint32
   222  	cs            uint16
   223  	__csh         uint16
   224  	eflags        uint32
   225  	esp_at_signal uint32
   226  	ss            uint16
   227  	__ssh         uint16
   228  	fpstate       *fpstate
   229  	oldmask       uint32
   230  	cr2           uint32
   231  }
   232  
   233  type ucontext struct {
   234  	uc_flags    uint32
   235  	uc_link     *ucontext
   236  	uc_stack    stackt
   237  	uc_mcontext sigcontext
   238  	uc_sigmask  uint32
   239  }
   240  
   241  type itimerspec32 struct {
   242  	it_interval timespec32
   243  	it_value    timespec32
   244  }
   245  type itimerspec struct {
   246  	it_interval timespec
   247  	it_value    timespec
   248  }
   249  
   250  type itimerval struct {
   251  	it_interval timeval
   252  	it_value    timeval
   253  }
   254  
   255  type sigeventFields struct {
   256  	value  uintptr
   257  	signo  int32
   258  	notify int32
   259  	// below here is a union; sigev_notify_thread_id is the only field we use
   260  	sigev_notify_thread_id int32
   261  }
   262  
   263  type sigevent struct {
   264  	sigeventFields
   265  
   266  	// Pad struct to the max size in the kernel.
   267  	_ [_sigev_max_size - unsafe.Sizeof(sigeventFields{})]byte
   268  }
   269  
   270  type sockaddr_un struct {
   271  	family uint16
   272  	path   [108]byte
   273  }
   274  

View as plain text