Hi Theo, Theo Buehler wrote on Wed, Jan 27, 2016 at 12:04:43AM +0100: > Todd Millert wrote:
>> Please don't, alarm(3) is perfectly fine to be using. We should >> probably remove that line from the manual. > The comment of alarm being made obsolete by setitimer has been there > for 30 years: > > https://www.freebsd.org/cgi/man.cgi?query=alarm&apropos=0&sektion=0&manpath=2.10+BSD&arch=default&format=html > > NetBSD and FreeBSD also still have it. I would prefer the following patch. * Use the same wording up front as for ualarm(3). It is relevant because alarm(3) and setitimer(ITIMER_REAL, ...) cancel each other. Without that sentence, people might be misled to think that they could use both to set independent alarms. * There are so many cross references that the SEE ALSO section looks confusing. Delete those that are not helpful: - The XSI sigpause(3) is less portable than the POSIX sigsuspend(3) and only minimally easier to use. POSIX calls sigpause(3) obsolescent, we call it obsolete. - The obsolete function sigvec(3) isn't standardized and less powerful than the POSIX sigaction(3). - The former XSI usleep(3) is less portable than the POSIX nanosleep(3) and only minimally easier to use. Current POSIX does not even mention usleep(3) as an XSI extension. - We could add nanosleep(3), but it differs from alarm(3) in two respects: Different granularity and not implemented by signal delivery, so it is not all that relevant, and it is linked from sleep(3) anyway. * Update the POSIX reference while here. * Also delete the misleading comment from the source file. OK? Ingo Index: alarm.3 =================================================================== RCS file: /cvs/src/lib/libc/gen/alarm.3,v retrieving revision 1.13 diff -u -p -r1.13 alarm.3 --- alarm.3 17 Jul 2013 05:42:11 -0000 1.13 +++ alarm.3 26 Jan 2016 23:37:05 -0000 @@ -39,7 +39,7 @@ .Fn alarm "unsigned int seconds" .Sh DESCRIPTION .Bf -symbolic -This interface is made obsolete by +This is a simplified interface to .Xr setitimer 2 . .Ef .Pp @@ -75,16 +75,14 @@ error code is placed in the global varia .Xr setitimer 2 , .Xr sigaction 2 , .Xr signal 3 , -.Xr sigpause 3 , -.Xr sigvec 3 , +.Xr sigsuspend 3 , .Xr sleep 3 , -.Xr ualarm 3 , -.Xr usleep 3 +.Xr ualarm 3 .Sh STANDARDS The .Fn alarm function conforms to -.St -p1003.1-90 . +.St -p1003.1-2008 . .Sh HISTORY An .Fn alarm Index: alarm.c =================================================================== RCS file: /cvs/src/lib/libc/gen/alarm.c,v retrieving revision 1.7 diff -u -p -r1.7 alarm.c --- alarm.c 8 Aug 2005 08:05:33 -0000 1.7 +++ alarm.c 26 Jan 2016 23:37:05 -0000 @@ -28,9 +28,6 @@ * SUCH DAMAGE. */ -/* - * Backwards compatible alarm. - */ #include <sys/time.h> #include <unistd.h> > Index: alarm.3 > =================================================================== > RCS file: /var/cvs/src/lib/libc/gen/alarm.3,v > retrieving revision 1.13 > diff -u -p -r1.13 alarm.3 > --- alarm.3 17 Jul 2013 05:42:11 -0000 1.13 > +++ alarm.3 26 Jan 2016 22:57:39 -0000 > @@ -38,11 +38,6 @@ > .Ft unsigned int > .Fn alarm "unsigned int seconds" > .Sh DESCRIPTION > -.Bf -symbolic > -This interface is made obsolete by > -.Xr setitimer 2 . > -.Ef > -.Pp > The > .Fn alarm > function waits a count of
