posix_fadvise64.S 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #if defined __NR_fadvise64_64 || defined __NR_fadvise64
  21. /* Was named __libc_posix_fadvise64 for some inexplicable reason.
  22. ** google says only uclibc has *__libc*_posix_fadviseXXX,
  23. ** so it cannot be compat with anything.
  24. **
  25. ** Remove this comment and one at the end after 0.9.31
  26. */
  27. .text
  28. .global posix_fadvise64
  29. .type posix_fadvise64,%function
  30. posix_fadvise64:
  31. #if defined __NR_fadvise64_64
  32. /* Save regs */
  33. pushl %ebp
  34. pushl %ebx
  35. pushl %esi
  36. pushl %edi
  37. movl $__NR_fadvise64_64, %eax /* Syscall number in %eax. */
  38. movl 20(%esp), %ebx
  39. movl 24(%esp), %ecx
  40. movl 28(%esp), %edx
  41. movl 32(%esp), %esi
  42. movl 36(%esp), %edi
  43. movl 40(%esp), %ebp
  44. /* Do the system call trap. */
  45. int $0x80
  46. /* Restore regs */
  47. popl %edi
  48. popl %esi
  49. popl %ebx
  50. popl %ebp
  51. /* Returns 0 on success, else an error code. */
  52. negl %eax
  53. #elif defined __NR_fadvise64
  54. /* Save regs */
  55. pushl %ebx
  56. pushl %esi
  57. pushl %edi
  58. #if 0
  59. /* does len overflow long? */
  60. cmpl $0, 28(%esp)
  61. movl $-EOVERFLOW, %eax
  62. jne overflow
  63. #endif
  64. movl $__NR_fadvise64, %eax /* Syscall number in %eax. */
  65. movl 16(%esp), %ebx
  66. movl 20(%esp), %ecx
  67. movl 24(%esp), %edx
  68. movl 28(%esp), %esi
  69. movl 32(%esp), %edi
  70. /* Do the system call trap. */
  71. int $0x80
  72. overflow:
  73. /* Restore regs */
  74. popl %edi
  75. popl %esi
  76. popl %ebx
  77. /* Returns 0 on success, else an error code. */
  78. negl %eax
  79. #endif
  80. /* Successful; return the syscall's value. */
  81. ret
  82. .size posix_fadvise64,.-posix_fadvise64
  83. /*
  84. ** libc_hidden_def(__libc_posix_fadvise64)
  85. ** #if defined __UCLIBC_HAS_LFS__ && defined __UCLIBC_HAS_ADVANCED_REALTIME__
  86. ** weak_alias(__libc_posix_fadvise64,posix_fadvise64)
  87. ** #endif
  88. */
  89. #endif