prsystem.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef prsystem_h___
  6. #define prsystem_h___
  7. /*
  8. ** API to NSPR functions returning system info.
  9. */
  10. #include "prtypes.h"
  11. PR_BEGIN_EXTERN_C
  12. /*
  13. ** Get the host' directory separator.
  14. ** Pathnames are then assumed to be of the form:
  15. ** [<sep><root_component><sep>]*(<component><sep>)<leaf_name>
  16. */
  17. NSPR_API(char) PR_GetDirectorySeparator(void);
  18. /*
  19. ** OBSOLETE -- the function name is misspelled.
  20. ** Use PR_GetDirectorySeparator instead.
  21. */
  22. NSPR_API(char) PR_GetDirectorySepartor(void);
  23. /*
  24. ** Get the host' path separator.
  25. ** Paths are assumed to be of the form:
  26. ** <directory>[<sep><directory>]*
  27. */
  28. NSPR_API(char) PR_GetPathSeparator(void);
  29. /* Types of information available via PR_GetSystemInfo(...) */
  30. typedef enum {
  31. PR_SI_HOSTNAME, /* the hostname with the domain name (if any)
  32. * removed */
  33. PR_SI_SYSNAME,
  34. PR_SI_RELEASE,
  35. PR_SI_ARCHITECTURE,
  36. PR_SI_HOSTNAME_UNTRUNCATED /* the hostname exactly as configured
  37. * on the system */
  38. } PRSysInfo;
  39. /*
  40. ** If successful returns a null termintated string in 'buf' for
  41. ** the information indicated in 'cmd'. If unseccussful the reason for
  42. ** the failure can be retrieved from PR_GetError().
  43. **
  44. ** The buffer is allocated by the caller and should be at least
  45. ** SYS_INFO_BUFFER_LENGTH bytes in length.
  46. */
  47. #define SYS_INFO_BUFFER_LENGTH 256
  48. NSPR_API(PRStatus) PR_GetSystemInfo(PRSysInfo cmd, char *buf, PRUint32 buflen);
  49. /*
  50. ** Return the number of bytes in a page
  51. */
  52. NSPR_API(PRInt32) PR_GetPageSize(void);
  53. /*
  54. ** Return log2 of the size of a page
  55. */
  56. NSPR_API(PRInt32) PR_GetPageShift(void);
  57. /*
  58. ** PR_GetNumberOfProcessors() -- returns the number of CPUs
  59. **
  60. ** Description:
  61. ** PR_GetNumberOfProcessors() extracts the number of processors
  62. ** (CPUs available in an SMP system) and returns the number.
  63. **
  64. ** Parameters:
  65. ** none
  66. **
  67. ** Returns:
  68. ** The number of available processors or -1 on error
  69. **
  70. */
  71. NSPR_API(PRInt32) PR_GetNumberOfProcessors( void );
  72. /*
  73. ** PR_GetPhysicalMemorySize() -- returns the amount of system RAM
  74. **
  75. ** Description:
  76. ** PR_GetPhysicalMemorySize() determines the amount of physical RAM
  77. ** in the system and returns the size in bytes.
  78. **
  79. ** Parameters:
  80. ** none
  81. **
  82. ** Returns:
  83. ** The amount of system RAM, or 0 on failure.
  84. **
  85. */
  86. NSPR_API(PRUint64) PR_GetPhysicalMemorySize(void);
  87. PR_END_EXTERN_C
  88. #endif /* prsystem_h___ */