1
0
mirror of https://github.com/golang/go synced 2024-10-04 18:21:21 -06:00
go/src/pkg/runtime/os_plan9.h
Russ Cox e9d62a6d81 runtime: refactor os-specific code
thread_GOOS.c becomes os_GOOS.c.

signal_GOOS_GOARCH.c becomes os_GOOS_GOARCH.c,
but with non-GOARCH-specific code moved into os_GOOS.c.

The actual arch-specific signal handler moves into signal_GOARCH.c
to avoid per-GOOS duplication.

New files signal_GOOS_GOARCH.h provide macros for
accessing fields of the very system-specific signal info structs.

Lots moving, but nothing changing.
This is a preliminarly cleanup so I can work on the signal
handling code to fix some open issues without having to
make each change 13 times.

Tested on Linux and OS X, 386 and amd64.
Will fix Plan 9, Windows, and ARM after the fact if necessary.
(Plan 9 and Windows should be fine; ARM will probably have some typos.)

Net effect: -1081 lines of code.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/7565048
2013-03-14 11:35:13 -07:00

83 lines
2.1 KiB
C

// Copyright 2010 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Plan 9-specific system calls
int32 runtime·pread(int32 fd, void *buf, int32 nbytes, int64 offset);
int32 runtime·pwrite(int32 fd, void *buf, int32 nbytes, int64 offset);
int64 runtime·seek(int32 fd, int64 offset, int32 whence);
void runtime·exits(int8* msg);
intptr runtime·brk_(void*);
int32 runtime·sleep(int32 ms);
int32 runtime·rfork(int32 flags, void *stk, M *mp, G *gp, void (*fn)(void));
int32 runtime·plan9_semacquire(uint32 *addr, int32 block);
int32 runtime·plan9_tsemacquire(uint32 *addr, int32 ms);
int32 runtime·plan9_semrelease(uint32 *addr, int32 count);
int32 runtime·notify(void (*fn)(void*, int8*));
int32 runtime·noted(int32);
void runtime·sigtramp(void*, int8*);
void runtime·sigpanic(void);
void runtime·goexitsall(int8*);
void runtime·setfpmasks(void);
/* open */
enum
{
OREAD = 0,
OWRITE = 1,
ORDWR = 2,
OEXEC = 3,
OTRUNC = 16,
OCEXEC = 32,
ORCLOSE = 64,
OEXCL = 0x1000
};
/* rfork */
enum
{
RFNAMEG = (1<<0),
RFENVG = (1<<1),
RFFDG = (1<<2),
RFNOTEG = (1<<3),
RFPROC = (1<<4),
RFMEM = (1<<5),
RFNOWAIT = (1<<6),
RFCNAMEG = (1<<10),
RFCENVG = (1<<11),
RFCFDG = (1<<12),
RFREND = (1<<13),
RFNOMNT = (1<<14)
};
/* notify */
enum
{
NCONT = 0,
NDFLT = 1
};
typedef struct Tos Tos;
typedef intptr Plink;
struct Tos {
struct /* Per process profiling */
{
Plink *pp; /* known to be 0(ptr) */
Plink *next; /* known to be 4(ptr) */
Plink *last;
Plink *first;
uint32 pid;
uint32 what;
} prof;
uint64 cyclefreq; /* cycle clock frequency if there is one, 0 otherwise */
int64 kcycles; /* cycles spent in kernel */
int64 pcycles; /* cycles spent in process (kernel + user) */
uint32 pid; /* might as well put the pid here */
uint32 clock;
/* top of stack is here */
};
#define NSIG 5 /* number of signals in runtime·SigTab array */
#define ERRMAX 128 /* max length of note string */