Allan Brehm Clausen
2005-10-28 13:11:49 UTC
Maybe this should go in the VFS forum, maybe not.
I'm reading the FileEvents.xlm to check for filechanges. This works
very well, except for one instance.
I'm reading the file events like this (some spaces was removed due to
newsreader problems :-):
$xml=WriteCommand(NSSFILE,"<nssRequest><fileEventList><listFileEvents
epochNumber=\"$epochNumber\"></listFileEvents></fileEventList></nssRequest>");
I'm checking every 1 second, but if more than 4 file changes has
ocurred within that second, then the $XML variable overfloews, and
number 5 gets truncated. How do I split this up to get more
filechanges per read?
Regards
Allan Brehm Clausen
The WriteCommand function looks like this:
sub WriteCommand(*$)
{
my $fh = $_[0];
my $command = $_[1];
my $result;
my $reply;
my $error;
seek $fh, 0, 0;
if (!syswrite($fh, $command, length($command)))
{
$result .= "Unable to send command to virtual file. ";
seek $fh, 0 ,0;
if (sysread($fh, $error, 1000))
{
$result .= $error;
}
$result .= "\n";
}
else
{
seek $fh, 0 ,0;
sysread($fh, $reply, 1000);
$result .= $reply;
}
return $result;
}
I'm reading the FileEvents.xlm to check for filechanges. This works
very well, except for one instance.
I'm reading the file events like this (some spaces was removed due to
newsreader problems :-):
$xml=WriteCommand(NSSFILE,"<nssRequest><fileEventList><listFileEvents
epochNumber=\"$epochNumber\"></listFileEvents></fileEventList></nssRequest>");
I'm checking every 1 second, but if more than 4 file changes has
ocurred within that second, then the $XML variable overfloews, and
number 5 gets truncated. How do I split this up to get more
filechanges per read?
Regards
Allan Brehm Clausen
The WriteCommand function looks like this:
sub WriteCommand(*$)
{
my $fh = $_[0];
my $command = $_[1];
my $result;
my $reply;
my $error;
seek $fh, 0, 0;
if (!syswrite($fh, $command, length($command)))
{
$result .= "Unable to send command to virtual file. ";
seek $fh, 0 ,0;
if (sysread($fh, $error, 1000))
{
$result .= $error;
}
$result .= "\n";
}
else
{
seek $fh, 0 ,0;
sysread($fh, $reply, 1000);
$result .= $reply;
}
return $result;
}