public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
* mknod bug?
@ 2022-05-21 21:22 Ken Brown
  2022-05-22 16:19 ` Ken Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Ken Brown @ 2022-05-21 21:22 UTC (permalink / raw)
  To: cygwin-devel

The definition of mknod in syscalls.cc has a third argument of type __dev16_t 
instead of dev_t.  This doesn't matter on 32-bit Cygwin, because calls to mknod 
are redirected to mknod32 via NEW_FUNCTIONS in Makefile.am [cygwin-3_3-branch 
only].  Presumably this definition exists for the sake of old 32-bit apps that 
were built when dev_t was 16 bits.

But it seems to be a clear bug on 64-bit Cygwin.  I think we need the following, 
similar to what we do for many other syscalls:

diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 3a652c4f4..344d1d329 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -3490,11 +3490,15 @@ mknod32 (const char *path, mode_t mode, dev_t dev)
    return -1;
  }

+#ifdef __i386__
  extern "C" int
  mknod (const char *_path, mode_t mode, __dev16_t dev)
  {
    return mknod32 (_path, mode, (dev_t) dev);
  }
+#else
+EXPORT_ALIAS (mknod32, mknod)
+#endif

  extern "C" int
  mkfifo (const char *path, mode_t mode)

If I'm right, this is a longstanding bug, and I'm surprised no one has noticed 
it before.  Am I missing something?

Ken

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-22 16:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-21 21:22 mknod bug? Ken Brown
2022-05-22 16:19 ` Ken Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).