unistd.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * unistd.h
  3. *
  4. * Copyright (C) 2017 Aleksandar Andrejevic <theflash@sdf.lonestar.org>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as
  8. * published by the Free Software Foundation, either version 3 of the
  9. * License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. #ifndef _UNISTD_H_
  20. #define _UNISTD_H_
  21. #include <mlcrt.h>
  22. #include <stddef.h>
  23. #include <stdint.h>
  24. #define PATH_MAX 16384
  25. #define STDIN_FILENO 0
  26. #define STDOUT_FILENO 1
  27. #define STDERR_FILENO 2
  28. #define O_RDONLY 0
  29. #define O_WRONLY 1
  30. #define O_RDWR 2
  31. #define O_CREAT (1 << 6)
  32. #define O_EXCL (1 << 7)
  33. #define O_TRUNC (1 << 9)
  34. #define O_APPEND (1 << 10)
  35. #define O_NONBLOCK (1 << 11)
  36. #define SEEK_SET 0
  37. #define SEEK_CUR 1
  38. #define SEEK_END 2
  39. typedef uint16_t mode_t;
  40. typedef ptrdiff_t off_t;
  41. typedef ptrdiff_t ssize_t;
  42. char *__CRT_PUBLIC(getcwd)(char *buf, size_t size);
  43. char *__CRT_PUBLIC(getwd)(char *buf);
  44. char *__CRT_PUBLIC(get_current_dir_name)(void);
  45. int __CRT_PUBLIC(fchdir)(int fd);
  46. int __CRT_PUBLIC(chdir)(const char *path);
  47. #ifndef __DONT_DEFINE_OPEN__
  48. int __CRT_PUBLIC(open)(const char *pathname, int flags, ...);
  49. #endif
  50. int __CRT_PUBLIC(creat)(const char *pathname, mode_t mode);
  51. int __CRT_PUBLIC(close)(int fd);
  52. ssize_t __CRT_PUBLIC(read)(int fd, void *buf, size_t count);
  53. ssize_t __CRT_PUBLIC(write)(int fd, const void *buf, size_t count);
  54. off_t __CRT_PUBLIC(lseek)(int fd, off_t offset, int whence);
  55. #endif