]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libc/sys/fcntl.2
Merge bmake-20230622
[FreeBSD/FreeBSD.git] / lib / libc / sys / fcntl.2
1 .\" Copyright (c) 1983, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. Neither the name of the University nor the names of its contributors
13 .\"    may be used to endorse or promote products derived from this software
14 .\"    without specific prior written permission.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
17 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
20 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 .\" SUCH DAMAGE.
27 .\"
28 .\"     @(#)fcntl.2     8.2 (Berkeley) 1/12/94
29 .\" $FreeBSD$
30 .\"
31 .Dd December 7, 2021
32 .Dt FCNTL 2
33 .Os
34 .Sh NAME
35 .Nm fcntl
36 .Nd file control
37 .Sh LIBRARY
38 .Lb libc
39 .Sh SYNOPSIS
40 .In fcntl.h
41 .Ft int
42 .Fn fcntl "int fd" "int cmd" "..."
43 .Sh DESCRIPTION
44 The
45 .Fn fcntl
46 system call provides for control over descriptors.
47 The argument
48 .Fa fd
49 is a descriptor to be operated on by
50 .Fa cmd
51 as described below.
52 Depending on the value of
53 .Fa cmd ,
54 .Fn fcntl
55 can take an additional third argument
56 .Fa arg .
57 Unless otherwise noted below for a specific operation,
58 .Fa arg
59 has type
60 .Vt int .
61 .Bl -tag -width F_DUP2FD_CLOEXEC
62 .It Dv F_DUPFD
63 Return a new descriptor as follows:
64 .Pp
65 .Bl -bullet -compact -offset 4n
66 .It
67 Lowest numbered available descriptor greater than or equal to
68 .Fa arg .
69 .It
70 Same object references as the original descriptor.
71 .It
72 New descriptor shares the same file offset if the object
73 was a file.
74 .It
75 Same access mode (read, write or read/write).
76 .It
77 Same file status flags (i.e., both file descriptors
78 share the same file status flags).
79 .It
80 The close-on-exec flag
81 .Dv FD_CLOEXEC
82 associated with the new file descriptor is cleared, so the file descriptor is
83 to remain open across
84 .Xr execve 2
85 system calls.
86 .El
87 .It Dv F_DUPFD_CLOEXEC
88 Like
89 .Dv F_DUPFD ,
90 but the
91 .Dv FD_CLOEXEC
92 flag associated with the new file descriptor is set, so the file descriptor
93 is closed when
94 .Xr execve 2
95 system call executes.
96 .It Dv F_DUP2FD
97 It is functionally equivalent to
98 .Bd -literal -offset indent
99 dup2(fd, arg)
100 .Ed
101 .It Dv F_DUP2FD_CLOEXEC
102 Like
103 .Dv F_DUP2FD ,
104 but the
105 .Dv FD_CLOEXEC
106 flag associated with the new file descriptor is set.
107 .Pp
108 The
109 .Dv F_DUP2FD
110 and
111 .Dv F_DUP2FD_CLOEXEC
112 constants are not portable, so they should not be used if
113 portability is needed.
114 Use
115 .Fn dup2
116 instead of
117 .Dv F_DUP2FD .
118 .It Dv F_GETFD
119 Get the close-on-exec flag associated with the file descriptor
120 .Fa fd
121 as
122 .Dv FD_CLOEXEC .
123 If the returned value ANDed with
124 .Dv FD_CLOEXEC
125 is 0,
126 the file will remain open across
127 .Fn exec ,
128 otherwise the file will be closed upon execution of
129 .Fn exec
130 .Fa ( arg
131 is ignored).
132 .It Dv F_SETFD
133 Set the close-on-exec flag associated with
134 .Fa fd
135 to
136 .Fa arg ,
137 where
138 .Fa arg
139 is either 0 or
140 .Dv FD_CLOEXEC ,
141 as described above.
142 .It Dv F_GETFL
143 Get descriptor status flags, as described below
144 .Fa ( arg
145 is ignored).
146 .It Dv F_SETFL
147 Set descriptor status flags to
148 .Fa arg .
149 .It Dv F_GETOWN
150 Get the process ID or process group
151 currently receiving
152 .Dv SIGIO
153 and
154 .Dv SIGURG
155 signals; process groups are returned
156 as negative values
157 .Fa ( arg
158 is ignored).
159 .It Dv F_SETOWN
160 Set the process or process group
161 to receive
162 .Dv SIGIO
163 and
164 .Dv SIGURG
165 signals;
166 process groups are specified by supplying
167 .Fa arg
168 as negative, otherwise
169 .Fa arg
170 is interpreted as a process ID.
171 .It Dv F_READAHEAD
172 Set or clear the read ahead amount for sequential access to the third
173 argument,
174 .Fa arg ,
175 which is rounded up to the nearest block size.
176 A zero value in
177 .Fa arg
178 turns off read ahead, a negative value restores the system default.
179 .It Dv F_RDAHEAD
180 Equivalent to Darwin counterpart which sets read ahead amount of 128KB
181 when the third argument,
182 .Fa arg
183 is non-zero.
184 A zero value in
185 .Fa arg
186 turns off read ahead.
187 .It Dv F_ADD_SEALS
188 Add seals to the file as described below, if the underlying filesystem supports
189 seals.
190 .It Dv F_GET_SEALS
191 Get seals associated with the file, if the underlying filesystem supports seals.
192 .It Dv F_ISUNIONSTACK
193 Check if the vnode is part of a union stack (either the "union" flag from
194 .Xr mount 2
195 or unionfs).
196 This is a hack not intended to be used outside of libc.
197 .It Dv F_KINFO
198 Fills a
199 .Vt struct kinfo_file
200 for the file referenced by the specified file descriptor.
201 The
202 .Fa arg
203 argument should point to the storage for
204 .Vt struct kinfo_file .
205 The
206 .Va kf_structsize
207 member of the passed structure must be initialized with the sizeof of
208 .Vt struct kinfo_file ,
209 to allow for the interface versioning and evolution.
210 .El
211 .Pp
212 The flags for the
213 .Dv F_GETFL
214 and
215 .Dv F_SETFL
216 commands are as follows:
217 .Bl -tag -width O_NONBLOCKX
218 .It Dv O_NONBLOCK
219 Non-blocking I/O; if no data is available to a
220 .Xr read 2
221 system call, or if a
222 .Xr write 2
223 operation would block,
224 the read or write call returns -1 with the error
225 .Er EAGAIN .
226 .It Dv O_APPEND
227 Force each write to append at the end of file;
228 corresponds to the
229 .Dv O_APPEND
230 flag of
231 .Xr open 2 .
232 .It Dv O_DIRECT
233 Minimize or eliminate the cache effects of reading and writing.
234 The system
235 will attempt to avoid caching the data you read or write.
236 If it cannot
237 avoid caching the data, it will minimize the impact the data has on the cache.
238 Use of this flag can drastically reduce performance if not used with care.
239 .It Dv O_ASYNC
240 Enable the
241 .Dv SIGIO
242 signal to be sent to the process group
243 when I/O is possible, e.g.,
244 upon availability of data to be read.
245 .It Dv O_SYNC
246 Enable synchronous writes.
247 Corresponds to the
248 .Dv O_SYNC
249 flag of
250 .Xr open 2 .
251 .Dv O_FSYNC
252 is an historical synonym for
253 .Dv O_SYNC .
254 .It Dv O_DSYNC
255 Enable synchronous data writes.
256 Corresponds to the
257 .Dv O_DSYNC
258 flag of
259 .Xr open 2 .
260 .El
261 .Pp
262 The seals that may be applied with
263 .Dv F_ADD_SEALS
264 are as follows:
265 .Bl -tag -width F_SEAL_SHRINK
266 .It Dv F_SEAL_SEAL
267 Prevent any further seals from being applied to the file.
268 .It Dv F_SEAL_SHRINK
269 Prevent the file from being shrunk with
270 .Xr ftruncate 2 .
271 .It Dv F_SEAL_GROW
272 Prevent the file from being enlarged with
273 .Xr ftruncate 2 .
274 .It Dv F_SEAL_WRITE
275 Prevent any further
276 .Xr write 2
277 calls to the file.
278 Any writes in progress will finish before
279 .Fn fcntl
280 returns.
281 If any writeable mappings exist, F_ADD_SEALS will fail and return
282 .Dv EBUSY .
283 .El
284 .Pp
285 Seals are on a per-inode basis and require support by the underlying filesystem.
286 If the underlying filesystem does not support seals,
287 .Dv F_ADD_SEALS
288 and
289 .Dv F_GET_SEALS
290 will fail and return
291 .Dv EINVAL .
292 .Pp
293 Several operations are available for doing advisory file locking;
294 they all operate on the following structure:
295 .Bd -literal
296 struct flock {
297         off_t   l_start;        /* starting offset */
298         off_t   l_len;          /* len = 0 means until end of file */
299         pid_t   l_pid;          /* lock owner */
300         short   l_type;         /* lock type: read/write, etc. */
301         short   l_whence;       /* type of l_start */
302         int     l_sysid;        /* remote system id or zero for local */
303 };
304 .Ed
305 These advisory file locking operations take a pointer to
306 .Vt struct flock
307 as the third argument
308 .Fa arg .
309 The commands available for advisory record locking are as follows:
310 .Bl -tag -width F_SETLKWX
311 .It Dv F_GETLK
312 Get the first lock that blocks the lock description pointed to by the
313 third argument,
314 .Fa arg ,
315 taken as a pointer to a
316 .Fa "struct flock"
317 (see above).
318 The information retrieved overwrites the information passed to
319 .Fn fcntl
320 in the
321 .Fa flock
322 structure.
323 If no lock is found that would prevent this lock from being created,
324 the structure is left unchanged by this system call except for the
325 lock type which is set to
326 .Dv F_UNLCK .
327 .It Dv F_SETLK
328 Set or clear a file segment lock according to the lock description
329 pointed to by the third argument,
330 .Fa arg ,
331 taken as a pointer to a
332 .Fa "struct flock"
333 (see above).
334 .Dv F_SETLK
335 is used to establish shared (or read) locks
336 .Pq Dv F_RDLCK
337 or exclusive (or write) locks,
338 .Pq Dv F_WRLCK ,
339 as well as remove either type of lock
340 .Pq Dv F_UNLCK .
341 If a shared or exclusive lock cannot be set,
342 .Fn fcntl
343 returns immediately with
344 .Er EAGAIN .
345 .It Dv F_SETLKW
346 This command is the same as
347 .Dv F_SETLK
348 except that if a shared or exclusive lock is blocked by other locks,
349 the process waits until the request can be satisfied.
350 If a signal that is to be caught is received while
351 .Fn fcntl
352 is waiting for a region, the
353 .Fn fcntl
354 will be interrupted if the signal handler has not specified the
355 .Dv SA_RESTART
356 (see
357 .Xr sigaction 2 ) .
358 .El
359 .Pp
360 When a shared lock has been set on a segment of a file,
361 other processes can set shared locks on that segment
362 or a portion of it.
363 A shared lock prevents any other process from setting an exclusive
364 lock on any portion of the protected area.
365 A request for a shared lock fails if the file descriptor was not
366 opened with read access.
367 .Pp
368 An exclusive lock prevents any other process from setting a shared lock or
369 an exclusive lock on any portion of the protected area.
370 A request for an exclusive lock fails if the file was not
371 opened with write access.
372 .Pp
373 The value of
374 .Fa l_whence
375 is
376 .Dv SEEK_SET ,
377 .Dv SEEK_CUR ,
378 or
379 .Dv SEEK_END
380 to indicate that the relative offset,
381 .Fa l_start
382 bytes, will be measured from the start of the file,
383 current position, or end of the file, respectively.
384 The value of
385 .Fa l_len
386 is the number of consecutive bytes to be locked.
387 If
388 .Fa l_len
389 is negative,
390 .Fa l_start
391 means end edge of the region.
392 The
393 .Fa l_pid
394 and
395 .Fa l_sysid
396 fields are only used with
397 .Dv F_GETLK
398 to return the process ID of the process holding a blocking lock and
399 the system ID of the system that owns that process.
400 Locks created by the local system will have a system ID of zero.
401 After a successful
402 .Dv F_GETLK
403 request, the value of
404 .Fa l_whence
405 is
406 .Dv SEEK_SET .
407 .Pp
408 Locks may start and extend beyond the current end of a file,
409 but may not start or extend before the beginning of the file.
410 A lock is set to extend to the largest possible value of the
411 file offset for that file if
412 .Fa l_len
413 is set to zero.
414 If
415 .Fa l_whence
416 and
417 .Fa l_start
418 point to the beginning of the file, and
419 .Fa l_len
420 is zero, the entire file is locked.
421 If an application wishes only to do entire file locking, the
422 .Xr flock 2
423 system call is much more efficient.
424 .Pp
425 There is at most one type of lock set for each byte in the file.
426 Before a successful return from an
427 .Dv F_SETLK
428 or an
429 .Dv F_SETLKW
430 request when the calling process has previously existing locks
431 on bytes in the region specified by the request,
432 the previous lock type for each byte in the specified
433 region is replaced by the new lock type.
434 As specified above under the descriptions
435 of shared locks and exclusive locks, an
436 .Dv F_SETLK
437 or an
438 .Dv F_SETLKW
439 request fails or blocks respectively when another process has existing
440 locks on bytes in the specified region and the type of any of those
441 locks conflicts with the type specified in the request.
442 .Pp
443 The queuing for
444 .Dv F_SETLKW
445 requests on local files is fair;
446 that is, while the thread is blocked,
447 subsequent requests conflicting with its requests will not be granted,
448 even if these requests do not conflict with existing locks.
449 .Pp
450 This interface follows the completely stupid semantics of System V and
451 .St -p1003.1-88
452 that require that all locks associated with a file for a given process are
453 removed when
454 .Em any
455 file descriptor for that file is closed by that process.
456 This semantic means that applications must be aware of any files that
457 a subroutine library may access.
458 For example if an application for updating the password file locks the
459 password file database while making the update, and then calls
460 .Xr getpwnam 3
461 to retrieve a record,
462 the lock will be lost because
463 .Xr getpwnam 3
464 opens, reads, and closes the password database.
465 The database close will release all locks that the process has
466 associated with the database, even if the library routine never
467 requested a lock on the database.
468 Another minor semantic problem with this interface is that
469 locks are not inherited by a child process created using the
470 .Xr fork 2
471 system call.
472 The
473 .Xr flock 2
474 interface has much more rational last close semantics and
475 allows locks to be inherited by child processes.
476 The
477 .Xr flock 2
478 system call is recommended for applications that want to ensure the integrity
479 of their locks when using library routines or wish to pass locks
480 to their children.
481 .Pp
482 The
483 .Fn fcntl ,
484 .Xr flock 2 ,
485 and
486 .Xr lockf 3
487 locks are compatible.
488 Processes using different locking interfaces can cooperate
489 over the same file safely.
490 However, only one of such interfaces should be used within
491 the same process.
492 If a file is locked by a process through
493 .Xr flock 2 ,
494 any record within the file will be seen as locked
495 from the viewpoint of another process using
496 .Fn fcntl
497 or
498 .Xr lockf 3 ,
499 and vice versa.
500 Note that
501 .Fn fcntl F_GETLK
502 returns \-1 in
503 .Fa l_pid
504 if the process holding a blocking lock previously locked the
505 file descriptor by
506 .Xr flock 2 .
507 .Pp
508 All locks associated with a file for a given process are
509 removed when the process terminates.
510 .Pp
511 All locks obtained before a call to
512 .Xr execve 2
513 remain in effect until the new program releases them.
514 If the new program does not know about the locks, they will not be
515 released until the program exits.
516 .Pp
517 A potential for deadlock occurs if a process controlling a locked region
518 is put to sleep by attempting to lock the locked region of another process.
519 This implementation detects that sleeping until a locked region is unlocked
520 would cause a deadlock and fails with an
521 .Er EDEADLK
522 error.
523 .Sh RETURN VALUES
524 Upon successful completion, the value returned depends on
525 .Fa cmd
526 as follows:
527 .Bl -tag -width F_GETOWNX -offset indent
528 .It Dv F_DUPFD
529 A new file descriptor.
530 .It Dv F_DUP2FD
531 A file descriptor equal to
532 .Fa arg .
533 .It Dv F_GETFD
534 Value of flag (only the low-order bit is defined).
535 .It Dv F_GETFL
536 Value of flags.
537 .It Dv F_GETOWN
538 Value of file descriptor owner.
539 .It other
540 Value other than -1.
541 .El
542 .Pp
543 Otherwise, a value of -1 is returned and
544 .Va errno
545 is set to indicate the error.
546 .Sh ERRORS
547 The
548 .Fn fcntl
549 system call will fail if:
550 .Bl -tag -width Er
551 .It Bq Er EAGAIN
552 The argument
553 .Fa cmd
554 is
555 .Dv F_SETLK ,
556 the type of lock
557 .Pq Fa l_type
558 is a shared lock
559 .Pq Dv F_RDLCK
560 or exclusive lock
561 .Pq Dv F_WRLCK ,
562 and the segment of a file to be locked is already
563 exclusive-locked by another process;
564 or the type is an exclusive lock and some portion of the
565 segment of a file to be locked is already shared-locked or
566 exclusive-locked by another process.
567 .It Bq Er EBADF
568 The
569 .Fa fd
570 argument
571 is not a valid open file descriptor.
572 .Pp
573 The argument
574 .Fa cmd
575 is
576 .Dv F_DUP2FD ,
577 and
578 .Fa arg
579 is not a valid file descriptor.
580 .Pp
581 The argument
582 .Fa cmd
583 is
584 .Dv F_SETLK
585 or
586 .Dv F_SETLKW ,
587 the type of lock
588 .Pq Fa l_type
589 is a shared lock
590 .Pq Dv F_RDLCK ,
591 and
592 .Fa fd
593 is not a valid file descriptor open for reading.
594 .Pp
595 The argument
596 .Fa cmd
597 is
598 .Dv F_SETLK
599 or
600 .Dv F_SETLKW ,
601 the type of lock
602 .Pq Fa l_type
603 is an exclusive lock
604 .Pq Dv F_WRLCK ,
605 and
606 .Fa fd
607 is not a valid file descriptor open for writing.
608 .It Bq Er EBUSY
609 The argument
610 .Fa cmd
611 is
612 .Dv F_ADD_SEALS ,
613 attempting to set
614 .Dv F_SEAL_WRITE ,
615 and writeable mappings of the file exist.
616 .It Bq Er EDEADLK
617 The argument
618 .Fa cmd
619 is
620 .Dv F_SETLKW ,
621 and a deadlock condition was detected.
622 .It Bq Er EINTR
623 The argument
624 .Fa cmd
625 is
626 .Dv F_SETLKW ,
627 and the system call was interrupted by a signal.
628 .It Bq Er EINVAL
629 The
630 .Fa cmd
631 argument
632 is
633 .Dv F_DUPFD
634 and
635 .Fa arg
636 is negative or greater than the maximum allowable number
637 (see
638 .Xr getdtablesize 2 ) .
639 .Pp
640 The argument
641 .Fa cmd
642 is
643 .Dv F_GETLK ,
644 .Dv F_SETLK
645 or
646 .Dv F_SETLKW
647 and the data to which
648 .Fa arg
649 points is not valid.
650 .Pp
651 The argument
652 .Fa cmd
653 is
654 .Dv F_ADD_SEALS
655 or
656 .Dv F_GET_SEALS ,
657 and the underlying filesystem does not support sealing.
658 .Pp
659 The argument
660 .Fa cmd
661 is invalid.
662 .It Bq Er EMFILE
663 The argument
664 .Fa cmd
665 is
666 .Dv F_DUPFD
667 and the maximum number of file descriptors permitted for the
668 process are already in use,
669 or no file descriptors greater than or equal to
670 .Fa arg
671 are available.
672 .It Bq Er ENOTTY
673 The
674 .Fa fd
675 argument is not a valid file descriptor for the requested operation.
676 This may be the case if
677 .Fa fd
678 is a device node, or a descriptor returned by
679 .Xr kqueue 2 .
680 .It Bq Er ENOLCK
681 The argument
682 .Fa cmd
683 is
684 .Dv F_SETLK
685 or
686 .Dv F_SETLKW ,
687 and satisfying the lock or unlock request would result in the
688 number of locked regions in the system exceeding a system-imposed limit.
689 .It Bq Er EOPNOTSUPP
690 The argument
691 .Fa cmd
692 is
693 .Dv F_GETLK ,
694 .Dv F_SETLK
695 or
696 .Dv F_SETLKW
697 and
698 .Fa fd
699 refers to a file for which locking is not supported.
700 .It Bq Er EOVERFLOW
701 The argument
702 .Fa cmd
703 is
704 .Dv F_GETLK ,
705 .Dv F_SETLK
706 or
707 .Dv F_SETLKW
708 and an
709 .Fa off_t
710 calculation overflowed.
711 .It Bq Er EPERM
712 The
713 .Fa cmd
714 argument
715 is
716 .Dv F_SETOWN
717 and
718 the process ID or process group given as an argument is in a
719 different session than the caller.
720 .Pp
721 The
722 .Fa cmd
723 argument
724 is
725 .Dv F_ADD_SEALS
726 and the
727 .Dv F_SEAL_SEAL
728 seal has already been set.
729 .It Bq Er ESRCH
730 The
731 .Fa cmd
732 argument
733 is
734 .Dv F_SETOWN
735 and
736 the process ID given as argument is not in use.
737 .El
738 .Pp
739 In addition, if
740 .Fa fd
741 refers to a descriptor open on a terminal device (as opposed to a
742 descriptor open on a socket), a
743 .Fa cmd
744 of
745 .Dv F_SETOWN
746 can fail for the same reasons as in
747 .Xr tcsetpgrp 3 ,
748 and a
749 .Fa cmd
750 of
751 .Dv F_GETOWN
752 for the reasons as stated in
753 .Xr tcgetpgrp 3 .
754 .Sh SEE ALSO
755 .Xr close 2 ,
756 .Xr dup2 2 ,
757 .Xr execve 2 ,
758 .Xr flock 2 ,
759 .Xr getdtablesize 2 ,
760 .Xr open 2 ,
761 .Xr sigaction 2 ,
762 .Xr lockf 3 ,
763 .Xr tcgetpgrp 3 ,
764 .Xr tcsetpgrp 3
765 .Sh STANDARDS
766 The
767 .Dv F_DUP2FD
768 constant is non portable.
769 It is provided for compatibility with AIX and Solaris.
770 .Pp
771 Per
772 .St -susv4 ,
773 a call with
774 .Dv F_SETLKW
775 should fail with
776 .Bq Er EINTR
777 after any caught signal
778 and should continue waiting during thread suspension such as a stop signal.
779 However, in this implementation a call with
780 .Dv F_SETLKW
781 is restarted after catching a signal with a
782 .Dv SA_RESTART
783 handler or a thread suspension such as a stop signal.
784 .Sh HISTORY
785 The
786 .Fn fcntl
787 system call appeared in
788 .Bx 4.2 .
789 .Pp
790 The
791 .Dv F_DUP2FD
792 constant first appeared in
793 .Fx 7.1 .