plan9fox/sys/man/3/env
cinap_lenrek 60adc40118 devenv: allow environment total size of up to 1MB
Sometimes, there is the one-off occation when one needs to
pass a huge list in rc...

This change makes devenv track total memory consumption
of environment groups allowing them to grow up to 1MB in
size (including overhead).

(Before, only the variable size was restricted, but
not the amount of files being created).

The maximum value size of a single environment variable
is set to half of the total size, which allows the
occational large value. (But not many of them).

Because we track all memory consuption, it is also
now possible to create around 10k small environment
variales.

A hashtable is added for name lookups and the qid.path
was changed to allow direct indexing into the entry
array without needing a scan lookup.

All smalloc() calls have been removed, exhaustion is
handled with error(Enomem) avoiding deadlock
in case we run out of kernel memory.
2022-01-23 21:33:58 +00:00

61 lines
1.2 KiB
Plaintext

.TH ENV 3
.SH NAME
env \- environment variables
.SH SYNOPSIS
.nf
.B bind #e /env
.BI /env/ var1
.BI /env/ var2
...
.fi
.SH DESCRIPTION
The
.I env
device serves a one-level directory containing files with arbitrary names
and contents.
The intention is that the file name is the name of an
.I environment variable
(see
.IR rc (1)),
and the content is the variable's current value.
.PP
When a
.IR fork (2)
system call creates a new process, both the parent and the
child continue to see exactly the same files in the
.I env
device: changes made in either process can be noticed by the other.
In contrast, an
.B rfork
system call with the
.B RFENVG
bit set (see
.IR fork (2))
causes a split: initially both process groups see the
same environment files, but any changes made in one process group
cannot be noticed by the other.
An
.B rfork
with
.B RFCENVG
splits and then clears the environment.
.PP
The special global environment
.B #ec
contains kernel configuration variables,
such as those set in
.IR plan9.ini (8).
All processes see the same
.BR #ec ;
its contents are writable only by the host owner.
.SH SEE ALSO
.IR rc (1),
.IR fork (2),
.B #c/reboot
in
.IR cons (3),
.IR plan9.ini (8)
.SH SOURCE
.B /sys/src/9/port/devenv.c