This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: question about which sleep is noted in manual
- From: MaShimiao <mashimiao dot fnst at cn dot fujitsu dot com>
- To: Alexandre Oliva <aoliva at redhat dot com>
- Cc: <libc-alpha at sourceware dot org>, <codonell at redhat dot com>
- Date: Mon, 22 Dec 2014 10:53:53 +0800
- Subject: Re: question about which sleep is noted in manual
- Authentication-results: sourceware.org; auth=none
- References: <547ED48B dot 2060509 at cn dot fujitsu dot com> <oregs9zvl2 dot fsf at free dot home> <5487EAF0 dot 70305 at cn dot fujitsu dot com> <orfvcd7a7a dot fsf at free dot home>
Hi Alexandre,
On 12/18/2014 02:18 PM, Alexandre Oliva wrote:
> /* We are going to use the `nanosleep' syscall of the kernel. But the
> @@ -104,7 +102,7 @@ __sleep (unsigned int seconds)
> have to do anything here. */
> if (oact.sa_handler == SIG_IGN)
> {
> - //__libc_cleanup_push (cl, &oset);
> + __libc_cleanup_push (cl, &oset);
>
> /* We should leave SIGCHLD blocked. */
> while (1)
> @@ -121,7 +119,7 @@ __sleep (unsigned int seconds)
> }
> }
>
> - //__libc_cleanup_pop (0);
> + __libc_cleanup_pop (0);
I think we do not need this change.
>From the original code, I get the following logic:
1. if function __sleep doesn't block SIGCHLDïthen it does nothing.
2. if funciont __sleep blocks SIGCHLD, no matter nanosleep() is cancelled or
not, __seleep will restore the original signal mask before return. detail as following:
//__libc_cleanup_pop (0);
saved_errno = errno;
/* Restore the original signal mask. */
(void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL);
__set_errno (saved_errno);
goto out;
}
So, I think we don't need this change.
Did I miss something?
Best regards
--
Ma Shimiao
Development Dept.I
Nanjing Fujitsu Nanda Software Tech. Co., Ltd.(FNST)