2009-02-10 00:35:25 +00:00
|
|
|
.\" Copyright (c) 2009 Linux Foundation, written by Michael Kerrisk
|
|
|
|
.\" <mtk.manpages@gmail.com>
|
|
|
|
.\"
|
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clock_getres.2, clock_nanosleep.2, close.2, connect.2, delete_module.2, dup.2, execve.2, exit_group.2, faccessat.2, fchmodat.2, fchownat.2, fcntl.2, fork.2, fstatat.2, fsync.2, futimesat.2, get_robust_list.2, getdents.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getpagesize.2, getpid.2, getresuid.2, getrlimit.2, getrusage.2, gettid.2, gettimeofday.2, getuid.2, getunwind.2, idle.2, init_module.2, intro.2, iopl.2, kcmp.2, kexec_load.2, kill.2, link.2, linkat.2, llseek.2, lookup_dcookie.2, madvise.2, mincore.2, mkdirat.2, mknodat.2, mmap.2, mmap2.2, mount.2, mprotect.2, mq_getsetattr.2, msgctl.2, msgget.2, msgop.2, msync.2, nice.2, open.2, openat.2, pause.2, perfmonctl.2, personality.2, pipe.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, quotactl.2, read.2, readahead.2, readdir.2, readlinkat.2, readv.2, reboot.2, recvmmsg.2, remap_file_pages.2, rename.2, renameat.2, rmdir.2, rt_sigqueueinfo.2, select.2, select_tut.2, semctl.2, semget.2, semop.2, sendmmsg.2, set_tid_address.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setresuid.2, setuid.2, setup.2, sgetmask.2, shmctl.2, shmget.2, shmop.2, sigaction.2, sigaltstack.2, signal.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, splice.2, stat.2, statfs.2, stime.2, subpage_prot.2, swapon.2, symlink.2, symlinkat.2, sync.2, sync_file_range.2, syscalls.2, sysctl.2, sysfs.2, syslog.2, tee.2, time.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, times.2, tkill.2, umask.2, umount.2, uname.2, unlink.2, unlinkat.2, uselib.2, ustat.2, utime.2, utimensat.2, vfork.2, vhangup.2, vm86.2, vmsplice.2, wait.2, wait4.2, write.2, CPU_SET.3, INFINITY.3, abort.3, abs.3, acos.3, acosh.3, adjtime.3, aio_init.3, asin.3, asinh.3, asprintf.3, assert.3, assert_perror.3, atan.3, atan2.3, atanh.3, atexit.3, atof.3, atoi.3, basename.3, bcmp.3, bcopy.3, bindresvport.3, bsd_signal.3, bsearch.3, bstring.3, byteorder.3, bzero.3, catgets.3, catopen.3, cbrt.3, ceil.3, clearenv.3, clock.3, clock_getcpuclockid.3, closedir.3, confstr.3, copysign.3, cos.3, cosh.3, ctermid.3, ctime.3, difftime.3, dirfd.3, div.3, dl_iterate_phdr.3, dprintf.3, drand48.3, drand48_r.3, dysize.3, ecvt.3, ecvt_r.3, end.3, endian.3, erf.3, erfc.3, ether_aton.3, euidaccess.3, exit.3, exp.3, exp10.3, exp2.3, expm1.3, fabs.3, fcloseall.3, fexecve.3, ffs.3, fgetgrent.3, fgetpwent.3, finite.3, flockfile.3, floor.3, fmod.3, fnmatch.3, fopencookie.3, fpathconf.3, fpurge.3, frexp.3, fseeko.3, ftok.3, futimes.3, gcvt.3, get_nprocs_conf.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getcontext.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getenv.3, getfsent.3, getgrent.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getifaddrs.3, getipnodebyname.3, getline.3, getlogin.3, getmntent.3, getnetent.3, getnetent_r.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwnam.3, getrpcent_r.3, gets.3, getservent.3, getservent_r.3, getumask.3, getusershell.3, getutmp.3, getw.3, glob.3, gnu_get_libc_version.3, gsignal.3, hypot.3, if_nameindex.3, if_nametoindex.3, ilogb.3, index.3, inet.3, inet_ntop.3, inet_pton.3, infnan.3, initgroups.3, insque.3, intro.3, isalpha.3, isatty.3, j0.3, ldexp.3, localeconv.3, log.3, log10.3, log1p.3, log2.3, logb.3, lrint.3, lround.3, lsearch.3, lseek64.3, makecontext.3, makedev.3, mallinfo.3, malloc.3, malloc_get_state.3, malloc_info.3, malloc_stats.3, malloc_trim.3, malloc_usable_size.3, mallopt.3, matherr.3, mcheck.3, memccpy.3, memchr.3, memcmp.3, memcpy.3, memfrob.3, memmem.3, memmove.3, memset.3, mkdtemp.3, mkfifo.3, mkfifoat.3, mkstemp.3, mktemp.3, modf.3, mq_close.3, mq_getattr.3, mq_notify.3, mq_open.3, mq_receive.3, mq_send.3, mq_unlink.3, mtrace.3, on_exit.3, opendir.3, posix_fallocate.3, posix_memalign.3, posix_openpt.3, pow.3, pow10.3, profil.3, psignal.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_detach.3, pthread_equal.3, pthread_exit.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_join.3, pthread_kill.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_setschedprio.3, pthread_sigmask.3, pthread_sigqueue.3, pthread_testcancel.3, pthread_tryjoin_np.3, pthread_yield.3, putenv.3, putpwent.3, puts.3, qecvt.3, qsort.3, raise.3, rand.3, random.3, random_r.3, re_comp.3, readdir.3, realpath.3, regex.3, remainder.3, remove.3, resolver.3, rewinddir.3, rint.3, round.3, scalb.3, scalbln.3, scandir.3, sched_getcpu.3, seekdir.3, sem_close.3, sem_destroy.3, sem_getvalue.3, sem_init.3, sem_open.3, sem_post.3, sem_unlink.3, sem_wait.3, setenv.3, setlocale.3, setlogmask.3, shm_open.3, siginterrupt.3, sigpause.3, sigqueue.3, sigset.3, sigsetops.3, sigvec.3, sigwait.3, sin.3, sinh.3, sleep.3, sockatmark.3, sqrt.3, statvfs.3, stdio_ext.3, stpcpy.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strdup.3, strerror.3, strfry.3, strftime.3, string.3, strlen.3, strpbrk.3, strptime.3, strsep.3, strsignal.3, strspn.3, strstr.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, strxfrm.3, swab.3, sysconf.3, syslog.3, system.3, sysv_signal.3, tan.3, tanh.3, tcgetpgrp.3, tcgetsid.3, telldir.3, tempnam.3, timegm.3, timeradd.3, tmpfile.3, tmpnam.3, toascii.3, toupper.3, trunc.3, tsearch.3, ttyslot.3, tzset.3, ulimit.3, undocumented.3, unlocked_stdio.3, usleep.3, y0.3, cpuid.4, full.4, initrd.4, mouse.4, msr.4, sd.4, st.4, acct.5, core.5, services.5, slabinfo.5, aio.7, capabilities.7, credentials.7, feature_test_macros.7, hier.7, inotify.7, libc.7, locale.7, man-pages.7, man.7, math_error.7, mq_overview.7, numa.7, path_resolution.7, pipe.7, pthreads.7, pty.7, rtld-audit.7, sem_overview.7, shm_overview.7, sigevent.7, signal.7, suffixes.7, svipc.7, termio.7, time.7, udplite.7, units.7, uri.7, sln.8: s/LICENSE_START(verbatim)/LICENSE_START(VERBATIM)/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-10 09:29:01 +00:00
|
|
|
.\" %%%LICENSE_START(VERBATIM)
|
2009-02-10 00:35:25 +00:00
|
|
|
.\" Permission is granted to make and distribute verbatim copies of this
|
|
|
|
.\" manual provided the copyright notice and this permission notice are
|
|
|
|
.\" preserved on all copies.
|
|
|
|
.\"
|
|
|
|
.\" Permission is granted to copy and distribute modified versions of this
|
|
|
|
.\" manual under the conditions for verbatim copying, provided that the
|
|
|
|
.\" entire resulting derived work is distributed under the terms of a
|
|
|
|
.\" permission notice identical to this one.
|
|
|
|
.\"
|
|
|
|
.\" Since the Linux kernel and libraries are constantly changing, this
|
|
|
|
.\" manual page may be incorrect or out-of-date. The author(s) assume no
|
|
|
|
.\" responsibility for errors or omissions, or for damages resulting from
|
|
|
|
.\" the use of the information contained herein. The author(s) may not
|
|
|
|
.\" have taken the same level of care in the production of this manual,
|
|
|
|
.\" which is licensed free of charge, as they might when working
|
|
|
|
.\" professionally.
|
|
|
|
.\"
|
|
|
|
.\" Formatted or processed versions of this manual, if unaccompanied by
|
|
|
|
.\" the source, must acknowledge the copyright and authors of this work.
|
intro.1, _exit.2, access.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clock_getres.2, clock_nanosleep.2, close.2, connect.2, delete_module.2, dup.2, execve.2, exit_group.2, faccessat.2, fchmodat.2, fchownat.2, fcntl.2, fork.2, fstatat.2, fsync.2, futimesat.2, get_robust_list.2, getdents.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getpagesize.2, getpid.2, getresuid.2, getrlimit.2, getrusage.2, gettid.2, gettimeofday.2, getuid.2, getunwind.2, idle.2, init_module.2, intro.2, iopl.2, kcmp.2, kexec_load.2, kill.2, link.2, linkat.2, llseek.2, lookup_dcookie.2, madvise.2, mincore.2, mkdirat.2, mknodat.2, mmap.2, mmap2.2, mount.2, mprotect.2, mq_getsetattr.2, msgctl.2, msgget.2, msgop.2, msync.2, nice.2, open.2, openat.2, pause.2, perfmonctl.2, personality.2, pipe.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, quotactl.2, read.2, readahead.2, readdir.2, readlinkat.2, readv.2, reboot.2, recvmmsg.2, remap_file_pages.2, rename.2, renameat.2, rmdir.2, rt_sigqueueinfo.2, select.2, select_tut.2, semctl.2, semget.2, semop.2, sendmmsg.2, set_tid_address.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setresuid.2, setuid.2, setup.2, sgetmask.2, shmctl.2, shmget.2, shmop.2, sigaction.2, sigaltstack.2, signal.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, splice.2, stat.2, statfs.2, stime.2, subpage_prot.2, swapon.2, symlink.2, symlinkat.2, sync.2, sync_file_range.2, syscalls.2, sysctl.2, sysfs.2, syslog.2, tee.2, time.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, times.2, tkill.2, umask.2, umount.2, uname.2, unlink.2, unlinkat.2, uselib.2, ustat.2, utime.2, utimensat.2, vfork.2, vhangup.2, vm86.2, vmsplice.2, wait.2, wait4.2, write.2, CPU_SET.3, INFINITY.3, abort.3, abs.3, acos.3, acosh.3, adjtime.3, aio_init.3, asin.3, asinh.3, asprintf.3, assert.3, assert_perror.3, atan.3, atan2.3, atanh.3, atexit.3, atof.3, atoi.3, basename.3, bcmp.3, bcopy.3, bindresvport.3, bsd_signal.3, bsearch.3, bstring.3, byteorder.3, bzero.3, catgets.3, catopen.3, cbrt.3, ceil.3, clearenv.3, clock.3, clock_getcpuclockid.3, closedir.3, confstr.3, copysign.3, cos.3, cosh.3, ctermid.3, ctime.3, difftime.3, dirfd.3, div.3, dl_iterate_phdr.3, dprintf.3, drand48.3, drand48_r.3, dysize.3, ecvt.3, ecvt_r.3, end.3, endian.3, erf.3, erfc.3, ether_aton.3, euidaccess.3, exit.3, exp.3, exp10.3, exp2.3, expm1.3, fabs.3, fcloseall.3, fexecve.3, ffs.3, fgetgrent.3, fgetpwent.3, finite.3, flockfile.3, floor.3, fmod.3, fnmatch.3, fopencookie.3, fpathconf.3, fpurge.3, frexp.3, fseeko.3, ftok.3, futimes.3, gcvt.3, get_nprocs_conf.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getcontext.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getenv.3, getfsent.3, getgrent.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getifaddrs.3, getipnodebyname.3, getline.3, getlogin.3, getmntent.3, getnetent.3, getnetent_r.3, getopt.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent.3, getpwnam.3, getrpcent_r.3, gets.3, getservent.3, getservent_r.3, getumask.3, getusershell.3, getutmp.3, getw.3, glob.3, gnu_get_libc_version.3, gsignal.3, hypot.3, if_nameindex.3, if_nametoindex.3, ilogb.3, index.3, inet.3, inet_ntop.3, inet_pton.3, infnan.3, initgroups.3, insque.3, intro.3, isalpha.3, isatty.3, j0.3, ldexp.3, localeconv.3, log.3, log10.3, log1p.3, log2.3, logb.3, lrint.3, lround.3, lsearch.3, lseek64.3, makecontext.3, makedev.3, mallinfo.3, malloc.3, malloc_get_state.3, malloc_info.3, malloc_stats.3, malloc_trim.3, malloc_usable_size.3, mallopt.3, matherr.3, mcheck.3, memccpy.3, memchr.3, memcmp.3, memcpy.3, memfrob.3, memmem.3, memmove.3, memset.3, mkdtemp.3, mkfifo.3, mkfifoat.3, mkstemp.3, mktemp.3, modf.3, mq_close.3, mq_getattr.3, mq_notify.3, mq_open.3, mq_receive.3, mq_send.3, mq_unlink.3, mtrace.3, on_exit.3, opendir.3, posix_fallocate.3, posix_memalign.3, posix_openpt.3, pow.3, pow10.3, profil.3, psignal.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_detach.3, pthread_equal.3, pthread_exit.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_join.3, pthread_kill.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_setschedprio.3, pthread_sigmask.3, pthread_sigqueue.3, pthread_testcancel.3, pthread_tryjoin_np.3, pthread_yield.3, putenv.3, putpwent.3, puts.3, qecvt.3, qsort.3, raise.3, rand.3, random.3, random_r.3, re_comp.3, readdir.3, realpath.3, regex.3, remainder.3, remove.3, resolver.3, rewinddir.3, rint.3, round.3, scalb.3, scalbln.3, scandir.3, sched_getcpu.3, seekdir.3, sem_close.3, sem_destroy.3, sem_getvalue.3, sem_init.3, sem_open.3, sem_post.3, sem_unlink.3, sem_wait.3, setenv.3, setlocale.3, setlogmask.3, shm_open.3, siginterrupt.3, sigpause.3, sigqueue.3, sigset.3, sigsetops.3, sigvec.3, sigwait.3, sin.3, sinh.3, sleep.3, sockatmark.3, sqrt.3, statvfs.3, stdio_ext.3, stpcpy.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strdup.3, strerror.3, strfry.3, strftime.3, string.3, strlen.3, strpbrk.3, strptime.3, strsep.3, strsignal.3, strspn.3, strstr.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, strxfrm.3, swab.3, sysconf.3, syslog.3, system.3, sysv_signal.3, tan.3, tanh.3, tcgetpgrp.3, tcgetsid.3, telldir.3, tempnam.3, timegm.3, timeradd.3, tmpfile.3, tmpnam.3, toascii.3, toupper.3, trunc.3, tsearch.3, ttyslot.3, tzset.3, ulimit.3, undocumented.3, unlocked_stdio.3, usleep.3, y0.3, cpuid.4, full.4, initrd.4, mouse.4, msr.4, sd.4, st.4, acct.5, core.5, services.5, slabinfo.5, aio.7, capabilities.7, credentials.7, feature_test_macros.7, hier.7, inotify.7, libc.7, locale.7, man-pages.7, man.7, math_error.7, mq_overview.7, numa.7, path_resolution.7, pipe.7, pthreads.7, pty.7, rtld-audit.7, sem_overview.7, shm_overview.7, sigevent.7, signal.7, suffixes.7, svipc.7, termio.7, time.7, udplite.7, units.7, uri.7, sln.8: Global fix: Add LICENSE_START(verbatim)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-10 09:28:40 +00:00
|
|
|
.\" %%%LICENSE_END
|
2011-09-07 18:37:55 +00:00
|
|
|
.\"
|
intro.1, locale.1, _exit.2, access.2, bpf.2, brk.2, capget.2, chmod.2, chroot.2, clock_getres.2, clone.2, eventfd.2, fallocate.2, fork.2, getgroups.2, gethostname.2, getpid.2, getpriority.2, getrlimit.2, getrusage.2, gettid.2, iopl.2, ioprio_set.2, killpg.2, mlock.2, mprotect.2, perf_event_open.2, poll.2, posix_fadvise.2, pread.2, ptrace.2, read.2, readv.2, recv.2, rename.2, sched_setaffinity.2, sched_setattr.2, seccomp.2, select.2, send.2, seteuid.2, setgid.2, setresuid.2, setreuid.2, setuid.2, sigaltstack.2, signalfd.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, socket.2, stat.2, timer_create.2, uname.2, utimensat.2, wait.2, wait4.2, write.2, MB_LEN_MAX.3, __ppc_get_timebase.3, clearenv.3, dl_iterate_phdr.3, error.3, fexecve.3, fpurge.3, fread.3, fts.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getgrent_r.3, gethostbyname.3, getifaddrs.3, getnameinfo.3, getnetent_r.3, getprotoent.3, getprotoent_r.3, getpw.3, getpwent_r.3, getrpcent.3, getrpcent_r.3, getrpcport.3, getservent.3, getservent_r.3, gsignal.3, key_setsecret.3, malloc_get_state.3, malloc_info.3, malloc_stats.3, malloc_trim.3, memcpy.3, mq_notify.3, mq_open.3, perror.3, profil.3, psignal.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_create.3, pthread_detach.3, pthread_getattr_np.3, pthread_join.3, pthread_setname_np.3, pthread_tryjoin_np.3, putgrent.3, rcmd.3, rpc.3, rpmatch.3, sem_close.3, sem_open.3, setaliasent.3, shm_open.3, sigqueue.3, strfmon.3, xcrypt.3, xdr.3, console_codes.4, null.4, core.5, host.conf.5, hosts.equiv.5, locale.5, repertoiremap.5, locale.7, man-pages.7, pty.7, rtld-audit.7, sched.7, vdso.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-07-23 14:12:28 +00:00
|
|
|
.TH TIMER_CREATE 2 2015-07-23 Linux "Linux Programmer's Manual"
|
2009-02-10 00:35:25 +00:00
|
|
|
.SH NAME
|
|
|
|
timer_create \- create a POSIX per-process timer
|
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <signal.h>
|
|
|
|
.B #include <time.h>
|
|
|
|
|
2010-09-27 04:58:55 +00:00
|
|
|
.BI "int timer_create(clockid_t " clockid ", struct sigevent *" sevp ,
|
2009-02-10 00:35:25 +00:00
|
|
|
.BI " timer_t *" timerid );
|
|
|
|
.fi
|
|
|
|
|
2009-02-23 18:46:09 +00:00
|
|
|
Link with \fI\-lrt\fP.
|
2009-02-10 00:35:25 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.BR timer_create ():
|
brk.2, chroot.2, faccessat.2, fchmodat.2, fchownat.2, fstatat.2, futimesat.2, getdtablesize.2, getpagesize.2, getsid.2, linkat.2, mkdirat.2, mknodat.2, openat.2, pread.2, readlinkat.2, renameat.2, setpgid.2, sigaltstack.2, symlinkat.2, sync.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, unlinkat.2, utimensat.2, vfork.2, acosh.3, asinh.3, atanh.3, dirfd.3, dprintf.3, ecvt.3, expm1.3, fexecve.3, fmemopen.3, gcvt.3, getcwd.3, gethostid.3, getpass.3, getsubopt.3, getw.3, mbsnrtowcs.3, mkfifoat.3, mkstemp.3, mktemp.3, opendir.3, posix_memalign.3, rint.3, siginterrupt.3, stpcpy.3, stpncpy.3, strdup.3, strerror.3, strnlen.3, strsignal.3, strtol.3, strtoul.3, ualarm.3, usleep.3, wcpcpy.3, wcpncpy.3, wcscasecmp.3, wcsdup.3, wcsncasecmp.3, wcsnlen.3, wcsnrtombs.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-09-19 06:02:38 +00:00
|
|
|
_POSIX_C_SOURCE\ >=\ 199309L
|
2009-02-10 00:35:25 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
.BR timer_create ()
|
|
|
|
creates a new per-process interval timer.
|
|
|
|
The ID of the new timer is returned in the buffer pointed to by
|
|
|
|
.IR timerid ,
|
epoll_ctl.2, execve.2, recv.2, timer_create.2, wait.2, argz_add.3, basename.3, dlopen.3, exec.3, fopencookie.3, fts.3, getaddrinfo.3, getcwd.3, gethostbyname.3, getifaddrs.3, getipnodebyname.3, getlogin.3, getnetent.3, getprotoent.3, getrpcent.3, getservent.3, getusershell.3, glob.3, if_nameindex.3, inet_ntop.3, lio_listio.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mq_notify.3, ptsname.3, realpath.3, setnetgrent.3, sigvec.3, strsignal.3, strtok.3, wcrtomb.3, wcsnrtombs.3, wcsrtombs.3, wcstombs.3, xdr.3: Global fix of "NULL pointer"
Change "NULL pointer: to "NUL " or null pointer".
POSIX uses the term "null pointer", not "NULL pointer".
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-01-03 02:01:50 +00:00
|
|
|
which must be a non-null pointer.
|
2009-02-10 00:35:25 +00:00
|
|
|
This ID is unique within the process, until the timer is deleted.
|
|
|
|
The new timer is initially disarmed.
|
|
|
|
|
|
|
|
The
|
|
|
|
.I clockid
|
|
|
|
argument specifies the clock that the new timer uses to measure time.
|
|
|
|
It can be specified as one of the following values:
|
|
|
|
.TP
|
|
|
|
.B CLOCK_REALTIME
|
|
|
|
A settable system-wide real-time clock.
|
|
|
|
.TP
|
|
|
|
.B CLOCK_MONOTONIC
|
accept.2, access.2, acct.2, clock_nanosleep.2, mbind.2, mincore.2, remap_file_pages.2, sched_setscheduler.2, set_mempolicy.2, splice.2, stat.2, syslog.2, timer_create.2, timerfd_create.2, truncate.2, fenv.3, ferror.3, fflush.3, fgetwc.3, fgetws.3, flockfile.3, fputwc.3, fputws.3, fread.3, getopt.3, gets.3, getwchar.3, glob.3, iconv.3, longjmp.3, pow.3, printf.3, puts.3, putwchar.3, regex.3, rpc.3, scanf.3, setjmp.3, termios.3, unlocked_stdio.3, wcswidth.3, hd.4, rtc.4, st.4, core.5, dir_colors.5, elf.5, proc.5, arp.7, ascii.7, boot.7, bootparam.7, charsets.7, futex.7, ip.7, iso_8859-11.7, man-pages.7, man.7, mdoc.samples.7, path_resolution.7, pipe.7, posixoptions.7, unicode.7, unix.7, uri.7, utf-8.7, ld.so.8: s/non-/non/
The tendency in English, as prescribed in style guides like
Chicago MoS, is towards removing hyphens after prefixes
like "non-" etc.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-01-16 17:20:12 +00:00
|
|
|
A nonsettable monotonically increasing clock that measures time
|
2009-02-10 00:35:25 +00:00
|
|
|
from some unspecified point in the past that does not change
|
|
|
|
after system startup.
|
|
|
|
.\" Note: the CLOCK_MONOTONIC_RAW clock added for clock_gettime()
|
|
|
|
.\" in 2.6.28 is not supported for POSIX timers -- mtk, Feb 2009
|
|
|
|
.TP
|
|
|
|
.BR CLOCK_PROCESS_CPUTIME_ID " (since Linux 2.6.12)"
|
|
|
|
A clock that measures (user and system) CPU time consumed by
|
|
|
|
(all of the threads in) the calling process.
|
|
|
|
.TP
|
|
|
|
.BR CLOCK_THREAD_CPUTIME_ID " (since Linux 2.6.12)"
|
|
|
|
A clock that measures (user and system) CPU time consumed by
|
|
|
|
the calling thread.
|
|
|
|
.\" The CLOCK_MONOTONIC_RAW that was added in 2.6.28 can't be used
|
|
|
|
.\" to create a timer -- mtk, Feb 2009
|
2016-11-21 13:41:59 +00:00
|
|
|
.TP
|
|
|
|
.BR CLOCK_BOOTTIME " (Since Linux 2.6.39)"
|
|
|
|
.\" commit 70a08cca1227dc31c784ec930099a4417a06e7d0
|
|
|
|
Like
|
|
|
|
.BR CLOCK_MONOTONIC ,
|
|
|
|
this is a monotonically increasing clock.
|
|
|
|
However, whereas the
|
|
|
|
.BR CLOCK_MONOTONIC
|
|
|
|
clock does not measure the time while a system is suspended, the
|
|
|
|
.BR CLOCK_BOOTTIME
|
|
|
|
clock does include the time during which the system is suspended.
|
|
|
|
This is useful for applications that need to be suspend-aware.
|
|
|
|
.BR CLOCK_REALTIME
|
|
|
|
is not suitable for such applications, since that clock is affected
|
|
|
|
by discontinuous changes to the system clock.
|
2016-11-21 13:53:44 +00:00
|
|
|
.TP
|
|
|
|
.BR CLOCK_REALTIME_ALARM " (since Linux 3.0)"
|
|
|
|
.\" commit 9a7adcf5c6dea63d2e47e6f6d2f7a6c9f48b9337
|
|
|
|
This clock is like
|
|
|
|
.BR CLOCK_REALTIME ,
|
|
|
|
but will wake the system if it is suspended.
|
|
|
|
The caller must have the
|
|
|
|
.B CAP_WAKE_ALARM
|
|
|
|
capability in order to set a timer against this clock.
|
|
|
|
.TP
|
|
|
|
.BR CLOCK_BOOTTIME_ALARM " (since Linux 3.0)"
|
|
|
|
.\" commit 9a7adcf5c6dea63d2e47e6f6d2f7a6c9f48b9337
|
|
|
|
This clock is like
|
|
|
|
.BR CLOCK_BOOTTIME ,
|
|
|
|
but will wake the system if it is suspended.
|
|
|
|
The caller must have the
|
|
|
|
.B CAP_WAKE_ALARM
|
|
|
|
capability in order to set a timer against this clock.
|
2009-02-10 00:35:25 +00:00
|
|
|
.PP
|
|
|
|
As well as the above values,
|
|
|
|
.I clockid
|
|
|
|
can be specified as the
|
|
|
|
.I clockid
|
|
|
|
returned by a call to
|
|
|
|
.BR clock_getcpuclockid (3)
|
|
|
|
or
|
|
|
|
.BR pthread_getcpuclockid (3).
|
|
|
|
|
|
|
|
The
|
2010-09-27 04:58:55 +00:00
|
|
|
.I sevp
|
2009-02-10 00:35:25 +00:00
|
|
|
argument points to a
|
|
|
|
.I sigevent
|
|
|
|
structure that specifies how the caller
|
|
|
|
should be notified when the timer expires.
|
2010-09-21 04:59:02 +00:00
|
|
|
For the definition and general details of this structure, see
|
|
|
|
.BR sigevent (7).
|
2009-02-10 00:35:25 +00:00
|
|
|
|
2010-09-21 04:59:02 +00:00
|
|
|
The
|
2010-09-27 04:58:55 +00:00
|
|
|
.I sevp.sigev_notify
|
2010-09-21 04:59:02 +00:00
|
|
|
field can have the following values:
|
2009-02-10 00:35:25 +00:00
|
|
|
.TP
|
|
|
|
.BR SIGEV_NONE
|
|
|
|
Don't asynchronously notify when the timer expires.
|
|
|
|
Progress of the timer can be monitored using
|
|
|
|
.BR timer_gettime (2).
|
|
|
|
.TP
|
|
|
|
.BR SIGEV_SIGNAL
|
|
|
|
Upon timer expiration, generate the signal
|
|
|
|
.I sigev_signo
|
|
|
|
for the process.
|
2010-09-21 04:59:02 +00:00
|
|
|
See
|
|
|
|
.BR sigevent (7)
|
|
|
|
for general details.
|
|
|
|
The
|
|
|
|
.I si_code
|
|
|
|
field of the
|
|
|
|
.I siginfo_t
|
|
|
|
structure will be set to
|
|
|
|
.BR SI_TIMER .
|
2009-02-10 00:35:25 +00:00
|
|
|
At any point in time,
|
|
|
|
at most one signal is queued to the process for a given timer; see
|
|
|
|
.BR timer_getoverrun (2)
|
|
|
|
for more details.
|
|
|
|
.TP
|
|
|
|
.BR SIGEV_THREAD
|
|
|
|
Upon timer expiration, invoke
|
|
|
|
.I sigev_notify_function
|
|
|
|
as if it were the start function of a new thread.
|
2010-09-21 04:59:02 +00:00
|
|
|
See
|
|
|
|
.BR sigevent (7)
|
|
|
|
for details.
|
2009-02-10 00:35:25 +00:00
|
|
|
.TP
|
|
|
|
.BR SIGEV_THREAD_ID " (Linux-specific)"
|
|
|
|
As for
|
|
|
|
.BR SIGEV_SIGNAL ,
|
|
|
|
but the signal is targeted at the thread whose ID is given in
|
|
|
|
.IR sigev_notify_thread_id ,
|
|
|
|
which must be a thread in the same process as the caller.
|
|
|
|
The
|
|
|
|
.IR sigev_notify_thread_id
|
|
|
|
field specifies a kernel thread ID, that is, the value returned by
|
|
|
|
.BR clone (2)
|
|
|
|
or
|
|
|
|
.BR gettid (2).
|
intro.1, _syscall.2, access.2, arch_prctl.2, cacheflush.2, chown.2, clock_getres.2, clone.2, create_module.2, fcntl.2, flock.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getpriority.2, getrlimit.2, getrusage.2, ioprio_set.2, kexec_load.2, madvise.2, mbind.2, migrate_pages.2, mknod.2, mmap.2, mount.2, move_pages.2, mprotect.2, open.2, pause.2, pciconfig_read.2, perf_event_open.2, prctl.2, ptrace.2, query_module.2, read.2, reboot.2, recv.2, s390_runtime_instr.2, sched_setscheduler.2, select_tut.2, send.2, set_mempolicy.2, setfsgid.2, setfsuid.2, sigaction.2, spu_create.2, spu_run.2, stime.2, swapon.2, syslog.2, timer_create.2, timer_getoverrun.2, times.2, tkill.2, umount.2, unimplemented.2, ustat.2, vm86.2, wait.2, abs.3, aio_read.3, aio_write.3, bsd_signal.3, catgets.3, clearenv.3, cmsg.3, dbopen.3, dirfd.3, dlopen.3, exec.3, fenv.3, ferror.3, fmemopen.3, fnmatch.3, fopen.3, futimes.3, getaddrinfo.3, getifaddrs.3, getipnodebyname.3, hsearch.3, if_nameindex.3, inet_pton.3, mblen.3, mbrlen.3, mbsrtowcs.3, mbtowc.3, mcheck.3, memfrob.3, mq_notify.3, netlink.3, posix_memalign.3, printf.3, pthread_attr_setscope.3, pthread_cleanup_push.3, pthread_kill_other_threads_np.3, pthread_self.3, pthread_setcancelstate.3, pthread_setconcurrency.3, raise.3, resolver.3, rpc.3, rtime.3, rtnetlink.3, scanf.3, setbuf.3, setnetgrent.3, shm_open.3, sigpause.3, sigset.3, sigwait.3, sockatmark.3, strcasecmp.3, strcmp.3, strdup.3, strftime.3, strptime.3, strsignal.3, strverscmp.3, sysv_signal.3, termios.3, wcrtomb.3, wcsnlen.3, wcsnrtombs.3, wcsrtombs.3, wctomb.3, wprintf.3, console_codes.4, cpuid.4, msr.4, rtc.4, sk98lin.4, st.4, tty.4, charmap.5, core.5, elf.5, hosts.equiv.5, proc.5, resolv.conf.5, services.5, slabinfo.5, arp.7, bootparam.7, capabilities.7, charsets.7, cpuset.7, ddp.7, epoll.7, feature_test_macros.7, futex.7, hier.7, icmp.7, inotify.7, ip.7, ipv6.7, man-pages.7, mdoc.7, mdoc.samples.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, posixoptions.7, pthreads.7, raw.7, rtld-audit.7, rtnetlink.7, sem_overview.7, sigevent.7, socket.7, spufs.7, tcp.7, udp.7, unicode.7, uri.7, utf-8.7, intro.8, ldconfig.8, sync.8: Global fix: fix placement of word "only"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-03-31 08:53:00 +00:00
|
|
|
This flag is intended only for use by threading libraries.
|
2009-02-10 00:35:25 +00:00
|
|
|
.PP
|
|
|
|
Specifying
|
2010-09-27 04:58:55 +00:00
|
|
|
.I sevp
|
2009-02-10 00:35:25 +00:00
|
|
|
as NULL is equivalent to specifying a pointer to a
|
|
|
|
.I sigevent
|
|
|
|
structure in which
|
|
|
|
.I sigev_notify
|
|
|
|
is
|
|
|
|
.BR SIGEV_SIGNAL ,
|
|
|
|
.I sigev_signo
|
|
|
|
is
|
|
|
|
.BR SIGALRM ,
|
|
|
|
and
|
|
|
|
.I sigev_value.sival_int
|
|
|
|
is the timer ID.
|
|
|
|
.SH RETURN VALUE
|
|
|
|
On success,
|
|
|
|
.BR timer_create ()
|
|
|
|
returns 0, and the ID of the new timer is placed in
|
|
|
|
.IR *timerid .
|
|
|
|
On failure, \-1 is returned, and
|
|
|
|
.I errno
|
|
|
|
is set to indicate the error.
|
|
|
|
.SH ERRORS
|
|
|
|
.TP
|
|
|
|
.B EAGAIN
|
|
|
|
Temporary error during kernel allocation of timer structures.
|
|
|
|
.TP
|
|
|
|
.B EINVAL
|
|
|
|
Clock ID,
|
|
|
|
.IR sigev_notify ,
|
|
|
|
.IR sigev_signo ,
|
2009-09-27 07:26:33 +00:00
|
|
|
or
|
2009-02-10 00:35:25 +00:00
|
|
|
.IR sigev_notify_thread_id
|
|
|
|
is invalid.
|
|
|
|
.TP
|
|
|
|
.B ENOMEM
|
|
|
|
.\" glibc layer: malloc()
|
|
|
|
Could not allocate memory.
|
|
|
|
.SH VERSIONS
|
|
|
|
This system call is available since Linux 2.6.
|
|
|
|
.SH CONFORMING TO
|
2015-04-18 06:32:18 +00:00
|
|
|
POSIX.1-2001, POSIX.1-2008.
|
2009-02-10 00:35:25 +00:00
|
|
|
.SH NOTES
|
|
|
|
A program may create multiple interval timers using
|
|
|
|
.BR timer_create ().
|
|
|
|
|
|
|
|
Timers are not inherited by the child of a
|
|
|
|
.BR fork (2),
|
|
|
|
and are disarmed and deleted during an
|
|
|
|
.BR execve (2).
|
|
|
|
|
|
|
|
The kernel preallocates a "queued real-time signal"
|
|
|
|
for each timer created using
|
|
|
|
.BR timer_create ().
|
|
|
|
Consequently, the number of timers is limited by the
|
|
|
|
.BR RLIMIT_SIGPENDING
|
|
|
|
resource limit (see
|
|
|
|
.BR setrlimit (2)).
|
|
|
|
|
|
|
|
The timers created by
|
|
|
|
.BR timer_create ()
|
|
|
|
are commonly known as "POSIX (interval) timers".
|
|
|
|
The POSIX timers API consists of the following interfaces:
|
|
|
|
.IP * 3
|
|
|
|
.BR timer_create ():
|
|
|
|
Create a timer.
|
|
|
|
.IP *
|
|
|
|
.BR timer_settime (2):
|
|
|
|
Arm (start) or disarm (stop) a timer.
|
|
|
|
.IP *
|
|
|
|
.BR timer_gettime (2):
|
|
|
|
Fetch the time remaining until the next expiration of a timer,
|
|
|
|
along with the interval setting of the timer.
|
|
|
|
.IP *
|
|
|
|
.BR timer_getoverrun (2):
|
|
|
|
Return the overrun count for the last timer expiration.
|
|
|
|
.IP *
|
|
|
|
.BR timer_delete (2):
|
|
|
|
Disarm and delete a timer.
|
2015-04-06 08:05:17 +00:00
|
|
|
.PP
|
2014-05-15 20:38:28 +00:00
|
|
|
Since Linux 3.10, the
|
|
|
|
.IR /proc/[pid]/timers
|
|
|
|
file can be used to list the POSIX timers for the process with PID
|
|
|
|
.IR pid .
|
|
|
|
See
|
|
|
|
.BR proc (5)
|
|
|
|
for further information.
|
|
|
|
.\"
|
_exit.2, access.2, brk.2, chmod.2, clone.2, epoll_wait.2, eventfd.2, fork.2, getgroups.2, gethostname.2, getpid.2, getpriority.2, killpg.2, mmap.2, poll.2, posix_fadvise.2, pread.2, ptrace.2, readv.2, sched_setaffinity.2, select.2, seteuid.2, setgid.2, setresuid.2, setreuid.2, setuid.2, sigaction.2, signalfd.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, stat.2, timer_create.2, uname.2, wait.2, wait4.2, mq_notify.3, mq_open.3, sigqueue.3, man-pages.7: Remove "ABI" from "C library/kernel ABI differences" subheadings
The "ABI" doesn't really convey anything significant in
the title. These subsections are about describing differences
between the kernel and (g)libc interfaces.
Reported-by: Andries E. Brouwer <Andries.Brouwer@cwi.nl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-05-08 11:08:00 +00:00
|
|
|
.SS C library/kernel differences
|
2009-02-10 00:35:25 +00:00
|
|
|
Part of the implementation of the POSIX timers API is provided by glibc.
|
2015-04-06 08:04:38 +00:00
|
|
|
.\" See nptl/sysdeps/unix/sysv/linux/timer_create.c
|
2009-02-10 00:35:25 +00:00
|
|
|
In particular:
|
|
|
|
.IP * 3
|
2015-04-06 08:04:38 +00:00
|
|
|
Much of the functionality for
|
2009-02-10 00:35:25 +00:00
|
|
|
.BR SIGEV_THREAD
|
|
|
|
is implemented within glibc, rather than the kernel.
|
2015-04-06 08:04:38 +00:00
|
|
|
(This is necessarily so,
|
|
|
|
since the thread involved in handling the notification is one
|
|
|
|
that must be managed by the C library POSIX threads implementation.)
|
|
|
|
Although the notification delivered to the process is via a thread,
|
|
|
|
internally the NPTL implementation uses a
|
|
|
|
.I sigev_notify
|
|
|
|
value of
|
|
|
|
.BR SIGEV_THREAD_ID
|
|
|
|
along with a real-time signal that is reserved by the implementation (see
|
|
|
|
.BR nptl (7)).
|
|
|
|
.IP *
|
|
|
|
The implementation of the default case where
|
|
|
|
.I evp
|
|
|
|
is NULL is handled inside glibc,
|
|
|
|
which invokes the underlying system call with a suitably populated
|
|
|
|
.I sigevent
|
|
|
|
structure.
|
2009-02-10 00:35:25 +00:00
|
|
|
.IP *
|
|
|
|
The timer IDs presented at user level are maintained by glibc,
|
|
|
|
which maps these IDs to the timer IDs employed by the kernel.
|
|
|
|
.\" See the glibc source file kernel-posix-timers.h for the structure
|
eventfd.2, futex.2, mmap2.2, open.2, pciconfig_read.2, ptrace.2, reboot.2, request_key.2, sched_rr_get_interval.2, splice.2, stat.2, sync_file_range.2, syscalls.2, timer_create.2, vm86.2, pthread_attr_setscope.3, core.5, proc.5, aio.7, futex.7, netlink.7, time.7: Global fix: "userspace" ==> "user space" or "user-space"
Existing pages variously use "userspace or "user space".
But, "userspace" is not quite an English word.
So change "userspace" to "user space" or, when used
attributively, "user-space".
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-10-21 06:04:42 +00:00
|
|
|
.\" that glibc uses to map user-space timer IDs to kernel timer IDs
|
2009-02-10 00:35:25 +00:00
|
|
|
.\" The kernel-level timer ID is exposed via siginfo.si_tid.
|
|
|
|
.PP
|
|
|
|
The POSIX timers system calls first appeared in Linux 2.6.
|
|
|
|
Prior to this,
|
eventfd.2, futex.2, mmap2.2, open.2, pciconfig_read.2, ptrace.2, reboot.2, request_key.2, sched_rr_get_interval.2, splice.2, stat.2, sync_file_range.2, syscalls.2, timer_create.2, vm86.2, pthread_attr_setscope.3, core.5, proc.5, aio.7, futex.7, netlink.7, time.7: Global fix: "userspace" ==> "user space" or "user-space"
Existing pages variously use "userspace or "user space".
But, "userspace" is not quite an English word.
So change "userspace" to "user space" or, when used
attributively, "user-space".
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-10-21 06:04:42 +00:00
|
|
|
glibc provided an incomplete user-space implementation
|
2009-02-10 00:35:25 +00:00
|
|
|
.RB ( CLOCK_REALTIME
|
|
|
|
timers only) using POSIX threads,
|
2015-04-06 08:04:38 +00:00
|
|
|
and in glibc versions before 2.17,
|
|
|
|
.\" glibc commit 93a78ac437ba44f493333d7e2a4b0249839ce460
|
|
|
|
the implementation falls back to this technique on systems
|
2009-02-10 00:35:25 +00:00
|
|
|
running pre-2.6 Linux kernels.
|
|
|
|
.SH EXAMPLE
|
|
|
|
The program below takes two arguments: a sleep period in seconds,
|
|
|
|
and a timer frequency in nanoseconds.
|
|
|
|
The program establishes a handler for the signal it uses for the timer,
|
|
|
|
blocks that signal,
|
|
|
|
creates and arms a timer that expires with the given frequency,
|
|
|
|
sleeps for the specified number of seconds,
|
|
|
|
and then unblocks the timer signal.
|
|
|
|
Assuming that the timer expired at least once while the program slept,
|
|
|
|
the signal handler will be invoked,
|
|
|
|
and the handler displays some information about the timer notification.
|
|
|
|
The program terminates after one invocation of the signal handler.
|
|
|
|
|
|
|
|
In the following example run, the program sleeps for 1 second,
|
|
|
|
after creating a timer that has a frequency of 100 nanoseconds.
|
|
|
|
By the time the signal is unblocked and delivered,
|
|
|
|
there have been around ten million overruns.
|
|
|
|
.in +4n
|
|
|
|
.nf
|
|
|
|
|
2011-09-07 19:30:13 +00:00
|
|
|
$ \fB./a.out 1 100\fP
|
2009-02-10 00:35:25 +00:00
|
|
|
Establishing handler for signal 34
|
|
|
|
Blocking signal 34
|
|
|
|
timer ID is 0x804c008
|
|
|
|
Sleeping for 1 seconds
|
|
|
|
Unblocking signal 34
|
|
|
|
Caught signal 34
|
|
|
|
sival_ptr = 0xbfb174f4; *sival_ptr = 0x804c008
|
|
|
|
overrun count = 10004886
|
|
|
|
.fi
|
|
|
|
.in
|
intro.1, time.1, _syscall.2, accept.2, brk.2, capget.2, faccessat.2, futimesat.2, gethostname.2, intro.2, ioprio_set.2, kill.2, madvise.2, mlock.2, mount.2, msgget.2, perf_event_open.2, poll.2, readv.2, sched_rr_get_interval.2, sched_setscheduler.2, select.2, select_tut.2, shmget.2, stat.2, timer_create.2, ustat.2, vfork.2, wait.2, alloca.3, atexit.3, catopen.3, crypt.3, dbopen.3, fenv.3, fopen.3, getaddrinfo_a.3, gethostbyname.3, getutent.3, intro.3, login.3, mallopt.3, queue.3, regex.3, sigpause.3, sigsetops.3, stdio.3, strftime.3, strptime.3, sysconf.3, ttyslot.3, undocumented.3, cciss.4, console_codes.4, hpsa.4, initrd.4, intro.4, rtc.4, st.4, tty_ioctl.4, wavelan.4, acct.5, charmap.5, dir_colors.5, hosts.5, intro.5, termcap.5, utmp.5, intro.6, armscii-8.7, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, ddp.7, epoll.7, glob.7, intro.7, ip.7, ipv6.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, koi8-r.7, koi8-u.7, man-pages.7, man.7, math_error.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, pthreads.7, raw.7, rtnetlink.7, signal.7, socket.7, spufs.7, svipc.7, tcp.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, intro.8: Global fix: use consistent capitalization in .SS headings
Capitalization in .SS sections across pages (and sometimes even
within a single page) is wildly inconsistent. Make it consistent.
Capitalize first word in heading, but otherwise use lower case,
except where English usage (e.g., proper nouns) or programming
language requirements (e.g., identifier names) dictate otherwise.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 14:08:38 +00:00
|
|
|
.SS Program source
|
2009-02-10 00:35:25 +00:00
|
|
|
\&
|
|
|
|
.nf
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#define CLOCKID CLOCK_REALTIME
|
2009-02-10 08:41:59 +00:00
|
|
|
#define SIG SIGRTMIN
|
2009-02-10 00:35:25 +00:00
|
|
|
|
|
|
|
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_siginfo(siginfo_t *si)
|
|
|
|
{
|
|
|
|
timer_t *tidp;
|
|
|
|
int or;
|
|
|
|
|
|
|
|
tidp = si\->si_value.sival_ptr;
|
|
|
|
|
|
|
|
printf(" sival_ptr = %p; ", si\->si_value.sival_ptr);
|
|
|
|
printf(" *sival_ptr = 0x%lx\\n", (long) *tidp);
|
|
|
|
|
|
|
|
or = timer_getoverrun(*tidp);
|
|
|
|
if (or == \-1)
|
|
|
|
errExit("timer_getoverrun");
|
|
|
|
else
|
|
|
|
printf(" overrun count = %d\\n", or);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
handler(int sig, siginfo_t *si, void *uc)
|
|
|
|
{
|
|
|
|
/* Note: calling printf() from a signal handler is not
|
|
|
|
strictly correct, since printf() is not async\-signal\-safe;
|
|
|
|
see signal(7) */
|
|
|
|
|
|
|
|
printf("Caught signal %d\\n", sig);
|
|
|
|
print_siginfo(si);
|
2009-02-10 08:41:04 +00:00
|
|
|
signal(sig, SIG_IGN);
|
2009-02-10 00:35:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
timer_t timerid;
|
|
|
|
struct sigevent sev;
|
|
|
|
struct itimerspec its;
|
|
|
|
long long freq_nanosecs;
|
|
|
|
sigset_t mask;
|
|
|
|
struct sigaction sa;
|
|
|
|
|
|
|
|
if (argc != 3) {
|
|
|
|
fprintf(stderr, "Usage: %s <sleep\-secs> <freq\-nanosecs>\\n",
|
|
|
|
argv[0]);
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Establish handler for timer signal */
|
|
|
|
|
|
|
|
printf("Establishing handler for signal %d\\n", SIG);
|
|
|
|
sa.sa_flags = SA_SIGINFO;
|
|
|
|
sa.sa_sigaction = handler;
|
|
|
|
sigemptyset(&sa.sa_mask);
|
|
|
|
if (sigaction(SIG, &sa, NULL) == \-1)
|
|
|
|
errExit("sigaction");
|
|
|
|
|
|
|
|
/* Block timer signal temporarily */
|
|
|
|
|
|
|
|
printf("Blocking signal %d\\n", SIG);
|
|
|
|
sigemptyset(&mask);
|
|
|
|
sigaddset(&mask, SIG);
|
|
|
|
if (sigprocmask(SIG_SETMASK, &mask, NULL) == \-1)
|
|
|
|
errExit("sigprocmask");
|
|
|
|
|
|
|
|
/* Create the timer */
|
|
|
|
|
|
|
|
sev.sigev_notify = SIGEV_SIGNAL;
|
|
|
|
sev.sigev_signo = SIG;
|
|
|
|
sev.sigev_value.sival_ptr = &timerid;
|
|
|
|
if (timer_create(CLOCKID, &sev, &timerid) == \-1)
|
|
|
|
errExit("timer_create");
|
|
|
|
|
|
|
|
printf("timer ID is 0x%lx\\n", (long) timerid);
|
|
|
|
|
|
|
|
/* Start the timer */
|
|
|
|
|
|
|
|
freq_nanosecs = atoll(argv[2]);
|
|
|
|
its.it_value.tv_sec = freq_nanosecs / 1000000000;
|
|
|
|
its.it_value.tv_nsec = freq_nanosecs % 1000000000;
|
|
|
|
its.it_interval.tv_sec = its.it_value.tv_sec;
|
|
|
|
its.it_interval.tv_nsec = its.it_value.tv_nsec;
|
|
|
|
|
|
|
|
if (timer_settime(timerid, 0, &its, NULL) == \-1)
|
|
|
|
errExit("timer_settime");
|
|
|
|
|
|
|
|
/* Sleep for a while; meanwhile, the timer may expire
|
|
|
|
multiple times */
|
|
|
|
|
|
|
|
printf("Sleeping for %d seconds\\n", atoi(argv[1]));
|
|
|
|
sleep(atoi(argv[1]));
|
|
|
|
|
|
|
|
/* Unlock the timer signal, so that timer notification
|
|
|
|
can be delivered */
|
|
|
|
|
|
|
|
printf("Unblocking signal %d\\n", SIG);
|
|
|
|
if (sigprocmask(SIG_UNBLOCK, &mask, NULL) == \-1)
|
|
|
|
errExit("sigprocmask");
|
|
|
|
|
|
|
|
exit(EXIT_SUCCESS);
|
|
|
|
}
|
|
|
|
.fi
|
|
|
|
.SH SEE ALSO
|
sched_get_priority_max.2, sched_setparam.2, sched_setaffinity.2, sched_setscheduler.2, timer_create.2, malloc.3, pthread_attr_init.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setstack.3, pthread_getattr_np.3, pthread_cancel.3, pthread_create.3, pthread_setschedparam.3, pthread_setschedprio.3, aio.7, time.7: Global ffix: disable justification and hyphenation in SEE ALSO
For a better visual result, disable justification and hyphenation
in SEE ALSO where page names are long.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-09-25 04:34:17 +00:00
|
|
|
.ad l
|
|
|
|
.nh
|
2009-02-10 00:35:25 +00:00
|
|
|
.BR clock_gettime (2),
|
|
|
|
.BR setitimer (2),
|
|
|
|
.BR timer_delete (2),
|
|
|
|
.BR timer_getoverrun (2),
|
clock_nanosleep.2, getpriority.2, kexec_load.2, nanosleep.2, nice.2, sched_setaffinity.2, timer_create.2, timer_delete.2, timer_settime.2, utime.2, btowc.3, futimes.3, log.3, pthread_attr_setguardsize.3, pthread_kill_other_threads_np.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setschedparam.3, pthread_setschedprio.3, pthread_tryjoin_np.3, strcoll.3, strcpy.3, string.3, strxfrm.3, networks.5, aio.7, sigevent.7, udplite.7: SEE ALSO: Place entries in correct order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2010-11-01 05:34:26 +00:00
|
|
|
.BR timer_settime (2),
|
2009-02-10 00:35:25 +00:00
|
|
|
.BR timerfd_create (2),
|
|
|
|
.BR clock_getcpuclockid (3),
|
|
|
|
.BR pthread_getcpuclockid (3),
|
|
|
|
.BR pthreads (7),
|
2010-09-21 04:59:02 +00:00
|
|
|
.BR sigevent (7),
|
2009-02-10 00:35:25 +00:00
|
|
|
.BR signal (7),
|
|
|
|
.BR time (7)
|