summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-07-17 14:49:49 -0400
committermidipix <writeonce@midipix.org>2016-07-21 03:47:29 -0400
commitd918bea72978afa375c83b167a70a814bcaf2a95 (patch)
tree8e0ffd745d0e00e0dfb4263afbd3bf94c3b2b193 /src
parent107e968247f2f44ff54a72d0281b974a7926ca44 (diff)
downloadptycon-d918bea72978afa375c83b167a70a814bcaf2a95.tar.bz2
ptycon-d918bea72978afa375c83b167a70a814bcaf2a95.tar.xz
pty layer: set client information for pty inheritance.
Diffstat (limited to 'src')
-rw-r--r--src/internal/ptycon_driver_impl.h8
-rw-r--r--src/internal/ptycon_ioctl_impl.h48
-rw-r--r--src/pty/ptyc_pty_ctx.c4
3 files changed, 60 insertions, 0 deletions
diff --git a/src/internal/ptycon_driver_impl.h b/src/internal/ptycon_driver_impl.h
index ee2e5ca..0acb69d 100644
--- a/src/internal/ptycon_driver_impl.h
+++ b/src/internal/ptycon_driver_impl.h
@@ -43,7 +43,15 @@ struct ptyc_loop_ctx {
int32_t fwinsize;
};
+struct ptyc_client_ctx {
+ void * hprocess;
+ void * hthread;
+ nt_cid cid;
+ nt_pty_client_info clinfo;
+};
+
struct ptyc_driver_ctx_impl {
+ struct ptyc_client_ctx clctx;
struct ptyc_term_ctx tctx;
struct ptyc_loop_ctx lctx;
struct ptyc_common_ctx cctx;
diff --git a/src/internal/ptycon_ioctl_impl.h b/src/internal/ptycon_ioctl_impl.h
index dacd689..a3d902d 100644
--- a/src/internal/ptycon_ioctl_impl.h
+++ b/src/internal/ptycon_ioctl_impl.h
@@ -19,4 +19,52 @@ static int32_t ptyc_grant(nt_pty * hptm)
&ctlinfo,sizeof(ctlinfo));
}
+static int32_t ptyc_set_client_info(
+ nt_pty * hpty,
+ nt_pty_client_info * clinfo)
+{
+ int32_t status;
+ nt_iosb iosb;
+ nt_large_integer ticks;
+ nt_large_integer freq;
+ nt_pty_client_info ptyinfo;
+
+ if ((status = ntapi->zw_query_performance_counter(
+ &ticks,&freq)))
+ return status;
+
+ ptyinfo.any[0] = (ticks.ulow << 19) | (ticks.ulow >> 13);
+
+ if ((status = ntapi->zw_query_performance_counter(
+ &ticks,&freq)))
+ return status;
+
+ ptyinfo.any[1] = (ticks.ulow << 15) | (ticks.ulow >> 17);
+
+ if ((status = ntapi->zw_query_performance_counter(
+ &ticks,&freq)))
+ return status;
+
+ ptyinfo.any[1] = (ticks.ulow << 11) | (ticks.ulow >> 21);
+
+ if ((status = ntapi->zw_query_performance_counter(
+ &ticks,&freq)))
+ return status;
+
+ ptyinfo.any[1] = (ticks.ulow << 17) | (ticks.ulow >> 15);
+
+ if ((status = ntapi->pty_set(
+ hpty,&iosb,
+ &ptyinfo,sizeof(ptyinfo),
+ NT_PTY_CLIENT_INFORMATION)))
+ return status;
+
+ clinfo->any[0] = ptyinfo.any[0];
+ clinfo->any[1] = ptyinfo.any[1];
+ clinfo->any[2] = ptyinfo.any[2];
+ clinfo->any[3] = ptyinfo.any[3];
+
+ return NT_STATUS_SUCCESS;
+}
+
#endif
diff --git a/src/pty/ptyc_pty_ctx.c b/src/pty/ptyc_pty_ctx.c
index f0e416d..99d8c69 100644
--- a/src/pty/ptyc_pty_ctx.c
+++ b/src/pty/ptyc_pty_ctx.c
@@ -200,6 +200,10 @@ int ptyc_alloc_pty(struct ptyc_driver_ctx * dctx)
return ptyc_set_status(
dctx,status);
+ if ((status = ptyc_set_client_info(cctx->hpts,&ictx->clctx.clinfo)))
+ return ptyc_set_status(
+ dctx,status);
+
if (cctx->drvflags & PTYC_DRIVER_DBG_RAW)
if ((status = ptyc_make_raw(cctx->hpts)))
return ptyc_set_status(