Author: Ronan Lamy <ronan.l...@gmail.com> Branch: rposix-for-3 Changeset: r83470:e4260eb4e93c Date: 2016-03-31 17:20 +0100 http://bitbucket.org/pypy/pypy/changeset/e4260eb4e93c/
Log: Implement rposix.fexecve() diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py --- a/rpython/rlib/rposix.py +++ b/rpython/rlib/rposix.py @@ -1801,6 +1801,26 @@ error = c_fchownat(dir_fd, path, owner, group, flag) handle_posix_error('fchownat', error) +if HAVE_FEXECVE: + c_fexecve = external('fexecve', + [rffi.INT, rffi.CCHARPP, rffi.CCHARPP], rffi.INT, + save_err=rffi.RFFI_SAVE_ERRNO) + + def fexecve(fd, args, env): + envstrs = [] + for item in env.iteritems(): + envstr = "%s=%s" % item + envstrs.append(envstr) + + # This list conversion already takes care of NUL bytes. + l_args = rffi.ll_liststr2charpp(args) + l_env = rffi.ll_liststr2charpp(envstrs) + c_fexecve(fd, l_args, l_env) + + rffi.free_charpp(l_env) + rffi.free_charpp(l_args) + raise OSError(get_saved_errno(), "execve failed") + if HAVE_LINKAT: c_linkat = external('linkat', [rffi.INT, rffi.CCHARP, rffi.INT, rffi.CCHARP, rffi.INT], rffi.INT) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit