mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-11 15:32:44 +00:00
This constant should be defined in limits.h. Define it in limits.h in the minimal libc, and use the definition found in newlib's includes. Values in newlib includes range from 1024 to 4096. The rationale is that all code should use the same value; having buffers specified with different sizes will lead to interoperability and out of bounds array writes. Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
/*
|
|
* Copyright (c) 2018 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#ifndef __POSIX_UNISTD_H__
|
|
#define __POSIX_UNISTD_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "sys/types.h"
|
|
#include "sys/stat.h"
|
|
|
|
#ifdef CONFIG_POSIX_FS
|
|
#include <fs.h>
|
|
|
|
typedef struct fs_dir_t DIR;
|
|
typedef unsigned int mode_t;
|
|
|
|
struct dirent {
|
|
unsigned int d_ino;
|
|
char d_name[PATH_MAX + 1];
|
|
};
|
|
|
|
/* File related operations */
|
|
extern int open(const char *name, int flags);
|
|
extern int close(int file);
|
|
extern ssize_t write(int file, char *buffer, unsigned int count);
|
|
extern ssize_t read(int file, char *buffer, unsigned int count);
|
|
extern int lseek(int file, int offset, int whence);
|
|
|
|
/* Directory related operations */
|
|
extern DIR *opendir(const char *dirname);
|
|
extern int closedir(DIR *dirp);
|
|
extern struct dirent *readdir(DIR *dirp);
|
|
|
|
/* 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);
|
|
#endif
|
|
|
|
unsigned sleep(unsigned int seconds);
|
|
int usleep(useconds_t useconds);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __POSIX_UNISTD_H__ */
|