Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nemu3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
nemu3
Commits
701cbfee
Commit
701cbfee
authored
Jun 12, 2011
by
alina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: EINTRs caught
parent
ed07c351
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
6 deletions
+27
-6
src/netns/environ.py
src/netns/environ.py
+11
-2
src/netns/node.py
src/netns/node.py
+12
-2
src/netns/protocol.py
src/netns/protocol.py
+4
-2
No files found.
src/netns/environ.py
View file @
701cbfee
# vim:ts=4:sw=4:et:ai:sts=4
import
os
,
os
.
path
,
socket
,
subprocess
,
sys
,
syslog
import
errno
,
os
,
os
.
path
,
socket
,
subprocess
,
sys
,
syslog
from
syslog
import
LOG_ERR
,
LOG_WARNING
,
LOG_NOTICE
,
LOG_INFO
,
LOG_DEBUG
__all__
=
[
"ip_path"
,
"tc_path"
,
"brctl_path"
,
"sysctl_path"
,
"hz"
]
...
...
@@ -133,7 +133,16 @@ def logger(priority, message):
return
if
priority
>
_log_level
:
return
_log_stream
.
write
(
"[%d] %s
\
n
"
%
(
os
.
getpid
(),
message
.
rstrip
()))
while
True
:
try
:
_log_stream
.
write
(
"[%d] %s
\
n
"
%
(
os
.
getpid
(),
message
.
rstrip
()))
except
OSError
,
e
:
# pragma: no cover
if
e
.
errno
==
errno
.
EINTR
:
continue
else
:
raise
break
_log_stream
.
flush
()
def
error
(
message
):
...
...
src/netns/node.py
View file @
701cbfee
#!/usr/bin/env python
# vim:ts=4:sw=4:et:ai:sts=4
import
os
,
socket
,
sys
,
traceback
,
unshare
,
weakref
import
errno
,
os
,
socket
,
sys
,
traceback
,
unshare
,
weakref
from
netns.environ
import
*
import
netns.interface
,
netns
.
protocol
,
netns
.
subprocess_
...
...
@@ -61,7 +61,17 @@ class Node(object):
if
self
.
_slave
:
self
.
_slave
.
shutdown
()
exitcode
=
os
.
waitpid
(
self
.
_pid
,
0
)[
1
]
while
True
:
try
:
exitcode
=
os
.
waitpid
(
self
.
_pid
,
0
)[
1
]
except
OSError
,
e
:
# pragma: no cover
if
e
.
errno
==
errno
.
EINTR
:
continue
else
:
raise
break
if
exitcode
!=
0
:
error
(
"Node(0x%x) process %d exited with non-zero status: %d"
%
(
id
(
self
),
self
.
_pid
,
exitcode
))
...
...
src/netns/protocol.py
View file @
701cbfee
...
...
@@ -158,7 +158,9 @@ class Server(object):
line
=
self
.
_rfd
.
readline
()
except
IOError
,
e
:
line
=
None
if
e
.
errno
!=
errno
.
EINTR
:
if
e
.
errno
==
errno
.
EINTR
:
continue
else
:
raise
break
if
not
line
:
...
...
@@ -674,7 +676,7 @@ class Client(object):
if
code
/
100
==
4
:
return
None
else
:
raise
"Error on command: %d %s"
%
(
code
,
text
)
raise
RuntimeError
(
"Error on command: %d %s"
%
(
code
,
text
)
)
def
wait
(
self
,
pid
):
"""Equivalent to Popen.wait(). Waits for the process to finish and
...
...
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