1
0
mirror of https://github.com/golang/go synced 2024-11-21 16:44:43 -07:00

cov and prof: implement windows version (just function stubs and build mods)

R=brainman, rsc
CC=golang-dev
https://golang.org/cl/1676054
This commit is contained in:
Joe Poirier 2010-07-30 11:47:11 +10:00 committed by Alex Brainman
parent 500425ac7b
commit b57ffae094
5 changed files with 86 additions and 3 deletions

View File

@ -292,9 +292,15 @@ extern char* getgoroot(void);
extern char* getgoversion(void); extern char* getgoversion(void);
#ifdef __MINGW32__ #ifdef __MINGW32__
extern int fork(); struct timespec {
int tv_sec;
long tv_nsec;
};
extern int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
extern int fork(void);
extern int pread(int fd, void *buf, int n, int off); extern int pread(int fd, void *buf, int n, int off);
extern int pwrite(int fd, void *buf, int n, int off); extern int pwrite(int fd, void *buf, int n, int off);
#define execv(prog, argv) execv(prog, (const char* const*)(argv))
#define execvp(prog, argv) execvp(prog, (const char**)(argv)) #define execvp(prog, argv) execvp(prog, (const char**)(argv))
#define lseek(fd, n, base) _lseeki64(fd, n, base) #define lseek(fd, n, base) _lseeki64(fd, n, base)
#define mkdir(path, perm) mkdir(path) #define mkdir(path, perm) mkdir(path)

View File

@ -22,9 +22,16 @@ $(TARG): $(OFILES)
clean: clean:
rm -f *.$O $(TARG) rm -f *.$O $(TARG)
install: install-$(shell uname | tr A-Z a-z) ifeq ($(GOOS),windows)
NAME=windows
else
NAME=$(shell uname | tr A-Z a-z)
endif
install: install-$(NAME)
install-linux: install-default install-linux: install-default
install-freebsd: install-default install-freebsd: install-default
install-windows: install-default
# on Darwin, have to install and setgid; see $GOROOT/src/sudo.bash # on Darwin, have to install and setgid; see $GOROOT/src/sudo.bash
install-darwin: $(TARG) install-darwin: $(TARG)

View File

@ -22,9 +22,16 @@ $(TARG): $(OFILES)
clean: clean:
rm -f *.$O $(TARG) rm -f *.$O $(TARG)
install: install-$(shell uname | tr A-Z a-z) install-pprof ifeq ($(GOOS),windows)
NAME=windows
else
NAME=$(shell uname | tr A-Z a-z)
endif
install: install-$(NAME) install-pprof
install-linux: install-default install-linux: install-default
install-freebsd: install-default install-freebsd: install-default
install-windows: install-default
# on Darwin, have to install and setgid; see $GOROOT/src/sudo.bash # on Darwin, have to install and setgid; see $GOROOT/src/sudo.bash
install-darwin: $(TARG) install-darwin: $(TARG)

View File

@ -52,6 +52,10 @@ ifneq ($(GOOS),windows)
OFILES+=\ OFILES+=\
$(shell uname | tr A-Z a-z).$O\ $(shell uname | tr A-Z a-z).$O\
else
OFILES+=\
windows.$O\
endif endif
HFILES=../../include/mach.h elf.h macho.h obj.h HFILES=../../include/mach.h elf.h macho.h obj.h

59
src/libmach/windows.c Normal file
View File

@ -0,0 +1,59 @@
// This is stubbed out for the moment. Will revisit when the time comes.
#include <u.h>
#include <libc.h>
#include <bio.h>
#include <mach.h>
int
ctlproc(int pid, char *msg)
{
sysfatal("ctlproc unimplemented in Windows");
}
char*
proctextfile(int pid)
{
sysfatal("proctextfile unimplemented in Windows");
}
char*
procstatus(int pid)
{
sysfatal("procstatus unimplemented in Windows");
}
Map*
attachproc(int pid, Fhdr *fp)
{
sysfatal("attachproc unimplemented in Windows");
}
void
detachproc(Map *m)
{
sysfatal("detachproc unimplemented in Windows");
}
int
procthreadpids(int pid, int *p, int np)
{
sysfatal("procthreadpids unimplemented in Windows");
}
int
pread(int fd, void *buf, int count, int offset)
{
sysfatal("pread unimplemented in Windows");
}
int
pwrite(int fd, void *buf, int count, int offset)
{
sysfatal("pwrite unimplemented in Windows");
}
int
nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{
sysfatal("nanosleep unimplemented in Windows");
}