This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] make <sys/sysmacros.h> compatible with glibc


On Mon, 2011-04-04 at 14:26 +0200, Corinna Vinschen wrote:
> On Apr  4 06:27, Yaakov (Cygwin/X) wrote:
> > Alright, do I still bump CYGWIN_VERSION_API_MINOR for only inline
> > functions?
> 
> No, that's not necessary.
> 
> > What about posix.sgml?
> 
> You can skip it as well.

Revised patch attached.


Yaakov

2011-04-04  Yaakov Selkowitz  <yselkowitz@users.sourceforge.net>

	* include/cygwin/types.h: Move #include <sys/sysmacros.h> to
	end of header so the latter get the dev_t typedef.
	* include/sys/sysmacros.h (gnu_dev_major, gnu_dev_minor,
	gnu_dev_makedev): Prototype and define as inline functions.
	(major, minor, makedev): Redefine in terms of gnu_dev_*.

Index: include/cygwin/types.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/types.h,v
retrieving revision 1.33
diff -u -r1.33 types.h
--- include/cygwin/types.h	29 Mar 2011 10:32:40 -0000	1.33
+++ include/cygwin/types.h	3 Apr 2011 20:43:20 -0000
@@ -17,7 +17,6 @@
 #ifndef _CYGWIN_TYPES_H
 #define _CYGWIN_TYPES_H
 
-#include <sys/sysmacros.h>
 #include <stdint.h>
 #include <endian.h>
 
@@ -220,6 +219,8 @@
 #endif /* __INSIDE_CYGWIN__ */
 #endif /* _CYGWIN_TYPES_H */
 
+#include <sys/sysmacros.h>
+
 #ifdef __cplusplus
 }
 #endif
Index: include/sys/sysmacros.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/sys/sysmacros.h,v
retrieving revision 1.4
diff -u -r1.4 sysmacros.h
--- include/sys/sysmacros.h	26 Feb 2010 09:36:21 -0000	1.4
+++ include/sys/sysmacros.h	3 Apr 2011 20:43:20 -0000
@@ -1,6 +1,6 @@
 /* sys/sysmacros.h
 
-   Copyright 1998, 2001, 2010 Red Hat, Inc.
+   Copyright 1998, 2001, 2010, 2011 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -11,8 +11,30 @@
 #ifndef _SYS_SYSMACROS_H
 #define _SYS_SYSMACROS_H
 
-#define major(dev) ((int)(((dev) >> 16) & 0xffff))
-#define minor(dev) ((int)((dev) & 0xffff))
-#define makedev(major, minor) (((major) << 16) | ((minor) & 0xffff))
+_ELIDABLE_INLINE int gnu_dev_major(dev_t);
+_ELIDABLE_INLINE int gnu_dev_minor(dev_t);
+_ELIDABLE_INLINE dev_t gnu_dev_makedev(int, int);
+
+_ELIDABLE_INLINE int
+gnu_dev_major(dev_t dev)
+{
+	return (int)(((dev) >> 16) & 0xffff);
+}
+
+_ELIDABLE_INLINE int
+gnu_dev_minor(dev_t dev)
+{
+	return (int)((dev) & 0xffff);
+}
+
+_ELIDABLE_INLINE dev_t
+gnu_dev_makedev(int maj, int min)
+{
+	return (((maj) << 16) | ((min) & 0xffff));
+}
+
+#define major(dev) gnu_dev_major(dev)
+#define minor(dev) gnu_dev_minor(dev)
+#define makedev(maj, min) gnu_dev_makedev(maj, min)
 
 #endif /* _SYS_SYSMACROS_H */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]