]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/linux-uml/linux-uml-2.4.26/10-flock.patch
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / linux-uml / linux-uml-2.4.26 / 10-flock.patch
1 Index: linux-2.4.24-2/arch/um/os-Linux/file.c
2 --- linux-2.4.24-2/arch/um/os-Linux/file.c      7 Apr 2004 20:44:49 -0000       1.29
3 +++ linux-2.4.24-2/arch/um/os-Linux/file.c      17 May 2004 18:35:49 -0000
4 @@ -688,6 +688,7 @@
5  
6  int os_lock_file(int fd, int excl)
7  {
8 +#if USE_FCNTL_LOCK
9         int type = excl ? F_WRLCK : F_RDLCK;
10         struct flock lock = ((struct flock) { .l_type   = type,
11                                               .l_whence = SEEK_SET,
12 @@ -710,6 +711,21 @@
13         err = save;
14   out:
15         return(err);
16 +#else
17 +       int type = excl ? LOCK_EX : LOCK_SH;
18 +       int err, save;
19 +
20 +       err = flock(fd, type | LOCK_NB);
21 +       if(!err)
22 +               goto out;
23 +
24 +       save = -errno;
25 +
26 +       printk("file already locked\n");
27 +       err = save;
28 + out:
29 +       return(err);
30 +#endif
31  }
32  
33  int os_ftruncate(int fd, __u64 size)