[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-team] /Perl/ fcntl (file-locking)



Qqn a déjà utilisé fcntl (2) en Perl pour locker un fichier ?
J'ai consulté le man pour bricoler un petit script de test:
- - - - - - - - - - - - - - - - - - - - - -
#!/usr/bin/perl
use Fcntl;
open(H, "foo") or die "Cannot open foo";
fcntl(H, F_SETLK, $buffer) or die "$!";
print "ok\n";
close(H);
1;
- - - - - - - - - - - - - - - - - - - - - -
et ça me sort à chaque fois:
Invalid argument at /home/pab/bin/lkfoo line 5.
(c'est le die du fcntl)
J'ai essayé de remplacer F_SETLK par F_GETLK, mais c pareil.

J'ai bricolé un script perl qui réexpédie des mails NetWare
par SMTP (hyper-facile ;)), mais j'aimerais bien ajouter un
lock exclusif sur les fichiers pendant que le script
travaille dessus.
De toute manière, ça m'étonnerait que je puisse mettre un lock
sur un fichier qui se trouve dans un répertoire NetWare monté.
Mais bon... je voudrais bien essayer ;)

-- 
  -o)  Pascal Bleser        |
  /\\  C++/UNIX Development | God is real, unless
 _\_v  ATOS Payment Systems | declared integer.
       Aachen, Germany      | 
<pbleser@atos-group.com>-------<guru@linuxbe.org>

---------
Visit the Linux Supertore Online: http://www.redcorp.com !
If you want to be deleted from the list, send a mail to
majordomo@rtfm.be with "unsubscribe linux-team" in the body.