Package: x11vnc
Followup-For: Bug #1067076
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu noble ubuntu-patch
X-Debbugs-Cc: michael.hud...@ubuntu.com
Control: tags -1 patch

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch:
    Use clock_gettime to replace gettimeofday.

Thanks for considering the patch.


-- System Information:
Debian Release: trixie/sid
  APT prefers mantic-updates
  APT policy: (500, 'mantic-updates'), (500, 'mantic-security'), (500, 
'mantic'), (100, 'mantic-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.5.0-25-generic (SMP w/16 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_NZ.UTF-8:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru 
x11vnc-0.9.16/debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch
 
x11vnc-0.9.16/debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch
--- 
x11vnc-0.9.16/debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch
   1970-01-01 12:00:00.000000000 +1200
+++ 
x11vnc-0.9.16/debian/patches/0007-use-clock_gettime-to-replace-gettimeofday.patch
   2024-03-21 15:26:54.000000000 +1300
@@ -0,0 +1,86 @@
+Description: Use clock_gettime to replace gettimeofday
+ So that the program is compatible with 64-bit time_t types on 32-bit systems
+Author: Zixing Liu <zixing....@canonical.com>
+Forwarded: no
+Last-Update: 2024-03-21
+
+Index: x11vnc/src/uinput.c
+===================================================================
+--- x11vnc.orig/src/uinput.c
++++ x11vnc/src/uinput.c
+@@ -710,6 +710,7 @@ void parse_uinput_str(char *in) {
+ static void ptr_move(int dx, int dy) {
+ #ifdef UINPUT_OK
+       struct input_event ev;
++      struct timespec tv;
+       int d = direct_rel_fd < 0 ? fd : direct_rel_fd;
+ 
+       if (injectable && strchr(injectable, 'M') == NULL) {
+@@ -720,7 +721,9 @@ static void ptr_move(int dx, int dy) {
+ 
+       if (db) fprintf(stderr, "ptr_move(%d, %d) fd=%d\n", dx, dy, d);
+ 
+-      gettimeofday(&ev.time, NULL);
++      clock_gettime(CLOCK_REALTIME, &tv);
++      ev.input_event_sec = tv.tv_sec;
++      ev.input_event_usec = tv.tv_nsec / 1000;
+       ev.type = EV_REL;
+       ev.code = REL_Y;
+       ev.value = dy;
+@@ -755,6 +758,7 @@ static void apply_tslib(int *x, int *y)
+ static void ptr_abs(int x, int y, int p) {
+ #ifdef UINPUT_OK
+       struct input_event ev;
++      struct timespec tv;
+       int x0, y0;
+       int d = direct_abs_fd < 0 ? fd : direct_abs_fd;
+ 
+@@ -773,7 +777,9 @@ static void ptr_abs(int x, int y, int p)
+ 
+       if (db) fprintf(stderr, "ptr_abs(%d, %d => %d %d, p=%d) fd=%d\n", x0, 
y0, x, y, p, d);
+ 
+-      gettimeofday(&ev.time, NULL);
++      clock_gettime(CLOCK_REALTIME, &tv);
++      ev.input_event_sec = tv.tv_sec;
++      ev.input_event_usec = tv.tv_nsec / 1000;
+       ev.type = EV_ABS;
+       ev.code = ABS_Y;
+       ev.value = y;
+@@ -950,6 +956,7 @@ if (0) {usleep(100*1000) ;}
+ static void button_click(int down, int btn) {
+ #ifdef UINPUT_OK
+       struct input_event ev;
++      struct timespec tv;
+       int d = direct_btn_fd < 0 ? fd : direct_btn_fd;
+ 
+       if (injectable && strchr(injectable, 'B') == NULL) {
+@@ -959,7 +966,9 @@ static void button_click(int down, int b
+       if (db) fprintf(stderr, "button_click: btn %d %s fd=%d\n", btn, down ? 
"down" : "up", d);
+ 
+       memset(&ev, 0, sizeof(ev));
+-      gettimeofday(&ev.time, NULL);
++      clock_gettime(CLOCK_REALTIME, &tv);
++      ev.input_event_sec = tv.tv_sec;
++      ev.input_event_usec = tv.tv_nsec / 1000;
+       ev.type = EV_KEY;
+       ev.value = down;
+ 
+@@ -1230,6 +1239,7 @@ void uinput_pointer_command(int mask, in
+ void uinput_key_command(int down, int keysym, rfbClientPtr client) {
+ #ifdef UINPUT_OK
+       struct input_event ev;
++      struct timespec tv;
+       int scancode;
+       allowed_input_t input;
+       int d = direct_key_fd < 0 ? fd : direct_key_fd;
+@@ -1253,7 +1263,9 @@ void uinput_key_command(int down, int ke
+       if (db) fprintf(stderr, "uinput_key_command: %d -> %d %s fd=%d\n", 
keysym, scancode, down ? "down" : "up", d);
+ 
+       memset(&ev, 0, sizeof(ev));
+-      gettimeofday(&ev.time, NULL);
++        clock_gettime(CLOCK_REALTIME, &tv);
++        ev.input_event_sec = tv.tv_sec;
++        ev.input_event_usec = tv.tv_nsec / 1000;
+       ev.type = EV_KEY;
+       ev.code = (unsigned char) scancode;
+       ev.value = down;
diff -Nru x11vnc-0.9.16/debian/patches/series 
x11vnc-0.9.16/debian/patches/series
--- x11vnc-0.9.16/debian/patches/series 2020-12-02 20:57:42.000000000 +1300
+++ x11vnc-0.9.16/debian/patches/series 2024-03-21 15:26:54.000000000 +1300
@@ -5,3 +5,4 @@
 0004-x11vnc.ftbfs-gcc10.patch
 0005-scan-limit-access-to-shared-memory-segments-to-curre.patch
 0006-fix-manpage-acute-accents.patch
+0007-use-clock_gettime-to-replace-gettimeofday.patch

Reply via email to