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 = timediv(ns, 1e9, &ts.tv_nsec)
   150  }
   151  
   152  type timespec struct {
   153  	tv_sec  int64
   154  	tv_nsec int64
   155  }
   156  
   157  //go:nosplit
   158  func (ts *timespec) setNsec(ns int64) {
   159  	var newNS int32
   160  	ts.tv_sec = int64(timediv(ns, 1e9, &newNS))
   161  	ts.tv_nsec = int64(newNS)
   162  }
   163  
   164  type timeval struct {
   165  	tv_sec  int32
   166  	tv_usec int32
   167  }
   168  
   169  func (tv *timeval) set_usec(x int32) {
   170  	tv.tv_usec = x
   171  }
   172  
   173  type sigactiont struct {
   174  	sa_handler  uintptr
   175  	sa_flags    uint32
   176  	sa_restorer uintptr
   177  	sa_mask     uint64
   178  }
   179  
   180  type siginfoFields struct {
   181  	si_signo int32
   182  	si_errno int32
   183  	si_code  int32
   184  	// below here is a union; si_addr is the only field we use
   185  	si_addr uint32
   186  }
   187  
   188  type siginfo struct {
   189  	siginfoFields
   190  
   191  	// Pad struct to the max size in the kernel.
   192  	_ [_si_max_size - unsafe.Sizeof(siginfoFields{})]byte
   193  }
   194  
   195  type stackt struct {
   196  	ss_sp    *byte
   197  	ss_flags int32
   198  	ss_size  uintptr
   199  }
   200  
   201  type sigcontext struct {
   202  	gs            uint16
   203  	__gsh         uint16
   204  	fs            uint16
   205  	__fsh         uint16
   206  	es            uint16
   207  	__esh         uint16
   208  	ds            uint16
   209  	__dsh         uint16
   210  	edi           uint32
   211  	esi           uint32
   212  	ebp           uint32
   213  	esp           uint32
   214  	ebx           uint32
   215  	edx           uint32
   216  	ecx           uint32
   217  	eax           uint32
   218  	trapno        uint32
   219  	err           uint32
   220  	eip           uint32
   221  	cs            uint16
   222  	__csh         uint16
   223  	eflags        uint32
   224  	esp_at_signal uint32
   225  	ss            uint16
   226  	__ssh         uint16
   227  	fpstate       *fpstate
   228  	oldmask       uint32
   229  	cr2           uint32
   230  }
   231  
   232  type ucontext struct {
   233  	uc_flags    uint32
   234  	uc_link     *ucontext
   235  	uc_stack    stackt
   236  	uc_mcontext sigcontext
   237  	uc_sigmask  uint32
   238  }
   239  
   240  type itimerspec32 struct {
   241  	it_interval timespec32
   242  	it_value    timespec32
   243  }
   244  type itimerspec struct {
   245  	it_interval timespec
   246  	it_value    timespec
   247  }
   248  
   249  type itimerval struct {
   250  	it_interval timeval
   251  	it_value    timeval
   252  }
   253  
   254  type sigeventFields struct {
   255  	value  uintptr
   256  	signo  int32
   257  	notify int32
   258  	// below here is a union; sigev_notify_thread_id is the only field we use
   259  	sigev_notify_thread_id int32
   260  }
   261  
   262  type sigevent struct {
   263  	sigeventFields
   264  
   265  	// Pad struct to the max size in the kernel.
   266  	_ [_sigev_max_size - unsafe.Sizeof(sigeventFields{})]byte
   267  }
   268  
   269  type sockaddr_un struct {
   270  	family uint16
   271  	path   [108]byte
   272  }
   273  

View as plain text