2018-01-13 17:24:23 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2018-09-14 19:43:44 +02:00
|
|
|
#ifndef ZEPHYR_INCLUDE_POSIX_UNISTD_H_
|
|
|
|
#define ZEPHYR_INCLUDE_POSIX_UNISTD_H_
|
2018-01-13 17:24:23 +01:00
|
|
|
|
2019-02-19 19:49:04 +01:00
|
|
|
#include "posix_types.h"
|
2018-05-03 13:47:22 +02:00
|
|
|
#include "sys/stat.h"
|
2019-02-21 18:31:18 +01:00
|
|
|
#ifdef CONFIG_NETWORKING
|
|
|
|
/* For zsock_gethostname() */
|
|
|
|
#include "net/socket.h"
|
|
|
|
#endif
|
2018-05-03 13:47:22 +02:00
|
|
|
|
2018-10-08 17:48:22 +02:00
|
|
|
#ifdef CONFIG_POSIX_API
|
2019-06-25 18:09:16 +02:00
|
|
|
#include <fs/fs.h>
|
2020-02-10 20:33:29 +01:00
|
|
|
#endif
|
2018-05-03 13:47:22 +02:00
|
|
|
|
2019-08-12 19:55:06 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-02-10 20:33:29 +01:00
|
|
|
#ifdef CONFIG_POSIX_API
|
2018-05-03 13:47:22 +02:00
|
|
|
/* File related operations */
|
|
|
|
extern int close(int file);
|
2018-10-08 17:48:22 +02:00
|
|
|
extern ssize_t write(int file, const void *buffer, size_t count);
|
|
|
|
extern ssize_t read(int file, void *buffer, size_t count);
|
|
|
|
extern off_t lseek(int file, off_t offset, int whence);
|
2018-05-03 13:47:22 +02:00
|
|
|
|
|
|
|
/* File System related operations */
|
|
|
|
extern int rename(const char *old, const char *newp);
|
|
|
|
extern int unlink(const char *path);
|
|
|
|
extern int stat(const char *path, struct stat *buf);
|
|
|
|
extern int mkdir(const char *path, mode_t mode);
|
2018-01-13 17:24:23 +01:00
|
|
|
|
2019-02-21 18:31:18 +01:00
|
|
|
#ifdef CONFIG_NETWORKING
|
|
|
|
static inline int gethostname(char *buf, size_t len)
|
|
|
|
{
|
|
|
|
return zsock_gethostname(buf, len);
|
|
|
|
}
|
2020-02-10 20:33:29 +01:00
|
|
|
#endif /* CONFIG_NETWORKING */
|
2019-02-21 18:31:18 +01:00
|
|
|
|
2020-02-10 20:33:29 +01:00
|
|
|
#endif /* CONFIG_POSIX_API */
|
2019-12-03 14:33:38 +01:00
|
|
|
|
|
|
|
unsigned sleep(unsigned int seconds);
|
|
|
|
int usleep(useconds_t useconds);
|
|
|
|
|
2018-01-13 17:24:23 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2018-05-03 13:47:22 +02:00
|
|
|
#endif
|
|
|
|
|
2018-09-14 19:43:44 +02:00
|
|
|
#endif /* ZEPHYR_INCLUDE_POSIX_UNISTD_H_ */
|