1
0
mirror of https://github.com/golang/go synced 2024-11-22 00:04:41 -07:00

runtime: fix freebsd-amd64 (and part of 386)

R=rsc
CC=golang-dev
https://golang.org/cl/4285063
This commit is contained in:
Andrew Gerrand 2011-03-24 11:45:12 +11:00
parent 913c8d7397
commit 1c05a90ae2
5 changed files with 28 additions and 8 deletions

View File

@ -137,7 +137,9 @@ sigaction(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
if(restart)
sa.sa_flags |= SA_RESTART;
sa.sa_mask = ~0ULL;
sa.__sigaction_u.__sa_sigaction = (uintptr)fn;
if (fn == runtime·sighandler)
fn = (void*)runtime·sigtramp;
sa.__sigaction_u.__sa_sigaction = (void*)fn;
runtime·sigaction(i, &sa, nil);
}
@ -165,7 +167,6 @@ runtime·initsig(int32 queue)
void
runtime·resetcpuprofiler(int32 hz)
{
Sigaction sa;
Itimerval it;
runtime·memclr((byte*)&it, sizeof it);

View File

@ -61,6 +61,9 @@ enum {
BUS_OBJERR = 0x3,
SEGV_MAPERR = 0x1,
SEGV_ACCERR = 0x2,
ITIMER_REAL = 0,
ITIMER_VIRTUAL = 0x1,
ITIMER_PROF = 0x2,
};
// Types
@ -83,7 +86,7 @@ struct ThrParam {
int64 *child_tid;
int64 *parent_tid;
int32 flags;
byte pad0[4];
byte pad_godefs_0[4];
Rtprio *rtp;
void* spare[3];
};
@ -93,7 +96,7 @@ struct Sigaltstack {
int8 *ss_sp;
uint64 ss_size;
int32 ss_flags;
byte pad0[4];
byte pad_godefs_0[4];
};
typedef struct Sigset Sigset;
@ -114,7 +117,7 @@ struct StackT {
int8 *ss_sp;
uint64 ss_size;
int32 ss_flags;
byte pad0[4];
byte pad_godefs_0[4];
};
typedef struct Siginfo Siginfo;
@ -178,6 +181,18 @@ struct Ucontext {
StackT uc_stack;
int32 uc_flags;
int32 __spare__[4];
byte pad0[12];
byte pad_godefs_0[12];
};
typedef struct Timeval Timeval;
struct Timeval {
int64 tv_sec;
int64 tv_usec;
};
typedef struct Itimerval Itimerval;
struct Itimerval {
Timeval it_interval;
Timeval it_value;
};
#pragma pack off

View File

@ -145,7 +145,9 @@ sigaction(int32 i, void (*fn)(int32, Siginfo*, void*, G*), bool restart)
if(restart)
sa.sa_flags |= SA_RESTART;
sa.sa_mask = ~0ULL;
sa.__sigaction_u.__sa_sigaction = (uintptr)fn;
if (fn == runtime·sighandler)
fn = (void*)runtime·sigtramp;
sa.__sigaction_u.__sa_sigaction = (void*)fn;
runtime·sigaction(i, &sa, nil);
}
@ -173,7 +175,6 @@ runtime·initsig(int32 queue)
void
runtime·resetcpuprofiler(int32 hz)
{
Sigaction sa;
Itimerval it;
runtime·memclr((byte*)&it, sizeof it);

View File

@ -19,6 +19,7 @@
#include <sys/rtprio.h>
#include <sys/thr.h>
#include <sys/_sigset.h>
#include <sys/unistd.h>
enum {
$PROT_NONE = PROT_NONE,
@ -103,4 +104,5 @@ typedef siginfo_t $Siginfo;
typedef mcontext_t $Mcontext;
typedef ucontext_t $Ucontext;
typedef struct timeval $Timeval;
typedef struct itimerval $Itimerval;

View File

@ -7,3 +7,4 @@ void runtime·sigaltstack(Sigaltstack*, Sigaltstack*);
struct sigaction;
void runtime·sigaction(int32, struct sigaction*, struct sigaction*);
void runtiem·setitimerval(int32, Itimerval*, Itimerval*);
void runtime·setitimer(int32, Itimerval*, Itimerval*);