On Thu, Sep 18, 2014 at 03:12:16PM +0200, Edward Tomasz Napierala wrote: > On 0918T1421, Konstantin Belousov wrote: > > On Thu, Sep 18, 2014 at 10:33:23AM +0000, Edward Tomasz Napierala wrote: > > > Author: trasz > > > Date: Thu Sep 18 10:33:23 2014 > > > New Revision: 271753 > > > URL: http://svnweb.freebsd.org/changeset/base/271753 > > > > > > Log: > > > Fix typos. > > > > > > Sponsored by: The FreeBSD Foundation > > > > > > Modified: > > > head/sys/fs/autofs/autofs.c > > > > > > Modified: head/sys/fs/autofs/autofs.c > > > ============================================================================== > > > --- head/sys/fs/autofs/autofs.c Thu Sep 18 10:01:56 2014 > > > (r271752) > > > +++ head/sys/fs/autofs/autofs.c Thu Sep 18 10:33:23 2014 > > > (r271753) > > > @@ -430,7 +430,7 @@ autofs_trigger_one(struct autofs_node *a > > > autofs_restore_sigmask(&oldset); > > > if (error != 0) { > > > /* > > > - * XXX: For some reson this returns -1 > > > + * XXX: For some reason this returns -1 > > > * instead of EINTR, wtf?! > > > */ > > > error = EINTR; > > > @@ -542,7 +542,7 @@ autofs_ioctl_request(struct autofs_daemo > > > &autofs_softc->sc_lock); > > > if (error != 0) { > > > /* > > > - * XXX: For some reson this returns -1 instead > > > + * XXX: For some reason this returns -1 instead > > > * of EINTR, wtf?! > > > */ > > > error = EINTR; > > The -1 is ERESTART, i.e. it is correct error value which indicates that > > syscall return path must restart the syscall after the trip to userland. > > This behaviour is controlled by SA_RESTART flag, see sigaction(2). > > Ah, I didn't realize it's a valid error number. > > > There are some syscalls, which explicitely deny restarting, mostly to > > correctly handle timeout values, most prominent is select(2) family. > > > > The comment above is definitely inappropriate, and translation of ERESTART > > to EINTR may be wrong as well. > > The whole point of this is to fail the syscall with EINTR. However, > I'm not sure what makes cv_wait_sig(9) to return with ERESTART instead > of EINTR. Is SA_RESTART set by default? When SA_RESTART set, interruption of cv_wait_sig() by signal causes it to return ERESTART instead of EINTR.
Default disposition is either ignoring of signals, or generating core dump, so question about SA_RESTART does not make sense. Despite this, ps_sigintr signal mask of the restartable signals is clear by default, so typical interrupt causes ERESTART before default termination action happens. Can you explain why this matters for autofs code ? Normal action for the kernel code is to pass errors from sig_wait class of functions to upper levels verbatim, except when the timeout must not be restarted.
pgpj7dZ6VKXIs.pgp
Description: PGP signature