1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
/* File::Sync.xs
*
* Copyright 1996,1997 Carey Evans. All rights reserved. This module is
* free software; you can redistribute it and/or modify it under the same
* terms as Perl itself. */
#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif
#include <unistd.h>
#ifndef HAVE_SYNC
int sync()
{
return 0;
}
#endif
#ifndef HAVE_FDATASYNC
int fdatasync(int fh)
{
croak("skipping unsupported fdatasync() call - you might want to use fsync() instead");
return 0;
}
#endif
MODULE = File::Sync PACKAGE = File::Sync
PROTOTYPES: ENABLE
void
sync()
PROTOTYPE:
SV*
fsync_fd(fd)
int fd
PROTOTYPE: $
CODE:
if (fsync(fd) == -1) XSRETURN_UNDEF;
else XSRETURN_YES;
SV*
fdatasync_fd(fd)
int fd
PROTOTYPE: $
CODE:
if (fdatasync(fd) == -1) XSRETURN_UNDEF;
else XSRETURN_YES;
|