Handle the CDROM_DISC_STATUS ioctl.

Patch from Daniel Kamil Kozar via BZ#333788.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14106 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/NEWS b/NEWS
index 142638e..08b4de2 100644
--- a/NEWS
+++ b/NEWS
@@ -153,6 +153,7 @@
 333230  AAarch64 missing instruction encodings: dc, ic, dsb.
 333428  ldr.w pc [rD, #imm] instruction leads to assertion
 333666  Recognize MPX instructions and bnd prefix.
+333788  Valgrind does not support the CDROM_DISC_STATUS ioctl (has patch)
 334049  lzcnt fails silently (x86_32)
 334705  sendmsg and recvmsg should guard against bogus msghdr fields.
 334727  Build fails with -Werror=format-security
diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c
index dfbe260..ea9f984 100644
--- a/coregrind/m_syswrap/syswrap-linux.c
+++ b/coregrind/m_syswrap/syswrap-linux.c
@@ -5540,6 +5540,9 @@
       /* SCSI no operand */
    case VKI_SCSI_IOCTL_DOORLOCK:
    case VKI_SCSI_IOCTL_DOORUNLOCK:
+   
+   /* CDROM stuff. */
+   case VKI_CDROM_DISC_STATUS:
 
    /* KVM ioctls that dont check for a numeric value as parameter */
    case VKI_KVM_S390_ENABLE_SIE:
@@ -7499,6 +7502,8 @@
       break;
 
       /* CD ROM stuff (??)  */
+   case VKI_CDROM_DISC_STATUS:
+      break;
    case VKI_CDROMSUBCHNL:
       POST_MEM_WRITE(ARG3, sizeof(struct vki_cdrom_subchnl));
       break;
diff --git a/docs/internals/3_9_BUGSTATUS.txt b/docs/internals/3_9_BUGSTATUS.txt
index 62b0f08..449865d 100644
--- a/docs/internals/3_9_BUGSTATUS.txt
+++ b/docs/internals/3_9_BUGSTATUS.txt
@@ -57,7 +57,6 @@
 333434  In some weird corner case Valgrind cannot execute
         executable files symlinked by /proc/self/fd (related to 331311?)
 333051  handling hugepages (is largely broken)
-333788  Valgrind does not support the CDROM_DISC_STATUS ioctl (has patch)
 333817  Valgrind reports the memory areas written to by the SG_IO
         ioctl as untouched
 334585  recvmmsg unhandled (+patch) (arm)
diff --git a/include/vki/vki-linux.h b/include/vki/vki-linux.h
index e386292..c5d60e3 100644
--- a/include/vki/vki-linux.h
+++ b/include/vki/vki-linux.h
@@ -1838,6 +1838,7 @@
                                 	           (struct cdrom_read) */
 #define VKI_CDROM_CLEAR_OPTIONS		0x5321  /* Clear behavior options */
 #define VKI_CDROM_DRIVE_STATUS		0x5326  /* Get tray position, etc. */
+#define VKI_CDROM_DISC_STATUS		0x5327	/* get CD type information */
 #define VKI_CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
 
 #define VKI_CDROM_SEND_PACKET		0x5393	/* send a packet to the drive */