Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
91eef984
Commit
91eef984
authored
Jan 22, 2012
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix declaration style
parent
beca27a3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
24 deletions
+31
-24
Modules/_posixsubprocess.c
Modules/_posixsubprocess.c
+31
-24
No files found.
Modules/_posixsubprocess.c
View file @
91eef984
...
@@ -43,7 +43,8 @@ static long max_fd;
...
@@ -43,7 +43,8 @@ static long max_fd;
/* Given the gc module call gc.enable() and return 0 on success. */
/* Given the gc module call gc.enable() and return 0 on success. */
static
int
_enable_gc
(
PyObject
*
gc_module
)
static
int
_enable_gc
(
PyObject
*
gc_module
)
{
{
PyObject
*
result
;
PyObject
*
result
;
result
=
PyObject_CallMethod
(
gc_module
,
"enable"
,
NULL
);
result
=
PyObject_CallMethod
(
gc_module
,
"enable"
,
NULL
);
...
@@ -55,7 +56,8 @@ static int _enable_gc(PyObject *gc_module)
...
@@ -55,7 +56,8 @@ static int _enable_gc(PyObject *gc_module)
/* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */
/* Convert ASCII to a positive int, no libc call. no overflow. -1 on error. */
static
int
_pos_int_from_ascii
(
char
*
name
)
static
int
_pos_int_from_ascii
(
char
*
name
)
{
{
int
num
=
0
;
int
num
=
0
;
while
(
*
name
>=
'0'
&&
*
name
<=
'9'
)
{
while
(
*
name
>=
'0'
&&
*
name
<=
'9'
)
{
...
@@ -75,7 +77,8 @@ static int _pos_int_from_ascii(char *name)
...
@@ -75,7 +77,8 @@ static int _pos_int_from_ascii(char *name)
* mounted) and do not have fdescfs for /dev/fd. MacOS X has a devfs
* mounted) and do not have fdescfs for /dev/fd. MacOS X has a devfs
* that properly supports /dev/fd.
* that properly supports /dev/fd.
*/
*/
static
int
_is_fdescfs_mounted_on_dev_fd
()
static
int
_is_fdescfs_mounted_on_dev_fd
()
{
{
struct
stat
dev_stat
;
struct
stat
dev_stat
;
struct
stat
dev_fd_stat
;
struct
stat
dev_fd_stat
;
...
@@ -91,7 +94,8 @@ static int _is_fdescfs_mounted_on_dev_fd()
...
@@ -91,7 +94,8 @@ static int _is_fdescfs_mounted_on_dev_fd()
/* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */
/* Returns 1 if there is a problem with fd_sequence, 0 otherwise. */
static
int
_sanity_check_python_fd_sequence
(
PyObject
*
fd_sequence
)
static
int
_sanity_check_python_fd_sequence
(
PyObject
*
fd_sequence
)
{
{
Py_ssize_t
seq_idx
,
seq_len
=
PySequence_Length
(
fd_sequence
);
Py_ssize_t
seq_idx
,
seq_len
=
PySequence_Length
(
fd_sequence
);
long
prev_fd
=
-
1
;
long
prev_fd
=
-
1
;
...
@@ -108,7 +112,8 @@ static int _sanity_check_python_fd_sequence(PyObject *fd_sequence)
...
@@ -108,7 +112,8 @@ static int _sanity_check_python_fd_sequence(PyObject *fd_sequence)
/* Is fd found in the sorted Python Sequence? */
/* Is fd found in the sorted Python Sequence? */
static
int
_is_fd_in_sorted_fd_sequence
(
int
fd
,
PyObject
*
fd_sequence
)
static
int
_is_fd_in_sorted_fd_sequence
(
int
fd
,
PyObject
*
fd_sequence
)
{
{
/* Binary search. */
/* Binary search. */
Py_ssize_t
search_min
=
0
;
Py_ssize_t
search_min
=
0
;
...
@@ -135,8 +140,8 @@ static int _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence)
...
@@ -135,8 +140,8 @@ static int _is_fd_in_sorted_fd_sequence(int fd, PyObject *fd_sequence)
* range defined by [start_fd, end_fd) is large this will take a
* range defined by [start_fd, end_fd) is large this will take a
* long time as it calls close() on EVERY possible fd.
* long time as it calls close() on EVERY possible fd.
*/
*/
static
void
_close_fds_by_brute_force
(
int
start_fd
,
int
end_fd
,
static
void
PyObject
*
py_fds_to_keep
)
_close_fds_by_brute_force
(
int
start_fd
,
int
end_fd
,
PyObject
*
py_fds_to_keep
)
{
{
Py_ssize_t
num_fds_to_keep
=
PySequence_Length
(
py_fds_to_keep
);
Py_ssize_t
num_fds_to_keep
=
PySequence_Length
(
py_fds_to_keep
);
Py_ssize_t
keep_seq_idx
;
Py_ssize_t
keep_seq_idx
;
...
@@ -191,8 +196,8 @@ struct linux_dirent {
...
@@ -191,8 +196,8 @@ struct linux_dirent {
* should be easy to add OS specific dirent or dirent64 structures and modify
* should be easy to add OS specific dirent or dirent64 structures and modify
* it with some cpp #define magic to work on other OSes as well if you want.
* it with some cpp #define magic to work on other OSes as well if you want.
*/
*/
static
void
_close_open_fd_range_safe
(
int
start_fd
,
int
end_fd
,
static
void
PyObject
*
py_fds_to_keep
)
_close_open_fd_range_safe
(
int
start_fd
,
int
end_fd
,
PyObject
*
py_fds_to_keep
)
{
{
int
fd_dir_fd
;
int
fd_dir_fd
;
if
(
start_fd
>=
end_fd
)
if
(
start_fd
>=
end_fd
)
...
@@ -243,7 +248,8 @@ static void _close_open_fd_range_safe(int start_fd, int end_fd,
...
@@ -243,7 +248,8 @@ static void _close_open_fd_range_safe(int start_fd, int end_fd,
* implemented as readdir() followed by memcpy(). See also:
* implemented as readdir() followed by memcpy(). See also:
* http://womble.decadent.org.uk/readdir_r-advisory.html
* http://womble.decadent.org.uk/readdir_r-advisory.html
*/
*/
static
void
_close_open_fd_range_maybe_unsafe
(
int
start_fd
,
int
end_fd
,
static
void
_close_open_fd_range_maybe_unsafe
(
int
start_fd
,
int
end_fd
,
PyObject
*
py_fds_to_keep
)
PyObject
*
py_fds_to_keep
)
{
{
DIR
*
proc_fd_dir
;
DIR
*
proc_fd_dir
;
...
@@ -315,7 +321,8 @@ static void _close_open_fd_range_maybe_unsafe(int start_fd, int end_fd,
...
@@ -315,7 +321,8 @@ static void _close_open_fd_range_maybe_unsafe(int start_fd, int end_fd,
* This restriction is documented at
* This restriction is documented at
* http://www.opengroup.org/onlinepubs/009695399/functions/fork.html.
* http://www.opengroup.org/onlinepubs/009695399/functions/fork.html.
*/
*/
static
void
child_exec
(
char
*
const
exec_array
[],
static
void
child_exec
(
char
*
const
exec_array
[],
char
*
const
argv
[],
char
*
const
argv
[],
char
*
const
envp
[],
char
*
const
envp
[],
const
char
*
cwd
,
const
char
*
cwd
,
...
...
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