This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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] SPU Add support for nanosleep, sleep and usleep


On Tue, Jun 12, 2007 at 03:14:20PM -0500, Joel Sherrill wrote:
> Jeff Johnston wrote:
> >Patrick Mansfield wrote:

> >>Note the libc/include/sys/unistd.h: to change from:
> >>    unsigned _EXFUN(usleep, (unsigned int __useconds));
> >>To:
> >>    int _EXFUN(usleep, (useconds_t __useconds));
> >>
> >>So we match both the existing usleep.c and POSIX.
> >>
> >
> >You can't just do that arbitrarily for Cygwin and RTEMS.  That 
> >function prototype is protected by their OS flags being set on.  If 
> >the prototype is not a typo error, then you must leave it alone.
> >
> The RTEMS implementation is
> 
> int usleep(  useconds_t useconds );
> 
> and the unistd.h we are using with the RPMs has it as:
> 
> int _EXFUN(usleep, (useconds_t __useconds));
> 
> Our patch to newlib has this fragment
> 
> @@ -200,7 +200,7 @@
> int    _EXFUN(getdtablesize, (void));
> int    _EXFUN(setdtablesize, (int));
> useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval));
> -unsigned _EXFUN(usleep, (unsigned int __useconds));
> +int _EXFUN(usleep, (useconds_t __useconds));
> #if !(defined  (_WINSOCK_H) || defined (__USE_W32_SOCKETS))
> /* winsock[2].h defines as __stdcall, and with int as 2nd arg */
>  int   _EXFUN(gethostname, (char *__name, size_t __len));
> 
> So I guess we are using  the POSIX usleep profile and it just hasn't gotten
> merged.

> >You should put in a #else and then prototype usleep appropriately.  

So OK to re-submit per Jeff's comment? Then Joel/cygwin will have to
submit the change noted above.

> >You don't need to refer to SPU since it is referring to the libc/posix 
> >prototype.

Jeff -

Not for this patch, but should I just remove the #ifdef CYGWIN etc. if I
am exposing an existing POSIX prototype?

For new POSIX prototypes do I need an #ifdef? For example, I'm adding
lockf() and defines for it, do you want an #ifdef __SPU__ around it?

-- Patrick Mansfield


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