forked from KolibriOS/kolibrios
6e3276cb4b
- Added basic support for dirent.h; - Added memory.h for compatibility; - Added ftruncate() function; - Fixed date and time structures in ksys_file_info_t. git-svn-id: svn://kolibrios.org@9954 a494cfbc-eb01-0410-851d-a64ba20cac60
25 lines
384 B
C
25 lines
384 B
C
|
|
#include <errno.h>
|
|
#include <sys/types.h>
|
|
#include <sys/ksys.h>
|
|
#include "glue.h"
|
|
#include "io.h"
|
|
|
|
int
|
|
_DEFUN (ftruncate, (fd, len),
|
|
int fd _AND
|
|
off_t len)
|
|
{
|
|
__io_handle *ioh;
|
|
if ((fd < 0) || (fd >=64))
|
|
{
|
|
errno = EBADF;
|
|
return (-1);
|
|
}
|
|
ioh = &__io_tab[fd];
|
|
if (_ksys_file_set_size(ioh->name, len))
|
|
return (-1);
|
|
|
|
return 0;
|
|
}
|