This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH 02/18] Provide POSIX defined id_t in <sys/types.h>
- From: Sebastian Huber <sebastian dot huber at embedded-brains dot de>
- To: newlib at sourceware dot org
- Date: Fri, 15 Apr 2016 11:34:12 +0200
- Subject: Re: [PATCH 02/18] Provide POSIX defined id_t in <sys/types.h>
- Authentication-results: sourceware.org; auth=none
- References: <1460634887-4420-1-git-send-email-sebastian dot huber at embedded-brains dot de> <1460634887-4420-2-git-send-email-sebastian dot huber at embedded-brains dot de> <20160415085715 dot GB5014 at calimero dot vinschen dot de> <5710AF85 dot 8030904 at embedded-brains dot de> <20160415092921 dot GC5014 at calimero dot vinschen dot de>
On 15/04/16 11:29, Corinna Vinschen wrote:
On Apr 15 11:08, Sebastian Huber wrote:
>
>
>On 15/04/16 10:57, Corinna Vinschen wrote:
> >Hi Sebastian,
> >
> >On Apr 14 13:54, Sebastian Huber wrote:
> >>>Signed-off-by: Sebastian Huber<sebastian.huber@embedded-brains.de>
> >>>---
> >>> newlib/libc/include/sys/_types.h | 4 ++++
> >>> newlib/libc/include/sys/types.h | 5 +++++
> >>> winsup/cygwin/include/cygwin/types.h | 6 ------
> >>> winsup/cygwin/include/machine/_types.h | 3 +++
> >>> 4 files changed, 12 insertions(+), 6 deletions(-)
> >>>
> >>>diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
> >>>index 762dfed..ebd4943 100644
> >>>--- a/newlib/libc/include/sys/_types.h
> >>>+++ b/newlib/libc/include/sys/_types.h
> >>>@@ -43,6 +43,10 @@ typedef unsigned short __uid_t;
> >>> typedef unsigned short __gid_t;
> >>> #endif
> >>> >+#ifndef __machine_id_t_defined
> >>>+typedef __pid_t __id_t;
> >>>+#endif
> >Glibc defines id_t as unsigned 32 bit type. __pid_t is int, therefore a
> >signed type.
> >
> >That's why Cygwin defined id_t as __uint32_t. Wouldn't it makes sense
> >to follow glibc for compatibility here, too? This would also allow to
> >get rid of the Cygwin-specific definition.
>
>With the defaults for
>
>#if defined(__XMK__)
>typedef signed char __pid_t;
>#else
>typedef int __pid_t;
>#endif
>
>#ifndef __machine_dev_t_defined
>typedef short __dev_t;
>#endif
>
>#ifndef __machine_uid_t_defined
>typedef unsigned short __uid_t;
>#endif
>
>#ifndef __machine_gid_t_defined
>typedef unsigned short __gid_t;
>#endif
>
>the use of __uint32_t is wrong for ILP64 targets (yes, very exotic).
...while the usage of __pid_t is potentially misleading and wrong for
__XMK__ (whatever that is).
Do we support ILP64 targets? If not, __uint32_t sounds like a good
compromise for now.
Ok, I will correct this in v2.
>we should use fixed-size types in <sys/_types.h> throughout.
That would be helpful to clear up confusion.
We should not do too many things at once, so this should be done in a
follow up patch set.
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber@embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschÃftliche Mitteilung im Sinne des EHUG.