Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* Reentrant versions of file system calls.  These implementations
  2.    just call the usual system calls.  */
  3.  
  4. #include <reent.h>
  5. #include <unistd.h>
  6. #include <_syslist.h>
  7.  
  8. /* Some targets provides their own versions of these functions.  Those
  9.    targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
  10.  
  11. #ifdef _REENT_ONLY
  12. #ifndef REENTRANT_SYSCALLS_PROVIDED
  13. #define REENTRANT_SYSCALLS_PROVIDED
  14. #endif
  15. #endif
  16.  
  17. #ifndef REENTRANT_SYSCALLS_PROVIDED
  18.  
  19. /* We use the errno variable used by the system dependent layer.  */
  20. #undef errno
  21. extern int errno;
  22.  
  23. /*
  24. FUNCTION
  25.         <<_unlink_r>>---Reentrant version of unlink
  26.        
  27. INDEX
  28.         _unlink_r
  29.  
  30. ANSI_SYNOPSIS
  31.         #include <reent.h>
  32.         int _unlink_r(struct _reent *<[ptr]>, const char *<[file]>);
  33.  
  34. TRAD_SYNOPSIS
  35.         #include <reent.h>
  36.         int _unlink_r(<[ptr]>, <[file]>)
  37.         struct _reent *<[ptr]>;
  38.         char *<[file]>;
  39.  
  40. DESCRIPTION
  41.         This is a reentrant version of <<unlink>>.  It
  42.         takes a pointer to the global data block, which holds
  43.         <<errno>>.
  44. */
  45.  
  46. int
  47. _DEFUN (_unlink_r, (ptr, file),
  48.      struct _reent *ptr _AND
  49.      _CONST char *file)
  50. {
  51.   int ret;
  52.  
  53.   errno = 0;
  54.   if ((ret = _unlink (file)) == -1 && errno != 0)
  55.     ptr->_errno = errno;
  56.   return ret;
  57. }
  58.  
  59. #endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */
  60.