1*8d741a5dSApple OSS Distributions /*
2*8d741a5dSApple OSS Distributions * Copyright (c) 2004, 2006 Apple Computer, Inc. All rights reserved.
3*8d741a5dSApple OSS Distributions *
4*8d741a5dSApple OSS Distributions * @APPLE_LICENSE_HEADER_START@
5*8d741a5dSApple OSS Distributions *
6*8d741a5dSApple OSS Distributions * This file contains Original Code and/or Modifications of Original Code
7*8d741a5dSApple OSS Distributions * as defined in and that are subject to the Apple Public Source License
8*8d741a5dSApple OSS Distributions * Version 2.0 (the 'License'). You may not use this file except in
9*8d741a5dSApple OSS Distributions * compliance with the License. Please obtain a copy of the License at
10*8d741a5dSApple OSS Distributions * http://www.opensource.apple.com/apsl/ and read it before using this
11*8d741a5dSApple OSS Distributions * file.
12*8d741a5dSApple OSS Distributions *
13*8d741a5dSApple OSS Distributions * The Original Code and all software distributed under the License are
14*8d741a5dSApple OSS Distributions * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15*8d741a5dSApple OSS Distributions * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16*8d741a5dSApple OSS Distributions * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17*8d741a5dSApple OSS Distributions * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18*8d741a5dSApple OSS Distributions * Please see the License for the specific language governing rights and
19*8d741a5dSApple OSS Distributions * limitations under the License.
20*8d741a5dSApple OSS Distributions *
21*8d741a5dSApple OSS Distributions * @APPLE_LICENSE_HEADER_END@
22*8d741a5dSApple OSS Distributions */
23*8d741a5dSApple OSS Distributions #include <stdarg.h>
24*8d741a5dSApple OSS Distributions
25*8d741a5dSApple OSS Distributions int __FCNTL(int, int, void *);
26*8d741a5dSApple OSS Distributions
27*8d741a5dSApple OSS Distributions /*
28*8d741a5dSApple OSS Distributions * Stub function to account for the differences in the size of the third
29*8d741a5dSApple OSS Distributions * argument when int and void * are different sizes. Also add pthread
30*8d741a5dSApple OSS Distributions * cancelability.
31*8d741a5dSApple OSS Distributions */
32*8d741a5dSApple OSS Distributions int
fcntl(int fd,int cmd,...)33*8d741a5dSApple OSS Distributions fcntl(int fd, int cmd, ...)
34*8d741a5dSApple OSS Distributions {
35*8d741a5dSApple OSS Distributions va_list ap;
36*8d741a5dSApple OSS Distributions void *arg;
37*8d741a5dSApple OSS Distributions
38*8d741a5dSApple OSS Distributions va_start(ap, cmd);
39*8d741a5dSApple OSS Distributions switch (cmd) {
40*8d741a5dSApple OSS Distributions case F_GETLK:
41*8d741a5dSApple OSS Distributions case F_GETLKPID:
42*8d741a5dSApple OSS Distributions case F_SETLK:
43*8d741a5dSApple OSS Distributions case F_SETLKW:
44*8d741a5dSApple OSS Distributions case F_SETLKWTIMEOUT:
45*8d741a5dSApple OSS Distributions case F_OFD_GETLK:
46*8d741a5dSApple OSS Distributions case F_OFD_GETLKPID:
47*8d741a5dSApple OSS Distributions case F_OFD_SETLK:
48*8d741a5dSApple OSS Distributions case F_OFD_SETLKW:
49*8d741a5dSApple OSS Distributions case F_OFD_SETLKWTIMEOUT:
50*8d741a5dSApple OSS Distributions case F_PREALLOCATE:
51*8d741a5dSApple OSS Distributions case F_PUNCHHOLE:
52*8d741a5dSApple OSS Distributions case F_SETSIZE:
53*8d741a5dSApple OSS Distributions case F_RDADVISE:
54*8d741a5dSApple OSS Distributions case F_LOG2PHYS:
55*8d741a5dSApple OSS Distributions case F_LOG2PHYS_EXT:
56*8d741a5dSApple OSS Distributions case F_GETPATH:
57*8d741a5dSApple OSS Distributions case F_GETPATH_NOFIRMLINK:
58*8d741a5dSApple OSS Distributions case F_GETPATH_MTMINFO:
59*8d741a5dSApple OSS Distributions case F_GETCODEDIR:
60*8d741a5dSApple OSS Distributions case F_PATHPKG_CHECK:
61*8d741a5dSApple OSS Distributions case F_OPENFROM:
62*8d741a5dSApple OSS Distributions case F_UNLINKFROM:
63*8d741a5dSApple OSS Distributions case F_ADDSIGS:
64*8d741a5dSApple OSS Distributions case F_ADDFILESIGS:
65*8d741a5dSApple OSS Distributions case F_ADDFILESIGS_FOR_DYLD_SIM:
66*8d741a5dSApple OSS Distributions case F_ADDFILESIGS_RETURN:
67*8d741a5dSApple OSS Distributions case F_ADDFILESIGS_INFO:
68*8d741a5dSApple OSS Distributions case F_ADDSIGS_MAIN_BINARY:
69*8d741a5dSApple OSS Distributions case F_ADDFILESUPPL:
70*8d741a5dSApple OSS Distributions case F_FINDSIGS:
71*8d741a5dSApple OSS Distributions case F_TRANSCODEKEY:
72*8d741a5dSApple OSS Distributions case F_TRIM_ACTIVE_FILE:
73*8d741a5dSApple OSS Distributions case F_SPECULATIVE_READ:
74*8d741a5dSApple OSS Distributions case F_CHECK_LV:
75*8d741a5dSApple OSS Distributions case F_GETSIGSINFO:
76*8d741a5dSApple OSS Distributions case F_ATTRIBUTION_TAG:
77*8d741a5dSApple OSS Distributions case F_ASSERT_BG_ACCESS:
78*8d741a5dSApple OSS Distributions arg = va_arg(ap, void *);
79*8d741a5dSApple OSS Distributions break;
80*8d741a5dSApple OSS Distributions default:
81*8d741a5dSApple OSS Distributions arg = (void *)((unsigned long)va_arg(ap, int));
82*8d741a5dSApple OSS Distributions break;
83*8d741a5dSApple OSS Distributions }
84*8d741a5dSApple OSS Distributions va_end(ap);
85*8d741a5dSApple OSS Distributions return __FCNTL(fd, cmd, arg);
86*8d741a5dSApple OSS Distributions }
87