Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
unistd.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Intel Corporation
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_POSIX_UNISTD_H_
7#define ZEPHYR_INCLUDE_POSIX_UNISTD_H_
8
9#include <time.h>
10
12
13#ifdef CONFIG_POSIX_API
14#include <zephyr/fs/fs.h>
15#endif
19
20#include "posix_features.h"
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#ifdef CONFIG_POSIX_API
27/* File related operations */
28int close(int file);
29ssize_t write(int file, const void *buffer, size_t count);
30ssize_t read(int file, void *buffer, size_t count);
31off_t lseek(int file, off_t offset, int whence);
32int fsync(int fd);
33int ftruncate(int fd, off_t length);
34
35#ifdef CONFIG_POSIX_SYNCHRONIZED_IO
36int fdatasync(int fd);
37#endif /* CONFIG_POSIX_SYNCHRONIZED_IO */
38
39/* File System related operations */
40int rename(const char *old, const char *newp);
41int unlink(const char *path);
42int stat(const char *path, struct stat *buf);
43int mkdir(const char *path, mode_t mode);
44int rmdir(const char *path);
45
46FUNC_NORETURN void _exit(int status);
47
48int gethostname(char *buf, size_t len);
49
50#endif /* CONFIG_POSIX_API */
51
52#ifdef CONFIG_POSIX_C_LIB_EXT
53int getopt(int argc, char *const argv[], const char *optstring);
54extern char *optarg;
55extern int opterr, optind, optopt;
56#endif
57
58int getentropy(void *buffer, size_t length);
60unsigned sleep(unsigned int seconds);
61int usleep(useconds_t useconds);
62#if _POSIX_C_SOURCE >= 2
63size_t confstr(int name, char *buf, size_t len);
64#endif
65
66#ifdef CONFIG_POSIX_SYSCONF_IMPL_MACRO
67#define sysconf(x) (long)CONCAT(__z_posix_sysconf, x)
68#else
69long sysconf(int opt);
70#endif /* CONFIG_POSIX_SYSCONF_IMPL_FULL */
71
72#if _XOPEN_SOURCE >= 500
73long gethostid(void);
74#endif
75
76#ifdef __cplusplus
77}
78#endif
79
80#endif /* ZEPHYR_INCLUDE_POSIX_UNISTD_H_ */
__SIZE_TYPE__ ssize_t
Definition types.h:28
__INTPTR_TYPE__ off_t
Definition types.h:36
unsigned int mode_t
Definition types.h:14
long pid_t
Definition posix_signal.h:80
unsigned long useconds_t
Definition posix_types.h:83
int stat(const char *__restrict __path, struct stat *__restrict __sbuf)
int mkdir(const char *_path, mode_t __mode)
Definition stat.h:57
int usleep(useconds_t useconds)
long sysconf(int opt)
int getentropy(void *buffer, size_t length)
unsigned sleep(unsigned int seconds)
pid_t getpid(void)