1*433d6423SLionel Sambuc /* test20: fcntl() Author: Jan-Mark Wams (jms@cs.vu.nl) */
2*433d6423SLionel Sambuc
3*433d6423SLionel Sambuc /* Some things have to be checked for ``exec()'' call's. Therefor
4*433d6423SLionel Sambuc ** there is a check routine called ``do_check()'' that will be
5*433d6423SLionel Sambuc ** called if the first argument (``argv[0]'') equals ``DO CHECK.''
6*433d6423SLionel Sambuc ** Note that there is no way the shell (``/bin/sh'') will set
7*433d6423SLionel Sambuc ** ``argv[0]'' to this funny value. (Unless we rename ``test20''
8*433d6423SLionel Sambuc ** to ``DO CHECK'' ;-)
9*433d6423SLionel Sambuc */
10*433d6423SLionel Sambuc
11*433d6423SLionel Sambuc #include <sys/types.h>
12*433d6423SLionel Sambuc #include <sys/stat.h>
13*433d6423SLionel Sambuc #include <sys/wait.h>
14*433d6423SLionel Sambuc #include <stdlib.h>
15*433d6423SLionel Sambuc #include <unistd.h>
16*433d6423SLionel Sambuc #include <string.h>
17*433d6423SLionel Sambuc #include <fcntl.h>
18*433d6423SLionel Sambuc #include <limits.h>
19*433d6423SLionel Sambuc #include <errno.h>
20*433d6423SLionel Sambuc #include <time.h>
21*433d6423SLionel Sambuc #include <stdio.h>
22*433d6423SLionel Sambuc
23*433d6423SLionel Sambuc int max_error = 4;
24*433d6423SLionel Sambuc #include "common.h"
25*433d6423SLionel Sambuc
26*433d6423SLionel Sambuc #define ITERATIONS 10
27*433d6423SLionel Sambuc
28*433d6423SLionel Sambuc #define System(cmd) if (system(cmd) != 0) printf("``%s'' failed\n", cmd)
29*433d6423SLionel Sambuc #define Chdir(dir) if (chdir(dir) != 0) printf("Can't goto %s\n", dir)
30*433d6423SLionel Sambuc #define Stat(a,b) if (stat(a,b) != 0) printf("Can't stat %s\n", a)
31*433d6423SLionel Sambuc
32*433d6423SLionel Sambuc
33*433d6423SLionel Sambuc int superuser;
34*433d6423SLionel Sambuc
35*433d6423SLionel Sambuc void test20a(void);
36*433d6423SLionel Sambuc void test20b(void);
37*433d6423SLionel Sambuc void test20c(void);
38*433d6423SLionel Sambuc void test20d(void);
39*433d6423SLionel Sambuc int do_check(void);
40*433d6423SLionel Sambuc
41*433d6423SLionel Sambuc char executable[1024];
42*433d6423SLionel Sambuc
main(int argc,char * argv[])43*433d6423SLionel Sambuc int main(int argc, char *argv[])
44*433d6423SLionel Sambuc {
45*433d6423SLionel Sambuc int i;
46*433d6423SLionel Sambuc
47*433d6423SLionel Sambuc sync();
48*433d6423SLionel Sambuc /* If we have to check things, call do_check(). */
49*433d6423SLionel Sambuc if (strcmp(argv[0], "DO CHECK") == 0) exit(do_check());
50*433d6423SLionel Sambuc
51*433d6423SLionel Sambuc /* Get the path of the executable. */
52*433d6423SLionel Sambuc strcpy(executable, "../");
53*433d6423SLionel Sambuc strcat(executable, argv[0]);
54*433d6423SLionel Sambuc
55*433d6423SLionel Sambuc start(20);
56*433d6423SLionel Sambuc superuser = (geteuid() == 0);
57*433d6423SLionel Sambuc
58*433d6423SLionel Sambuc for (i = 0; i < ITERATIONS; i++) {
59*433d6423SLionel Sambuc test20a();
60*433d6423SLionel Sambuc test20b();
61*433d6423SLionel Sambuc test20c();
62*433d6423SLionel Sambuc test20d();
63*433d6423SLionel Sambuc }
64*433d6423SLionel Sambuc quit();
65*433d6423SLionel Sambuc
66*433d6423SLionel Sambuc return(-1); /* Unreachable */
67*433d6423SLionel Sambuc }
68*433d6423SLionel Sambuc
test20a()69*433d6423SLionel Sambuc void test20a()
70*433d6423SLionel Sambuc { /* Test normal operation. */
71*433d6423SLionel Sambuc subtest = 1;
72*433d6423SLionel Sambuc System("rm -rf ../DIR_20/*");
73*433d6423SLionel Sambuc }
74*433d6423SLionel Sambuc
test20b()75*433d6423SLionel Sambuc void test20b()
76*433d6423SLionel Sambuc {
77*433d6423SLionel Sambuc subtest = 2;
78*433d6423SLionel Sambuc System("rm -rf ../DIR_20/*");
79*433d6423SLionel Sambuc }
80*433d6423SLionel Sambuc
test20c()81*433d6423SLionel Sambuc void test20c()
82*433d6423SLionel Sambuc {
83*433d6423SLionel Sambuc subtest = 3;
84*433d6423SLionel Sambuc System("rm -rf ../DIR_20/*");
85*433d6423SLionel Sambuc }
86*433d6423SLionel Sambuc
87*433d6423SLionel Sambuc /* Open fds 3, 4, 5 and 6. Set FD_CLOEXEC on 5 and 6. Exclusively lock the
88*433d6423SLionel Sambuc ** first 10 bytes of fd no. 3. Shared lock fd no. 7. Lock fd no. 8 after
89*433d6423SLionel Sambuc ** the fork. Do a ``exec()'' call with a funny argv[0] and check the return
90*433d6423SLionel Sambuc ** value.
91*433d6423SLionel Sambuc */
test20d()92*433d6423SLionel Sambuc void test20d()
93*433d6423SLionel Sambuc { /* Test locks with ``fork()'' and ``exec().'' */
94*433d6423SLionel Sambuc int fd3, fd4, fd5, fd6, fd7, fd8;
95*433d6423SLionel Sambuc int stat_loc;
96*433d6423SLionel Sambuc int do_check_retval;
97*433d6423SLionel Sambuc char *argv[2];
98*433d6423SLionel Sambuc struct flock fl;
99*433d6423SLionel Sambuc
100*433d6423SLionel Sambuc subtest = 4;
101*433d6423SLionel Sambuc
102*433d6423SLionel Sambuc argv[0] = "DO CHECK";
103*433d6423SLionel Sambuc argv[1] = (char *) NULL;
104*433d6423SLionel Sambuc
105*433d6423SLionel Sambuc fl.l_whence = SEEK_SET;
106*433d6423SLionel Sambuc fl.l_start = 0;
107*433d6423SLionel Sambuc fl.l_len = 10;
108*433d6423SLionel Sambuc
109*433d6423SLionel Sambuc /* Make a dummy files and open them. */
110*433d6423SLionel Sambuc System("echo 'Great Balls Of Fire!' > file3");
111*433d6423SLionel Sambuc System("echo 'Great Balls Of Fire!' > file4");
112*433d6423SLionel Sambuc System("echo 'Great Balls Of Fire!' > file7");
113*433d6423SLionel Sambuc System("echo 'Great Balls Of Fire!' > file8");
114*433d6423SLionel Sambuc System("echo 'Great Balls Of Fire!' > file");
115*433d6423SLionel Sambuc if ((fd3 = open("file3", O_RDWR)) != 3) e(1);
116*433d6423SLionel Sambuc if ((fd4 = open("file4", O_RDWR)) != 4) e(2);
117*433d6423SLionel Sambuc if ((fd5 = open("file", O_RDWR)) != 5) e(3);
118*433d6423SLionel Sambuc if ((fd6 = open("file", O_RDWR)) != 6) e(4);
119*433d6423SLionel Sambuc if ((fd7 = open("file7", O_RDWR)) != 7) e(5);
120*433d6423SLionel Sambuc if ((fd8 = open("file8", O_RDWR)) != 8) e(6);
121*433d6423SLionel Sambuc
122*433d6423SLionel Sambuc /* Set FD_CLOEXEC flags on fd5 and fd6. */
123*433d6423SLionel Sambuc if (fcntl(fd5, F_SETFD, FD_CLOEXEC) == -1) e(7);
124*433d6423SLionel Sambuc if (fcntl(fd6, F_SETFD, FD_CLOEXEC) == -1) e(8);
125*433d6423SLionel Sambuc
126*433d6423SLionel Sambuc /* Lock the first ten bytes from fd3 (for writing). */
127*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
128*433d6423SLionel Sambuc if (fcntl(fd3, F_SETLK, &fl) == -1) e(9);
129*433d6423SLionel Sambuc
130*433d6423SLionel Sambuc /* Lock (for reading) fd7. */
131*433d6423SLionel Sambuc fl.l_type = F_RDLCK;
132*433d6423SLionel Sambuc if (fcntl(fd7, F_SETLK, &fl) == -1) e(10);
133*433d6423SLionel Sambuc
134*433d6423SLionel Sambuc switch (fork()) {
135*433d6423SLionel Sambuc case -1: printf("Can't fork\n"); break;
136*433d6423SLionel Sambuc case 0:
137*433d6423SLionel Sambuc alarm(20);
138*433d6423SLionel Sambuc
139*433d6423SLionel Sambuc /* Lock fd8. */
140*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
141*433d6423SLionel Sambuc if (fcntl(fd8, F_SETLK, &fl) == -1) e(11);
142*433d6423SLionel Sambuc
143*433d6423SLionel Sambuc /* Check the lock on fd3 and fd7. */
144*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
145*433d6423SLionel Sambuc if (fcntl(fd3, F_GETLK, &fl) == -1) e(12);
146*433d6423SLionel Sambuc if (fl.l_type != F_WRLCK) e(13);
147*433d6423SLionel Sambuc if (fl.l_pid != getppid()) e(14);
148*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
149*433d6423SLionel Sambuc if (fcntl(fd7, F_GETLK, &fl) == -1) e(15);
150*433d6423SLionel Sambuc if (fl.l_type != F_RDLCK) e(16);
151*433d6423SLionel Sambuc if (fl.l_pid != getppid()) e(17);
152*433d6423SLionel Sambuc
153*433d6423SLionel Sambuc /* Check FD_CLOEXEC flags. */
154*433d6423SLionel Sambuc if ((fcntl(fd3, F_GETFD) & FD_CLOEXEC) != 0) e(18);
155*433d6423SLionel Sambuc if ((fcntl(fd4, F_GETFD) & FD_CLOEXEC) != 0) e(19);
156*433d6423SLionel Sambuc if ((fcntl(fd5, F_GETFD) & FD_CLOEXEC) != FD_CLOEXEC) e(20);
157*433d6423SLionel Sambuc if ((fcntl(fd6, F_GETFD) & FD_CLOEXEC) != FD_CLOEXEC) e(21);
158*433d6423SLionel Sambuc if ((fcntl(fd7, F_GETFD) & FD_CLOEXEC) != 0) e(22);
159*433d6423SLionel Sambuc if ((fcntl(fd8, F_GETFD) & FD_CLOEXEC) != 0) e(23);
160*433d6423SLionel Sambuc
161*433d6423SLionel Sambuc execlp(executable + 3, "DO CHECK", (char *) NULL);
162*433d6423SLionel Sambuc execlp(executable, "DO CHECK", (char *) NULL);
163*433d6423SLionel Sambuc printf("Can't exec %s or %s\n", executable + 3, executable);
164*433d6423SLionel Sambuc exit(0);
165*433d6423SLionel Sambuc
166*433d6423SLionel Sambuc default:
167*433d6423SLionel Sambuc wait(&stat_loc);
168*433d6423SLionel Sambuc if (WIFSIGNALED(stat_loc)) e(24); /* Alarm? */
169*433d6423SLionel Sambuc if (WIFEXITED(stat_loc) == 0) {
170*433d6423SLionel Sambuc errct=10000;
171*433d6423SLionel Sambuc quit();
172*433d6423SLionel Sambuc }
173*433d6423SLionel Sambuc }
174*433d6423SLionel Sambuc
175*433d6423SLionel Sambuc /* Check the return value of do_check(). */
176*433d6423SLionel Sambuc do_check_retval = WEXITSTATUS(stat_loc);
177*433d6423SLionel Sambuc if ((do_check_retval & 0x11) == 0x11) e(25);
178*433d6423SLionel Sambuc if ((do_check_retval & 0x12) == 0x12) e(26);
179*433d6423SLionel Sambuc if ((do_check_retval & 0x14) == 0x14) e(27);
180*433d6423SLionel Sambuc if ((do_check_retval & 0x18) == 0x18) e(28);
181*433d6423SLionel Sambuc if ((do_check_retval & 0x21) == 0x21) e(29);
182*433d6423SLionel Sambuc if ((do_check_retval & 0x22) == 0x22) e(30);
183*433d6423SLionel Sambuc if ((do_check_retval & 0x24) == 0x24) e(31);
184*433d6423SLionel Sambuc if ((do_check_retval & 0x28) == 0x28) e(32);
185*433d6423SLionel Sambuc if ((do_check_retval & 0x41) == 0x41) e(33);
186*433d6423SLionel Sambuc if ((do_check_retval & 0x42) == 0x42) e(34);
187*433d6423SLionel Sambuc if ((do_check_retval & 0x44) == 0x44) e(35);
188*433d6423SLionel Sambuc if ((do_check_retval & 0x48) == 0x48) e(36);
189*433d6423SLionel Sambuc if ((do_check_retval & 0x81) == 0x81) e(37);
190*433d6423SLionel Sambuc if ((do_check_retval & 0x82) == 0x82) e(38);
191*433d6423SLionel Sambuc if ((do_check_retval & 0x84) == 0x84) e(39);
192*433d6423SLionel Sambuc if ((do_check_retval & 0x88) == 0x88) e(40);
193*433d6423SLionel Sambuc
194*433d6423SLionel Sambuc switch (fork()) {
195*433d6423SLionel Sambuc case -1: printf("Can't fork\n"); break;
196*433d6423SLionel Sambuc case 0:
197*433d6423SLionel Sambuc alarm(20);
198*433d6423SLionel Sambuc
199*433d6423SLionel Sambuc /* Lock fd8. */
200*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
201*433d6423SLionel Sambuc if (fcntl(fd8, F_SETLK, &fl) == -1) e(41);
202*433d6423SLionel Sambuc
203*433d6423SLionel Sambuc execvp(executable + 3, argv);
204*433d6423SLionel Sambuc execvp(executable, argv);
205*433d6423SLionel Sambuc printf("Can't exec %s or %s\n", executable + 3, executable);
206*433d6423SLionel Sambuc exit(0);
207*433d6423SLionel Sambuc
208*433d6423SLionel Sambuc default:
209*433d6423SLionel Sambuc wait(&stat_loc);
210*433d6423SLionel Sambuc if (WIFSIGNALED(stat_loc)) e(48); /* Alarm? */
211*433d6423SLionel Sambuc }
212*433d6423SLionel Sambuc
213*433d6423SLionel Sambuc /* Check the return value of do_check(). */
214*433d6423SLionel Sambuc do_check_retval = WEXITSTATUS(stat_loc);
215*433d6423SLionel Sambuc if ((do_check_retval & 0x11) == 0x11) e(49);
216*433d6423SLionel Sambuc if ((do_check_retval & 0x12) == 0x12) e(50);
217*433d6423SLionel Sambuc if ((do_check_retval & 0x14) == 0x14) e(51);
218*433d6423SLionel Sambuc if ((do_check_retval & 0x18) == 0x18) e(52);
219*433d6423SLionel Sambuc if ((do_check_retval & 0x21) == 0x21) e(53);
220*433d6423SLionel Sambuc if ((do_check_retval & 0x22) == 0x22) e(54);
221*433d6423SLionel Sambuc if ((do_check_retval & 0x24) == 0x24) e(55);
222*433d6423SLionel Sambuc if ((do_check_retval & 0x28) == 0x28) e(56);
223*433d6423SLionel Sambuc if ((do_check_retval & 0x41) == 0x41) e(57);
224*433d6423SLionel Sambuc if ((do_check_retval & 0x42) == 0x42) e(58);
225*433d6423SLionel Sambuc if ((do_check_retval & 0x44) == 0x44) e(59);
226*433d6423SLionel Sambuc if ((do_check_retval & 0x48) == 0x48) e(60);
227*433d6423SLionel Sambuc if ((do_check_retval & 0x81) == 0x81) e(61);
228*433d6423SLionel Sambuc if ((do_check_retval & 0x82) == 0x82) e(62);
229*433d6423SLionel Sambuc if ((do_check_retval & 0x84) == 0x84) e(63);
230*433d6423SLionel Sambuc if ((do_check_retval & 0x88) == 0x88) e(64);
231*433d6423SLionel Sambuc
232*433d6423SLionel Sambuc fl.l_type = F_UNLCK;
233*433d6423SLionel Sambuc if (fcntl(fd3, F_SETLK, &fl) == -1) e(65);
234*433d6423SLionel Sambuc if (fcntl(fd7, F_SETLK, &fl) == -1) e(66);
235*433d6423SLionel Sambuc
236*433d6423SLionel Sambuc if (close(fd3) != 0) e(67);
237*433d6423SLionel Sambuc if (close(fd4) != 0) e(68);
238*433d6423SLionel Sambuc if (close(fd5) != 0) e(69);
239*433d6423SLionel Sambuc if (close(fd6) != 0) e(70);
240*433d6423SLionel Sambuc if (close(fd7) != 0) e(71);
241*433d6423SLionel Sambuc if (close(fd8) != 0) e(72);
242*433d6423SLionel Sambuc
243*433d6423SLionel Sambuc System("rm -f ../DIR_20/*\n");
244*433d6423SLionel Sambuc }
245*433d6423SLionel Sambuc
246*433d6423SLionel Sambuc /* This routine checks that fds 0 through 4, 7 and 8 are open and the rest
247*433d6423SLionel Sambuc ** is closed. It also checks if we can lock the first 10 bytes on fd no. 3
248*433d6423SLionel Sambuc ** and 4. It should not be possible to lock fd no. 3, but it should be
249*433d6423SLionel Sambuc ** possible to lock fd no. 4. See ``test20d()'' for usage of this routine.
250*433d6423SLionel Sambuc */
do_check()251*433d6423SLionel Sambuc int do_check()
252*433d6423SLionel Sambuc {
253*433d6423SLionel Sambuc int i;
254*433d6423SLionel Sambuc int retval = 0;
255*433d6423SLionel Sambuc struct flock fl;
256*433d6423SLionel Sambuc
257*433d6423SLionel Sambuc fl.l_whence = SEEK_SET;
258*433d6423SLionel Sambuc fl.l_start = 0;
259*433d6423SLionel Sambuc fl.l_len = 10;
260*433d6423SLionel Sambuc
261*433d6423SLionel Sambuc /* All std.. are open. */
262*433d6423SLionel Sambuc if (fcntl(0, F_GETFD) == -1) retval |= 0x11;
263*433d6423SLionel Sambuc if (fcntl(1, F_GETFD) == -1) retval |= 0x11;
264*433d6423SLionel Sambuc if (fcntl(2, F_GETFD) == -1) retval |= 0x11;
265*433d6423SLionel Sambuc
266*433d6423SLionel Sambuc /* Fd no. 3, 4, 7 and 8 are open. */
267*433d6423SLionel Sambuc if (fcntl(3, F_GETFD) == -1) retval |= 0x12;
268*433d6423SLionel Sambuc if (fcntl(4, F_GETFD) == -1) retval |= 0x12;
269*433d6423SLionel Sambuc if (fcntl(7, F_GETFD) == -1) retval |= 0x12;
270*433d6423SLionel Sambuc
271*433d6423SLionel Sambuc /* Fd no. 5, 6 and 9 trough OPEN_MAX are closed. */
272*433d6423SLionel Sambuc if (fcntl(5, F_GETFD) != -1) retval |= 0x14;
273*433d6423SLionel Sambuc if (fcntl(6, F_GETFD) != -1) retval |= 0x14;
274*433d6423SLionel Sambuc for (i = 9; i < OPEN_MAX; i++)
275*433d6423SLionel Sambuc if (fcntl(i, F_GETFD) != -1) retval |= 0x18;
276*433d6423SLionel Sambuc
277*433d6423SLionel Sambuc #if 0
278*433d6423SLionel Sambuc /* Fd no. 3 is WRLCKed. */
279*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
280*433d6423SLionel Sambuc if (fcntl(3, F_SETLK, &fl) != -1) retval |= 0x21;
281*433d6423SLionel Sambuc if (errno != EACCES && errno != EAGAIN) retval |= 0x22;
282*433d6423SLionel Sambuc fl.l_type = F_RDLCK;
283*433d6423SLionel Sambuc if (fcntl(3, F_SETLK, &fl) != -1) retval |= 0x24;
284*433d6423SLionel Sambuc if (errno != EACCES && errno != EAGAIN) retval |= 0x22;
285*433d6423SLionel Sambuc fl.l_type = F_RDLCK;
286*433d6423SLionel Sambuc if (fcntl(3, F_GETLK, &fl) == -1) retval |= 0x28;
287*433d6423SLionel Sambuc if (fl.l_type != F_WRLCK) retval |= 0x28;
288*433d6423SLionel Sambuc if (fl.l_pid != getpid()) retval |= 0x28;
289*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
290*433d6423SLionel Sambuc if (fcntl(3, F_GETLK, &fl) == -1) retval |= 0x28;
291*433d6423SLionel Sambuc if (fl.l_type != F_WRLCK) retval |= 0x28;
292*433d6423SLionel Sambuc if (fl.l_pid != getpid()) retval |= 0x28;
293*433d6423SLionel Sambuc #endif
294*433d6423SLionel Sambuc
295*433d6423SLionel Sambuc /* Fd no. 4 is not locked. */
296*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
297*433d6423SLionel Sambuc if (fcntl(4, F_SETLK, &fl) == -1) retval |= 0x41;
298*433d6423SLionel Sambuc if (fcntl(4, F_GETLK, &fl) == -1) retval |= 0x42;
299*433d6423SLionel Sambuc #if 0 /* XXX - see test7.c */
300*433d6423SLionel Sambuc if (fl.l_type != F_WRLCK) retval |= 0x42;
301*433d6423SLionel Sambuc if (fl.l_pid != getpid()) retval |= 0x42;
302*433d6423SLionel Sambuc #endif /* 0 */
303*433d6423SLionel Sambuc
304*433d6423SLionel Sambuc /* Fd no. 8 is locked after the fork, it is ours. */
305*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
306*433d6423SLionel Sambuc if (fcntl(8, F_SETLK, &fl) == -1) retval |= 0x44;
307*433d6423SLionel Sambuc if (fcntl(8, F_GETLK, &fl) == -1) retval |= 0x48;
308*433d6423SLionel Sambuc #if 0 /* XXX - see test7.c */
309*433d6423SLionel Sambuc if (fl.l_type != F_WRLCK) retval |= 0x48;
310*433d6423SLionel Sambuc if (fl.l_pid != getpid()) retval |= 0x48;
311*433d6423SLionel Sambuc #endif /* 0 */
312*433d6423SLionel Sambuc
313*433d6423SLionel Sambuc #if 0
314*433d6423SLionel Sambuc /* Fd no. 7 is RDLCKed. */
315*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
316*433d6423SLionel Sambuc if (fcntl(7, F_SETLK, &fl) != -1) retval |= 0x81;
317*433d6423SLionel Sambuc if (errno != EACCES && errno != EAGAIN) retval |= 0x82;
318*433d6423SLionel Sambuc fl.l_type = F_RDLCK;
319*433d6423SLionel Sambuc if (fcntl(7, F_SETLK, &fl) == -1) retval |= 0x84;
320*433d6423SLionel Sambuc fl.l_type = F_RDLCK;
321*433d6423SLionel Sambuc if (fcntl(7, F_GETLK, &fl) == -1) retval |= 0x88;
322*433d6423SLionel Sambuc if (fl.l_type != F_UNLCK) retval |= 0x88;
323*433d6423SLionel Sambuc fl.l_type = F_WRLCK;
324*433d6423SLionel Sambuc if (fcntl(7, F_GETLK, &fl) == -1) retval |= 0x88;
325*433d6423SLionel Sambuc if (fl.l_type != F_RDLCK) retval |= 0x88;
326*433d6423SLionel Sambuc if (fl.l_pid != getppid()) retval |= 0x88;
327*433d6423SLionel Sambuc #endif
328*433d6423SLionel Sambuc
329*433d6423SLionel Sambuc return retval;
330*433d6423SLionel Sambuc }
331*433d6423SLionel Sambuc
332