… | |
… | |
395 | my $runtime = "$LOCALDIR/runtime"; |
395 | my $runtime = "$LOCALDIR/runtime"; |
396 | |
396 | |
397 | # first touch the runtime file to show we are still running: |
397 | # first touch the runtime file to show we are still running: |
398 | # the fsync below can take a very very long time. |
398 | # the fsync below can take a very very long time. |
399 | |
399 | |
400 | if (my $fh = aio_open $runtime, O_WRONLY, 0) { |
400 | IO::AIO::aio_utime $runtime, undef, undef; |
401 | utime undef, undef, $fh; |
|
|
402 | } |
|
|
403 | |
401 | |
404 | my $guard = cf::lock_acquire "write_runtime"; |
402 | my $guard = cf::lock_acquire "write_runtime"; |
405 | |
403 | |
406 | my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644 |
404 | my $fh = aio_open "$runtime~", O_WRONLY | O_CREAT, 0644 |
407 | or return; |
405 | or return; |
… | |
… | |
416 | # always fsync - this file is important |
414 | # always fsync - this file is important |
417 | aio_fsync $fh |
415 | aio_fsync $fh |
418 | and return; |
416 | and return; |
419 | |
417 | |
420 | # touch it again to show we are up-to-date |
418 | # touch it again to show we are up-to-date |
421 | utime undef, undef, $fh; |
419 | aio_utime $fh, undef, undef; |
422 | |
420 | |
423 | close $fh |
421 | close $fh |
424 | or return; |
422 | or return; |
425 | |
423 | |
426 | aio_rename "$runtime~", $runtime |
424 | aio_rename "$runtime~", $runtime |
… | |
… | |
2481 | warn $@ if $@; |
2479 | warn $@ if $@; |
2482 | _exit 0; |
2480 | _exit 0; |
2483 | } |
2481 | } |
2484 | } |
2482 | } |
2485 | |
2483 | |
2486 | |
|
|
2487 | |
|
|
2488 | ############################################################################# |
2484 | ############################################################################# |
2489 | # the server's init and main functions |
2485 | # the server's init and main functions |
2490 | |
2486 | |
2491 | sub load_facedata($) { |
2487 | sub load_facedata($) { |
2492 | my ($path) = @_; |
2488 | my ($path) = @_; |