]> git.lizzy.rs Git - plan9front.git/blob - sys/man/3/env
Import sources from 2011-03-30 iso image - sys/man
[plan9front.git] / sys / man / 3 / env
1 .TH ENV 3
2 .SH NAME
3 env \- environment variables
4 .SH SYNOPSIS
5 .nf
6 .B bind #e /env
7
8 .BI /env/ var1
9 .BI /env/ var2
10  ...
11 .fi
12 .SH DESCRIPTION
13 The
14 .I env
15 device serves a one-level directory containing files with arbitrary names
16 and contents.
17 The intention is that the file name is the name of an
18 .I environment variable
19 (see
20 .IR rc (1)),
21 and the content is the variable's current value.
22 .PP
23 When a
24 .IR fork (2)
25 system call creates a new process, both the parent and the
26 child continue to see exactly the same files in the
27 .I env
28 device: changes made in either process can be noticed by the other.
29 In contrast, an
30 .B rfork
31 system call with the
32 .B RFENVG
33 bit set (see
34 .IR fork (2))
35 causes a split: initially both process groups see the
36 same environment files, but any changes made in one process group
37 cannot be noticed by the other.
38 An
39 .B rfork
40 with
41 .B RFCENVG
42 splits and then clears the environment.
43 .PP
44 The special global environment
45 .B #ec
46 contains kernel configuration variables,
47 such as those set in 
48 .IR plan9.ini (8).
49 All processes see the same
50 .BR #ec ;
51 its contents are writable only by the host owner.
52 [XXX actually everything is world writable; that's a mistake.]
53 .SH SEE ALSO
54 .IR rc (1),
55 .IR fork (2),
56 .B #c/reboot
57 in
58 .IR cons (3),
59 .IR plan9.ini (8)
60 .SH SOURCE
61 .B /sys/src/9/port/devenv.c
62 .SH BUGS
63 A write starting at an offset after the current extent of a file
64 yields an error instead of zero filling.