summaryrefslogtreecommitdiffhomepage
path: root/src/process
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-12-14 06:09:54 +0000
committermidipix <writeonce@midipix.org>2016-12-15 01:47:53 -0500
commit5489c6fe80117f0fa7e247adc6e886a458840bbb (patch)
tree3d75fb68dca308e6ccca0cd500db7438fdb58593 /src/process
parent604059ced974f5ed17d9959bb5d3962900649121 (diff)
downloadntapi-5489c6fe80117f0fa7e247adc6e886a458840bbb.tar.bz2
ntapi-5489c6fe80117f0fa7e247adc6e886a458840bbb.tar.xz
__ntapi_tt_fork_v1(): code clean-up.
Diffstat (limited to 'src/process')
-rw-r--r--src/process/ntapi_tt_fork_v1.c16
-rw-r--r--src/process/ntapi_tt_fork_v2.c13
2 files changed, 16 insertions, 13 deletions
diff --git a/src/process/ntapi_tt_fork_v1.c b/src/process/ntapi_tt_fork_v1.c
index 15852e5..841e1e4 100644
--- a/src/process/ntapi_tt_fork_v1.c
+++ b/src/process/ntapi_tt_fork_v1.c
@@ -61,7 +61,8 @@ intptr_t __fastcall __tt_fork_impl_v1(
nt_client_id cid;
nt_large_integer timeout;
- hprocess = hthread = (void *)0;
+ hprocess = 0;
+ hthread = 0;
oa.len = sizeof(nt_object_attributes);
oa.root_dir = 0;
@@ -156,19 +157,20 @@ intptr_t __fastcall __ntapi_tt_fork_v1(
intptr_t pid;
nt_large_integer timeout;
void ** hport_session;
- void * hevent_tty_connected;
+ void * htty_connected;
ntapi_internals * __internals;
__internals = __ntapi_internals();
hport_session = &__internals->hport_tty_session;
timeout.quad = (-1) * 10 * 1000 * __NT_FORK_CHILD_WAIT_MILLISEC;
+ htty_connected = 0;
if (at_locked_cas(&__internals->hlock,0,1))
return (intptr_t)(-1);
if (hport_session && *hport_session)
if (__ntapi_tt_create_inheritable_event(
- &hevent_tty_connected,
+ &htty_connected,
NT_NOTIFICATION_EVENT,
NT_EVENT_NOT_SIGNALED))
return (intptr_t)(-1);
@@ -194,24 +196,24 @@ intptr_t __fastcall __ntapi_tt_fork_v1(
__internals->rtdata->hsession = *hport_session;
__ntapi->zw_set_event(
- hevent_tty_connected,
+ htty_connected,
0);
} else if (pid > 0) {
status = __ntapi->zw_wait_for_single_object(
- hevent_tty_connected,
+ htty_connected,
NT_SYNC_NON_ALERTABLE,
&timeout);
if (status && __PSX_DEBUG)
if ((status = __ntapi->zw_wait_for_single_object(
- hevent_tty_connected,
+ htty_connected,
NT_SYNC_NON_ALERTABLE,
0)))
pid = __tt_fork_cancel(*hprocess,status);
}
- __ntapi->zw_close(hevent_tty_connected);
+ __ntapi->zw_close(htty_connected);
}
return pid;
diff --git a/src/process/ntapi_tt_fork_v2.c b/src/process/ntapi_tt_fork_v2.c
index 233362c..7c47696 100644
--- a/src/process/ntapi_tt_fork_v2.c
+++ b/src/process/ntapi_tt_fork_v2.c
@@ -126,16 +126,17 @@ intptr_t __fastcall __ntapi_tt_fork_v2(
intptr_t pid;
nt_large_integer timeout;
void ** hport_session;
- void * hevent_tty_connected;
+ void * htty_connected;
ntapi_internals * __internals;
__internals = __ntapi_internals();
hport_session = &__internals->hport_tty_session;
timeout.quad = (-1) * 10 * 1000 * __NT_FORK_CHILD_WAIT_MILLISEC;
+ htty_connected = 0;
if (hport_session && *hport_session)
if (__ntapi_tt_create_inheritable_event(
- &hevent_tty_connected,
+ &htty_connected,
NT_NOTIFICATION_EVENT,
NT_EVENT_NOT_SIGNALED))
return (intptr_t)(-1);
@@ -160,24 +161,24 @@ intptr_t __fastcall __ntapi_tt_fork_v2(
__internals->rtdata->hsession = *hport_session;
__ntapi->zw_set_event(
- hevent_tty_connected,
+ htty_connected,
0);
} else {
status = __ntapi->zw_wait_for_single_object(
- hevent_tty_connected,
+ htty_connected,
NT_SYNC_NON_ALERTABLE,
&timeout);
if (status && __PSX_DEBUG)
if ((status = __ntapi->zw_wait_for_single_object(
- hevent_tty_connected,
+ htty_connected,
NT_SYNC_NON_ALERTABLE,
0)))
pid = __tt_fork_cancel(*hprocess,status);
}
- __ntapi->zw_close(hevent_tty_connected);
+ __ntapi->zw_close(htty_connected);
return pid;
}