Hi, On Mon, 31 Oct 2005, Nikhil wrote:
can someone please help me.. hoping I was clear about my problem ..
Regards, Nikhil
my $ut_template = 'A32 A4 A32 l s s2 x2 l2 l x20 s A257 x'; my $ut_file_write = "/u/me//pl_wtmpx"; my $ut_user = "reboot"; my $ut_ut_id = ""; my $ut_line = "system boot";my $ut_pid = ""; my $ut_type = 2; my $ut_exit_e_termination = ""; my $ut_exit_e_exit = ""; my $ut_timeval = get_boottime(); my $ut_pad = ""; my $ut_session = ""; my ($ut_host, $ut_syslen) = "";
open(WTMP_H,">$ut_file_write") || die "Unable to open $ut_file_write : $! print WTMP_H $boot_record; close(WTMP_H);
Ouch, you can not do this. You're writing a bunch of variables of who knows what length, packed together straight to wtmpx. You can not expect this to work at all.
can someone please suggest where is that I am going wrong in writing the record on to test wtmpx file.
You should not expect to be able to write or read these files at all. They are undocumented, the record may not bear any resemblance to struct utmpx at all, subject to change at any time, etc. See 'man -s 4 utmpx'.
You should instead use the pututxline() provided by the system, or the appropriate binding to it for perl.
I don't know much about perl, there likely must be a CPAN module somewhere which implements a perl wrapper around the utx system facilities, if these are not already supported out of the 'box' by perl.
Find it, use that. :) --paulj _______________________________________________ opensolaris-discuss mailing list [email protected]
