readlink.c 525 B

123456789101112131415161718192021
  1. /*
  2. * readlink() for uClibc
  3. *
  4. * Copyright (C) 2000-2007 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <unistd.h>
  10. #if defined(__NR_readlinkat) && !defined(__NR_readlink)
  11. # include <fcntl.h>
  12. ssize_t readlink (const char *path, char *buf, size_t len)
  13. {
  14. return readlinkat(AT_FDCWD, path, buf, len);
  15. }
  16. #else
  17. _syscall3(ssize_t, readlink, const char *, path, char *, buf, size_t, bufsiz)
  18. #endif
  19. libc_hidden_def(readlink)