public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Cygwin: signal.cc: Include <unistd.h>
@ 2022-05-12  6:43 Sebastian Huber
  2022-05-12  8:14 ` Corinna Vinschen
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Huber @ 2022-05-12  6:43 UTC (permalink / raw)
  To: newlib

Include <unistd.h> for sleep() and usleep() declarations.  Fix return type of
usleep().
---
 winsup/cygwin/signal.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 9b6c2509d..22d3715df 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -11,6 +11,7 @@ details. */
 
 #include "winsup.h"
 #include <stdlib.h>
+#include <unistd.h>
 #include <sys/cygwin.h>
 #include <sys/signalfd.h>
 #include "pinfo.h"
@@ -163,7 +164,7 @@ nanosleep (const struct timespec *rqtp, struct timespec *rmtp)
   return 0;
 }
 
-extern "C" unsigned int
+unsigned int
 sleep (unsigned int seconds)
 {
   struct timespec req, rem;
@@ -174,7 +175,7 @@ sleep (unsigned int seconds)
   return 0;
 }
 
-extern "C" unsigned int
+int
 usleep (useconds_t useconds)
 {
   struct timespec req;
-- 
2.35.3


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

* Re: [PATCH] Cygwin: signal.cc: Include <unistd.h>
  2022-05-12  6:43 [PATCH] Cygwin: signal.cc: Include <unistd.h> Sebastian Huber
@ 2022-05-12  8:14 ` Corinna Vinschen
  2022-05-12  8:22   ` Sebastian Huber
  0 siblings, 1 reply; 6+ messages in thread
From: Corinna Vinschen @ 2022-05-12  8:14 UTC (permalink / raw)
  To: newlib

Hi Sebastian,

On May 12 08:43, Sebastian Huber wrote:
> Include <unistd.h> for sleep() and usleep() declarations.  Fix return type of
> usleep().
> ---
>  winsup/cygwin/signal.cc | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
> index 9b6c2509d..22d3715df 100644
> --- a/winsup/cygwin/signal.cc
> +++ b/winsup/cygwin/signal.cc
> @@ -11,6 +11,7 @@ details. */
>  
>  #include "winsup.h"
>  #include <stdlib.h>
> +#include <unistd.h>
>  #include <sys/cygwin.h>
>  #include <sys/signalfd.h>
>  #include "pinfo.h"
> @@ -163,7 +164,7 @@ nanosleep (const struct timespec *rqtp, struct timespec *rmtp)
>    return 0;
>  }
>  
> -extern "C" unsigned int
> +unsigned int

Why are you dropping the extern "C" here?  It's not really necessary at
this point, but all functions in C++ files exported to the userspace are
marked this way.

>  sleep (unsigned int seconds)
>  {
>    struct timespec req, rem;
> @@ -174,7 +175,7 @@ sleep (unsigned int seconds)
>    return 0;
>  }
>  
> -extern "C" unsigned int
> +int
>  usleep (useconds_t useconds)

Good catch, otherwise, thank you!  I'd prefer if you push just the
type change and keep the extern "C" as a marker for exported functions.


Thanks,
Corinna


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

* Re: [PATCH] Cygwin: signal.cc: Include <unistd.h>
  2022-05-12  8:14 ` Corinna Vinschen
@ 2022-05-12  8:22   ` Sebastian Huber
  2022-05-12  8:46     ` Corinna Vinschen
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Huber @ 2022-05-12  8:22 UTC (permalink / raw)
  To: newlib

On 12/05/2022 10:14, Corinna Vinschen wrote:
>>   sleep (unsigned int seconds)
>>   {
>>     struct timespec req, rem;
>> @@ -174,7 +175,7 @@ sleep (unsigned int seconds)
>>     return 0;
>>   }
>>   
>> -extern "C" unsigned int
>> +int
>>   usleep (useconds_t useconds)
> Good catch, otherwise, thank you!  I'd prefer if you push just the
> type change and keep the extern "C" as a marker for exported functions.

Ok, what about the unistd.h include?

-- 
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

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

