]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
345338 - TIOCGSERIAL and TIOCSSERIAL ioctl support on Linux
authorJulian Seward <jseward@acm.org>
Fri, 14 Aug 2015 08:17:37 +0000 (08:17 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 14 Aug 2015 08:17:37 +0000 (08:17 +0000)
Patch from Martin Ling (martin-kdebugs@earth.li)

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15542

coregrind/m_syswrap/syswrap-linux.c
include/vki/vki-amd64-linux.h
include/vki/vki-arm-linux.h
include/vki/vki-arm64-linux.h
include/vki/vki-linux.h
include/vki/vki-ppc32-linux.h
include/vki/vki-ppc64-linux.h
include/vki/vki-s390x-linux.h
include/vki/vki-x86-linux.h

index 6fd0d8376c7fb9a39e9780d910cc692685d03c90..c69ab9de868351c1eef1b99fa1c52842b6e06cbf 100644 (file)
@@ -8354,6 +8354,18 @@ PRE(sys_ioctl)
       break;
    }
 
+   /* Serial */
+   case VKI_TIOCGSERIAL: {
+      struct vki_serial_struct *data = (struct vki_serial_struct *)ARG3;
+      PRE_MEM_WRITE("ioctl(VKI_TIOCGSERIAL)", (Addr)data, sizeof(*data));
+      break;
+   }
+   case VKI_TIOCSSERIAL: {
+      struct vki_serial_struct *data = (struct vki_serial_struct *)ARG3;
+      PRE_MEM_READ("ioctl(VKI_TIOCSSERIAL)", (Addr)data, sizeof(*data));
+      break;
+   }
+
    default:
       /* EVIOC* are variable length and return size written on success */
       switch (ARG2 & ~(_VKI_IOC_SIZEMASK << _VKI_IOC_SIZESHIFT)) {
@@ -10239,6 +10251,15 @@ POST(sys_ioctl)
    case VKI_MEDIA_IOC_SETUP_LINK:
       break;
 
+   /* Serial */
+   case VKI_TIOCGSERIAL: {
+      struct vki_serial_struct *data = (struct vki_serial_struct *)ARG3;
+      POST_MEM_WRITE((Addr)data, sizeof(*data));
+      break;
+   }
+   case VKI_TIOCSSERIAL:
+      break;
+
    default:
       /* EVIOC* are variable length and return size written on success */
       switch (ARG2 & ~(_VKI_IOC_SIZEMASK << _VKI_IOC_SIZESHIFT)) {
index 61847a7116ab6c476c90f7846ee5c701cc12b8aa..863b31c887de598df4302bbb5300058b290e5b1a 100644 (file)
@@ -690,6 +690,13 @@ struct vki_shminfo64 {
 #define        VKI_ENOSYS       38  /* Function not implemented */
 #define        VKI_EOVERFLOW    75  /* Value too large for defined data type */
 
+//----------------------------------------------------------------------
+// From linux-3.19.0/include/uapi/asm-generic/ioctls.h
+//----------------------------------------------------------------------
+
+#define VKI_TIOCGSERIAL     0x541E
+#define VKI_TIOCSSERIAL     0x541F
+
 //----------------------------------------------------------------------
 // And that's it!
 //----------------------------------------------------------------------
index 031f52858871076b2f5bb29353fc3efc44b2c0f3..26ffc8b596acda9681ffe204376bca43ecbb5c64 100644 (file)
@@ -900,6 +900,13 @@ struct vki_vm86plus_struct {
 #define        VKI_ENOSYS       38  /* Function not implemented */
 #define        VKI_EOVERFLOW    75  /* Value too large for defined data type */
 
+//----------------------------------------------------------------------
+// From linux-3.19.0/include/uapi/asm-generic/ioctls.h
+//----------------------------------------------------------------------
+
+#define VKI_TIOCGSERIAL     0x541E
+#define VKI_TIOCSSERIAL     0x541F
+
 //----------------------------------------------------------------------
 // And that's it!
 //----------------------------------------------------------------------
index 747d0bf801d4cabe2a51f3679a235e8f1f4f25e2..7851cf7aa4281b44f6fa0fcae5a04a08df46dc09 100644 (file)
@@ -683,6 +683,13 @@ struct vki_shminfo64 {
 #define        VKI_ENOSYS       38  /* Function not implemented */
 #define        VKI_EOVERFLOW    75  /* Value too large for defined data type */
 
+//----------------------------------------------------------------------
+// From linux-3.19.0/include/uapi/asm-generic/ioctls.h
+//----------------------------------------------------------------------
+
+#define VKI_TIOCGSERIAL     0x541E
+#define VKI_TIOCSSERIAL     0x541F
+
 //----------------------------------------------------------------------
 // And that's it!
 //----------------------------------------------------------------------
index 4ede25c7d6005a6798a3192ebec9c45b3ba2dead..b332894e9411b7cdebb184153e1049b7b15c4da3 100644 (file)
@@ -4666,6 +4666,31 @@ enum vki_kcmp_type {
 //----------------------------------------------------------------------
 #define VKI_BINPRM_BUF_SIZE 128
 
+//----------------------------------------------------------------------
+// From linux-3.19.0/include/linux/serial.h
+//----------------------------------------------------------------------
+
+struct vki_serial_struct {
+       int     type;
+       int     line;
+       unsigned int    port;
+       int     irq;
+       int     flags;
+       int     xmit_fifo_size;
+       int     custom_divisor;
+       int     baud_base;
+       unsigned short  close_delay;
+       char    io_type;
+       char    reserved_char[1];
+       int     hub6;
+       unsigned short  closing_wait; /* time to wait before closing */
+       unsigned short  closing_wait2; /* no longer used... */
+       unsigned char   *iomem_base;
+       unsigned short  iomem_reg_shift;
+       unsigned int    port_high;
+       unsigned long   iomap_base;     /* cookie passed into ioremap */
+};
+
 #endif // __VKI_LINUX_H
 
 /*--------------------------------------------------------------------*/
index 6aea179c8a8c766014374e4dc006fe48f6edc854..f92220876f74248843f355daa9394e1cc9a9f595 100644 (file)
@@ -626,8 +626,8 @@ struct vki_termios {
 //#define VKI_TIOCSSOFTCAR     0x541A
 #define VKI_TIOCLINUX          0x541C
 //#define VKI_TIOCCONS         0x541D
-//#define VKI_TIOCGSERIAL      0x541E
-//#define VKI_TIOCSSERIAL      0x541F
+#define VKI_TIOCGSERIAL        0x541E
+#define VKI_TIOCSSERIAL        0x541F
 //#define VKI_TIOCPKT          0x5420
 //# define VKI_TIOCPKT_DATA             0
 //# define VKI_TIOCPKT_FLUSHREAD        1
index 8848b05764ef0e83033a226fdb853525fbdd95ab..fdcb93e8e5508b41279eec58f2d550261300b7a0 100644 (file)
@@ -794,6 +794,13 @@ struct vki_shminfo64 {
 #define        VKI_ENOSYS       38  /* Function not implemented */
 #define        VKI_EOVERFLOW    75  /* Value too large for defined data type */
 
+//----------------------------------------------------------------------
+// From linux-3.19.0/arch/powerpc/include/uapi/asm/ioctls.h
+//----------------------------------------------------------------------
+
+#define VKI_TIOCGSERIAL     0x541E
+#define VKI_TIOCSSERIAL     0x541F
+
 //----------------------------------------------------------------------
 // end
 //----------------------------------------------------------------------
index 85c449d4e259703f3dd2b93190d60cbc85d1b4bf..914cd8012a93d44752783e32d8e74647f44ba60f 100644 (file)
@@ -976,6 +976,13 @@ struct vki_shminfo64 {
 #define        VKI_ENOSYS       38  /* Function not implemented */
 #define        VKI_EOVERFLOW    75  /* Value too large for defined data type */
 
+//----------------------------------------------------------------------
+// From linux-3.19.0/include/uapi/asm-generic/ioctls.h
+//----------------------------------------------------------------------
+
+#define VKI_TIOCGSERIAL     0x541E
+#define VKI_TIOCSSERIAL     0x541F
+
 #endif // __VKI_S390X_LINUX_H
 
 /*--------------------------------------------------------------------*/
index c34e027403a844eb35ed4475720e297c22f92cff..f6b1dc546cacdda68d7ce2d1bbf304e5dc3ac34d 100644 (file)
@@ -906,6 +906,13 @@ struct vki_vm86plus_struct {
 #define        VKI_ENOSYS       38  /* Function not implemented */
 #define        VKI_EOVERFLOW    75  /* Value too large for defined data type */
 
+//----------------------------------------------------------------------
+// From linux-3.19.0/include/uapi/asm-generic/ioctls.h
+//----------------------------------------------------------------------
+
+#define VKI_TIOCGSERIAL     0x541E
+#define VKI_TIOCSSERIAL     0x541F
+
 //----------------------------------------------------------------------
 // And that's it!
 //----------------------------------------------------------------------