search for: sysopen

Displaying 13 results from an estimated 13 matches for "sysopen".

Did you mean: sys_open
2010 Apr 07
2
[PATCH] Target::LibVirt: Don't truncate a volume when opening it
perl's '>' open mode truncates by default, and will create a new file if necessary. We don't want to truncate an existing volume when writing to it, and it's an error if the volume doesn't already exist. Use sysopen to be explicit about this. --- lib/Sys/VirtV2V/Target/LibVirt.pm | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/lib/Sys/VirtV2V/Target/LibVirt.pm b/lib/Sys/VirtV2V/Target/LibVirt.pm index c8802ac..99a1ad2 100644 --- a/lib/Sys/VirtV2V/Target/LibVirt.pm +++ b/lib/Sys/V...
2005 Jul 10
1
VM Outcall: Rube Goldberg Edition
...re is the vm-notify.pl script: =========================================================================== #!/usr/bin/perl -w use Fcntl; use Fcntl ":flock"; $dial_context="local-access"; ($vm_box, $vm_context) = $ARGV[1] =~/(.*)\@(.*)/; $current_vm_context = ""; if(!sysopen($vm_conf_file_handle, "/etc/asterisk/voicemail.conf", O_RDONLY)) { printf("Cannot open /etc/asterisk/voicemail.conf!\n"); exit(1); } while($vm_conf_line = <$vm_conf_file_handle>) { chomp($vm_conf_line); if((substr($vm_conf_line,0,1) eq ";") || (lengt...
2014 Jan 30
5
[PATCH 00/05] Mending for mkdiskimage
...tion end.) Although mkdiskimage should be suitable now for USB sticks on unix-like systems beyond Linux, i still have no clue about USB sticks at NT/2K/XP/DOS systems. There is hope that the sysseek() method of size determination will work with a suitable file object. If only it has an address for sysopen(). Have a nice day :) Thomas
2006 Jan 11
0
how to force Samba respects file locking?
...se the file was changed without mercy. :-) I wrote the code below to implement this test: -- code -- #!/usr/bin/perl use strict; use warnings; use Fcntl qw(:DEFAULT :flock); my $sec = 30; print 'Please type the file that I should lock for $sec: '; my $file = <STDIN>; chomp $file; sysopen( FH, $file, O_RDWR ) or die "Cannot edit $file: $!\n"; flock( FH, LOCK_EX ) or die "Cannot lock $file: $!\n"; print 'Ok, holding the file for $sec seconds. I will not change anythingin the file', "\n"; sleep $sec; close(FH); print "Finished\n";...
2014 Jan 30
0
[PATCH 03/05] utils/mkdiskimage.in: Replaced the partly linux-specific file size determination by a sysseek() experiment
...00000 +0100 +++ utils/mkdiskimage.in 2014-01-30 20:50:59.000000000 +0100 @@ -19,6 +19,7 @@ use bytes; use integer; use Fcntl; +use Fcntl qw(:seek); use Errno; use Cwd; use IO::Handle; # For flush() @@ -116,15 +117,8 @@ if ( $c == 0 && $file ne '' ) { $len = 0; if ( sysopen(OUTPUT, $file, O_RDWR, 0666) ) { $is_open = 1; - - if ( (@filestat = stat(OUTPUT)) && S_ISREG($filestat[2]) ) { - $len = $filestat[7] >> 9; - } elsif ( $is_linux && S_ISBLK($filestat[2]) ) { - $blksize = pack("L!", 0); - if ( ioctl(OUTPUT, $BLKGETSIZE,...
2014 Jul 10
0
[PATCH 00/05] Mending for mkdiskimage
...skimage should be suitable now for USB sticks > on unix-like systems beyond Linux, i still have no clue about > USB sticks at NT/2K/XP/DOS systems. > There is hope that the sysseek() method of size determination > will work with a suitable file object. If only it has an address > for sysopen(). > > > Have a nice day :) > > Thomas > Groeten Geert Stappers -- Leven en laten leven
2014 Jan 30
2
[PATCH 02/05] utils/mkdiskimage.in: With option -s: Avoid zeroizing the partition even if truncate() failed
utils/mkdiskimage.in: With option -s: Avoid zeroizing the partition even if truncate() failed. --- utils/mkdiskimage_patched_01.in 2014-01-30 20:43:02.000000000 +0100 +++ utils/mkdiskimage.in 2014-01-30 20:45:09.000000000 +0100 @@ -217,8 +217,11 @@ print OUTPUT "\x55\xaa"; $totalsize = $c*$h*$s; $tracks = $c*$h; -# If -s is given, try to simply use truncate... -unless
2009 Mar 04
1
performance problem with 3.2.8: unbuffered reads for some users
...P SP3. For details, see my test below.. When are those buffering parameters negotiated? Do you have any idea why the behavior depends on the connected user? Any hints how I could further track down this problem? Cheers, --leo The test was done using 2 byte reads on the windows box: perl -le 'sysopen(F, "R:/firefox/LICENSE", O_RDONLY); do { $n= sysread(F, $buf, 2) } while ($n)' The result can be found here: smbadmin (buffered reads): http://leo.kloburg.at/tmp/samba/smbadmin-tshark.txt abergolth (unbuffered reads, same box): http://leo.kloburg.at/tmp/samba/abergolth-tshark.txt...
2014 Jul 10
4
[PATCH 1/5] utils/mkdiskimage.in: Option -s caused freshly created image files to be too small by a factor of 512.
--- utils/mkdiskimage.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/mkdiskimage.in b/utils/mkdiskimage.in index 533193a..a95a077 100644 --- a/utils/mkdiskimage.in +++ b/utils/mkdiskimage.in @@ -218,7 +218,7 @@ $totalsize = $c*$h*$s; $tracks = $c*$h; # If -s is given, try to simply use truncate... -unless ($opt{'s'} && truncate(OUTPUT,
2014 Jan 30
1
[PATCH] Mending proposals for mkdiskimage
...#39;} && $h && $s ) { # Specify size in megabytes, not in cylinders + $mb = $c; $c = ($c*1024*2)/($h*$s); + $zero_tail = ($mb * 1024 * 2 - $c * $h * $s); } $is_open = 0; @@ -116,15 +120,8 @@ if ( $c == 0 && $file ne '' ) { $len = 0; if ( sysopen(OUTPUT, $file, O_RDWR, 0666) ) { $is_open = 1; - - if ( (@filestat = stat(OUTPUT)) && S_ISREG($filestat[2]) ) { - $len = $filestat[7] >> 9; - } elsif ( $is_linux && S_ISBLK($filestat[2]) ) { - $blksize = pack("L!", 0); - if ( ioctl(OUTPUT, $BLKGETSIZE,...
2003 Apr 20
0
How I got Samba 2.2.8a to run on OpenBSD 3.2 i386
...er_passwd = "/etc/master.passwd"; umask(077); exit if $<; $username = pop(@ARGV); exit if !defined $username; getpwnam($username) or exit; system(split(/\s+/, "$pwd_mkdb -c $master_passwd")); exit if $?; print "new-pwd"; $newpwd = <STDIN>; chomp($newpwd); sysopen(NEW_PW, $passwd_tmp, O_WRONLY|O_CREAT|O_EXCL|O_NONBLOCK|O_SHLOCK, 0600) or exit; open(OLD_PW, "< $master_passwd"); while(<OLD_PW>){ @user = split(/:/); if($user[0] eq $username){ $user[1] = encrypt($newpwd); } print NEW_PW join(':', @user); } close OLD_PW; system($...
2002 Dec 21
0
Re: samba digest, Vol 1 #2006 - 24 msgs (Out of the office - Returning Monday, Jan. 6th)
...mb_proc_close() call with a 0 I did this, now when I open the files, mtime is set to epoch for the unix machine's view, and some 2106 date on the w2k machine. when tar'ing sometimes it sees the file as epoch, and sometimes it sees it as a day or a month before epoch (1970-01-01). Even using sysopen() or open() O_RDONLY in a perl script modifies the mtime. I realy didn't expect a file open in readonly to change the mtime. An interesting thing was that shelling `stat` immediatly after the open() or even the close() calls in the perl script still showed the old mtime, but calling stat from t...
2010 Sep 21
1
[PREVIEW ONLY] Refactor data transfer code
...ock -{ - my $self = shift; - - my $type = $self->{vol}->get_info()->{type}; - return $type == Sys::Virt::StorageVol::TYPE_BLOCK; -} - -sub open -{ - my $self = shift; - - my $path = $self->get_path(); - - # We want to open the existing volume without truncating it - sysopen(my $fd, $path, O_WRONLY) - or die(user_message(__x("Error opening storage volume {path} ". - "for writing: {error}", error => $!))); - - $self->{fd} = $fd; -} - -sub write -{ - my $self = shift; - my ($data) = @_; - - defin...