lkml.org 
[lkml]   [1996]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectflock && flockfile
Date
-----BEGIN PGP SIGNED MESSAGE-----

Hello
I've got a flock/fileflock related question:
Could anyone send me working example of working fileflock, maybe it is not
kernel-related, but when one uses for opening file fopen("asd","w") , then
function fopen uses open("asd",O_CREAT|O_WRONLY), and it spoils in some
way lock on this file, so You in fact cant use flockfile at all.

Try this example:
file a.c:

#include <stdio.h>
void main() {
FILE *f=fopen("asd","w");
flockfile(f);
getchar();
funlockfile(f);
fclose(f);
}

file b.c:

#include <stdio.h>
void main() {
FILE *f=fopen("asd","w");
flockfile(f);
funlockfile(f);
fclose(f);
}

Then on one console run: 'a', and on second 'b', You will see that 'b'
stops its work instead of waiting for stop of 'a'.

Is that bug or feature ?

TIA & Greets from...
- --
Bartlomiej Czardybon
PiK-Net, SysAdm

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBMjAbdEkpxXmZPqE9AQF+xQP9EcEBonsrdA9IXjppvP0pG65F5PdPl9BQ
ijEReo9T7/ZkGbSth3iBYinvbFenS/GXKb+6mB7e/AqWUX6KVzdWgJn+8BIAFEPa
6BaUD7oTG5AlZou9qKjhyOfsaYhk4BLg3SZv/HLnV/IMf1Dild5Biy5KrJo0sLzN
BXqS2qvkObg=
=KvO+
-----END PGP SIGNATURE-----

\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.025 / U:1.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site