On this page:
system-type
system-language+  country
system-library-subpath
version
banner
current-command-line-arguments
current-thread-initial-stack-size
vector-set-performance-stats!

15.8 Environment and Runtime Information

procedure

(system-type [mode])

  (or/c symbol? string? bytes? exact-positive-integer? vector?)
  mode : 
(or/c 'os 'word 'vm 'gc 'link 'machine
      'so-suffix 'so-mode 'fs-change)
 = 'os
Returns information about the operating system, build mode, or machine for a running Racket. (Installation tools should use cross-system-type, instead, to support cross-installation.)

In 'os mode, the possible symbol results are:

In 'word mode, the result is either 32 or 64 to indicate whether Racket is running as a 32-bit program or 64-bit program.

In 'vm mode, the only possible symbol result is:

In 'gc mode, the possible symbol results are:

In 'link mode, the possible symbol results are:

Future ports of Racket may expand the list of 'os, 'gc, and 'link results.

In 'machine mode, then the result is a string, which contains further details about the current machine in a platform-specific format.

In 'so-suffix mode, then the result is a byte string that represents the file extension used for shared objects on the current platform. The byte string starts with a period, so it is suitable as a second argument to path-replace-suffix.

In 'so-mode mode, then the result is 'local if foreign libraries should be opened in “local” mode by default (as on most platforms) or 'global if foreign libraries should be opened in “global” mode.

In 'fs-change mode, the result is an immutable vector of four elements. Each element is either #f or a symbol, where a symbol indicates the presence of a property and #f indicates the absence of a property. The possible symbols, in order, are:

Changed in version 6.8.0.2 of package base: Added 'vm mode.

Returns a string to identify the current user’s language and country.

On Unix and Mac OS, the string is five characters: two lowercase ASCII letters for the language, an underscore, and two uppercase ASCII letters for the country. On Windows, the string can be arbitrarily long, but the language and country are in English (all ASCII letters or spaces) separated by an underscore.

On Unix, the result is determined by checking the LC_ALL, LC_TYPE, and LANG environment variables, in that order (and the result is used if the environment variable’s value starts with two lowercase ASCII letters, an underscore, and two uppercase ASCII letters, followed by either nothing or a period). On Windows and Mac OS, the result is determined by system calls.

procedure

(system-library-subpath [mode])  path?

  mode : (or/c 'cgc '3m #f) = (system-type 'gc)
Returns a relative directory path. This string can be used to build paths to system-specific files. For example, when Racket is running on Solaris on a Sparc architecture, the subpath starts "sparc-solaris", while the subpath for Windows on an i386 architecture starts "win32\\i386".

The optional mode argument specifies the relevant garbage-collection variant, which one of the possible results of (system-type 'gc): 'cgc or '3m. It can also be #f, in which case the result is independent of the garbage-collection variant.

Installation tools should use cross-system-library-subpath, instead, to support cross-installation.

procedure

(version)  (and/c string? immutable?)

Returns an immutable string indicating the currently executing version of Racket.

procedure

(banner)  (and/c string? immutable?)

Returns an immutable string for Racket’s start-up banner text (or the banner text for an embedding program, such as GRacket). The banner string ends with a newline.

A parameter that is initialized with command-line arguments when Racket starts (not including any command-line arguments that were treated as flags for the system).

On Unix and Mac OS, command-line arguments are provided to the Racket process as byte strings. The arguments are converted to strings using bytes->string/locale and #\uFFFD as the encoding-error character.

A parameter that provides a hint about how much space to reserve for a newly created thread’s local variables. The actual space used by a computation is affected by JIT compilation, but it is otherwise platform-independent.

procedure

(vector-set-performance-stats! results [thd])  void?

  results : 
(and/c vector?
       (not/c immutable?))
  thd : (or/c thread? #f) = #f
Sets elements in results to report current performance statistics. If thd is not #f, a particular set of thread-specific statistics are reported, otherwise a different set of global (within the current place) statics are reported.

For global statistics, up to 12 elements are set in the vector, starting from the beginning. If results has n elements where n < 12, then the n elements are set to the first n performance-statistics values. The reported statistics values are as follows, in the order that they are set within results:

For thread-specific statistics, up to 4 elements are set in the vector:

Changed in version 6.1.1.8 of package base: Added vector position 11 for global statistics.