Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
09241858
Commit
09241858
authored
Jun 10, 2011
by
Yuval Pavel Zholkover
Committed by
Rob Pike
Jun 10, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: fix Plan 9 "lingering goroutines bug".
R=rsc, r CC=golang-dev
https://golang.org/cl/4589042
parent
9b409ac7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
62 additions
and
3 deletions
+62
-3
src/pkg/runtime/plan9/386/sys.s
src/pkg/runtime/plan9/386/sys.s
+5
-0
src/pkg/runtime/plan9/os.h
src/pkg/runtime/plan9/os.h
+30
-0
src/pkg/runtime/plan9/thread.c
src/pkg/runtime/plan9/thread.c
+27
-3
No files found.
src/pkg/runtime/plan9/386/sys.s
View file @
09241858
...
...
@@ -9,6 +9,11 @@
TEXT
runtime
·
setldt
(
SB
),7,$0
RET
TEXT
runtime
·
open
(
SB
),7,$0
MOVL
$
14
,
AX
INT
$
64
RET
TEXT
runtime
·
write
(
SB
),7,$0
MOVL
$
20
,
AX
INT
$
64
...
...
src/pkg/runtime/plan9/os.h
View file @
09241858
...
...
@@ -6,6 +6,14 @@ extern int32 runtime·write(int32 fd, void* buffer, int32 nbytes);
extern
void
runtime
·
exits
(
int8
*
msg
);
extern
int32
runtime
·
brk_
(
void
*
);
/* open */
enum
{
OREAD
=
0
,
OWRITE
=
1
,
ORDWR
=
2
};
/* rfork */
enum
{
...
...
@@ -22,6 +30,28 @@ enum
RFREND
=
(
1
<<
13
),
RFNOMNT
=
(
1
<<
14
)
};
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 */
};
extern
int32
runtime
·
rfork
(
int32
flags
,
void
*
stk
,
M
*
m
,
G
*
g
,
void
(
*
fn
)(
void
));
extern
int32
runtime
·
plan9_semacquire
(
uint32
*
addr
,
int32
block
);
extern
int32
runtime
·
plan9_semrelease
(
uint32
*
addr
,
int32
count
);
src/pkg/runtime/plan9/thread.c
View file @
09241858
...
...
@@ -27,24 +27,48 @@ runtime·initsig(int32 queue)
{
}
extern
Tos
*
_tos
;
void
runtime
·
exit
(
int32
)
{
int32
fd
;
uint8
buf
[
128
];
uint8
tmp
[
16
];
uint8
*
p
,
*
q
;
int32
pid
;
runtime
·
memclr
(
buf
,
sizeof
buf
);
runtime
·
memclr
(
tmp
,
sizeof
tmp
);
pid
=
_tos
->
pid
;
/* build path string /proc/pid/notepg */
for
(
q
=
tmp
;
pid
>
0
;)
{
*
q
++
=
'0'
+
(
pid
%
10
);
pid
=
pid
/
10
;
}
p
=
buf
;
runtime
·
mcpy
((
void
*
)
p
,
(
void
*
)
"/proc/"
,
6
);
p
+=
6
;
for
(
q
--
;
q
>=
tmp
;)
*
p
++
=
*
q
--
;
runtime
·
mcpy
((
void
*
)
p
,
(
void
*
)
"/notepg"
,
7
);
/* post interrupt note */
fd
=
runtime
·
open
(
buf
,
OWRITE
);
runtime
·
write
(
fd
,
"interrupt"
,
9
);
runtime
·
exits
(
nil
);
}
void
runtime
·
newosproc
(
M
*
m
,
G
*
g
,
void
*
stk
,
void
(
*
fn
)(
void
))
{
USED
(
m
,
g
,
stk
,
fn
);
m
->
tls
[
0
]
=
m
->
id
;
// so 386 asm can find it
if
(
0
){
runtime
·
printf
(
"newosproc stk=%p m=%p g=%p fn=%p rfork=%p id=%d/%d ostk=%p
\n
"
,
stk
,
m
,
g
,
fn
,
runtime
·
rfork
,
m
->
id
,
m
->
tls
[
0
],
&
m
);
}
if
(
runtime
·
rfork
(
RFPROC
|
RFMEM
,
stk
,
m
,
g
,
fn
)
<
0
)
if
(
runtime
·
rfork
(
RFPROC
|
RFMEM
|
RFNOWAIT
,
stk
,
m
,
g
,
fn
)
<
0
)
runtime
·
throw
(
"newosproc: rfork failed"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment