[PATCH] Cygwin: signal.cc: Include <unistd.h>
Corinna Vinschen
vinschen@redhat.com
Thu May 12 08:14:08 GMT 2022
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
More information about the Newlib
mailing list