[PATCH] 2.3.14 put back compatability for old-style fcntl locking

david parsons (o.r.c@p.e.l.l.p.o.r.t.l.a.n.d.o.r.u.s)
19 Aug 1999 16:27:54 -0700


I've got old a.out programs that use gdbm; these programs fail because
the old-style F_SHLCK and F_EXLCK aren't known anymore. In olden times,
F_SHLCK was an alias for F_RDLCK and F_EXLCK was an alias for F_WRLCK,
so I've taken the old code and forward ported it (complete with
commented-out F_BROKEN flags) into 2.3.14.

____
david parsons \bi/ I don't actually use gdbm anymore, but I used it
\/ for a long long time and I'd hate to be bitten
if I update some of my old router machines from
1.2.13 to 2.4...

diff -Naur linux-2.3.14-orig/fs/locks.c linux-2.3.14/fs/locks.c
--- linux-2.3.14-orig/fs/locks.c Mon Jul 5 20:11:07 1999
+++ linux-2.3.14/fs/locks.c Thu Aug 19 00:30:24 1999
@@ -448,10 +448,10 @@
current->pid, current->comm);
}
}
+#endif
if (!(filp->f_mode & 3))
goto out_putf;
break;
-#endif
default:
error = -EINVAL;
goto out_putf;
@@ -648,11 +648,22 @@
init_waitqueue_head(&fl->fl_wait);
fl->fl_flags = FL_POSIX;

+ /*
+ * remap old-style locks into the locking method de jour
+ */
switch (l->l_type) {
case F_RDLCK:
case F_WRLCK:
case F_UNLCK:
fl->fl_type = l->l_type;
+ break;
+ case F_SHLCK :
+ fl->fl_type = F_RDLCK;
+ /*fl->fl_flags |= F_BROKEN;*/
+ break;
+ case F_EXLCK :
+ fl->fl_type = F_WRLCK;
+ /*fl->fl_flags |= F_BROKEN;*/
break;
default:
return (0);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/