file.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. #ifndef BASE_FILE_H
  13. #define BASE_FILE_H
  14. #ifndef NOINTNSAPI
  15. #define INTNSAPI
  16. #endif /* !NOINTNSAPI */
  17. /* GLOBAL FUNCTIONS:
  18. * DESCRIPTION:
  19. * system-specific functions for reading/writing files
  20. */
  21. #ifndef NETSITE_H
  22. #include "../netsite.h"
  23. #endif /* !NETSITE_H */
  24. /* --- Begin function prototypes --- */
  25. #ifdef INTNSAPI
  26. NSPR_BEGIN_EXTERN_C
  27. void INTsystem_errmsg_init(void);
  28. NSAPI_PUBLIC SYS_FILE INTsystem_fopenRO(char *path);
  29. NSAPI_PUBLIC SYS_FILE INTsystem_fopenWA(char *path);
  30. NSAPI_PUBLIC SYS_FILE INTsystem_fopenRW(char *path);
  31. NSAPI_PUBLIC SYS_FILE INTsystem_fopenWT(char *path);
  32. NSAPI_PUBLIC int INTsystem_fread(SYS_FILE fd, char *buf, int sz);
  33. NSAPI_PUBLIC int INTsystem_fwrite(SYS_FILE fd,char *buf,int sz);
  34. NSAPI_PUBLIC int INTsystem_fwrite_atomic(SYS_FILE fd, char *buf, int sz);
  35. NSAPI_PUBLIC int INTsystem_lseek(SYS_FILE fd, int off, int wh);
  36. NSAPI_PUBLIC int INTsystem_fclose(SYS_FILE fd);
  37. NSAPI_PUBLIC int INTsystem_stat(char *name, struct stat *finfo);
  38. NSAPI_PUBLIC int INTsystem_rename(char *oldpath, char *newpath);
  39. NSAPI_PUBLIC int INTsystem_unlink(char *path);
  40. NSAPI_PUBLIC int INTsystem_tlock(SYS_FILE fd);
  41. NSAPI_PUBLIC int INTsystem_flock(SYS_FILE fd);
  42. NSAPI_PUBLIC int INTsystem_ulock(SYS_FILE fd);
  43. /* --- OBSOLETE ----------------------------------------------------------
  44. * The following macros/functions are obsolete and are only maintained for
  45. * compatibility. Do not use them. 11-19-96
  46. * -----------------------------------------------------------------------
  47. */
  48. NSAPI_PUBLIC int INTsystem_nocoredumps(void);
  49. NSAPI_PUBLIC int INTfile_setinherit(SYS_FILE fd, int value);
  50. NSAPI_PUBLIC int INTfile_notfound(void);
  51. NSAPI_PUBLIC const char *INTsystem_errmsg(void);
  52. NSAPI_PUBLIC int INTsystem_errmsg_fn(char **buff, size_t maxlen);
  53. NSPR_END_EXTERN_C
  54. #define system_errmsg_init INTsystem_errmsg_init
  55. #define system_fopenRO INTsystem_fopenRO
  56. #define system_fopenWA INTsystem_fopenWA
  57. #define system_fopenRW INTsystem_fopenRW
  58. #define system_fopenWT INTsystem_fopenWT
  59. #define system_fread INTsystem_fread
  60. #define system_fwrite INTsystem_fwrite
  61. #define system_fwrite_atomic INTsystem_fwrite_atomic
  62. #define system_lseek INTsystem_lseek
  63. #define system_fclose INTsystem_fclose
  64. #define system_stat INTsystem_stat
  65. #define system_rename INTsystem_rename
  66. #define system_unlink INTsystem_unlink
  67. #define system_tlock INTsystem_tlock
  68. #define system_flock INTsystem_flock
  69. #define system_ulock INTsystem_ulock
  70. #define system_nocoredumps INTsystem_nocoredumps
  71. #define file_setinherit INTfile_setinherit
  72. #define file_notfound INTfile_notfound
  73. #define rtfile_notfound INTfile_notfound
  74. #define system_errmsg INTsystem_errmsg
  75. #define system_errmsg_fn INTsystem_errmsg_fn
  76. #endif /* INTNSAPI */
  77. #endif /* BASE_FILE_H */