creat.c 519 B

12345678910111213141516171819202122
  1. /*
  2. * Copyright (C) 2017 Waldemar Brodkorb <wbx@uclibc-ng.org>
  3. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. #include <fcntl.h>
  6. #include <sys/types.h>
  7. #include <cancel.h>
  8. int
  9. creat (const char *file, mode_t mode)
  10. {
  11. # ifdef __NR_creat
  12. return _syscall2(int, __NC(creat), const char*, file, mode_t, mode)
  13. # else
  14. return __open (file, O_WRONLY | O_CREAT | O_TRUNC, mode);
  15. # endif
  16. }
  17. CANCELLABLE_SYSCALL(int, creat, (const char *file, mode_t mode), (file, mode))
  18. lt_libc_hidden(creat)