… | |
… | |
187 | @safe::cf::global::ISA = @cf::global::ISA = 'cf::attachable'; |
187 | @safe::cf::global::ISA = @cf::global::ISA = 'cf::attachable'; |
188 | @safe::cf::object::ISA = @cf::object::ISA = 'cf::attachable'; |
188 | @safe::cf::object::ISA = @cf::object::ISA = 'cf::attachable'; |
189 | @safe::cf::player::ISA = @cf::player::ISA = 'cf::attachable'; |
189 | @safe::cf::player::ISA = @cf::player::ISA = 'cf::attachable'; |
190 | @safe::cf::client::ISA = @cf::client::ISA = 'cf::attachable'; |
190 | @safe::cf::client::ISA = @cf::client::ISA = 'cf::attachable'; |
191 | @safe::cf::map::ISA = @cf::map::ISA = 'cf::attachable'; |
191 | @safe::cf::map::ISA = @cf::map::ISA = 'cf::attachable'; |
|
|
192 | @safe::cf::arch::ISA = @cf::arch::ISA = 'cf::object'; |
192 | @safe::cf::object::player::ISA = @cf::object::player::ISA = 'cf::object'; |
193 | @safe::cf::object::player::ISA = @cf::object::player::ISA = 'cf::object'; # not really true (yet) |
193 | |
194 | |
194 | # we bless all objects into (empty) derived classes to force a method lookup |
195 | # we bless all objects into (empty) derived classes to force a method lookup |
195 | # within the Safe compartment. |
196 | # within the Safe compartment. |
196 | for my $pkg (qw( |
197 | for my $pkg (qw( |
197 | cf::global cf::attachable |
198 | cf::global cf::attachable |
… | |
… | |
395 | my $runtime = "$LOCALDIR/runtime"; |
396 | my $runtime = "$LOCALDIR/runtime"; |
396 | |
397 | |
397 | # first touch the runtime file to show we are still running: |
398 | # first touch the runtime file to show we are still running: |
398 | # the fsync below can take a very very long time. |
399 | # the fsync below can take a very very long time. |
399 | |
400 | |
400 | if (my $fh = aio_open $runtime, O_WRONLY, 0) { |
401 | IO::AIO::aio_utime $runtime, undef, undef; |
401 | utime undef, undef, $fh; |
|
|
402 | } |
|
|
403 | |
402 | |
404 | my $guard = cf::lock_acquire "write_runtime"; |
403 | my $guard = cf::lock_acquire "write_runtime"; |
405 | |
404 | |
406 | my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644 |
405 | my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644 |
407 | or return; |
406 | or return; |
… | |
… | |
416 | # always fsync - this file is important |
415 | # always fsync - this file is important |
417 | aio_fsync $fh |
416 | aio_fsync $fh |
418 | and return; |
417 | and return; |
419 | |
418 | |
420 | # touch it again to show we are up-to-date |
419 | # touch it again to show we are up-to-date |
421 | utime undef, undef, $fh; |
420 | aio_utime $fh, undef, undef; |
422 | |
421 | |
423 | close $fh |
422 | close $fh |
424 | or return; |
423 | or return; |
425 | |
424 | |
426 | aio_rename "$runtime~", $runtime |
425 | aio_rename "$runtime~", $runtime |
… | |
… | |
2481 | warn $@ if $@; |
2480 | warn $@ if $@; |
2482 | _exit 0; |
2481 | _exit 0; |
2483 | } |
2482 | } |
2484 | } |
2483 | } |
2485 | |
2484 | |
2486 | |
|
|
2487 | |
|
|
2488 | ############################################################################# |
2485 | ############################################################################# |
2489 | # the server's init and main functions |
2486 | # the server's init and main functions |
2490 | |
2487 | |
2491 | sub load_facedata($) { |
2488 | sub load_facedata($) { |
2492 | my ($path) = @_; |
2489 | my ($path) = @_; |