2024-01-04 23:20:35 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) KolibriOS team 2004-2024. All rights reserved.
|
|
|
|
* Distributed under terms of the GNU General Public License
|
|
|
|
*/
|
|
|
|
|
2014-05-11 00:12:19 +02:00
|
|
|
#include <sys/types.h>
|
2016-03-13 01:52:58 +01:00
|
|
|
#include <errno.h>
|
2024-01-04 23:20:35 +01:00
|
|
|
#include <sys/ksys.h>
|
2014-05-11 00:12:19 +02:00
|
|
|
|
2024-01-04 23:20:35 +01:00
|
|
|
int write_file(const char *path, const void *buff,
|
2014-05-11 00:12:19 +02:00
|
|
|
size_t offset, size_t count, size_t *writes)
|
|
|
|
{
|
2024-01-04 23:20:35 +01:00
|
|
|
ksys_file_status_t st = _ksys_file_write(path, offset, count, buff);
|
|
|
|
*writes = st.rw_bytes;
|
|
|
|
if(!st.status)
|
2016-03-13 01:52:58 +01:00
|
|
|
return 0;
|
2024-01-04 23:20:35 +01:00
|
|
|
else if (st.status == KSYS_FS_ERR_8)
|
2016-03-13 01:52:58 +01:00
|
|
|
return ENOSPC;
|
|
|
|
return -1;
|
2024-01-04 23:20:35 +01:00
|
|
|
}
|