* Re: [PATCH] Cygwin: signal.cc: Include <unistd.h>
  2022-05-12  8:22   ` Sebastian Huber
@ 2022-05-12  8:46     ` Corinna Vinschen
  2022-05-12 14:48       ` Brian Inglis
  0 siblings, 1 reply; 6+ messages in thread
From: Corinna Vinschen @ 2022-05-12  8:46 UTC (permalink / raw)
  To: newlib

On May 12 10:22, Sebastian Huber wrote:
> On 12/05/2022 10:14, Corinna Vinschen wrote:
> > >   sleep (unsigned int seconds)
> > >   {
> > >     struct timespec req, rem;
> > > @@ -174,7 +175,7 @@ sleep (unsigned int seconds)
> > >     return 0;
> > >   }
> > > -extern "C" unsigned int
> > > +int
> > >   usleep (useconds_t useconds)
> > Good catch, otherwise, thank you!  I'd prefer if you push just the
> > type change and keep the extern "C" as a marker for exported functions.
> 
> Ok, what about the unistd.h include?

Let's keep it.  It might help to uncover other issues in future.


Thx,
Corinna


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

* Re: [PATCH] Cygwin: signal.cc: Include <unistd.h>
  2022-05-12  8:46     ` Corinna Vinschen
@ 2022-05-12 14:48       ` Brian Inglis
  2022-05-12 16:05         ` Corinna Vinschen
  0 siblings, 1 reply; 6+ messages in thread
From: Brian Inglis @ 2022-05-12 14:48 UTC (permalink / raw)
  To: newlib

On 2022-05-12 02:46, Corinna Vinschen wrote:
> On May 12 10:22, Sebastian Huber wrote:
>> On 12/05/2022 10:14, Corinna Vinschen wrote:
>>>>    sleep (unsigned int seconds)
>>>>    {
>>>>      struct timespec req, rem;
>>>> @@ -174,7 +175,7 @@ sleep (unsigned int seconds)
>>>>      return 0;
>>>>    }
>>>> -extern "C" unsigned int
>>>> +int
>>>>    usleep (useconds_t useconds)
>>> Good catch, otherwise, thank you!  I'd prefer if you push just the
>>> type change and keep the extern "C" as a marker for exported functions.
>>
>> Ok, what about the unistd.h include?
> 
> Let's keep it.  It might help to uncover other issues in future.

Shouldn't these Cygwin winsup patches be posted separately to
cygwin-patches rather than newlib, once any newlib patches they depend 
on have been accepted.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]

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

* Re: [PATCH] Cygwin: signal.cc: Include <unistd.h>
  2022-05-12 14:48       ` Brian Inglis
@ 2022-05-12 16:05         ` Corinna Vinschen
  0 siblings, 0 replies; 6+ messages in thread
From: Corinna Vinschen @ 2022-05-12 16:05 UTC (permalink / raw)
  To: newlib

On May 12 08:48, Brian Inglis wrote:
> On 2022-05-12 02:46, Corinna Vinschen wrote:
> > On May 12 10:22, Sebastian Huber wrote:
> > > On 12/05/2022 10:14, Corinna Vinschen wrote:
> > > > >    sleep (unsigned int seconds)
> > > > >    {
> > > > >      struct timespec req, rem;
> > > > > @@ -174,7 +175,7 @@ sleep (unsigned int seconds)
> > > > >      return 0;
> > > > >    }
> > > > > -extern "C" unsigned int
> > > > > +int
> > > > >    usleep (useconds_t useconds)
> > > > Good catch, otherwise, thank you!  I'd prefer if you push just the
> > > > type change and keep the extern "C" as a marker for exported functions.
> > > 
> > > Ok, what about the unistd.h include?
> > 
> > Let's keep it.  It might help to uncover other issues in future.
> 
> Shouldn't these Cygwin winsup patches be posted separately to
> cygwin-patches rather than newlib, once any newlib patches they depend on
> have been accepted.

Not really.  If the patch changes something generic which Cygwin uses,
then the patch should ideally contain the required Cygwin patch, too.
Otherwise you'd have a deliberately build breakage in git history.  We
have a few of them in the past, they are a PITA.


Corinna


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-12  6:43 [PATCH] Cygwin: signal.cc: Include <unistd.h> Sebastian Huber
2022-05-12  8:14 ` Corinna Vinschen
2022-05-12  8:22   ` Sebastian Huber
2022-05-12  8:46     ` Corinna Vinschen
2022-05-12 14:48       ` Brian Inglis
2022-05-12 16:05         ` Corinna Vinschen

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).