[pypy-svn] r34304 - in pypy/dist/pypy: module/posix rpython rpython/module translator/c translator/c/src
arigo at codespeak.net
arigo at codespeak.net
Tue Nov 7 04:57:04 CET 2006
Author: arigo
Date: Tue Nov 7 04:56:49 2006
New Revision: 34304
Modified:
pypy/dist/pypy/module/posix/__init__.py
pypy/dist/pypy/module/posix/interp_posix.py
pypy/dist/pypy/rpython/extfunctable.py
pypy/dist/pypy/rpython/module/ll_os.py
pypy/dist/pypy/translator/c/extfunc.py
pypy/dist/pypy/translator/c/src/ll_os.h
Log:
Added os.kill().
Modified: pypy/dist/pypy/module/posix/__init__.py
==============================================================================
--- pypy/dist/pypy/module/posix/__init__.py (original)
+++ pypy/dist/pypy/module/posix/__init__.py Tue Nov 7 04:56:49 2006
@@ -47,6 +47,7 @@
'chmod' : 'interp_posix.chmod',
'rename' : 'interp_posix.rename',
'_exit' : 'interp_posix._exit',
+ 'kill' : 'interp_posix.kill',
#'getuid' : 'interp_posix.getuid',
#'geteuid' : 'interp_posix.geteuid',
}
Modified: pypy/dist/pypy/module/posix/interp_posix.py
==============================================================================
--- pypy/dist/pypy/module/posix/interp_posix.py (original)
+++ pypy/dist/pypy/module/posix/interp_posix.py Tue Nov 7 04:56:49 2006
@@ -344,6 +344,14 @@
return space.wrap(pid)
getpid.unwrap_spec = [ObjSpace]
+def kill(space, pid, sig):
+ "Kill a process with a signal."
+ try:
+ os.kill(pid, sig)
+ except OSError, e:
+ raise wrap_oserror(space, e)
+kill.unwrap_spec = [ObjSpace, int, int]
+
def link(space, src, dst):
"Create a hard link to a file."
try:
Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py (original)
+++ pypy/dist/pypy/rpython/extfunctable.py Tue Nov 7 04:56:49 2006
@@ -217,6 +217,7 @@
declare(os.chmod , noneannotation, 'll_os/chmod')
declare(os.rename , noneannotation, 'll_os/rename')
declare(os._exit , noneannotation, 'll_os/_exit')
+declare(os.kill , noneannotation, 'll_os/kill')
if hasattr(os, 'getpid'):
declare(os.getpid , int, 'll_os/getpid')
if hasattr(os, 'link'):
Modified: pypy/dist/pypy/rpython/module/ll_os.py
==============================================================================
--- pypy/dist/pypy/rpython/module/ll_os.py (original)
+++ pypy/dist/pypy/rpython/module/ll_os.py Tue Nov 7 04:56:49 2006
@@ -143,6 +143,10 @@
return os.getpid()
ll_os_getpid.suggested_primitive = True
+ def ll_os_kill(cls, pid, sig):
+ os.kill(pid, sig)
+ ll_os_kill.suggested_primitive = True
+
def ll_os_link(cls, path1, path2):
os.link(cls.from_rstr(path1), cls.from_rstr(path2))
ll_os_link.suggested_primitive = True
Modified: pypy/dist/pypy/translator/c/extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/extfunc.py (original)
+++ pypy/dist/pypy/translator/c/extfunc.py Tue Nov 7 04:56:49 2006
@@ -52,6 +52,7 @@
impl.ll_os_chmod.im_func: 'LL_os_chmod',
impl.ll_os_rename.im_func: 'LL_os_rename',
impl.ll_os_getpid.im_func: 'LL_os_getpid',
+ impl.ll_os_kill.im_func: 'LL_os_kill',
impl.ll_os_link.im_func: 'LL_os_link',
impl.ll_os_symlink.im_func: 'LL_os_symlink',
impl.ll_readlink_into: 'LL_readlink_into',
Modified: pypy/dist/pypy/translator/c/src/ll_os.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_os.h (original)
+++ pypy/dist/pypy/translator/c/src/ll_os.h Tue Nov 7 04:56:49 2006
@@ -9,6 +9,7 @@
#include <errno.h>
#include <fcntl.h>
+#include <signal.h>
#ifndef PATH_MAX
/* assume windows */
# define PATH_MAX 254
@@ -73,6 +74,7 @@
void LL_os_chmod(RPyString * path, int mode);
void LL_os_rename(RPyString * path1, RPyString * path2);
long LL_os_getpid(void);
+void LL_os_kill(int pid, int sig);
void LL_os_link(RPyString * path1, RPyString * path2);
void LL_os_symlink(RPyString * path1, RPyString * path2);
long LL_readlink_into(RPyString *path, RPyString *buffer);
@@ -342,6 +344,13 @@
return getpid();
}
+void LL_os_kill(int pid, int sig) {
+ int error = kill(pid, sig);
+ if (error != 0) {
+ RPYTHON_RAISE_OSERROR(errno);
+ }
+}
+
#ifdef HAVE_FILESYSTEM_WITH_LINKS
void LL_os_link(RPyString * path1, RPyString * path2) {
More information about the Pypy-commit
mailing list