posix_fadvise64.S 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Copyright (C) 1995-2000,2002,2003,2004,2005,2006
  2. Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. #define _ERRNO_H 1
  17. #include <features.h>
  18. #include <bits/errno.h>
  19. #include <sys/syscall.h>
  20. .text
  21. .global posix_fadvise64
  22. .type posix_fadvise64,%function
  23. posix_fadvise64:
  24. #ifdef __NR_posix_fadvise64_64
  25. /* Save regs */
  26. pushl %ebp
  27. pushl %ebx
  28. pushl %esi
  29. pushl %edi
  30. movl $__NR_posix_fadvise64_64, %eax /* Syscall number in %eax. */
  31. movl 24(%esp), %ebx
  32. movl 28(%esp), %ecx
  33. movl 32(%esp), %edx
  34. movl 36(%esp), %esi
  35. movl 40(%esp), %edi
  36. movl 44(%esp), %ebp
  37. /* Do the system call trap. */
  38. int $0x80
  39. /* Restore regs */
  40. popl %edi
  41. popl %esi
  42. popl %ebx
  43. popl %ebp
  44. /* If 0 > %eax > -4096 there was an error. */
  45. cmpl $-4096, %eax
  46. ja __syscall_error
  47. #else
  48. movl $-ENOSYS, %eax
  49. jmp __syscall_error
  50. #endif
  51. /* Successful; return the syscall's value. */
  52. ret
  53. .size posix_fadvise64,.-posix_fadvise64
  54. libc_hidden_def(posix_fadvise64)