POSIX compatible ftruncate() for Windows
This commit is contained in:
parent
adbcdf4335
commit
3c5fa553bb
2 changed files with 10 additions and 0 deletions
|
@ -412,6 +412,15 @@ posix_fsync(int fd)
|
||||||
FILE_FUNCTION(FDMAP_IO_FILE, _commit(handle))
|
FILE_FUNCTION(FDMAP_IO_FILE, _commit(handle))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* POSIX ftruncate()
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
ftruncate(int fd, off_t length)
|
||||||
|
{
|
||||||
|
FILE_FUNCTION(FDMAP_IO_FILE, _chsize(handle, length))
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* POSIX equivalent for fstat().
|
* POSIX equivalent for fstat().
|
||||||
* fstat() is used instead of _fstat(),
|
* fstat() is used instead of _fstat(),
|
||||||
|
|
|
@ -127,6 +127,7 @@ extern int fcntl(int fd, int cmd, ...);
|
||||||
posix_write((fd), (buffer), (count))
|
posix_write((fd), (buffer), (count))
|
||||||
#define fsync(fd) \
|
#define fsync(fd) \
|
||||||
posix_fsync((fd))
|
posix_fsync((fd))
|
||||||
|
extern int ftruncate(int fd, off_t length);
|
||||||
extern int posix_close(int fd);
|
extern int posix_close(int fd);
|
||||||
extern off_t posix_lseek(int fd, off_t offset, int origin);
|
extern off_t posix_lseek(int fd, off_t offset, int origin);
|
||||||
extern ssize_t posix_read(int fd, void *buffer, size_t count);
|
extern ssize_t posix_read(int fd, void *buffer, size_t count);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue