2004-11-03 13:51:07 +00:00
|
|
|
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
|
2014-01-22 06:18:09 +00:00
|
|
|
.\" and Copyright (C) 1993 Michael Haardt, Ian Jackson.
|
|
|
|
.\" and Copyright (C) 2008 Greg Banks
|
2014-02-21 06:33:19 +00:00
|
|
|
.\" and Copyright (C) 2006, 2008, 2013, 2014 Michael Kerrisk <mtk.manpages@gmail.com>
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
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)
|
2004-11-03 13:51:07 +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.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" 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.
|
2007-04-12 22:42:49 +00:00
|
|
|
.\"
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" 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
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
|
|
|
.\" Modified 1993-07-21 by Rik Faith <faith@cs.unc.edu>
|
|
|
|
.\" Modified 1994-08-21 by Michael Haardt
|
|
|
|
.\" Modified 1996-04-13 by Andries Brouwer <aeb@cwi.nl>
|
|
|
|
.\" Modified 1996-05-13 by Thomas Koenig
|
|
|
|
.\" Modified 1996-12-20 by Michael Haardt
|
|
|
|
.\" Modified 1999-02-19 by Andries Brouwer <aeb@cwi.nl>
|
|
|
|
.\" Modified 1998-11-28 by Joseph S. Myers <jsm28@hermes.cam.ac.uk>
|
|
|
|
.\" Modified 1999-06-03 by Michael Haardt
|
2007-09-20 06:52:22 +00:00
|
|
|
.\" Modified 2002-05-07 by Michael Kerrisk <mtk.manpages@gmail.com>
|
|
|
|
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
|
2004-12-08 16:41:10 +00:00
|
|
|
.\" 2004-12-08, mtk, reordered flags list alphabetically
|
|
|
|
.\" 2004-12-08, Martin Pool <mbp@sourcefrog.net> (& mtk), added O_NOATIME
|
2007-09-10 04:34:20 +00:00
|
|
|
.\" 2007-09-18, mtk, Added description of O_CLOEXEC + other minor edits
|
2008-01-03 16:06:22 +00:00
|
|
|
.\" 2008-01-03, mtk, with input from Trond Myklebust
|
2008-01-03 08:12:02 +00:00
|
|
|
.\" <trond.myklebust@fys.uio.no> and Timo Sirainen <tss@iki.fi>
|
|
|
|
.\" Rewrite description of O_EXCL.
|
2008-02-11 10:38:24 +00:00
|
|
|
.\" 2008-01-11, Greg Banks <gnb@melbourne.sgi.com>: add more detail
|
|
|
|
.\" on O_DIRECT.
|
2008-05-12 14:38:18 +00:00
|
|
|
.\" 2008-02-26, Michael Haardt: Reorganized text for O_CREAT and mode
|
2004-11-03 13:51:07 +00:00
|
|
|
.\"
|
2008-05-12 14:30:24 +00:00
|
|
|
.\" FIXME . Apr 08: The next POSIX revision has O_EXEC, O_SEARCH, and
|
2008-04-08 11:28:12 +00:00
|
|
|
.\" O_TTYINIT. Eventually these may need to be documented. --mtk
|
|
|
|
.\"
|
_exit.2, alarm.2, chmod.2, clone.2, epoll_ctl.2, fcntl.2, fork.2, fsync.2, getdents.2, getpid.2, ioctl.2, ioctl_console.2, ioctl_list.2, ioctl_ns.2, ioctl_tty.2, ioctl_userfaultfd.2, kexec_load.2, lseek.2, mincore.2, mkdir.2, mknod.2, mmap.2, open.2, poll.2, posix_fadvise.2, prctl.2, rename.2, sched_setaffinity.2, select.2, select_tut.2, sigaction.2, signalfd.2, sigprocmask.2, sigwaitinfo.2, socketcall.2, stat.2, statx.2, syscalls.2, truncate.2, umask.2, unshare.2, userfaultfd.2, utime.2, utimensat.2, wait.2, bzero.3, cfree.3, exit.3, getentropy.3, grantpt.3, insque.3, shm_open.3, syslog.3, termios.3, ttyname.3, wcsdup.3, console_codes.4, tty.4, vcs.4, elf.5, nsswitch.conf.5, proc.5, slabinfo.5, tmpfs.5, bootparam.7, environ.7, hostname.7, inotify.7, mailaddr.7, man-pages.7, namespaces.7, pid_namespaces.7, pthreads.7, pty.7, sem_overview.7, signal.7, socket.7, tcp.7, termio.7, user_namespaces.7, xattr.7, ld.so.8, zdump.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2017-05-03 17:27:48 +00:00
|
|
|
.TH OPEN 2 2017-05-03 "Linux" "Linux Programmer's Manual"
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH NAME
|
2014-02-21 06:33:19 +00:00
|
|
|
open, openat, creat \- open and possibly create a file
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH SYNOPSIS
|
|
|
|
.nf
|
|
|
|
.B #include <sys/types.h>
|
|
|
|
.B #include <sys/stat.h>
|
|
|
|
.B #include <fcntl.h>
|
|
|
|
.sp
|
|
|
|
.BI "int open(const char *" pathname ", int " flags );
|
|
|
|
.BI "int open(const char *" pathname ", int " flags ", mode_t " mode );
|
2007-12-23 13:45:24 +00:00
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
.BI "int creat(const char *" pathname ", mode_t " mode );
|
2014-02-21 06:33:19 +00:00
|
|
|
.sp
|
|
|
|
.BI "int openat(int " dirfd ", const char *" pathname ", int " flags );
|
|
|
|
.BI "int openat(int " dirfd ", const char *" pathname ", int " flags \
|
|
|
|
", mode_t " mode );
|
2004-11-03 13:51:07 +00:00
|
|
|
.fi
|
2014-02-21 06:33:19 +00:00
|
|
|
.sp
|
|
|
|
.in -4n
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
|
|
.BR feature_test_macros (7)):
|
|
|
|
.in
|
|
|
|
.sp
|
|
|
|
.BR openat ():
|
|
|
|
.PD 0
|
|
|
|
.ad l
|
|
|
|
.RS 4
|
|
|
|
.TP 4
|
|
|
|
Since glibc 2.10:
|
access.2, chmod.2, chown.2, link.2, mkdir.2, open.2, readlink.2, rename.2, stat.2, symlink.2, unlink.2, utimensat.2, vfork.2, dirfd.3, fexecve.3, ffs.3, fmemopen.3, getcwd.3, gethostbyname.3, getline.3, mbsnrtowcs.3, mkdtemp.3, mkfifo.3, opendir.3, printf.3, psignal.3, qecvt.3, scandir.3, stpcpy.3, stpncpy.3, strdup.3, strnlen.3, strsignal.3, ualarm.3, usleep.3, wcpcpy.3, wcpncpy.3, wcscasecmp.3, wcsdup.3, wcsncasecmp.3, wcsnlen.3, wcsnrtombs.3: Simply FTM requirements
Looking at <features.h> (or feature_test_macros(7)), one can
see that when _XOPEN_SOURCE is defined with the value 700
(or greater), then _POSIX_C_SOURCE is defined with the value
200809L (or greater). Therefore, terms in the man pages such as
_XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
can be simpified to:
_POSIX_C_SOURCE\ >=\ 200809L
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-02-08 11:46:05 +00:00
|
|
|
_POSIX_C_SOURCE\ >=\ 200809L
|
2014-02-21 06:33:19 +00:00
|
|
|
.TP
|
|
|
|
Before glibc 2.10:
|
|
|
|
_ATFILE_SOURCE
|
|
|
|
.RE
|
|
|
|
.ad
|
|
|
|
.PD
|
2004-11-03 13:51:07 +00:00
|
|
|
.SH DESCRIPTION
|
2005-06-22 09:52:33 +00:00
|
|
|
Given a
|
2007-09-20 16:26:31 +00:00
|
|
|
.I pathname
|
2005-06-22 09:52:33 +00:00
|
|
|
for a file,
|
2005-06-21 10:04:56 +00:00
|
|
|
.BR open ()
|
_syscall.2, accept.2, epoll_create.2, inotify_add_watch.2, ioctl.2, msgget.2, msgop.2, open.2, prctl.2, sched_setscheduler.2, semctl.2, semget.2, swapon.2, addseverity.3, cacosh.3, csqrt.3, dirfd.3, drand48.3, fputws.3, mq_send.3, posix_openpt.3, puts.3, sched_getcpu.3, shm_open.3, sqrt.3, sysconf.3, tgamma.3, ulimit.3, credentials.7, svipc.7: Global fix: s/non-negative/nonnegative/
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 16:44:48 +00:00
|
|
|
returns a file descriptor, a small, nonnegative integer
|
2005-06-22 09:52:33 +00:00
|
|
|
for use in subsequent system calls
|
|
|
|
.RB ( read "(2), " write "(2), " lseek "(2), " fcntl "(2), etc.)."
|
|
|
|
The file descriptor returned by a successful call will be
|
2005-06-27 15:35:32 +00:00
|
|
|
the lowest-numbered file descriptor not currently open for the process.
|
2005-06-22 09:52:33 +00:00
|
|
|
.PP
|
2007-09-10 04:34:20 +00:00
|
|
|
By default, the new file descriptor is set to remain open across an
|
2005-06-22 09:52:33 +00:00
|
|
|
.BR execve (2)
|
2005-06-21 10:04:56 +00:00
|
|
|
(i.e., the
|
|
|
|
.B FD_CLOEXEC
|
|
|
|
file descriptor flag described in
|
2014-08-04 21:26:22 +00:00
|
|
|
.BR fcntl (2)
|
|
|
|
is initially disabled); the
|
2007-09-10 04:34:20 +00:00
|
|
|
.B O_CLOEXEC
|
2014-05-19 09:06:18 +00:00
|
|
|
flag, described below, can be used to change this default.
|
2005-06-21 10:04:56 +00:00
|
|
|
The file offset is set to the beginning of the file (see
|
2007-04-12 22:42:49 +00:00
|
|
|
.BR lseek (2)).
|
2005-06-22 09:52:33 +00:00
|
|
|
.PP
|
|
|
|
A call to
|
|
|
|
.BR open ()
|
|
|
|
creates a new
|
|
|
|
.IR "open file description" ,
|
|
|
|
an entry in the system-wide table of open files.
|
2014-04-22 04:21:16 +00:00
|
|
|
The open file description records the file offset and the file status flags
|
2014-04-22 04:47:13 +00:00
|
|
|
(see below).
|
2014-04-22 04:21:16 +00:00
|
|
|
A file descriptor is a reference to an open file description;
|
2005-06-27 15:35:32 +00:00
|
|
|
this reference is unaffected if
|
|
|
|
.I pathname
|
|
|
|
is subsequently removed or modified to refer to a different file.
|
2014-05-01 05:28:52 +00:00
|
|
|
For further details on open file descriptions, see NOTES.
|
2005-06-22 09:52:33 +00:00
|
|
|
.PP
|
2008-07-10 20:53:08 +00:00
|
|
|
The argument
|
2004-11-03 13:51:07 +00:00
|
|
|
.I flags
|
2005-06-22 09:52:33 +00:00
|
|
|
must include one of the following
|
|
|
|
.IR "access modes" :
|
2007-12-05 13:47:50 +00:00
|
|
|
.BR O_RDONLY ", " O_WRONLY ", or " O_RDWR .
|
2005-06-22 09:52:33 +00:00
|
|
|
These request opening the file read-only, write-only, or read/write,
|
|
|
|
respectively.
|
2006-02-02 03:25:41 +00:00
|
|
|
|
|
|
|
In addition, zero or more file creation flags and file status flags
|
2007-04-12 22:42:49 +00:00
|
|
|
can be
|
2004-11-03 13:51:07 +00:00
|
|
|
.RI bitwise- or 'd
|
2005-06-22 09:52:33 +00:00
|
|
|
in
|
2006-02-02 03:25:41 +00:00
|
|
|
.IR flags .
|
2007-04-12 22:42:49 +00:00
|
|
|
The
|
|
|
|
.I file creation flags
|
|
|
|
are
|
2013-02-18 08:05:25 +00:00
|
|
|
.BR O_CLOEXEC ,
|
2013-03-05 17:22:04 +00:00
|
|
|
.BR O_CREAT ,
|
2013-02-18 08:05:25 +00:00
|
|
|
.BR O_DIRECTORY ,
|
|
|
|
.BR O_EXCL ,
|
|
|
|
.BR O_NOCTTY ,
|
|
|
|
.BR O_NOFOLLOW ,
|
2013-08-07 17:31:58 +00:00
|
|
|
.BR O_TMPFILE ,
|
2013-02-18 08:05:25 +00:00
|
|
|
and
|
2015-08-14 16:04:52 +00:00
|
|
|
.BR O_TRUNC .
|
2007-04-12 22:42:49 +00:00
|
|
|
The
|
|
|
|
.I file status flags
|
2006-02-02 03:25:41 +00:00
|
|
|
are all of the remaining flags listed below.
|
2013-02-18 08:05:25 +00:00
|
|
|
.\" SUSv4 divides the flags into:
|
2008-10-10 13:42:34 +00:00
|
|
|
.\" * Access mode
|
|
|
|
.\" * File creation
|
|
|
|
.\" * File status
|
|
|
|
.\" * Other (O_CLOEXEC, O_DIRECTORY, O_NOFOLLOW)
|
|
|
|
.\" though it's not clear what the difference between "other" and
|
2013-02-18 08:05:25 +00:00
|
|
|
.\" "File creation" flags is. I raised an Aardvark to see if this
|
|
|
|
.\" can be clarified in SUSv4; 10 Oct 2008.
|
|
|
|
.\" http://thread.gmane.org/gmane.comp.standards.posix.austin.general/64/focus=67
|
|
|
|
.\" TC1 (balloted in 2013), resolved this, so that those three constants
|
|
|
|
.\" are also categorized" as file status flags.
|
|
|
|
.\"
|
2006-02-02 03:25:41 +00:00
|
|
|
The distinction between these two groups of flags is that
|
2017-01-25 21:36:47 +00:00
|
|
|
the file creation flags affect the semantics of the open operation itself,
|
|
|
|
while the file status flags affect the semantics of subsequent I/O operations.
|
|
|
|
The file status flags can be retrieved and (in some cases)
|
2014-01-21 07:57:56 +00:00
|
|
|
modified; see
|
|
|
|
.BR fcntl (2)
|
|
|
|
for details.
|
|
|
|
|
2006-02-02 03:25:41 +00:00
|
|
|
The full list of file creation flags and file status flags is as follows:
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2004-12-08 16:41:10 +00:00
|
|
|
.B O_APPEND
|
2007-04-12 22:42:49 +00:00
|
|
|
The file is opened in append mode.
|
|
|
|
Before each
|
2007-05-11 23:07:02 +00:00
|
|
|
.BR write (2),
|
2005-07-18 17:10:25 +00:00
|
|
|
the file offset is positioned at the end of the file,
|
2004-12-08 16:41:10 +00:00
|
|
|
as if with
|
2007-05-11 23:07:02 +00:00
|
|
|
.BR lseek (2).
|
2017-03-11 23:01:45 +00:00
|
|
|
The modification of the file offset and the write operation
|
2017-02-21 07:42:43 +00:00
|
|
|
are performed as a single atomic step.
|
|
|
|
|
2004-12-08 16:41:10 +00:00
|
|
|
.B O_APPEND
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
may lead to corrupted files on NFS filesystems if more than one process
|
2007-04-12 22:42:49 +00:00
|
|
|
appends data to a file at once.
|
2008-10-29 16:31:22 +00:00
|
|
|
.\" For more background, see
|
|
|
|
.\" http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453946
|
|
|
|
.\" http://nfs.sourceforge.net/
|
2007-04-12 22:42:49 +00:00
|
|
|
This is because NFS does not support
|
2004-12-08 16:41:10 +00:00
|
|
|
appending to a file, so the client kernel has to simulate it, which
|
|
|
|
can't be done without a race condition.
|
|
|
|
.TP
|
|
|
|
.B O_ASYNC
|
2006-01-15 04:39:23 +00:00
|
|
|
Enable signal-driven I/O:
|
2007-06-21 05:38:48 +00:00
|
|
|
generate a signal
|
|
|
|
.RB ( SIGIO
|
|
|
|
by default, but this can be changed via
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR fcntl (2))
|
|
|
|
when input or output becomes possible on this file descriptor.
|
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 feature is available only for terminals, pseudoterminals,
|
2005-06-21 10:04:56 +00:00
|
|
|
sockets, and (since Linux 2.6) pipes and FIFOs.
|
|
|
|
See
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR fcntl (2)
|
|
|
|
for further details.
|
2014-01-21 06:28:03 +00:00
|
|
|
See also BUGS, below.
|
2007-09-10 04:34:20 +00:00
|
|
|
.TP
|
2014-01-21 02:40:40 +00:00
|
|
|
.BR O_CLOEXEC " (since Linux 2.6.23)"
|
2014-04-22 19:02:45 +00:00
|
|
|
.\" NOTE! several other man pages refer to this text
|
2007-09-10 04:34:20 +00:00
|
|
|
Enable the close-on-exec flag for the new file descriptor.
|
2016-12-05 14:57:37 +00:00
|
|
|
.\" FIXME . for later review when Issue 8 is one day released...
|
|
|
|
.\" POSIX proposes to fix many APIs that provide hidden FDs
|
|
|
|
.\" http://austingroupbugs.net/tag_view_page.php?tag_id=8
|
|
|
|
.\" http://austingroupbugs.net/view.php?id=368
|
2008-10-10 12:01:50 +00:00
|
|
|
Specifying this flag permits a program to avoid additional
|
2007-09-10 04:34:20 +00:00
|
|
|
.BR fcntl (2)
|
|
|
|
.B F_SETFD
|
2008-10-10 12:01:50 +00:00
|
|
|
operations to set the
|
2007-09-20 16:26:31 +00:00
|
|
|
.B FD_CLOEXEC
|
2007-09-10 04:34:20 +00:00
|
|
|
flag.
|
2014-04-20 05:45:21 +00:00
|
|
|
|
|
|
|
Note that the use of this flag is essential in some multithreaded programs,
|
|
|
|
because using a separate
|
2007-09-10 04:34:20 +00:00
|
|
|
.BR fcntl (2)
|
|
|
|
.B F_SETFD
|
|
|
|
operation to set the
|
2007-09-20 16:26:31 +00:00
|
|
|
.B FD_CLOEXEC
|
2007-09-10 04:34:20 +00:00
|
|
|
flag does not suffice to avoid race conditions
|
2014-04-20 05:45:21 +00:00
|
|
|
where one thread opens a file descriptor and
|
|
|
|
attempts to set its close-on-exec flag using
|
|
|
|
.BR fcntl (2)
|
|
|
|
at the same time as another thread does a
|
2007-09-10 04:34:20 +00:00
|
|
|
.BR fork (2)
|
|
|
|
plus
|
|
|
|
.BR execve (2).
|
2014-04-20 05:45:21 +00:00
|
|
|
Depending on the order of execution,
|
2014-05-08 08:09:17 +00:00
|
|
|
the race may lead to the file descriptor returned by
|
2014-04-20 05:45:21 +00:00
|
|
|
.BR open ()
|
|
|
|
being unintentionally leaked to the program executed by the child process
|
|
|
|
created by
|
|
|
|
.BR fork (2).
|
|
|
|
(This kind of race is in principle possible for any system call
|
|
|
|
that creates a file descriptor whose close-on-exec flag should be set,
|
|
|
|
and various other Linux system calls provide an equivalent of the
|
|
|
|
.BR O_CLOEXEC
|
|
|
|
flag to deal with this problem.)
|
2007-09-10 04:34:20 +00:00
|
|
|
.\" This flag fixes only one form of the race condition;
|
2016-01-01 10:45:50 +00:00
|
|
|
.\" The race can also occur with, for example, file descriptors
|
2007-09-10 04:34:20 +00:00
|
|
|
.\" returned by accept(), pipe(), etc.
|
2004-12-08 16:41:10 +00:00
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B O_CREAT
|
2014-03-26 04:32:23 +00:00
|
|
|
If the file does not exist, it will be created.
|
2016-09-12 06:19:47 +00:00
|
|
|
|
2016-09-12 06:20:45 +00:00
|
|
|
The owner (user ID) of the new file is set to the effective user ID
|
2007-04-12 22:42:49 +00:00
|
|
|
of the process.
|
2016-09-12 06:29:15 +00:00
|
|
|
|
|
|
|
The group ownership (group ID) of the new file is set either to
|
|
|
|
the effective group ID of the process (System V semantics)
|
|
|
|
or to the group ID of the parent directory (BSD semantics).
|
|
|
|
On Linux, the behavior depends on whether the
|
|
|
|
set-group-ID mode bit is set on the parent directory:
|
|
|
|
if that bit is set, then BSD semantics apply;
|
|
|
|
otherwise, System V semantics apply.
|
|
|
|
For some filesystems, the behavior also depends on the
|
2004-11-03 13:51:07 +00:00
|
|
|
.I bsdgroups
|
|
|
|
and
|
|
|
|
.I sysvgroups
|
2016-09-12 06:29:15 +00:00
|
|
|
mount options described in
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR mount (8)).
|
2008-05-13 10:54:22 +00:00
|
|
|
.\" As at 2.6.25, bsdgroups is supported by ext2, ext3, ext4, and
|
|
|
|
.\" XFS (since 2.6.14).
|
2008-02-28 14:47:54 +00:00
|
|
|
.RS
|
|
|
|
.PP
|
2016-02-13 16:55:10 +00:00
|
|
|
The
|
2008-02-28 14:47:54 +00:00
|
|
|
.I mode
|
2016-02-13 16:55:10 +00:00
|
|
|
argument specifies the file mode bits be applied when a new file is created.
|
2008-02-28 14:47:54 +00:00
|
|
|
This argument must be supplied when
|
|
|
|
.B O_CREAT
|
2013-08-07 17:31:58 +00:00
|
|
|
or
|
|
|
|
.B O_TMPFILE
|
2008-02-28 14:47:54 +00:00
|
|
|
is specified in
|
|
|
|
.IR flags ;
|
2013-08-07 17:31:58 +00:00
|
|
|
if neither
|
2008-02-28 14:47:54 +00:00
|
|
|
.B O_CREAT
|
2013-08-07 17:31:58 +00:00
|
|
|
nor
|
|
|
|
.B O_TMPFILE
|
|
|
|
is specified, then
|
2008-02-28 14:47:54 +00:00
|
|
|
.I mode
|
|
|
|
is ignored.
|
2015-04-21 11:58:45 +00:00
|
|
|
The effective mode is modified by the process's
|
2008-02-28 14:47:54 +00:00
|
|
|
.I umask
|
2015-04-21 11:58:45 +00:00
|
|
|
in the usual way: in the absence of a default ACL, the mode of the
|
|
|
|
created file is
|
2008-04-24 09:36:45 +00:00
|
|
|
.IR "(mode\ &\ ~umask)" .
|
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
|
|
|
Note that this mode applies only to future accesses of the
|
2008-02-28 14:47:54 +00:00
|
|
|
newly created file; the
|
|
|
|
.BR open ()
|
|
|
|
call that creates a read-only file may well return a read/write
|
|
|
|
file descriptor.
|
|
|
|
.PP
|
|
|
|
The following symbolic constants are provided for
|
|
|
|
.IR mode :
|
|
|
|
.TP 9
|
|
|
|
.B S_IRWXU
|
2015-05-06 15:57:32 +00:00
|
|
|
00700 user (file owner) has read, write, and execute permission
|
2008-02-28 14:47:54 +00:00
|
|
|
.TP
|
|
|
|
.B S_IRUSR
|
|
|
|
00400 user has read permission
|
|
|
|
.TP
|
|
|
|
.B S_IWUSR
|
|
|
|
00200 user has write permission
|
|
|
|
.TP
|
|
|
|
.B S_IXUSR
|
|
|
|
00100 user has execute permission
|
|
|
|
.TP
|
|
|
|
.B S_IRWXG
|
2015-05-06 15:57:32 +00:00
|
|
|
00070 group has read, write, and execute permission
|
2008-02-28 14:47:54 +00:00
|
|
|
.TP
|
|
|
|
.B S_IRGRP
|
|
|
|
00040 group has read permission
|
|
|
|
.TP
|
|
|
|
.B S_IWGRP
|
|
|
|
00020 group has write permission
|
|
|
|
.TP
|
|
|
|
.B S_IXGRP
|
|
|
|
00010 group has execute permission
|
|
|
|
.TP
|
|
|
|
.B S_IRWXO
|
2015-05-06 15:57:32 +00:00
|
|
|
00007 others have read, write, and execute permission
|
2008-02-28 14:47:54 +00:00
|
|
|
.TP
|
|
|
|
.B S_IROTH
|
|
|
|
00004 others have read permission
|
|
|
|
.TP
|
|
|
|
.B S_IWOTH
|
|
|
|
00002 others have write permission
|
|
|
|
.TP
|
|
|
|
.B S_IXOTH
|
|
|
|
00001 others have execute permission
|
|
|
|
.RE
|
2015-04-21 12:25:11 +00:00
|
|
|
.IP
|
|
|
|
According to POSIX, the effect when other bits are set in
|
|
|
|
.I mode
|
|
|
|
is unspecified.
|
|
|
|
On Linux, the following bits are also honored in
|
|
|
|
.IR mode :
|
|
|
|
.RS
|
|
|
|
.TP 9
|
|
|
|
.B S_ISUID
|
|
|
|
0004000 set-user-ID bit
|
|
|
|
.TP
|
|
|
|
.B S_ISGID
|
|
|
|
0002000 set-group-ID bit (see
|
2017-04-22 20:05:37 +00:00
|
|
|
.BR inode (7)).
|
2015-04-21 12:25:11 +00:00
|
|
|
.TP
|
|
|
|
.B S_ISVTX
|
|
|
|
0001000 sticky bit (see
|
2017-04-22 20:05:37 +00:00
|
|
|
.BR inode (7)).
|
2015-04-21 12:25:11 +00:00
|
|
|
.RE
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2014-01-21 02:40:40 +00:00
|
|
|
.BR O_DIRECT " (since Linux 2.4.10)"
|
2004-12-08 16:41:10 +00:00
|
|
|
Try to minimize cache effects of the I/O to and from this file.
|
|
|
|
In general this will degrade performance, but it is useful in
|
|
|
|
special situations, such as when applications do their own caching.
|
2013-02-18 14:18:52 +00:00
|
|
|
File I/O is done directly to/from user-space buffers.
|
2009-09-20 05:41:16 +00:00
|
|
|
The
|
|
|
|
.B O_DIRECT
|
2012-02-12 21:22:05 +00:00
|
|
|
flag on its own makes an effort to transfer data synchronously,
|
2009-09-20 05:41:16 +00:00
|
|
|
but does not give the guarantees of the
|
|
|
|
.B O_SYNC
|
2012-02-12 21:22:05 +00:00
|
|
|
flag that data and necessary metadata are transferred.
|
|
|
|
To guarantee synchronous I/O,
|
2009-09-20 05:41:16 +00:00
|
|
|
.B O_SYNC
|
|
|
|
must be used in addition to
|
|
|
|
.BR O_DIRECT .
|
2012-03-23 23:21:11 +00:00
|
|
|
See NOTES below for further discussion.
|
2006-03-12 21:18:47 +00:00
|
|
|
.sp
|
2007-04-12 22:42:49 +00:00
|
|
|
A semantically similar (but deprecated) interface for block devices
|
2006-03-12 21:18:47 +00:00
|
|
|
is described in
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR raw (8).
|
|
|
|
.TP
|
|
|
|
.B O_DIRECTORY
|
2007-07-18 20:24:30 +00:00
|
|
|
If \fIpathname\fP is not a directory, cause the open to fail.
|
2005-10-12 10:35:09 +00:00
|
|
|
.\" But see the following and its replies:
|
|
|
|
.\" http://marc.theaimsgroup.com/?t=112748702800001&r=1&w=2
|
|
|
|
.\" [PATCH] open: O_DIRECTORY and O_CREAT together should fail
|
|
|
|
.\" O_DIRECTORY | O_CREAT causes O_DIRECTORY to be ignored.
|
2014-04-10 19:11:50 +00:00
|
|
|
This flag was added in kernel version 2.1.126, to
|
2007-05-12 09:06:04 +00:00
|
|
|
avoid denial-of-service problems if
|
|
|
|
.BR opendir (3)
|
|
|
|
is called on a
|
2013-07-20 21:00:28 +00:00
|
|
|
FIFO or tape device.
|
2004-12-08 16:41:10 +00:00
|
|
|
.TP
|
2014-03-16 08:55:02 +00:00
|
|
|
.B O_DSYNC
|
|
|
|
Write operations on the file will complete according to the requirements of
|
|
|
|
synchronized I/O
|
|
|
|
.I data
|
|
|
|
integrity completion.
|
|
|
|
|
|
|
|
By the time
|
|
|
|
.BR write (2)
|
|
|
|
(and similar)
|
|
|
|
return, the output data
|
|
|
|
has been transferred to the underlying hardware,
|
|
|
|
along with any file metadata that would be required to retrieve that data
|
|
|
|
(i.e., as though each
|
|
|
|
.BR write (2)
|
|
|
|
was followed by a call to
|
|
|
|
.BR fdatasync (2)).
|
|
|
|
.IR "See NOTES below" .
|
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B O_EXCL
|
2008-01-03 08:12:02 +00:00
|
|
|
Ensure that this call creates the file:
|
|
|
|
if this flag is specified in conjunction with
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR O_CREAT ,
|
2008-01-03 08:12:02 +00:00
|
|
|
and
|
|
|
|
.I pathname
|
|
|
|
already exists, then
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR open ()
|
2007-04-12 22:42:49 +00:00
|
|
|
will fail.
|
2008-01-03 08:12:02 +00:00
|
|
|
|
|
|
|
When these two flags are specified, symbolic links are not followed:
|
|
|
|
.\" POSIX.1-2001 explicitly requires this behavior.
|
|
|
|
if
|
|
|
|
.I pathname
|
|
|
|
is a symbolic link, then
|
|
|
|
.BR open ()
|
|
|
|
fails regardless of where the symbolic link points to.
|
|
|
|
|
2010-11-15 05:58:11 +00:00
|
|
|
In general, the behavior of
|
|
|
|
.B O_EXCL
|
|
|
|
is undefined if it is used without
|
|
|
|
.BR O_CREAT .
|
|
|
|
There is one exception: on Linux 2.6 and later,
|
|
|
|
.B O_EXCL
|
|
|
|
can be used without
|
|
|
|
.B O_CREAT
|
|
|
|
if
|
|
|
|
.I pathname
|
|
|
|
refers to a block device.
|
2010-12-03 05:53:39 +00:00
|
|
|
If the block device is in use by the system (e.g., mounted),
|
|
|
|
.BR open ()
|
2010-11-15 05:58:11 +00:00
|
|
|
fails with the error
|
|
|
|
.BR EBUSY .
|
|
|
|
|
2010-06-14 02:38:26 +00:00
|
|
|
On NFS,
|
2008-01-03 08:12:02 +00:00
|
|
|
.B O_EXCL
|
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
|
|
|
is supported only when using NFSv3 or later on kernel 2.6 or later.
|
2010-06-14 02:38:26 +00:00
|
|
|
In NFS environments where
|
2004-11-03 13:51:07 +00:00
|
|
|
.B O_EXCL
|
2008-01-03 08:12:02 +00:00
|
|
|
support is not provided, programs that rely on it
|
|
|
|
for performing locking tasks will contain a race condition.
|
|
|
|
Portable programs that want to perform atomic file locking using a lockfile,
|
|
|
|
and need to avoid reliance on NFS support for
|
|
|
|
.BR O_EXCL ,
|
|
|
|
can create a unique file on
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
the same filesystem (e.g., incorporating hostname and PID), and use
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR link (2)
|
2007-04-12 22:42:49 +00:00
|
|
|
to make a link to the lockfile.
|
2007-05-12 09:06:04 +00:00
|
|
|
If
|
|
|
|
.BR link (2)
|
2008-01-03 08:12:02 +00:00
|
|
|
returns 0, the lock is successful.
|
2007-04-12 22:42:49 +00:00
|
|
|
Otherwise, use
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR stat (2)
|
|
|
|
on the unique file to check if its link count has increased to 2,
|
|
|
|
in which case the lock is also successful.
|
|
|
|
.TP
|
2004-12-08 16:41:10 +00:00
|
|
|
.B O_LARGEFILE
|
|
|
|
(LFS)
|
|
|
|
Allow files whose sizes cannot be represented in an
|
2005-11-02 13:55:25 +00:00
|
|
|
.I off_t
|
2004-12-08 16:41:10 +00:00
|
|
|
(but can be represented in an
|
2005-11-02 13:55:25 +00:00
|
|
|
.IR off64_t )
|
2004-12-08 16:41:10 +00:00
|
|
|
to be opened.
|
2007-04-12 22:42:49 +00:00
|
|
|
The
|
2006-11-25 01:00:24 +00:00
|
|
|
.B _LARGEFILE64_SOURCE
|
2010-09-10 04:33:31 +00:00
|
|
|
macro must be defined
|
|
|
|
(before including
|
|
|
|
.I any
|
|
|
|
header files)
|
|
|
|
in order to obtain this definition.
|
2007-04-12 22:42:49 +00:00
|
|
|
Setting the
|
2006-11-25 01:00:24 +00:00
|
|
|
.B _FILE_OFFSET_BITS
|
2006-11-25 18:35:39 +00:00
|
|
|
feature test macro to 64 (rather than using
|
|
|
|
.BR O_LARGEFILE )
|
2011-09-14 07:27:32 +00:00
|
|
|
is the preferred
|
2006-11-25 18:35:39 +00:00
|
|
|
method of accessing large files on 32-bit systems (see
|
2006-11-25 18:22:22 +00:00
|
|
|
.BR feature_test_macros (7)).
|
2004-12-08 16:41:10 +00:00
|
|
|
.TP
|
2014-01-21 02:40:40 +00:00
|
|
|
.BR O_NOATIME " (since Linux 2.6.8)"
|
2013-02-18 14:25:00 +00:00
|
|
|
Do not update the file last access time
|
|
|
|
.RI ( st_atime
|
|
|
|
in the inode)
|
2005-07-19 07:15:17 +00:00
|
|
|
when the file is
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR read (2).
|
2016-09-12 18:10:28 +00:00
|
|
|
|
|
|
|
This flag can be employed only if one of the following conditions is true:
|
|
|
|
.RS
|
|
|
|
.IP * 3
|
|
|
|
The effective UID of the process
|
|
|
|
.\" Strictly speaking: the filesystem UID
|
|
|
|
matches the owner UID of the file.
|
|
|
|
.IP *
|
|
|
|
The calling process has the
|
|
|
|
.BR CAP_FOWNER
|
|
|
|
capability in its user namespace and
|
|
|
|
the owner UID of the file has a mapping in the namespace.
|
|
|
|
.RE
|
|
|
|
.IP
|
2004-12-08 16:41:10 +00:00
|
|
|
This flag is intended for use by indexing or backup programs,
|
|
|
|
where its use can significantly reduce the amount of disk activity.
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
This flag may not be effective on all filesystems.
|
2004-12-08 16:41:10 +00:00
|
|
|
One example is NFS, where the server maintains the access time.
|
2007-06-13 21:48:16 +00:00
|
|
|
.\" The O_NOATIME flag also affects the treatment of st_atime
|
2006-02-08 09:44:13 +00:00
|
|
|
.\" by mmap() and readdir(2), MTK, Dec 04.
|
2004-12-08 16:41:10 +00:00
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B O_NOCTTY
|
|
|
|
If
|
|
|
|
.I pathname
|
intro.1, fork.2, futex.2, open.2, rename.2, select_tut.2, semop.2, spu_create.2, stat.2, netlink.3, random.3, scanf.3, shm_open.3, strftime.3, console.4, console_codes.4, sk98lin.4, st.4, bootparam.7, cpuset.7, credentials.7, man-pages.7, path_resolution.7, uri.7: Global fix: remove spaces around em-dash
Normal English typographical convention is not to have
spaces around em dashes.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2011-10-03 06:47:35 +00:00
|
|
|
refers to a terminal device\(emsee
|
2013-02-18 14:25:00 +00:00
|
|
|
.BR tty (4)\(emit
|
|
|
|
will not become the process's controlling terminal even if the
|
2004-11-03 13:51:07 +00:00
|
|
|
process does not have one.
|
|
|
|
.TP
|
2004-12-08 16:41:10 +00:00
|
|
|
.B O_NOFOLLOW
|
2017-01-25 20:55:08 +00:00
|
|
|
If \fIpathname\fP is a symbolic link, then the open fails, with the error
|
|
|
|
.BR ELOOP .
|
2017-01-25 20:57:09 +00:00
|
|
|
Symbolic links in earlier components of the pathname will still be
|
|
|
|
followed.
|
|
|
|
(Note that the
|
|
|
|
.B ELOOP
|
|
|
|
error that can occur in this case is indistinguishable from the case where
|
2017-01-25 20:55:08 +00:00
|
|
|
an open fails because there are too many symbolic links found
|
|
|
|
while resolving components in the prefix part of the pathname.)
|
2017-01-25 20:57:09 +00:00
|
|
|
|
2017-01-25 20:51:15 +00:00
|
|
|
This flag is a FreeBSD extension, which was added to Linux in version 2.1.126,
|
|
|
|
and has subsequently been standardized in POSIX.1-2008.
|
2017-01-25 20:57:09 +00:00
|
|
|
|
2013-02-13 23:18:22 +00:00
|
|
|
See also
|
2014-01-21 03:00:06 +00:00
|
|
|
.BR O_PATH
|
2013-02-13 23:18:22 +00:00
|
|
|
below.
|
2005-06-22 09:52:33 +00:00
|
|
|
.\" The headers from glibc 2.0.100 and later include a
|
|
|
|
.\" definition of this flag; \fIkernels before 2.1.126 will ignore it if
|
2007-07-18 20:24:30 +00:00
|
|
|
.\" used\fP.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.BR O_NONBLOCK " or " O_NDELAY
|
accept.2, connect.2, eventfd.2, flock.2, open.2, posix_fadvise.2, read.2, recv.2, sched_setscheduler.2, select_tut.2, send.2, signalfd.2, splice.2, timerfd_create.2, write.2, flockfile.3, mkfifo.3, mq_notify.3, mq_open.3, pthread_tryjoin_np.3, scanf.3, random.4, ddp.7, epoll.7, fifo.7, ip.7, pipe.7, socket.7, spufs.7: Global fix: s/non-blocking/nonblocking/
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 16:43:10 +00:00
|
|
|
When possible, the file is opened in nonblocking mode.
|
2007-04-12 22:42:49 +00:00
|
|
|
Neither the
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR open ()
|
2004-11-03 13:51:07 +00:00
|
|
|
nor any subsequent operations on the file descriptor which is
|
|
|
|
returned will cause the calling process to wait.
|
2015-05-11 09:30:00 +00:00
|
|
|
|
2015-05-11 10:03:43 +00:00
|
|
|
Note that this flag has no effect for regular files and block devices;
|
|
|
|
that is, I/O operations will (briefly) block when device activity
|
|
|
|
is required, regardless of whether
|
|
|
|
.B O_NONBLOCK
|
|
|
|
is set.
|
|
|
|
Since
|
|
|
|
.B O_NONBLOCK
|
|
|
|
semantics might eventually be implemented,
|
|
|
|
applications should not depend upon blocking behavior
|
|
|
|
when specifying this flag for regular files and block devices.
|
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
For the handling of FIFOs (named pipes), see also
|
2006-04-21 01:46:04 +00:00
|
|
|
.BR fifo (7).
|
2006-03-31 21:12:45 +00:00
|
|
|
For a discussion of the effect of
|
2007-09-20 16:26:31 +00:00
|
|
|
.B O_NONBLOCK
|
2006-03-31 21:12:45 +00:00
|
|
|
in conjunction with mandatory file locks and with file leases, see
|
|
|
|
.BR fcntl (2).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2013-02-13 23:18:22 +00:00
|
|
|
.BR O_PATH " (since Linux 2.6.39)"
|
|
|
|
.\" commit 1abf0c718f15a56a0a435588d1b104c7a37dc9bd
|
|
|
|
.\" commit 326be7b484843988afe57566b627fb7a70beac56
|
|
|
|
.\" commit 65cfc6722361570bfe255698d9cd4dccaf47570d
|
|
|
|
.\"
|
|
|
|
.\" http://thread.gmane.org/gmane.linux.man/2790/focus=3496
|
|
|
|
.\" Subject: Re: [PATCH] open(2): document O_PATH
|
|
|
|
.\" Newsgroups: gmane.linux.man, gmane.linux.kernel
|
|
|
|
.\"
|
|
|
|
Obtain a file descriptor that can be used for two purposes:
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
to indicate a location in the filesystem tree and
|
2013-02-13 23:18:22 +00:00
|
|
|
to perform operations that act purely at the file descriptor level.
|
|
|
|
The file itself is not opened, and other file operations (e.g.,
|
|
|
|
.BR read (2),
|
|
|
|
.BR write (2),
|
|
|
|
.BR fchmod (2),
|
|
|
|
.BR fchown (2),
|
2013-08-09 07:49:22 +00:00
|
|
|
.BR fgetxattr (2),
|
2017-08-10 03:25:21 +00:00
|
|
|
.BR ioctl (2),
|
2013-08-09 07:49:22 +00:00
|
|
|
.BR mmap (2))
|
2013-02-13 23:18:22 +00:00
|
|
|
fail with the error
|
|
|
|
.BR EBADF .
|
|
|
|
|
|
|
|
The following operations
|
|
|
|
.I can
|
|
|
|
be performed on the resulting file descriptor:
|
|
|
|
.RS
|
|
|
|
.IP * 3
|
|
|
|
.BR close (2);
|
|
|
|
.BR fchdir (2)
|
|
|
|
(since Linux 3.5);
|
|
|
|
.\" commit 332a2e1244bd08b9e3ecd378028513396a004a24
|
|
|
|
.BR fstat (2)
|
2017-08-10 03:25:21 +00:00
|
|
|
(since Linux 3.6);
|
2013-02-13 23:18:22 +00:00
|
|
|
.\" fstat(): commit 55815f70147dcfa3ead5738fd56d3574e2e3c1c2
|
2017-08-10 03:25:21 +00:00
|
|
|
.BR fstatfs (2)
|
|
|
|
(since Linux 3.12).
|
|
|
|
.\" fstatfs(): commit 9d05746e7b16d8565dddbe3200faa1e669d23bbf
|
2013-02-13 23:18:22 +00:00
|
|
|
.IP *
|
|
|
|
Duplicating the file descriptor
|
|
|
|
.RB ( dup (2),
|
|
|
|
.BR fcntl (2)
|
|
|
|
.BR F_DUPFD ,
|
|
|
|
etc.).
|
|
|
|
.IP *
|
|
|
|
Getting and setting file descriptor flags
|
|
|
|
.RB ( fcntl (2)
|
|
|
|
.BR F_GETFD
|
|
|
|
and
|
|
|
|
.BR F_SETFD ).
|
2013-07-20 20:55:51 +00:00
|
|
|
.IP *
|
|
|
|
Retrieving open file status flags using the
|
|
|
|
.BR fcntl (2)
|
2013-07-22 10:44:48 +00:00
|
|
|
.BR F_GETFL
|
2013-07-20 20:55:51 +00:00
|
|
|
operation: the returned flags will include the bit
|
|
|
|
.BR O_PATH .
|
2013-02-13 23:18:22 +00:00
|
|
|
.IP *
|
|
|
|
Passing the file descriptor as the
|
|
|
|
.IR dirfd
|
|
|
|
argument of
|
2016-12-16 14:28:20 +00:00
|
|
|
.BR openat ()
|
2013-02-13 23:18:22 +00:00
|
|
|
and the other "*at()" system calls.
|
2014-05-02 08:04:00 +00:00
|
|
|
This includes
|
|
|
|
.BR linkat (2)
|
|
|
|
with
|
2014-05-21 11:16:14 +00:00
|
|
|
.BR AT_EMPTY_PATH
|
2014-05-02 08:04:00 +00:00
|
|
|
(or via procfs using
|
|
|
|
.BR AT_SYMLINK_FOLLOW )
|
|
|
|
even if the file is not a directory.
|
2013-02-13 23:18:22 +00:00
|
|
|
.IP *
|
|
|
|
Passing the file descriptor to another process via a UNIX domain socket
|
|
|
|
(see
|
|
|
|
.BR SCM_RIGHTS
|
|
|
|
in
|
|
|
|
.BR unix (7)).
|
|
|
|
.RE
|
|
|
|
.IP
|
|
|
|
When
|
|
|
|
.B O_PATH
|
|
|
|
is specified in
|
|
|
|
.IR flags ,
|
|
|
|
flag bits other than
|
2014-06-18 10:12:56 +00:00
|
|
|
.BR O_CLOEXEC ,
|
|
|
|
.BR O_DIRECTORY ,
|
2013-02-13 23:18:22 +00:00
|
|
|
and
|
|
|
|
.BR O_NOFOLLOW
|
|
|
|
are ignored.
|
|
|
|
|
2014-03-18 09:39:57 +00:00
|
|
|
If
|
|
|
|
.I pathname
|
|
|
|
is a symbolic link and the
|
2013-02-13 23:18:22 +00:00
|
|
|
.BR O_NOFOLLOW
|
|
|
|
flag is also specified,
|
|
|
|
then the call returns a file descriptor referring to the symbolic link.
|
|
|
|
This file descriptor can be used as the
|
|
|
|
.I dirfd
|
|
|
|
argument in calls to
|
|
|
|
.BR fchownat (2),
|
|
|
|
.BR fstatat (2),
|
|
|
|
.BR linkat (2),
|
|
|
|
and
|
|
|
|
.BR readlinkat (2)
|
|
|
|
with an empty pathname to have the calls operate on the symbolic link.
|
2017-08-10 03:25:21 +00:00
|
|
|
|
|
|
|
If
|
|
|
|
.I pathname
|
|
|
|
refers to an automount point that has not yet been triggered, so no
|
|
|
|
other filesystem is mounted on it, then the call returns a file
|
|
|
|
descriptor referring to the automount directory without triggering a mount.
|
|
|
|
.BR fstatfs (2)
|
|
|
|
can then be used to determine if it is, in fact, an untriggered
|
|
|
|
automount point
|
|
|
|
.RB ( ".f_type == AUTOFS_SUPER_MAGIC" ).
|
2013-02-13 23:18:22 +00:00
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B O_SYNC
|
2014-03-16 08:55:02 +00:00
|
|
|
Write operations on the file will complete according to the requirements of
|
|
|
|
synchronized I/O
|
|
|
|
.I file
|
|
|
|
integrity completion
|
2014-08-25 12:40:42 +00:00
|
|
|
(by contrast with the
|
2014-03-16 08:55:02 +00:00
|
|
|
synchronized I/O
|
|
|
|
.I data
|
|
|
|
integrity completion
|
|
|
|
provided by
|
|
|
|
.BR O_DSYNC .)
|
|
|
|
|
|
|
|
By the time
|
|
|
|
.BR write (2)
|
|
|
|
(and similar)
|
|
|
|
return, the output data and associated file metadata
|
|
|
|
have been transferred to the underlying hardware
|
|
|
|
(i.e., as though each
|
|
|
|
.BR write (2)
|
|
|
|
was followed by a call to
|
|
|
|
.BR fsync (2)).
|
|
|
|
.IR "See NOTES below" .
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2014-01-21 06:24:57 +00:00
|
|
|
.BR O_TMPFILE " (since Linux 3.11)"
|
|
|
|
.\" commit 60545d0d4610b02e55f65d141c95b18ccf855b6e
|
|
|
|
.\" commit f4e0c30c191f87851c4a53454abb55ee276f4a7e
|
|
|
|
.\" commit bb458c644a59dbba3a1fe59b27106c5e68e1c4bd
|
|
|
|
Create an unnamed temporary file.
|
|
|
|
The
|
|
|
|
.I pathname
|
|
|
|
argument specifies a directory;
|
|
|
|
an unnamed inode will be created in that directory's filesystem.
|
|
|
|
Anything written to the resulting file will be lost when
|
|
|
|
the last file descriptor is closed, unless the file is given a name.
|
|
|
|
|
|
|
|
.B O_TMPFILE
|
|
|
|
must be specified with one of
|
|
|
|
.B O_RDWR
|
|
|
|
or
|
|
|
|
.B O_WRONLY
|
|
|
|
and, optionally,
|
|
|
|
.BR O_EXCL .
|
|
|
|
If
|
|
|
|
.B O_EXCL
|
|
|
|
is not specified, then
|
|
|
|
.BR linkat (2)
|
|
|
|
can be used to link the temporary file into the filesystem, making it
|
|
|
|
permanent, using code like the following:
|
|
|
|
|
|
|
|
.in +4n
|
|
|
|
.nf
|
|
|
|
char path[PATH_MAX];
|
|
|
|
fd = open("/path/to/dir", O_TMPFILE | O_RDWR,
|
2014-01-21 09:23:26 +00:00
|
|
|
S_IRUSR | S_IWUSR);
|
|
|
|
|
2014-01-21 06:24:57 +00:00
|
|
|
/* File I/O on 'fd'... */
|
2014-01-21 09:23:26 +00:00
|
|
|
|
2014-01-21 06:24:57 +00:00
|
|
|
snprintf(path, PATH_MAX, "/proc/self/fd/%d", fd);
|
2014-01-22 02:50:36 +00:00
|
|
|
linkat(AT_FDCWD, path, AT_FDCWD, "/path/for/file",
|
2014-01-21 09:23:26 +00:00
|
|
|
AT_SYMLINK_FOLLOW);
|
2014-01-21 06:24:57 +00:00
|
|
|
.fi
|
|
|
|
.in
|
|
|
|
|
|
|
|
In this case,
|
|
|
|
the
|
|
|
|
.BR open ()
|
|
|
|
.I mode
|
|
|
|
argument determines the file permission mode, as with
|
|
|
|
.BR O_CREAT .
|
|
|
|
|
2014-01-22 03:01:25 +00:00
|
|
|
Specifying
|
|
|
|
.B O_EXCL
|
|
|
|
in conjunction with
|
|
|
|
.B O_TMPFILE
|
|
|
|
prevents a temporary file from being linked into the filesystem
|
|
|
|
in the above manner.
|
|
|
|
(Note that the meaning of
|
|
|
|
.B O_EXCL
|
|
|
|
in this case is different from the meaning of
|
|
|
|
.B O_EXCL
|
|
|
|
otherwise.)
|
|
|
|
|
2014-01-21 06:24:57 +00:00
|
|
|
There are two main use cases for
|
|
|
|
.\" Inspired by http://lwn.net/Articles/559147/
|
|
|
|
.BR O_TMPFILE :
|
|
|
|
.RS
|
|
|
|
.IP * 3
|
|
|
|
Improved
|
|
|
|
.BR tmpfile (3)
|
|
|
|
functionality: race-free creation of temporary files that
|
|
|
|
(1) are automatically deleted when closed;
|
|
|
|
(2) can never be reached via any pathname;
|
|
|
|
(3) are not subject to symlink attacks; and
|
|
|
|
(4) do not require the caller to devise unique names.
|
|
|
|
.IP *
|
|
|
|
Creating a file that is initially invisible, which is then populated
|
2014-01-24 04:18:01 +00:00
|
|
|
with data and adjusted to have appropriate filesystem attributes
|
2016-05-21 23:00:15 +00:00
|
|
|
.RB ( fchown (2),
|
|
|
|
.BR fchmod (2),
|
2014-01-21 06:24:57 +00:00
|
|
|
.BR fsetxattr (2),
|
|
|
|
etc.)
|
|
|
|
before being atomically linked into the filesystem
|
|
|
|
in a fully formed state (using
|
|
|
|
.BR linkat (2)
|
|
|
|
as described above).
|
|
|
|
.RE
|
|
|
|
.IP
|
|
|
|
.B O_TMPFILE
|
|
|
|
requires support by the underlying filesystem;
|
|
|
|
only a subset of Linux filesystems provide that support.
|
2014-04-10 04:30:24 +00:00
|
|
|
In the initial implementation, support was provided in
|
2014-05-19 08:39:47 +00:00
|
|
|
the ext2, ext3, ext4, UDF, Minix, and shmem filesystems.
|
2016-09-26 09:08:30 +00:00
|
|
|
.\" To check for support, grep for "tmpfile" in kernel sources
|
2016-10-13 06:00:25 +00:00
|
|
|
Support for other filesystems has subsequently been added as follows:
|
|
|
|
XFS (Linux 3.15);
|
2014-04-10 04:30:24 +00:00
|
|
|
.\" commit 99b6436bc29e4f10e4388c27a3e4810191cc4788
|
|
|
|
.\" commit ab29743117f9f4c22ac44c13c1647fb24fb2bafe
|
2016-12-12 09:47:17 +00:00
|
|
|
Btrfs (Linux 3.16);
|
2016-02-22 14:47:29 +00:00
|
|
|
.\" commit ef3b9af50bfa6a1f02cd7b3f5124b712b1ba3e3c
|
2016-10-13 06:00:25 +00:00
|
|
|
F2FS (Linux 3.16);
|
2016-09-26 09:08:30 +00:00
|
|
|
.\" commit 50732df02eefb39ab414ef655979c2c9b64ad21c
|
2016-10-13 06:00:25 +00:00
|
|
|
and ubifs (Linux 4.9)
|
2014-01-21 06:24:57 +00:00
|
|
|
.TP
|
2004-12-08 16:41:10 +00:00
|
|
|
.B O_TRUNC
|
2014-01-21 09:25:00 +00:00
|
|
|
If the file already exists and is a regular file and the access mode allows
|
2007-06-22 17:16:20 +00:00
|
|
|
writing (i.e., is
|
|
|
|
.B O_RDWR
|
|
|
|
or
|
|
|
|
.BR O_WRONLY )
|
|
|
|
it will be truncated to length 0.
|
|
|
|
If the file is a FIFO or terminal device file, the
|
|
|
|
.B O_TRUNC
|
2007-04-12 22:42:49 +00:00
|
|
|
flag is ignored.
|
time.1, get_kernel_syms.2, getitimer.2, open.2, perf_event_open.2, wait.2, alloca.3, bcmp.3, catopen.3, fputwc.3, iconv.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, mbsinit.3, putwchar.3, rcmd.3, rexec.3, sigqueue.3, strverscmp.3, wctrans.3, wctype.3, wcwidth.3, console_codes.4, initrd.4, st.4, elf.5, nss.5, ip.7, netdevice.7, path_resolution.7, socket.7, udp.7, ld.so.8: grfix: s/Otherwise /Otherwise, /
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-04-28 08:15:47 +00:00
|
|
|
Otherwise, the effect of
|
2007-06-22 17:16:20 +00:00
|
|
|
.B O_TRUNC
|
|
|
|
is unspecified.
|
2014-02-21 06:33:19 +00:00
|
|
|
.SS creat()
|
2016-06-03 01:08:38 +00:00
|
|
|
A call to
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR creat ()
|
2016-06-03 01:08:38 +00:00
|
|
|
is equivalent to calling
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR open ()
|
2004-11-03 13:51:07 +00:00
|
|
|
with
|
|
|
|
.I flags
|
|
|
|
equal to
|
|
|
|
.BR O_CREAT|O_WRONLY|O_TRUNC .
|
2014-02-21 06:33:19 +00:00
|
|
|
.SS openat()
|
|
|
|
The
|
|
|
|
.BR openat ()
|
|
|
|
system call operates in exactly the same way as
|
access.2, chmod.2, chown.2, link.2, mkdir.2, open.2, readlink.2, rename.2, stat.2, symlink.2, unlink.2, mkfifo.3, scandir.3: Minor fix: remove section numbers in references to functions inside page
With the page merges, we now have some references to functions
within the page that have section numbers. Remove those.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-02-21 11:50:40 +00:00
|
|
|
.BR open (),
|
2014-02-21 06:33:19 +00:00
|
|
|
except for the differences described here.
|
|
|
|
|
|
|
|
If the pathname given in
|
|
|
|
.I pathname
|
|
|
|
is relative, then it is interpreted relative to the directory
|
2014-05-06 12:17:01 +00:00
|
|
|
referred to by the file descriptor
|
2014-02-21 06:33:19 +00:00
|
|
|
.I dirfd
|
|
|
|
(rather than relative to the current working directory of
|
|
|
|
the calling process, as is done by
|
access.2, chmod.2, chown.2, link.2, mkdir.2, open.2, readlink.2, rename.2, stat.2, symlink.2, unlink.2, mkfifo.3, scandir.3: Minor fix: remove section numbers in references to functions inside page
With the page merges, we now have some references to functions
within the page that have section numbers. Remove those.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-02-21 11:50:40 +00:00
|
|
|
.BR open ()
|
2014-02-21 06:33:19 +00:00
|
|
|
for a relative pathname).
|
|
|
|
|
|
|
|
If
|
|
|
|
.I pathname
|
|
|
|
is relative and
|
|
|
|
.I dirfd
|
|
|
|
is the special value
|
|
|
|
.BR AT_FDCWD ,
|
|
|
|
then
|
|
|
|
.I pathname
|
|
|
|
is interpreted relative to the current working
|
|
|
|
directory of the calling process (like
|
access.2, chmod.2, chown.2, link.2, mkdir.2, open.2, readlink.2, rename.2, stat.2, symlink.2, unlink.2, mkfifo.3, scandir.3: Minor fix: remove section numbers in references to functions inside page
With the page merges, we now have some references to functions
within the page that have section numbers. Remove those.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-02-21 11:50:40 +00:00
|
|
|
.BR open ()).
|
2014-02-21 06:33:19 +00:00
|
|
|
|
|
|
|
If
|
|
|
|
.I pathname
|
|
|
|
is absolute, then
|
|
|
|
.I dirfd
|
|
|
|
is ignored.
|
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bdflush.2, bind.2, brk.2, cacheflush.2, capget.2, chdir.2, chmod.2, chown.2, chroot.2, clock_getres.2, clock_nanosleep.2, clone.2, close.2, connect.2, create_module.2, delete_module.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, execve.2, exit_group.2, faccessat.2, fchmodat.2, fchownat.2, fcntl.2, flock.2, fork.2, fstatat.2, fsync.2, futex.2, futimesat.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getdents.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getitimer.2, getpagesize.2, getpeername.2, getpid.2, getpriority.2, getresuid.2, getrlimit.2, getrusage.2, getsid.2, getsockname.2, getsockopt.2, gettid.2, gettimeofday.2, getuid.2, getunwind.2, getxattr.2, idle.2, init_module.2, inotify_add_watch.2, inotify_init.2, inotify_rm_watch.2, intro.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl.2, ioctl_list.2, ioperm.2, iopl.2, ioprio_set.2, ipc.2, kcmp.2, kill.2, killpg.2, link.2, linkat.2, listen.2, listxattr.2, llseek.2, lookup_dcookie.2, lseek.2, madvise.2, migrate_pages.2, mincore.2, mkdir.2, mkdirat.2, mknod.2, mknodat.2, mlock.2, mmap.2, mmap2.2, modify_ldt.2, mount.2, move_pages.2, mprotect.2, mq_getsetattr.2, mremap.2, msgctl.2, msgget.2, msgop.2, msync.2, nanosleep.2, nfsservctl.2, nice.2, open.2, openat.2, outb.2, pause.2, pciconfig_read.2, perf_event_open.2, perfmonctl.2, personality.2, pipe.2, pivot_root.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, read.2, readahead.2, readdir.2, readlink.2, readlinkat.2, readv.2, reboot.2, recv.2, remap_file_pages.2, removexattr.2, rename.2, renameat.2, rmdir.2, rt_sigqueueinfo.2, sched_get_priority_max.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setparam.2, sched_setscheduler.2, sched_yield.2, select.2, semctl.2, semget.2, semop.2, send.2, sendfile.2, set_thread_area.2, set_tid_address.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, setup.2, setxattr.2, shmctl.2, shmget.2, shmop.2, shutdown.2, sigaction.2, sigaltstack.2, signal.2, signalfd.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, socket.2, socketcall.2, socketpair.2, splice.2, stat.2, statfs.2, stime.2, swapon.2, symlink.2, symlinkat.2, sync.2, sync_file_range.2, sysctl.2, sysfs.2, sysinfo.2, syslog.2, tee.2, time.2, timerfd_create.2, times.2, tkill.2, truncate.2, umask.2, umount.2, uname.2, unimplemented.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, MB_CUR_MAX.3, MB_LEN_MAX.3, __setfpucw.3, a64l.3, abort.3, abs.3, acos.3, acosh.3, addseverity.3, adjtime.3, aio_cancel.3, aio_error.3, aio_fsync.3, aio_read.3, aio_return.3, aio_suspend.3, aio_write.3, alloca.3, argz_add.3, asin.3, asinh.3, asprintf.3, assert.3, assert_perror.3, atan.3, atan2.3, atanh.3, atexit.3, atof.3, atoi.3, backtrace.3, basename.3, bcmp.3, bcopy.3, bindresvport.3, bsd_signal.3, bsearch.3, bstring.3, btowc.3, btree.3, byteorder.3, bzero.3, cabs.3, cacos.3, cacosh.3, canonicalize_file_name.3, carg.3, casin.3, casinh.3, catan.3, catanh.3, catgets.3, catopen.3, cbrt.3, ccos.3, ccosh.3, ceil.3, cerf.3, cexp.3, cexp2.3, cfree.3, cimag.3, clearenv.3, clock.3, clock_getcpuclockid.3, clog.3, clog10.3, clog2.3, closedir.3, cmsg.3, confstr.3, conj.3, copysign.3, cos.3, cosh.3, cpow.3, cproj.3, creal.3, crypt.3, csin.3, csinh.3, csqrt.3, ctan.3, ctanh.3, ctermid.3, ctime.3, daemon.3, dbopen.3, des_crypt.3, difftime.3, dirfd.3, div.3, dl_iterate_phdr.3, dlopen.3, dprintf.3, drand48.3, drand48_r.3, dysize.3, ecvt.3, ecvt_r.3, encrypt.3, end.3, endian.3, envz_add.3, erf.3, erfc.3, err.3, errno.3, error.3, ether_aton.3, euidaccess.3, exec.3, exit.3, exp.3, exp10.3, exp2.3, expm1.3, fabs.3, fclose.3, fcloseall.3, fdim.3, fenv.3, ferror.3, fexecve.3, fflush.3, ffs.3, fgetgrent.3, fgetpwent.3, fgetwc.3, fgetws.3, finite.3, flockfile.3, floor.3, fma.3, fmax.3, fmemopen.3, fmin.3, fmod.3, fmtmsg.3, fnmatch.3, fopen.3, fpathconf.3, fpclassify.3, fpurge.3, fputwc.3, fputws.3, fread.3, frexp.3, fseek.3, fseeko.3, ftime.3, ftok.3, fts.3, ftw.3, futimes.3, fwide.3, gamma.3, gcvt.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getcontext.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getenv.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getipnodebyname.3, getline.3, getloadavg.3, getlogin.3, getmntent.3, getnameinfo.3, getnetent.3, getnetent_r.3, getopt.3, getpass.3, getprotoent.3, getprotoent_r.3, getpt.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getrpcent_r.3, getrpcport.3, gets.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, getumask.3, getusershell.3, getutent.3, getw.3, getwchar.3, glob.3, grantpt.3, gsignal.3, hash.3, hsearch.3, hypot.3, iconv.3, iconv_close.3, iconv_open.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, isgreater.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, j0.3, key_setsecret.3, ldexp.3, lgamma.3, lio_listio.3, localeconv.3, lockf.3, log.3, log10.3, log1p.3, log2.3, logb.3, login.3, longjmp.3, lrint.3, lround.3, lsearch.3, lseek64.3, makecontext.3, makedev.3, malloc.3, malloc_hook.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, memccpy.3, memchr.3, memcmp.3, memcpy.3, memfrob.3, memmem.3, memmove.3, mempcpy.3, memset.3, mkdtemp.3, mkfifo.3, mkfifoat.3, mkstemp.3, mktemp.3, modf.3, mpool.3, mq_close.3, mq_getattr.3, mq_notify.3, mq_open.3, mq_receive.3, mq_send.3, mq_unlink.3, mtrace.3, nan.3, netlink.3, nextafter.3, nl_langinfo.3, offsetof.3, on_exit.3, opendir.3, openpty.3, perror.3, popen.3, posix_fallocate.3, posix_memalign.3, posix_openpt.3, pow.3, pow10.3, printf.3, profil.3, program_invocation_name.3, psignal.3, pthread_kill_other_threads_np.3, ptsname.3, putenv.3, putgrent.3, putpwent.3, puts.3, putwchar.3, qecvt.3, qsort.3, queue.3, raise.3, rand.3, random.3, random_r.3, rcmd.3, re_comp.3, readdir.3, realpath.3, recno.3, regex.3, remainder.3, remove.3, remquo.3, resolver.3, rewinddir.3, rexec.3, rint.3, round.3, rpc.3, rpmatch.3, rtime.3, rtnetlink.3, scalb.3, scalbln.3, scandir.3, scandirat.3, scanf.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, setaliasent.3, setbuf.3, setenv.3, setjmp.3, setlocale.3, setlogmask.3, setnetgrent.3, shm_open.3, siginterrupt.3, signbit.3, significand.3, sigpause.3, sigqueue.3, sigset.3, sigsetops.3, sigvec.3, sin.3, sincos.3, sinh.3, sleep.3, sockatmark.3, sqrt.3, statvfs.3, stdarg.3, stdin.3, stdio.3, stdio_ext.3, stpcpy.3, stpncpy.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strdup.3, strerror.3, strfmon.3, strfry.3, strftime.3, string.3, strlen.3, strnlen.3, strpbrk.3, strptime.3, strsep.3, strsignal.3, strspn.3, strstr.3, strtod.3, strtoimax.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, termios.3, tgamma.3, timegm.3, timeradd.3, tmpfile.3, tmpnam.3, toascii.3, toupper.3, towctrans.3, towlower.3, towupper.3, trunc.3, tsearch.3, ttyname.3, ttyslot.3, tzset.3, ualarm.3, ulimit.3, ungetwc.3, unlocked_stdio.3, unlockpt.3, updwtmp.3, usleep.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstoimax.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wordexp.3, wprintf.3, xcrypt.3, xdr.3, y0.3, cciss.4, console.4, console_codes.4, console_ioctl.4, dsp56k.4, fd.4, full.4, hd.4, hpsa.4, initrd.4, intro.4, lp.4, mem.4, mouse.4, null.4, pts.4, ram.4, random.4, rtc.4, sk98lin.4, st.4, tty.4, ttyS.4, tty_ioctl.4, vcs.4, wavelan.4, acct.5, charmap.5, dir_colors.5, filesystems.5, ftpusers.5, group.5, host.conf.5, hosts.5, hosts.equiv.5, intro.5, issue.5, locale.5, motd.5, networks.5, nologin.5, nscd.conf.5, passwd.5, proc.5, protocols.5, resolv.conf.5, rpc.5, securetty.5, services.5, shells.5, termcap.5, ttytype.5, utmp.5, armscii-8.7, arp.7, ascii.7, bootparam.7, capabilities.7, charsets.7, complex.7, cp1251.7, credentials.7, ddp.7, environ.7, epoll.7, fifo.7, futex.7, glob.7, hier.7, icmp.7, inotify.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, locale.7, mailaddr.7, man.7, mq_overview.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, posixoptions.7, pthreads.7, pty.7, raw.7, regex.7, rtld-audit.7, rtnetlink.7, sem_overview.7, shm_overview.7, sigevent.7, signal.7, socket.7, standards.7, suffixes.7, svipc.7, tcp.7, termio.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, nscd.8, sync.8, tzselect.8, zdump.8, zic.8: Global fix: remove unneeded double quotes in .SH headings
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 18:01:36 +00:00
|
|
|
.SH RETURN VALUE
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR open (),
|
|
|
|
.BR openat (),
|
2007-04-12 22:42:49 +00:00
|
|
|
and
|
2005-10-19 07:29:28 +00:00
|
|
|
.BR creat ()
|
2004-12-08 16:41:10 +00:00
|
|
|
return the new file descriptor, or \-1 if an error occurred
|
|
|
|
(in which case,
|
2004-11-03 13:51:07 +00:00
|
|
|
.I errno
|
|
|
|
is set appropriately).
|
|
|
|
.SH ERRORS
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR open (),
|
|
|
|
.BR openat (),
|
|
|
|
and
|
|
|
|
.BR creat ()
|
|
|
|
can fail with the following errors:
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B EACCES
|
|
|
|
The requested access to the file is not allowed, or search permission
|
|
|
|
is denied for one of the directories in the path prefix of
|
|
|
|
.IR pathname ,
|
|
|
|
or the file did not exist yet and write access to the parent directory
|
|
|
|
is not allowed.
|
|
|
|
(See also
|
2007-05-26 12:41:39 +00:00
|
|
|
.BR path_resolution (7).)
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
link.2, mkdir.2, mknod.2, open.2, rename.2, symlink.2, write.2, mkfifo.3: Document EDQUOT error
The return error EDQUOT is not documented in open(2), write(2),
symlink(2) etc..
Whether inodes or disk blocks are required for each function
is something I based on received wisdom and BSD documentation,
rather than tracing the code to the kernel. For symlink(2)
this certainly depends on the file system type.
This patch was previously sent to the linux-man mailing list
as an RFC in September 2010.
Signed-off-by: Mark Hills <mark@pogo.org.uk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-12-22 17:56:59 +00:00
|
|
|
.B EDQUOT
|
|
|
|
Where
|
|
|
|
.B O_CREAT
|
|
|
|
is specified, the file does not exist, and the user's quota of disk
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
blocks or inodes on the filesystem has been exhausted.
|
link.2, mkdir.2, mknod.2, open.2, rename.2, symlink.2, write.2, mkfifo.3: Document EDQUOT error
The return error EDQUOT is not documented in open(2), write(2),
symlink(2) etc..
Whether inodes or disk blocks are required for each function
is something I based on received wisdom and BSD documentation,
rather than tracing the code to the kernel. For symlink(2)
this certainly depends on the file system type.
This patch was previously sent to the linux-man mailing list
as an RFC in September 2010.
Signed-off-by: Mark Hills <mark@pogo.org.uk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-12-22 17:56:59 +00:00
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B EEXIST
|
|
|
|
.I pathname
|
|
|
|
already exists and
|
|
|
|
.BR O_CREAT " and " O_EXCL
|
|
|
|
were used.
|
|
|
|
.TP
|
|
|
|
.B EFAULT
|
2007-09-20 16:26:31 +00:00
|
|
|
.I pathname
|
2005-10-19 07:29:28 +00:00
|
|
|
points outside your accessible address space.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2007-01-06 23:31:16 +00:00
|
|
|
.B EFBIG
|
2008-12-04 17:25:19 +00:00
|
|
|
See
|
|
|
|
.BR EOVERFLOW .
|
2007-01-06 23:31:16 +00:00
|
|
|
.TP
|
2008-07-04 15:44:19 +00:00
|
|
|
.B EINTR
|
|
|
|
While blocked waiting to complete an open of a slow device
|
|
|
|
(e.g., a FIFO; see
|
|
|
|
.BR fifo (7)),
|
|
|
|
the call was interrupted by a signal handler; see
|
|
|
|
.BR signal (7).
|
|
|
|
.TP
|
2013-08-16 20:57:47 +00:00
|
|
|
.B EINVAL
|
|
|
|
The filesystem does not support the
|
|
|
|
.BR O_DIRECT
|
2014-01-20 12:34:57 +00:00
|
|
|
flag.
|
|
|
|
See
|
2013-08-16 20:57:47 +00:00
|
|
|
.BR NOTES
|
|
|
|
for more information.
|
|
|
|
.TP
|
2014-01-20 13:42:18 +00:00
|
|
|
.B EINVAL
|
|
|
|
Invalid value in
|
|
|
|
.\" In particular, __O_TMPFILE instead of O_TMPFILE
|
|
|
|
.IR flags .
|
|
|
|
.TP
|
|
|
|
.B EINVAL
|
|
|
|
.B O_TMPFILE
|
|
|
|
was specified in
|
|
|
|
.IR flags ,
|
|
|
|
but neither
|
|
|
|
.B O_WRONLY
|
|
|
|
nor
|
|
|
|
.B O_RDWR
|
|
|
|
was specified.
|
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B EISDIR
|
|
|
|
.I pathname
|
|
|
|
refers to a directory and the access requested involved writing
|
|
|
|
(that is,
|
|
|
|
.B O_WRONLY
|
|
|
|
or
|
|
|
|
.B O_RDWR
|
|
|
|
is set).
|
|
|
|
.TP
|
2014-01-20 13:42:18 +00:00
|
|
|
.B EISDIR
|
2014-01-21 03:00:06 +00:00
|
|
|
.I pathname
|
|
|
|
refers to an existing directory,
|
2014-01-20 13:42:18 +00:00
|
|
|
.B O_TMPFILE
|
|
|
|
and one of
|
|
|
|
.B O_WRONLY
|
|
|
|
or
|
|
|
|
.B O_RDWR
|
|
|
|
were specified in
|
|
|
|
.IR flags ,
|
|
|
|
but this kernel version does not provide the
|
|
|
|
.B O_TMPFILE
|
|
|
|
functionality.
|
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B ELOOP
|
|
|
|
Too many symbolic links were encountered in resolving
|
2014-03-18 10:46:48 +00:00
|
|
|
.IR pathname .
|
|
|
|
.TP
|
|
|
|
.B ELOOP
|
2004-11-03 13:51:07 +00:00
|
|
|
.I pathname
|
2014-03-18 10:46:48 +00:00
|
|
|
was a symbolic link, and
|
|
|
|
.I flags
|
|
|
|
specified
|
|
|
|
.BR O_NOFOLLOW
|
|
|
|
but not
|
|
|
|
.BR O_PATH .
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B EMFILE
|
accept.2, dup.2, eventfd.2, execve.2, fcntl.2, memfd_create.2, open.2, perf_event_open.2, pipe.2, signalfd.2, socket.2, socketpair.2, spu_create.2, timerfd_create.2, getgrent.3, getgrnam.3, getlogin.3, getpwent.3, getpwnam.3, mq_open.3, opendir.3, sem_open.3, shm_open.3, tmpfile.3: ERRORS: standardize text for EMFILE error
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-27 15:35:01 +00:00
|
|
|
The per-process limit on the number of open file descriptors has been reached
|
2015-01-13 09:26:41 +00:00
|
|
|
(see the description of
|
|
|
|
.BR RLIMIT_NOFILE
|
|
|
|
in
|
|
|
|
.BR getrlimit (2)).
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B ENAMETOOLONG
|
2007-09-20 16:26:31 +00:00
|
|
|
.I pathname
|
2005-10-19 07:29:28 +00:00
|
|
|
was too long.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B ENFILE
|
accept.2, acct.2, epoll_create.2, execve.2, futex.2, inotify_init.2, mmap.2, open.2, pipe.2, shmget.2, socket.2, socketpair.2, spu_create.2, swapon.2, uselib.2, getgrent.3, getgrnam.3, getlogin.3, getpwent.3, getpwnam.3, mq_open.3, opendir.3, sem_open.3, shm_open.3, tmpfile.3, fanotify.7: ERRORS: standardize text for ENFILE error
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-12-27 16:10:23 +00:00
|
|
|
The system-wide limit on the total number of open files has been reached.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B ENODEV
|
|
|
|
.I pathname
|
|
|
|
refers to a device special file and no corresponding device exists.
|
2007-06-22 17:16:20 +00:00
|
|
|
(This is a Linux kernel bug; in this situation
|
|
|
|
.B ENXIO
|
|
|
|
must be returned.)
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
|
|
|
.B ENOENT
|
2007-06-22 17:16:20 +00:00
|
|
|
.B O_CREAT
|
|
|
|
is not set and the named file does not exist.
|
2004-11-03 13:51:07 +00:00
|
|
|
Or, a directory component in
|
|
|
|
.I pathname
|
|
|
|
does not exist or is a dangling symbolic link.
|
|
|
|
.TP
|
2014-01-21 04:55:58 +00:00
|
|
|
.B ENOENT
|
|
|
|
.I pathname
|
|
|
|
refers to a nonexistent directory,
|
|
|
|
.B O_TMPFILE
|
|
|
|
and one of
|
|
|
|
.B O_WRONLY
|
|
|
|
or
|
|
|
|
.B O_RDWR
|
|
|
|
were specified in
|
|
|
|
.IR flags ,
|
|
|
|
but this kernel version does not provide the
|
|
|
|
.B O_TMPFILE
|
|
|
|
functionality.
|
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B ENOMEM
|
2016-08-13 19:54:32 +00:00
|
|
|
The named file is a FIFO,
|
|
|
|
but memory for the FIFO buffer can't be allocated because
|
|
|
|
the per-user hard limit on memory allocation for pipes has been reached
|
|
|
|
and the caller is not privileged; see
|
|
|
|
.BR pipe (7).
|
|
|
|
.TP
|
|
|
|
.B ENOMEM
|
2004-11-03 13:51:07 +00:00
|
|
|
Insufficient kernel memory was available.
|
|
|
|
.TP
|
|
|
|
.B ENOSPC
|
|
|
|
.I pathname
|
|
|
|
was to be created but the device containing
|
|
|
|
.I pathname
|
|
|
|
has no room for the new file.
|
|
|
|
.TP
|
|
|
|
.B ENOTDIR
|
|
|
|
A component used as a directory in
|
|
|
|
.I pathname
|
2007-07-18 20:24:30 +00:00
|
|
|
is not, in fact, a directory, or \fBO_DIRECTORY\fP was specified and
|
2004-11-03 13:51:07 +00:00
|
|
|
.I pathname
|
|
|
|
was not a directory.
|
|
|
|
.TP
|
|
|
|
.B ENXIO
|
2007-06-22 17:16:20 +00:00
|
|
|
.BR O_NONBLOCK " | " O_WRONLY
|
2014-05-19 09:25:57 +00:00
|
|
|
is set, the named file is a FIFO, and
|
|
|
|
no process has the FIFO open for reading.
|
2016-08-13 19:46:45 +00:00
|
|
|
.TP
|
|
|
|
.B ENXIO
|
|
|
|
The file is a device special file and no corresponding device exists.
|
2004-11-03 13:51:07 +00:00
|
|
|
.TP
|
2014-01-20 13:52:16 +00:00
|
|
|
.BR EOPNOTSUPP
|
|
|
|
The filesystem containing
|
|
|
|
.I pathname
|
|
|
|
does not support
|
|
|
|
.BR O_TMPFILE .
|
|
|
|
.TP
|
2008-12-04 17:25:19 +00:00
|
|
|
.B EOVERFLOW
|
|
|
|
.I pathname
|
|
|
|
refers to a regular file that is too large to be opened.
|
|
|
|
The usual scenario here is that an application compiled
|
|
|
|
on a 32-bit platform without
|
2008-12-04 20:46:28 +00:00
|
|
|
.I -D_FILE_OFFSET_BITS=64
|
2008-12-04 17:25:19 +00:00
|
|
|
tried to open a file whose size exceeds
|
2014-09-26 05:30:02 +00:00
|
|
|
.I (1<<31)-1
|
|
|
|
bytes;
|
2008-12-04 17:25:19 +00:00
|
|
|
see also
|
|
|
|
.B O_LARGEFILE
|
|
|
|
above.
|
2015-04-18 05:16:40 +00:00
|
|
|
This is the error specified by POSIX.1;
|
2008-12-04 17:25:19 +00:00
|
|
|
in kernels before 2.6.24, Linux gave the error
|
|
|
|
.B EFBIG
|
|
|
|
for this case.
|
|
|
|
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=7253
|
|
|
|
.\" "Open of a large file on 32-bit fails with EFBIG, should be EOVERFLOW"
|
|
|
|
.\" Reported 2006-10-03
|
|
|
|
.TP
|
2004-12-08 16:41:10 +00:00
|
|
|
.B EPERM
|
|
|
|
The
|
|
|
|
.B O_NOATIME
|
|
|
|
flag was specified, but the effective user ID of the caller
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
.\" Strictly speaking, it's the filesystem UID... (MTK)
|
2016-09-12 18:10:28 +00:00
|
|
|
did not match the owner of the file and the caller was not privileged.
|
2004-12-08 16:41:10 +00:00
|
|
|
.TP
|
2015-01-19 08:16:41 +00:00
|
|
|
.B EPERM
|
|
|
|
The operation was prevented by a file seal; see
|
|
|
|
.BR fcntl (2).
|
|
|
|
.TP
|
2004-11-03 13:51:07 +00:00
|
|
|
.B EROFS
|
|
|
|
.I pathname
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
refers to a file on a read-only filesystem and write access was
|
2004-11-03 13:51:07 +00:00
|
|
|
requested.
|
|
|
|
.TP
|
|
|
|
.B ETXTBSY
|
|
|
|
.I pathname
|
|
|
|
refers to an executable image which is currently being executed and
|
|
|
|
write access was requested.
|
2005-11-17 14:55:31 +00:00
|
|
|
.TP
|
|
|
|
.B EWOULDBLOCK
|
|
|
|
The
|
|
|
|
.B O_NONBLOCK
|
|
|
|
flag was specified, and an incompatible lease was held on the file
|
|
|
|
(see
|
|
|
|
.BR fcntl (2)).
|
2014-02-21 06:33:19 +00:00
|
|
|
.PP
|
|
|
|
The following additional errors can occur for
|
|
|
|
.BR openat ():
|
|
|
|
.TP
|
|
|
|
.B EBADF
|
|
|
|
.I dirfd
|
|
|
|
is not a valid file descriptor.
|
|
|
|
.TP
|
|
|
|
.B ENOTDIR
|
|
|
|
.I pathname
|
2014-05-19 09:23:13 +00:00
|
|
|
is a relative pathname and
|
2014-02-21 06:33:19 +00:00
|
|
|
.I dirfd
|
|
|
|
is a file descriptor referring to a file other than a directory.
|
|
|
|
.SH VERSIONS
|
|
|
|
.BR openat ()
|
|
|
|
was added to Linux in kernel 2.6.16;
|
|
|
|
library support was added to glibc in version 2.4.
|
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bdflush.2, bind.2, brk.2, cacheflush.2, capget.2, chdir.2, chmod.2, chown.2, chroot.2, clock_getres.2, clock_nanosleep.2, clone.2, close.2, connect.2, create_module.2, delete_module.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, execve.2, exit_group.2, faccessat.2, fchmodat.2, fchownat.2, fcntl.2, flock.2, fork.2, fstatat.2, fsync.2, futex.2, futimesat.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getdents.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getitimer.2, getpagesize.2, getpeername.2, getpid.2, getpriority.2, getresuid.2, getrlimit.2, getrusage.2, getsid.2, getsockname.2, getsockopt.2, gettid.2, gettimeofday.2, getuid.2, getunwind.2, getxattr.2, idle.2, init_module.2, inotify_add_watch.2, inotify_init.2, inotify_rm_watch.2, intro.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl.2, ioctl_list.2, ioperm.2, iopl.2, ioprio_set.2, ipc.2, kcmp.2, kill.2, killpg.2, link.2, linkat.2, listen.2, listxattr.2, llseek.2, lookup_dcookie.2, lseek.2, madvise.2, migrate_pages.2, mincore.2, mkdir.2, mkdirat.2, mknod.2, mknodat.2, mlock.2, mmap.2, mmap2.2, modify_ldt.2, mount.2, move_pages.2, mprotect.2, mq_getsetattr.2, mremap.2, msgctl.2, msgget.2, msgop.2, msync.2, nanosleep.2, nfsservctl.2, nice.2, open.2, openat.2, outb.2, pause.2, pciconfig_read.2, perf_event_open.2, perfmonctl.2, personality.2, pipe.2, pivot_root.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, read.2, readahead.2, readdir.2, readlink.2, readlinkat.2, readv.2, reboot.2, recv.2, remap_file_pages.2, removexattr.2, rename.2, renameat.2, rmdir.2, rt_sigqueueinfo.2, sched_get_priority_max.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setparam.2, sched_setscheduler.2, sched_yield.2, select.2, semctl.2, semget.2, semop.2, send.2, sendfile.2, set_thread_area.2, set_tid_address.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, setup.2, setxattr.2, shmctl.2, shmget.2, shmop.2, shutdown.2, sigaction.2, sigaltstack.2, signal.2, signalfd.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, socket.2, socketcall.2, socketpair.2, splice.2, stat.2, statfs.2, stime.2, swapon.2, symlink.2, symlinkat.2, sync.2, sync_file_range.2, sysctl.2, sysfs.2, sysinfo.2, syslog.2, tee.2, time.2, timerfd_create.2, times.2, tkill.2, truncate.2, umask.2, umount.2, uname.2, unimplemented.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, MB_CUR_MAX.3, MB_LEN_MAX.3, __setfpucw.3, a64l.3, abort.3, abs.3, acos.3, acosh.3, addseverity.3, adjtime.3, aio_cancel.3, aio_error.3, aio_fsync.3, aio_read.3, aio_return.3, aio_suspend.3, aio_write.3, alloca.3, argz_add.3, asin.3, asinh.3, asprintf.3, assert.3, assert_perror.3, atan.3, atan2.3, atanh.3, atexit.3, atof.3, atoi.3, backtrace.3, basename.3, bcmp.3, bcopy.3, bindresvport.3, bsd_signal.3, bsearch.3, bstring.3, btowc.3, btree.3, byteorder.3, bzero.3, cabs.3, cacos.3, cacosh.3, canonicalize_file_name.3, carg.3, casin.3, casinh.3, catan.3, catanh.3, catgets.3, catopen.3, cbrt.3, ccos.3, ccosh.3, ceil.3, cerf.3, cexp.3, cexp2.3, cfree.3, cimag.3, clearenv.3, clock.3, clock_getcpuclockid.3, clog.3, clog10.3, clog2.3, closedir.3, cmsg.3, confstr.3, conj.3, copysign.3, cos.3, cosh.3, cpow.3, cproj.3, creal.3, crypt.3, csin.3, csinh.3, csqrt.3, ctan.3, ctanh.3, ctermid.3, ctime.3, daemon.3, dbopen.3, des_crypt.3, difftime.3, dirfd.3, div.3, dl_iterate_phdr.3, dlopen.3, dprintf.3, drand48.3, drand48_r.3, dysize.3, ecvt.3, ecvt_r.3, encrypt.3, end.3, endian.3, envz_add.3, erf.3, erfc.3, err.3, errno.3, error.3, ether_aton.3, euidaccess.3, exec.3, exit.3, exp.3, exp10.3, exp2.3, expm1.3, fabs.3, fclose.3, fcloseall.3, fdim.3, fenv.3, ferror.3, fexecve.3, fflush.3, ffs.3, fgetgrent.3, fgetpwent.3, fgetwc.3, fgetws.3, finite.3, flockfile.3, floor.3, fma.3, fmax.3, fmemopen.3, fmin.3, fmod.3, fmtmsg.3, fnmatch.3, fopen.3, fpathconf.3, fpclassify.3, fpurge.3, fputwc.3, fputws.3, fread.3, frexp.3, fseek.3, fseeko.3, ftime.3, ftok.3, fts.3, ftw.3, futimes.3, fwide.3, gamma.3, gcvt.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getcontext.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getenv.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getipnodebyname.3, getline.3, getloadavg.3, getlogin.3, getmntent.3, getnameinfo.3, getnetent.3, getnetent_r.3, getopt.3, getpass.3, getprotoent.3, getprotoent_r.3, getpt.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getrpcent_r.3, getrpcport.3, gets.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, getumask.3, getusershell.3, getutent.3, getw.3, getwchar.3, glob.3, grantpt.3, gsignal.3, hash.3, hsearch.3, hypot.3, iconv.3, iconv_close.3, iconv_open.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, isgreater.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, j0.3, key_setsecret.3, ldexp.3, lgamma.3, lio_listio.3, localeconv.3, lockf.3, log.3, log10.3, log1p.3, log2.3, logb.3, login.3, longjmp.3, lrint.3, lround.3, lsearch.3, lseek64.3, makecontext.3, makedev.3, malloc.3, malloc_hook.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, memccpy.3, memchr.3, memcmp.3, memcpy.3, memfrob.3, memmem.3, memmove.3, mempcpy.3, memset.3, mkdtemp.3, mkfifo.3, mkfifoat.3, mkstemp.3, mktemp.3, modf.3, mpool.3, mq_close.3, mq_getattr.3, mq_notify.3, mq_open.3, mq_receive.3, mq_send.3, mq_unlink.3, mtrace.3, nan.3, netlink.3, nextafter.3, nl_langinfo.3, offsetof.3, on_exit.3, opendir.3, openpty.3, perror.3, popen.3, posix_fallocate.3, posix_memalign.3, posix_openpt.3, pow.3, pow10.3, printf.3, profil.3, program_invocation_name.3, psignal.3, pthread_kill_other_threads_np.3, ptsname.3, putenv.3, putgrent.3, putpwent.3, puts.3, putwchar.3, qecvt.3, qsort.3, queue.3, raise.3, rand.3, random.3, random_r.3, rcmd.3, re_comp.3, readdir.3, realpath.3, recno.3, regex.3, remainder.3, remove.3, remquo.3, resolver.3, rewinddir.3, rexec.3, rint.3, round.3, rpc.3, rpmatch.3, rtime.3, rtnetlink.3, scalb.3, scalbln.3, scandir.3, scandirat.3, scanf.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, setaliasent.3, setbuf.3, setenv.3, setjmp.3, setlocale.3, setlogmask.3, setnetgrent.3, shm_open.3, siginterrupt.3, signbit.3, significand.3, sigpause.3, sigqueue.3, sigset.3, sigsetops.3, sigvec.3, sin.3, sincos.3, sinh.3, sleep.3, sockatmark.3, sqrt.3, statvfs.3, stdarg.3, stdin.3, stdio.3, stdio_ext.3, stpcpy.3, stpncpy.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strdup.3, strerror.3, strfmon.3, strfry.3, strftime.3, string.3, strlen.3, strnlen.3, strpbrk.3, strptime.3, strsep.3, strsignal.3, strspn.3, strstr.3, strtod.3, strtoimax.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, termios.3, tgamma.3, timegm.3, timeradd.3, tmpfile.3, tmpnam.3, toascii.3, toupper.3, towctrans.3, towlower.3, towupper.3, trunc.3, tsearch.3, ttyname.3, ttyslot.3, tzset.3, ualarm.3, ulimit.3, ungetwc.3, unlocked_stdio.3, unlockpt.3, updwtmp.3, usleep.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstoimax.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wordexp.3, wprintf.3, xcrypt.3, xdr.3, y0.3, cciss.4, console.4, console_codes.4, console_ioctl.4, dsp56k.4, fd.4, full.4, hd.4, hpsa.4, initrd.4, intro.4, lp.4, mem.4, mouse.4, null.4, pts.4, ram.4, random.4, rtc.4, sk98lin.4, st.4, tty.4, ttyS.4, tty_ioctl.4, vcs.4, wavelan.4, acct.5, charmap.5, dir_colors.5, filesystems.5, ftpusers.5, group.5, host.conf.5, hosts.5, hosts.equiv.5, intro.5, issue.5, locale.5, motd.5, networks.5, nologin.5, nscd.conf.5, passwd.5, proc.5, protocols.5, resolv.conf.5, rpc.5, securetty.5, services.5, shells.5, termcap.5, ttytype.5, utmp.5, armscii-8.7, arp.7, ascii.7, bootparam.7, capabilities.7, charsets.7, complex.7, cp1251.7, credentials.7, ddp.7, environ.7, epoll.7, fifo.7, futex.7, glob.7, hier.7, icmp.7, inotify.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, locale.7, mailaddr.7, man.7, mq_overview.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, posixoptions.7, pthreads.7, pty.7, raw.7, regex.7, rtld-audit.7, rtnetlink.7, sem_overview.7, shm_overview.7, sigevent.7, signal.7, socket.7, standards.7, suffixes.7, svipc.7, tcp.7, termio.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, nscd.8, sync.8, tzselect.8, zdump.8, zic.8: Global fix: remove unneeded double quotes in .SH headings
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 18:01:36 +00:00
|
|
|
.SH CONFORMING TO
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR open (),
|
|
|
|
.BR creat ()
|
2014-01-21 03:25:46 +00:00
|
|
|
SVr4, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
|
|
|
|
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR openat ():
|
|
|
|
POSIX.1-2008.
|
|
|
|
|
2004-11-03 13:51:07 +00:00
|
|
|
The
|
2014-01-21 03:25:46 +00:00
|
|
|
.BR O_DIRECT ,
|
2004-12-08 16:41:10 +00:00
|
|
|
.BR O_NOATIME ,
|
2014-01-21 03:25:46 +00:00
|
|
|
.BR O_PATH ,
|
2004-11-03 13:51:07 +00:00
|
|
|
and
|
2014-01-21 03:25:46 +00:00
|
|
|
.BR O_TMPFILE
|
|
|
|
flags are Linux-specific.
|
|
|
|
One must define
|
2008-05-12 14:30:24 +00:00
|
|
|
.B _GNU_SOURCE
|
|
|
|
to obtain their definitions.
|
2008-04-08 11:28:12 +00:00
|
|
|
|
|
|
|
The
|
2014-01-21 03:25:46 +00:00
|
|
|
.BR O_CLOEXEC ,
|
|
|
|
.BR O_DIRECTORY ,
|
|
|
|
and
|
|
|
|
.BR O_NOFOLLOW
|
|
|
|
flags are not specified in POSIX.1-2001,
|
|
|
|
but are specified in POSIX.1-2008.
|
|
|
|
Since glibc 2.12, one can obtain their definitions by defining either
|
|
|
|
.B _POSIX_C_SOURCE
|
|
|
|
with a value greater than or equal to 200809L or
|
|
|
|
.BR _XOPEN_SOURCE
|
|
|
|
with a value greater than or equal to 700.
|
|
|
|
In glibc 2.11 and earlier, one obtains the definitions by defining
|
|
|
|
.BR _GNU_SOURCE .
|
2008-04-08 11:28:12 +00:00
|
|
|
|
2014-01-21 03:25:46 +00:00
|
|
|
As noted in
|
|
|
|
.BR feature_test_macros (7),
|
2014-01-24 11:06:21 +00:00
|
|
|
feature test macros such as
|
2014-01-21 03:25:46 +00:00
|
|
|
.BR _POSIX_C_SOURCE ,
|
|
|
|
.BR _XOPEN_SOURCE ,
|
|
|
|
and
|
2007-09-10 04:34:20 +00:00
|
|
|
.B _GNU_SOURCE
|
2014-01-21 03:25:46 +00:00
|
|
|
must be defined before including
|
2010-09-10 04:33:31 +00:00
|
|
|
.I any
|
2014-01-21 03:25:46 +00:00
|
|
|
header files.
|
2007-05-18 16:06:42 +00:00
|
|
|
.SH NOTES
|
2007-06-21 22:55:04 +00:00
|
|
|
Under Linux, the
|
2007-05-18 16:06:42 +00:00
|
|
|
.B O_NONBLOCK
|
|
|
|
flag indicates that one wants to open
|
|
|
|
but does not necessarily have the intention to read or write.
|
|
|
|
This is typically used to open devices in order to get a file descriptor
|
|
|
|
for use with
|
|
|
|
.BR ioctl (2).
|
2004-11-03 13:51:07 +00:00
|
|
|
.LP
|
|
|
|
The (undefined) effect of
|
|
|
|
.B O_RDONLY | O_TRUNC
|
2007-04-12 22:42:49 +00:00
|
|
|
varies among implementations.
|
2006-11-25 01:00:24 +00:00
|
|
|
On many systems the file is actually truncated.
|
2004-11-03 13:51:07 +00:00
|
|
|
.\" Linux 2.0, 2.5: truncate
|
|
|
|
.\" Solaris 5.7, 5.8: truncate
|
|
|
|
.\" Irix 6.5: truncate
|
|
|
|
.\" Tru64 5.1B: truncate
|
|
|
|
.\" HP-UX 11.22: truncate
|
|
|
|
.\" FreeBSD 4.7: truncate
|
2007-05-18 16:06:42 +00:00
|
|
|
|
2014-03-16 09:02:33 +00:00
|
|
|
Note that
|
|
|
|
.BR open ()
|
|
|
|
can open device special files, but
|
|
|
|
.BR creat ()
|
|
|
|
cannot create them; use
|
|
|
|
.BR mknod (2)
|
|
|
|
instead.
|
|
|
|
|
|
|
|
If the file is newly created, its
|
|
|
|
.IR st_atime ,
|
|
|
|
.IR st_ctime ,
|
|
|
|
.I st_mtime
|
|
|
|
fields
|
|
|
|
(respectively, time of last access, time of last status change, and
|
|
|
|
time of last modification; see
|
|
|
|
.BR stat (2))
|
|
|
|
are set
|
|
|
|
to the current time, and so are the
|
|
|
|
.I st_ctime
|
|
|
|
and
|
|
|
|
.I st_mtime
|
|
|
|
fields of the
|
|
|
|
parent directory.
|
|
|
|
Otherwise, if the file is modified because of the
|
|
|
|
.B O_TRUNC
|
2015-04-21 13:26:15 +00:00
|
|
|
flag, its
|
|
|
|
.I st_ctime
|
|
|
|
and
|
|
|
|
.I st_mtime
|
|
|
|
fields are set to the current time.
|
2016-03-08 17:58:34 +00:00
|
|
|
|
|
|
|
The files in the
|
|
|
|
.I /proc/[pid]/fd
|
|
|
|
directory show the open file descriptors of the process with the PID
|
|
|
|
.IR pid .
|
|
|
|
The files in the
|
|
|
|
.I /proc/[pid]/fdinfo
|
|
|
|
directory show even more information about these files descriptors.
|
|
|
|
See
|
|
|
|
.BR proc (5)
|
|
|
|
for further details of both of these directories.
|
2014-03-16 09:02:33 +00:00
|
|
|
.\"
|
|
|
|
.\"
|
2014-05-01 05:28:52 +00:00
|
|
|
.SS Open file descriptions
|
|
|
|
The term open file description is the one used by POSIX to refer to the
|
|
|
|
entries in the system-wide table of open files.
|
2014-06-14 06:03:45 +00:00
|
|
|
In other contexts, this object is
|
2014-05-01 05:28:52 +00:00
|
|
|
variously also called an "open file object",
|
|
|
|
a "file handle", an "open file table entry",
|
|
|
|
or\(emin kernel-developer parlance\(ema
|
|
|
|
.IR "struct file" .
|
|
|
|
|
|
|
|
When a file descriptor is duplicated (using
|
|
|
|
.BR dup (2)
|
|
|
|
or similar),
|
|
|
|
the duplicate refers to the same open file description
|
|
|
|
as the original file descriptor,
|
|
|
|
and the two file descriptors consequently share
|
|
|
|
the file offset and file status flags.
|
|
|
|
Such sharing can also occur between processes:
|
|
|
|
a child process created via
|
2014-06-14 06:03:45 +00:00
|
|
|
.BR fork (2)
|
2014-05-01 05:28:52 +00:00
|
|
|
inherits duplicates of its parent's file descriptors,
|
|
|
|
and those duplicates refer to the same open file descriptions.
|
|
|
|
|
|
|
|
Each
|
arch_prctl.2, execveat.2, fanotify_mark.2, fcntl.2, fork.2, madvise.2, mknod.2, mmap.2, modify_ldt.2, mount.2, open.2, prctl.2, ptrace.2, restart_syscall.2, seccomp.2, semop.2, set_thread_area.2, symlink.2, umount.2, unlink.2, error.3, getnetent.3, getprotoent.3, getservent.3, getutent.3, glob.3, login.3, setjmp.3, setnetgrent.3, wordexp.3, epoll.7: Remove section number from page self reference
Fix places where pages refer to the function that they describe
and include a section number in that reference. Such references
cause some HTML-rendering tools to create self-references in the
page.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-08-07 16:40:35 +00:00
|
|
|
.BR open ()
|
2014-05-01 05:28:52 +00:00
|
|
|
of a file creates a new open file description;
|
|
|
|
thus, there may be multiple open file descriptions
|
|
|
|
corresponding to a file inode.
|
2016-07-28 08:31:51 +00:00
|
|
|
|
|
|
|
On Linux, one can use the
|
|
|
|
.BR kcmp (2)
|
|
|
|
.B KCMP_FILE
|
|
|
|
operation to test whether two file descriptors
|
|
|
|
(in the same process or in two different processes)
|
|
|
|
refer to the same open file description.
|
2014-05-01 05:28:52 +00:00
|
|
|
.\"
|
|
|
|
.\"
|
2014-03-16 09:02:33 +00:00
|
|
|
.SS Synchronized I/O
|
2014-03-16 08:55:02 +00:00
|
|
|
The POSIX.1-2008 "synchronized I/O" option
|
|
|
|
specifies different variants of synchronized I/O,
|
|
|
|
and specifies the
|
|
|
|
.BR open ()
|
|
|
|
flags
|
2009-09-20 05:41:16 +00:00
|
|
|
.BR O_SYNC ,
|
|
|
|
.BR O_DSYNC ,
|
|
|
|
and
|
2014-03-16 08:55:02 +00:00
|
|
|
.BR O_RSYNC
|
|
|
|
for controlling the behavior.
|
|
|
|
Regardless of whether an implementation supports this option,
|
|
|
|
it must at least support the use of
|
|
|
|
.BR O_SYNC
|
|
|
|
for regular files.
|
|
|
|
|
2014-03-18 15:29:34 +00:00
|
|
|
Linux implements
|
2014-03-16 08:55:02 +00:00
|
|
|
.BR O_SYNC
|
|
|
|
and
|
|
|
|
.BR O_DSYNC ,
|
|
|
|
but not
|
2009-09-20 05:41:16 +00:00
|
|
|
.BR O_RSYNC .
|
2014-03-16 08:55:02 +00:00
|
|
|
(Somewhat incorrectly, glibc defines
|
|
|
|
.BR O_RSYNC
|
|
|
|
to have the same value as
|
|
|
|
.BR O_SYNC .)
|
|
|
|
|
|
|
|
.BR O_SYNC
|
|
|
|
provides synchronized I/O
|
|
|
|
.I file
|
|
|
|
integrity completion,
|
|
|
|
meaning write operations will flush data and all associated metadata
|
|
|
|
to the underlying hardware.
|
|
|
|
.BR O_DSYNC
|
|
|
|
provides synchronized I/O
|
|
|
|
.I data
|
|
|
|
integrity completion,
|
|
|
|
meaning write operations will flush data
|
|
|
|
to the underlying hardware,
|
|
|
|
but will only flush metadata updates that are required
|
|
|
|
to allow a subsequent read operation to complete successfully.
|
|
|
|
Data integrity completion can reduce the number of disk operations
|
|
|
|
that are required for applications that don't need the guarantees
|
|
|
|
of file integrity completion.
|
|
|
|
|
2014-08-01 19:57:51 +00:00
|
|
|
To understand the difference between the two types of completion,
|
2014-03-16 08:55:02 +00:00
|
|
|
consider two pieces of file metadata:
|
|
|
|
the file last modification timestamp
|
|
|
|
.RI ( st_mtime )
|
|
|
|
and the file length.
|
|
|
|
All write operations will update the last file modification timestamp,
|
|
|
|
but only writes that add data to the end of the
|
|
|
|
file will change the file length.
|
|
|
|
The last modification timestamp is not needed to ensure that
|
|
|
|
a read completes successfully, but the file length is.
|
|
|
|
Thus,
|
|
|
|
.BR O_DSYNC
|
|
|
|
would only guarantee to flush updates to the file length metadata
|
|
|
|
(whereas
|
|
|
|
.BR O_SYNC
|
|
|
|
would also always flush the last modification timestamp metadata).
|
|
|
|
|
|
|
|
Before Linux 2.6.33, Linux implemented only the
|
|
|
|
.BR O_SYNC
|
2014-03-18 15:29:34 +00:00
|
|
|
flag for
|
2014-03-16 08:55:02 +00:00
|
|
|
.BR open ().
|
|
|
|
However, when that flag was specified,
|
|
|
|
most filesystems actually provided the equivalent of synchronized I/O
|
|
|
|
.I data
|
|
|
|
integrity completion (i.e.,
|
|
|
|
.BR O_SYNC
|
|
|
|
was actually implemented as the equivalent of
|
|
|
|
.BR O_DSYNC ).
|
|
|
|
|
|
|
|
Since Linux 2.6.33, proper
|
|
|
|
.BR O_SYNC
|
|
|
|
support is provided.
|
|
|
|
However, to ensure backward binary compatibility,
|
|
|
|
.BR O_DSYNC
|
|
|
|
was defined with the same value as the historical
|
2009-09-20 05:41:16 +00:00
|
|
|
.BR O_SYNC ,
|
|
|
|
and
|
2014-03-16 08:55:02 +00:00
|
|
|
.BR O_SYNC
|
2014-03-18 15:29:34 +00:00
|
|
|
was defined as a new (two-bit) flag value that includes the
|
2014-03-16 08:55:02 +00:00
|
|
|
.BR O_DSYNC
|
|
|
|
flag value.
|
|
|
|
This ensures that applications compiled against
|
|
|
|
new headers get at least
|
|
|
|
.BR O_DSYNC
|
|
|
|
semantics on pre-2.6.33 kernels.
|
2014-03-16 09:02:33 +00:00
|
|
|
.\"
|
|
|
|
.\"
|
|
|
|
.SS NFS
|
|
|
|
There are many infelicities in the protocol underlying NFS, affecting
|
|
|
|
amongst others
|
|
|
|
.BR O_SYNC " and " O_NDELAY .
|
2007-05-18 16:06:42 +00:00
|
|
|
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
On NFS filesystems with UID mapping enabled,
|
2007-05-18 16:06:42 +00:00
|
|
|
.BR open ()
|
|
|
|
may
|
2007-06-08 11:56:22 +00:00
|
|
|
return a file descriptor but, for example,
|
2007-05-18 16:06:42 +00:00
|
|
|
.BR read (2)
|
|
|
|
requests are denied
|
|
|
|
with \fBEACCES\fP.
|
|
|
|
This is because the client performs
|
|
|
|
.BR open ()
|
|
|
|
by checking the
|
|
|
|
permissions, but UID mapping is performed by the server upon
|
|
|
|
read and write requests.
|
2014-03-16 09:02:33 +00:00
|
|
|
.\"
|
|
|
|
.\"
|
2015-03-22 15:09:36 +00:00
|
|
|
.SS FIFOs
|
|
|
|
Opening the read or write end of a FIFO blocks until the other
|
|
|
|
end is also opened (by another process or thread).
|
|
|
|
See
|
|
|
|
.BR fifo (7)
|
|
|
|
for further details.
|
|
|
|
.\"
|
|
|
|
.\"
|
2014-03-16 09:02:33 +00:00
|
|
|
.SS File access mode
|
|
|
|
Unlike the other values that can be specified in
|
|
|
|
.IR flags ,
|
|
|
|
the
|
|
|
|
.I "access mode"
|
|
|
|
values
|
|
|
|
.BR O_RDONLY ", " O_WRONLY ", and " O_RDWR
|
|
|
|
do not specify individual bits.
|
|
|
|
Rather, they define the low order two bits of
|
|
|
|
.IR flags ,
|
|
|
|
and are defined respectively as 0, 1, and 2.
|
|
|
|
In other words, the combination
|
|
|
|
.B "O_RDONLY | O_WRONLY"
|
|
|
|
is a logical error, and certainly does not have the same meaning as
|
|
|
|
.BR O_RDWR .
|
2007-05-18 16:06:42 +00:00
|
|
|
|
2014-03-16 09:02:33 +00:00
|
|
|
Linux reserves the special, nonstandard access mode 3 (binary 11) in
|
|
|
|
.I flags
|
|
|
|
to mean:
|
2016-01-01 10:45:50 +00:00
|
|
|
check for read and write permission on the file and return a file descriptor
|
2014-03-16 09:02:33 +00:00
|
|
|
that can't be used for reading or writing.
|
|
|
|
This nonstandard access mode is used by some Linux drivers to return a
|
2016-01-01 10:45:50 +00:00
|
|
|
file descriptor that is to be used only for device-specific
|
2014-03-16 09:02:33 +00:00
|
|
|
.BR ioctl (2)
|
|
|
|
operations.
|
|
|
|
.\" See for example util-linux's disk-utils/setfdprm.c
|
|
|
|
.\" For some background on access mode 3, see
|
|
|
|
.\" http://thread.gmane.org/gmane.linux.kernel/653123
|
|
|
|
.\" "[RFC] correct flags to f_mode conversion in __dentry_open"
|
|
|
|
.\" LKML, 12 Mar 2008
|
2014-02-21 06:33:19 +00:00
|
|
|
.\"
|
|
|
|
.\"
|
2014-03-17 12:05:39 +00:00
|
|
|
.SS Rationale for openat() and other "directory file descriptor" APIs
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR openat ()
|
2014-03-17 12:05:39 +00:00
|
|
|
and the other system calls and library functions that take
|
|
|
|
a directory file descriptor argument
|
2014-02-21 06:33:19 +00:00
|
|
|
(i.e.,
|
2015-01-09 13:25:32 +00:00
|
|
|
.BR execveat (2),
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR faccessat (2),
|
2014-03-17 12:05:39 +00:00
|
|
|
.BR fanotify_mark (2),
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR fchmodat (2),
|
|
|
|
.BR fchownat (2),
|
|
|
|
.BR fstatat (2),
|
|
|
|
.BR futimesat (2),
|
|
|
|
.BR linkat (2),
|
|
|
|
.BR mkdirat (2),
|
|
|
|
.BR mknodat (2),
|
2014-03-17 12:05:39 +00:00
|
|
|
.BR name_to_handle_at (2),
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR readlinkat (2),
|
|
|
|
.BR renameat (2),
|
2017-03-16 06:28:21 +00:00
|
|
|
.BR statx (2),
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR symlinkat (2),
|
|
|
|
.BR unlinkat (2),
|
2015-03-17 07:25:43 +00:00
|
|
|
.BR utimensat (2),
|
2014-03-17 12:05:39 +00:00
|
|
|
.BR mkfifoat (3),
|
2014-02-21 06:33:19 +00:00
|
|
|
and
|
2014-03-17 12:05:39 +00:00
|
|
|
.BR scandirat (3))
|
2017-03-16 06:29:59 +00:00
|
|
|
address two problems with the older interfaces that preceded them.
|
2014-02-26 17:29:50 +00:00
|
|
|
Here, the explanation is in terms of the
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR openat ()
|
2014-03-17 12:09:20 +00:00
|
|
|
call, but the rationale is analogous for the other interfaces.
|
2014-02-21 06:33:19 +00:00
|
|
|
|
|
|
|
First,
|
|
|
|
.BR openat ()
|
|
|
|
allows an application to avoid race conditions that could
|
|
|
|
occur when using
|
access.2, chmod.2, chown.2, link.2, mkdir.2, open.2, readlink.2, rename.2, stat.2, symlink.2, unlink.2, mkfifo.3, scandir.3: Minor fix: remove section numbers in references to functions inside page
With the page merges, we now have some references to functions
within the page that have section numbers. Remove those.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-02-21 11:50:40 +00:00
|
|
|
.BR open ()
|
2014-02-21 06:33:19 +00:00
|
|
|
to open files in directories other than the current working directory.
|
|
|
|
These race conditions result from the fact that some component
|
|
|
|
of the directory prefix given to
|
access.2, chmod.2, chown.2, link.2, mkdir.2, open.2, readlink.2, rename.2, stat.2, symlink.2, unlink.2, mkfifo.3, scandir.3: Minor fix: remove section numbers in references to functions inside page
With the page merges, we now have some references to functions
within the page that have section numbers. Remove those.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-02-21 11:50:40 +00:00
|
|
|
.BR open ()
|
2014-02-21 06:33:19 +00:00
|
|
|
could be changed in parallel with the call to
|
access.2, chmod.2, chown.2, link.2, mkdir.2, open.2, readlink.2, rename.2, stat.2, symlink.2, unlink.2, mkfifo.3, scandir.3: Minor fix: remove section numbers in references to functions inside page
With the page merges, we now have some references to functions
within the page that have section numbers. Remove those.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2014-02-21 11:50:40 +00:00
|
|
|
.BR open ().
|
2014-12-12 07:45:17 +00:00
|
|
|
Suppose, for example, that we wish to create the file
|
|
|
|
.I path/to/xxx.dep
|
|
|
|
if the file
|
|
|
|
.I path/to/xxx
|
|
|
|
exists.
|
|
|
|
The problem is that between the existence check and the file creation step,
|
|
|
|
.I path
|
|
|
|
or
|
|
|
|
.I to
|
|
|
|
(which might be symbolic links)
|
|
|
|
could be modified to point to a different location.
|
2014-02-21 06:33:19 +00:00
|
|
|
Such races can be avoided by
|
|
|
|
opening a file descriptor for the target directory,
|
|
|
|
and then specifying that file descriptor as the
|
|
|
|
.I dirfd
|
2014-12-12 07:45:17 +00:00
|
|
|
argument of (say)
|
|
|
|
.BR fstatat (2)
|
|
|
|
and
|
2014-02-21 06:33:19 +00:00
|
|
|
.BR openat ().
|
2017-06-27 06:54:09 +00:00
|
|
|
The use of the
|
|
|
|
.I dirfd
|
|
|
|
file descriptor also has other benefits:
|
|
|
|
.IP * 3
|
|
|
|
the file descriptor is a stable reference to the directory,
|
|
|
|
even if the directory is renamed; and
|
|
|
|
.IP *
|
|
|
|
the open file descriptor prevents the underlying filesystem from
|
|
|
|
being dismounted,
|
|
|
|
just as when a process has a current working directory on a filesystem.
|
|
|
|
.PP
|
2014-02-21 06:33:19 +00:00
|
|
|
Second,
|
|
|
|
.BR openat ()
|
|
|
|
allows the implementation of a per-thread "current working
|
|
|
|
directory", via file descriptor(s) maintained by the application.
|
|
|
|
(This functionality can also be obtained by tricks based
|
|
|
|
on the use of
|
|
|
|
.IR /proc/self/fd/ dirfd,
|
|
|
|
but less efficiently.)
|
|
|
|
.\"
|
|
|
|
.\"
|
2008-02-11 10:38:24 +00:00
|
|
|
.SS O_DIRECT
|
|
|
|
.LP
|
|
|
|
The
|
|
|
|
.B O_DIRECT
|
|
|
|
flag may impose alignment restrictions on the length and address
|
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
|
|
|
of user-space buffers and the file offset of I/Os.
|
2008-02-11 10:38:24 +00:00
|
|
|
In Linux alignment
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
restrictions vary by filesystem and kernel version and might be
|
2008-02-11 10:38:24 +00:00
|
|
|
absent entirely.
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
However there is currently no filesystem\-independent
|
2008-02-11 10:38:24 +00:00
|
|
|
interface for an application to discover these restrictions for a given
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
file or filesystem.
|
|
|
|
Some filesystems provide their own interfaces
|
2008-02-11 10:38:24 +00:00
|
|
|
for doing so, for example the
|
|
|
|
.B XFS_IOC_DIOINFO
|
|
|
|
operation in
|
|
|
|
.BR xfsctl (3).
|
|
|
|
.LP
|
2008-11-14 18:58:09 +00:00
|
|
|
Under Linux 2.4, transfer sizes, and the alignment of the user buffer
|
|
|
|
and the file offset must all be multiples of the logical block size
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
of the filesystem.
|
2014-04-22 18:03:55 +00:00
|
|
|
Since Linux 2.6.0, alignment to the logical block size of the
|
2014-04-22 17:21:19 +00:00
|
|
|
underlying storage (typically 512 bytes) suffices.
|
2014-04-22 18:03:55 +00:00
|
|
|
The logical block size can be determined using the
|
2014-04-22 17:21:19 +00:00
|
|
|
.BR ioctl (2)
|
|
|
|
.B BLKSSZGET
|
2014-04-22 18:03:55 +00:00
|
|
|
operation or from the shell using the command:
|
|
|
|
|
|
|
|
blockdev \-\-getss
|
2012-05-09 05:50:54 +00:00
|
|
|
.LP
|
|
|
|
.B O_DIRECT
|
|
|
|
I/Os should never be run concurrently with the
|
2012-05-01 05:51:47 +00:00
|
|
|
.BR fork (2)
|
2012-05-09 05:50:54 +00:00
|
|
|
system call,
|
|
|
|
if the memory buffer is a private mapping
|
|
|
|
(i.e., any mapping created with the
|
2012-06-07 13:18:51 +00:00
|
|
|
.BR mmap (2)
|
2012-05-09 05:50:54 +00:00
|
|
|
.BR MAP_PRIVATE
|
2012-05-10 20:13:04 +00:00
|
|
|
flag;
|
2012-05-09 05:50:54 +00:00
|
|
|
this includes memory allocated on the heap and statically allocated buffers).
|
|
|
|
Any such I/Os, whether submitted via an asynchronous I/O interface or from
|
|
|
|
another thread in the process,
|
|
|
|
should be completed before
|
|
|
|
.BR fork (2)
|
|
|
|
is called.
|
|
|
|
Failure to do so can result in data corruption and undefined behavior in
|
|
|
|
parent and child processes.
|
|
|
|
This restriction does not apply when the memory buffer for the
|
|
|
|
.B O_DIRECT
|
|
|
|
I/Os was created using
|
|
|
|
.BR shmat (2)
|
|
|
|
or
|
|
|
|
.BR mmap (2)
|
|
|
|
with the
|
|
|
|
.B MAP_SHARED
|
|
|
|
flag.
|
|
|
|
Nor does this restriction apply when the memory buffer has been advised as
|
|
|
|
.B MADV_DONTFORK
|
2012-05-10 20:13:04 +00:00
|
|
|
with
|
2012-06-07 13:18:51 +00:00
|
|
|
.BR madvise (2),
|
2012-05-09 05:50:54 +00:00
|
|
|
ensuring that it will not be available
|
|
|
|
to the child after
|
|
|
|
.BR fork (2).
|
2008-02-11 10:38:24 +00:00
|
|
|
.LP
|
|
|
|
The
|
|
|
|
.B O_DIRECT
|
|
|
|
flag was introduced in SGI IRIX, where it has alignment
|
|
|
|
restrictions similar to those of Linux 2.4.
|
|
|
|
IRIX has also a
|
|
|
|
.BR fcntl (2)
|
|
|
|
call to query appropriate alignments, and sizes.
|
|
|
|
FreeBSD 4.x introduced
|
|
|
|
a flag of the same name, but without alignment restrictions.
|
|
|
|
.LP
|
|
|
|
.B O_DIRECT
|
|
|
|
support was added under Linux in kernel version 2.4.10.
|
|
|
|
Older Linux kernels simply ignore this flag.
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
Some filesystems may not implement the flag and
|
2008-02-11 10:38:24 +00:00
|
|
|
.BR open ()
|
|
|
|
will fail with
|
|
|
|
.B EINVAL
|
|
|
|
if it is used.
|
|
|
|
.LP
|
|
|
|
Applications should avoid mixing
|
|
|
|
.B O_DIRECT
|
|
|
|
and normal I/O to the same file,
|
|
|
|
and especially to overlapping byte regions in the same file.
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
Even when the filesystem correctly handles the coherency issues in
|
2008-02-11 10:38:24 +00:00
|
|
|
this situation, overall I/O throughput is likely to be slower than
|
|
|
|
using either mode alone.
|
|
|
|
Likewise, applications should avoid mixing
|
|
|
|
.BR mmap (2)
|
|
|
|
of files with direct I/O to the same files.
|
|
|
|
.LP
|
2014-06-16 20:25:04 +00:00
|
|
|
The behavior of
|
2008-02-11 10:38:24 +00:00
|
|
|
.B O_DIRECT
|
intro.1, time.1, access.2, acct.2, alloc_hugepages.2, bind.2, chdir.2, chmod.2, chown.2, chroot.2, clone.2, close.2, execve.2, fallocate.2, fcntl.2, getdents.2, getrusage.2, getxattr.2, init_module.2, inotify_add_watch.2, ioprio_set.2, kcmp.2, link.2, listxattr.2, lseek.2, madvise.2, mkdir.2, mknod.2, mmap.2, mount.2, move_pages.2, msgctl.2, nfsservctl.2, open.2, pivot_root.2, quotactl.2, read.2, readlink.2, removexattr.2, rename.2, rmdir.2, semctl.2, setfsgid.2, setfsuid.2, setresuid.2, setuid.2, setup.2, setxattr.2, shmctl.2, splice.2, spu_create.2, stat.2, statfs.2, swapon.2, symlink.2, sync.2, sync_file_range.2, sysfs.2, truncate.2, umount.2, unlink.2, unshare.2, ustat.2, utime.2, utimensat.2, write.2, btree.3, errno.3, fexecve.3, ftw.3, futimes.3, get_nprocs_conf.3, getcwd.3, getdirentries.3, getmntent.3, glob.3, mkfifo.3, mq_open.3, readdir.3, realpath.3, recno.3, remove.3, sem_open.3, shm_open.3, statvfs.3, sysconf.3, telldir.3, tmpfile.3, cciss.4, initrd.4, pts.4, sk98lin.4, vcs.4, core.5, filesystems.5, proc.5, boot.7, bootparam.7, capabilities.7, cpuset.7, credentials.7, feature_test_macros.7, fifo.7, hier.7, inotify.7, intro.7, mq_overview.7, path_resolution.7, pipe.7, sem_overview.7, shm_overview.7, spufs.7, symlink.7, unix.7, uri.7, sync.8: Global fix: s/file system/filesystem/
Notwithstanding 24d01c530c5a3f75217543d02bf6712395e5f90c,
"filesystem" is the form used by the great majority of man pages
outside the man-pages project and in a number of other sources,
so let's go with that.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-08-08 08:07:57 +00:00
|
|
|
with NFS will differ from local filesystems.
|
2008-02-11 10:38:24 +00:00
|
|
|
Older kernels, or
|
|
|
|
kernels configured in certain ways, may not support this combination.
|
|
|
|
The NFS protocol does not support passing the flag to the server, so
|
|
|
|
.B O_DIRECT
|
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
|
|
|
I/O will bypass the page cache only on the client; the server may
|
2008-02-11 10:38:24 +00:00
|
|
|
still cache the I/O.
|
|
|
|
The client asks the server to make the I/O
|
|
|
|
synchronous to preserve the synchronous semantics of
|
|
|
|
.BR O_DIRECT .
|
|
|
|
Some servers will perform poorly under these circumstances, especially
|
|
|
|
if the I/O size is small.
|
|
|
|
Some servers may also be configured to
|
|
|
|
lie to clients about the I/O having reached stable storage; this
|
|
|
|
will avoid the performance penalty at some risk to data integrity
|
|
|
|
in the event of server power failure.
|
|
|
|
The Linux NFS client places no alignment restrictions on
|
|
|
|
.B O_DIRECT
|
|
|
|
I/O.
|
|
|
|
.PP
|
|
|
|
In summary,
|
|
|
|
.B O_DIRECT
|
|
|
|
is a potentially powerful tool that should be used with caution.
|
|
|
|
It is recommended that applications treat use of
|
|
|
|
.B O_DIRECT
|
|
|
|
as a performance option which is disabled by default.
|
|
|
|
.PP
|
|
|
|
.RS
|
2004-11-03 13:51:07 +00:00
|
|
|
"The thing that has always disturbed me about O_DIRECT is that the whole
|
|
|
|
interface is just stupid, and was probably designed by a deranged monkey
|
intro.1, fork.2, futex.2, open.2, rename.2, select_tut.2, semop.2, spu_create.2, stat.2, netlink.3, random.3, scanf.3, shm_open.3, strftime.3, console.4, console_codes.4, sk98lin.4, st.4, bootparam.7, cpuset.7, credentials.7, man-pages.7, path_resolution.7, uri.7: Global fix: remove spaces around em-dash
Normal English typographical convention is not to have
spaces around em dashes.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2011-10-03 06:47:35 +00:00
|
|
|
on some serious mind-controlling substances."\(emLinus
|
2008-02-11 10:38:24 +00:00
|
|
|
.RE
|
|
|
|
.SH BUGS
|
2006-01-15 04:39:23 +00:00
|
|
|
Currently, it is not possible to enable signal-driven
|
|
|
|
I/O by specifying
|
|
|
|
.B O_ASYNC
|
2007-04-12 22:42:49 +00:00
|
|
|
when calling
|
2006-01-15 04:39:23 +00:00
|
|
|
.BR open ();
|
|
|
|
use
|
|
|
|
.BR fcntl (2)
|
|
|
|
to enable this flag.
|
2007-06-13 21:48:16 +00:00
|
|
|
.\" FIXME . Check bugzilla report on open(O_ASYNC)
|
2006-02-08 09:44:13 +00:00
|
|
|
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=5993
|
2014-01-24 04:16:55 +00:00
|
|
|
|
|
|
|
One must check for two different error codes,
|
|
|
|
.B EISDIR
|
|
|
|
and
|
|
|
|
.BR ENOENT ,
|
|
|
|
when trying to determine whether the kernel supports
|
2014-02-10 21:01:28 +00:00
|
|
|
.B O_TMPFILE
|
2014-01-24 04:16:55 +00:00
|
|
|
functionality.
|
2015-05-06 16:20:41 +00:00
|
|
|
|
|
|
|
When both
|
|
|
|
.B O_CREAT
|
|
|
|
and
|
|
|
|
.B O_DIRECTORY
|
|
|
|
are specified in
|
|
|
|
.IR flags
|
|
|
|
and the file specified by
|
|
|
|
.I pathname
|
|
|
|
does not exist,
|
|
|
|
.BR open ()
|
|
|
|
will create a regular file (i.e.,
|
|
|
|
.B O_DIRECTORY
|
|
|
|
is ignored).
|
getent.1, intro.1, time.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, adjtimex.2, alarm.2, alloc_hugepages.2, arch_prctl.2, bdflush.2, bind.2, brk.2, cacheflush.2, capget.2, chdir.2, chmod.2, chown.2, chroot.2, clock_getres.2, clock_nanosleep.2, clone.2, close.2, connect.2, create_module.2, delete_module.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, execve.2, exit_group.2, faccessat.2, fchmodat.2, fchownat.2, fcntl.2, flock.2, fork.2, fstatat.2, fsync.2, futex.2, futimesat.2, get_kernel_syms.2, get_robust_list.2, get_thread_area.2, getcpu.2, getdents.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getitimer.2, getpagesize.2, getpeername.2, getpid.2, getpriority.2, getresuid.2, getrlimit.2, getrusage.2, getsid.2, getsockname.2, getsockopt.2, gettid.2, gettimeofday.2, getuid.2, getunwind.2, getxattr.2, idle.2, init_module.2, inotify_add_watch.2, inotify_init.2, inotify_rm_watch.2, intro.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl.2, ioctl_list.2, ioperm.2, iopl.2, ioprio_set.2, ipc.2, kcmp.2, kill.2, killpg.2, link.2, linkat.2, listen.2, listxattr.2, llseek.2, lookup_dcookie.2, lseek.2, madvise.2, migrate_pages.2, mincore.2, mkdir.2, mkdirat.2, mknod.2, mknodat.2, mlock.2, mmap.2, mmap2.2, modify_ldt.2, mount.2, move_pages.2, mprotect.2, mq_getsetattr.2, mremap.2, msgctl.2, msgget.2, msgop.2, msync.2, nanosleep.2, nfsservctl.2, nice.2, open.2, openat.2, outb.2, pause.2, pciconfig_read.2, perf_event_open.2, perfmonctl.2, personality.2, pipe.2, pivot_root.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, read.2, readahead.2, readdir.2, readlink.2, readlinkat.2, readv.2, reboot.2, recv.2, remap_file_pages.2, removexattr.2, rename.2, renameat.2, rmdir.2, rt_sigqueueinfo.2, sched_get_priority_max.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setparam.2, sched_setscheduler.2, sched_yield.2, select.2, semctl.2, semget.2, semop.2, send.2, sendfile.2, set_thread_area.2, set_tid_address.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, setup.2, setxattr.2, shmctl.2, shmget.2, shmop.2, shutdown.2, sigaction.2, sigaltstack.2, signal.2, signalfd.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, socket.2, socketcall.2, socketpair.2, splice.2, stat.2, statfs.2, stime.2, swapon.2, symlink.2, symlinkat.2, sync.2, sync_file_range.2, sysctl.2, sysfs.2, sysinfo.2, syslog.2, tee.2, time.2, timerfd_create.2, times.2, tkill.2, truncate.2, umask.2, umount.2, uname.2, unimplemented.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, MB_CUR_MAX.3, MB_LEN_MAX.3, __setfpucw.3, a64l.3, abort.3, abs.3, acos.3, acosh.3, addseverity.3, adjtime.3, aio_cancel.3, aio_error.3, aio_fsync.3, aio_read.3, aio_return.3, aio_suspend.3, aio_write.3, alloca.3, argz_add.3, asin.3, asinh.3, asprintf.3, assert.3, assert_perror.3, atan.3, atan2.3, atanh.3, atexit.3, atof.3, atoi.3, backtrace.3, basename.3, bcmp.3, bcopy.3, bindresvport.3, bsd_signal.3, bsearch.3, bstring.3, btowc.3, btree.3, byteorder.3, bzero.3, cabs.3, cacos.3, cacosh.3, canonicalize_file_name.3, carg.3, casin.3, casinh.3, catan.3, catanh.3, catgets.3, catopen.3, cbrt.3, ccos.3, ccosh.3, ceil.3, cerf.3, cexp.3, cexp2.3, cfree.3, cimag.3, clearenv.3, clock.3, clock_getcpuclockid.3, clog.3, clog10.3, clog2.3, closedir.3, cmsg.3, confstr.3, conj.3, copysign.3, cos.3, cosh.3, cpow.3, cproj.3, creal.3, crypt.3, csin.3, csinh.3, csqrt.3, ctan.3, ctanh.3, ctermid.3, ctime.3, daemon.3, dbopen.3, des_crypt.3, difftime.3, dirfd.3, div.3, dl_iterate_phdr.3, dlopen.3, dprintf.3, drand48.3, drand48_r.3, dysize.3, ecvt.3, ecvt_r.3, encrypt.3, end.3, endian.3, envz_add.3, erf.3, erfc.3, err.3, errno.3, error.3, ether_aton.3, euidaccess.3, exec.3, exit.3, exp.3, exp10.3, exp2.3, expm1.3, fabs.3, fclose.3, fcloseall.3, fdim.3, fenv.3, ferror.3, fexecve.3, fflush.3, ffs.3, fgetgrent.3, fgetpwent.3, fgetwc.3, fgetws.3, finite.3, flockfile.3, floor.3, fma.3, fmax.3, fmemopen.3, fmin.3, fmod.3, fmtmsg.3, fnmatch.3, fopen.3, fpathconf.3, fpclassify.3, fpurge.3, fputwc.3, fputws.3, fread.3, frexp.3, fseek.3, fseeko.3, ftime.3, ftok.3, fts.3, ftw.3, futimes.3, fwide.3, gamma.3, gcvt.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getcontext.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getenv.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getipnodebyname.3, getline.3, getloadavg.3, getlogin.3, getmntent.3, getnameinfo.3, getnetent.3, getnetent_r.3, getopt.3, getpass.3, getprotoent.3, getprotoent_r.3, getpt.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getrpcent_r.3, getrpcport.3, gets.3, getservent.3, getservent_r.3, getspnam.3, getttyent.3, getumask.3, getusershell.3, getutent.3, getw.3, getwchar.3, glob.3, grantpt.3, gsignal.3, hash.3, hsearch.3, hypot.3, iconv.3, iconv_close.3, iconv_open.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, isgreater.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, j0.3, key_setsecret.3, ldexp.3, lgamma.3, lio_listio.3, localeconv.3, lockf.3, log.3, log10.3, log1p.3, log2.3, logb.3, login.3, longjmp.3, lrint.3, lround.3, lsearch.3, lseek64.3, makecontext.3, makedev.3, malloc.3, malloc_hook.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, memccpy.3, memchr.3, memcmp.3, memcpy.3, memfrob.3, memmem.3, memmove.3, mempcpy.3, memset.3, mkdtemp.3, mkfifo.3, mkfifoat.3, mkstemp.3, mktemp.3, modf.3, mpool.3, mq_close.3, mq_getattr.3, mq_notify.3, mq_open.3, mq_receive.3, mq_send.3, mq_unlink.3, mtrace.3, nan.3, netlink.3, nextafter.3, nl_langinfo.3, offsetof.3, on_exit.3, opendir.3, openpty.3, perror.3, popen.3, posix_fallocate.3, posix_memalign.3, posix_openpt.3, pow.3, pow10.3, printf.3, profil.3, program_invocation_name.3, psignal.3, pthread_kill_other_threads_np.3, ptsname.3, putenv.3, putgrent.3, putpwent.3, puts.3, putwchar.3, qecvt.3, qsort.3, queue.3, raise.3, rand.3, random.3, random_r.3, rcmd.3, re_comp.3, readdir.3, realpath.3, recno.3, regex.3, remainder.3, remove.3, remquo.3, resolver.3, rewinddir.3, rexec.3, rint.3, round.3, rpc.3, rpmatch.3, rtime.3, rtnetlink.3, scalb.3, scalbln.3, scandir.3, scandirat.3, scanf.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, setaliasent.3, setbuf.3, setenv.3, setjmp.3, setlocale.3, setlogmask.3, setnetgrent.3, shm_open.3, siginterrupt.3, signbit.3, significand.3, sigpause.3, sigqueue.3, sigset.3, sigsetops.3, sigvec.3, sin.3, sincos.3, sinh.3, sleep.3, sockatmark.3, sqrt.3, statvfs.3, stdarg.3, stdin.3, stdio.3, stdio_ext.3, stpcpy.3, stpncpy.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strdup.3, strerror.3, strfmon.3, strfry.3, strftime.3, string.3, strlen.3, strnlen.3, strpbrk.3, strptime.3, strsep.3, strsignal.3, strspn.3, strstr.3, strtod.3, strtoimax.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, termios.3, tgamma.3, timegm.3, timeradd.3, tmpfile.3, tmpnam.3, toascii.3, toupper.3, towctrans.3, towlower.3, towupper.3, trunc.3, tsearch.3, ttyname.3, ttyslot.3, tzset.3, ualarm.3, ulimit.3, ungetwc.3, unlocked_stdio.3, unlockpt.3, updwtmp.3, usleep.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstoimax.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wordexp.3, wprintf.3, xcrypt.3, xdr.3, y0.3, cciss.4, console.4, console_codes.4, console_ioctl.4, dsp56k.4, fd.4, full.4, hd.4, hpsa.4, initrd.4, intro.4, lp.4, mem.4, mouse.4, null.4, pts.4, ram.4, random.4, rtc.4, sk98lin.4, st.4, tty.4, ttyS.4, tty_ioctl.4, vcs.4, wavelan.4, acct.5, charmap.5, dir_colors.5, filesystems.5, ftpusers.5, group.5, host.conf.5, hosts.5, hosts.equiv.5, intro.5, issue.5, locale.5, motd.5, networks.5, nologin.5, nscd.conf.5, passwd.5, proc.5, protocols.5, resolv.conf.5, rpc.5, securetty.5, services.5, shells.5, termcap.5, ttytype.5, utmp.5, armscii-8.7, arp.7, ascii.7, bootparam.7, capabilities.7, charsets.7, complex.7, cp1251.7, credentials.7, ddp.7, environ.7, epoll.7, fifo.7, futex.7, glob.7, hier.7, icmp.7, inotify.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, locale.7, mailaddr.7, man.7, mq_overview.7, netdevice.7, netlink.7, numa.7, packet.7, path_resolution.7, pipe.7, posixoptions.7, pthreads.7, pty.7, raw.7, regex.7, rtld-audit.7, rtnetlink.7, sem_overview.7, shm_overview.7, sigevent.7, signal.7, socket.7, standards.7, suffixes.7, svipc.7, tcp.7, termio.7, time.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, utf-8.7, x25.7, nscd.8, sync.8, tzselect.8, zdump.8, zic.8: Global fix: remove unneeded double quotes in .SH headings
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2013-02-24 18:01:36 +00:00
|
|
|
.SH SEE ALSO
|
2008-05-13 11:29:39 +00:00
|
|
|
.BR chmod (2),
|
|
|
|
.BR chown (2),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR close (2),
|
2005-06-22 09:52:33 +00:00
|
|
|
.BR dup (2),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR fcntl (2),
|
|
|
|
.BR link (2),
|
2005-06-21 10:04:56 +00:00
|
|
|
.BR lseek (2),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR mknod (2),
|
2005-06-22 09:52:33 +00:00
|
|
|
.BR mmap (2),
|
2008-07-14 15:52:21 +00:00
|
|
|
.BR mount (2),
|
2014-05-10 05:33:48 +00:00
|
|
|
.BR open_by_handle_at (2),
|
2004-11-03 13:51:07 +00:00
|
|
|
.BR read (2),
|
|
|
|
.BR socket (2),
|
|
|
|
.BR stat (2),
|
|
|
|
.BR umask (2),
|
|
|
|
.BR unlink (2),
|
|
|
|
.BR write (2),
|
|
|
|
.BR fopen (3),
|
2016-05-02 19:42:03 +00:00
|
|
|
.BR acl (5),
|
2008-07-14 15:52:21 +00:00
|
|
|
.BR fifo (7),
|
2017-04-22 19:54:23 +00:00
|
|
|
.BR inode (7),
|
2008-06-11 21:50:53 +00:00
|
|
|
.BR path_resolution (7),
|
|
|
|
.BR symlink (7)
|