This file is indexed.

/usr/share/gnu-smalltalk/kernel/ProcEnv.st is in gnu-smalltalk-common 3.2.4-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
"======================================================================
|
|   ProcessEnvironment Method Definitions
|
|
 ======================================================================"

"======================================================================
|
| Copyright 2008, 2009 Free Software Foundation, Inc.
| Written by Paolo Bonzini.
|
| This file is part of the GNU Smalltalk class library.
|
| The GNU Smalltalk class library is free software; you can redistribute it
| and/or modify it under the terms of the GNU Lesser General Public License
| as published by the Free Software Foundation; either version 2.1, or (at
| your option) any later version.
| 
| The GNU Smalltalk class library is distributed in the hope that it will be
| useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
| General Public License for more details.
| 
| You should have received a copy of the GNU Lesser General Public License
| along with the GNU Smalltalk class library; see the file COPYING.LIB.
| If not, write to the Free Software Foundation, 59 Temple Place - Suite
| 330, Boston, MA 02110-1301, USA.  
|
 ======================================================================"



LookupKey subclass: ProcessVariable [
    <category: 'Language-Processes'>
    <comment: 'I represent a proxy for a thread-local variable defined
for a process.  Requesting the value will return the thread-local
setting for the current process.'>

    ProcessVariable class >> key: anObject [
	"Return a new ProcessVariable with the given key.  Not that the key
	 need not be a symbol or string, for example you could use an
	 array #(#{class name} 'name').  Setting the variable's value will
	 automatically create it in the current process, while removal must
	 be done by hand through the ProcessEnvironment singleton object."
	<category: 'accessing'>
	^self basicNew key: anObject
    ]

    ProcessVariable class >> new [
	"Return a new ProcessVariable with a new anonymous but unique key.
	 It is suggested to use a descriptive name instead to ease debugging.
	 Setting the variable's value will automatically create it in
	 the current process, while removal must be done by hand through
	 the ProcessEnvironment singleton object."
	<category: 'accessing'>
	^self basicNew key: Object new
    ]

    environment [
	"Return the environment in which this ProcessVariable lives.  This
	 is the singleton instance of ProcessEnvironment for all variables."
	<category: 'accessing'>
	^ProcessEnvironment uniqueInstance
    ]

    use: anObject during: aBlock [
	"Set the value of this variable to anObject during the execution
         of aBlock, then restore it."
	<category: 'accessing'>
        | oldValue |
        oldValue := self value.
        self value: anObject.
        ^aBlock ensure: [self value: oldValue]
    ]

    valueIfAbsent: aBlock [
	"Return the value of this variable in the current process."
	<category: 'accessing'>
	^Processor activeProcess environment at: self key ifAbsent: [ nil ]
    ]

    value [
	"Return the value of this variable in the current process."
	<category: 'accessing'>
	^Processor activeProcess environment at: self key ifAbsent: [ nil ]
    ]

    value: anObject [
	"Set the value of the current process's copy of the variable to be
	 anObject."
	<category: 'accessing'>
	Processor activeProcess environment at: self key put: anObject
    ]
]



Object subclass: ProcessEnvironment [
    <category: 'Language-Processes'>
    <comment: 'I represent a proxy for thread-local variables defined for
Smalltalk processes.  Associations requested to me retrieve the thread-local
value for the current process.  For now, I don''t provide the full protocol of
a Dictionary; in particular the iteration protocol is absent.'>

    ProcessEnvironment class [
	| uniqueInstance |

	uniqueInstance [
	    "Return the singleton instance of ProcessEnvironment."
	    <category: 'singleton'>
	    uniqueInstance isNil ifTrue: [ uniqueInstance := self basicNew ].
	    ^uniqueInstance
	]

	new [
	    <category: 'disabled'>
	    self shouldNotImplement
	]
    ]

    add: newObject [
        "Add the newObject association to the receiver"

        <category: 'accessing'>
        ^Processor activeProcess environment add: newObject
    ]

    at: key put: value [
        "Store value as associated to the given key"

        <category: 'accessing'>
        ^Processor activeProcess environment at: key put: value
    ]

    at: key [
        "Answer the value associated to the given key. Return nil if the key
         is not found"

        <category: 'accessing'>
        ^Processor activeProcess environment at: key ifAbsent: [nil]
    ]

    at: key ifAbsent: aBlock [
        "Answer the value associated to the given key, or the result of evaluating
         aBlock if the key is not found"

        <category: 'accessing'>
        ^Processor activeProcess environment at: key ifAbsent: aBlock
    ]

    at: key ifAbsentPut: aBlock [
        "Answer the value associated to the given key, setting it to
	 the result of evaluating aBlock if the key is not found."

        <category: 'accessing'>
        ^Processor activeProcess environment at: key ifAbsentPut: aBlock
    ]

    at: key ifPresent: aBlock [
        "Answer the value associated to the given key, or the result of evaluating
         aBlock if the key is not found"

        <category: 'accessing'>
        ^Processor activeProcess environment at: key ifPresent: aBlock
    ]

    associationAt: key ifAbsent: aBlock [
        "Answer the value associated to the given key, or the result of evaluating
         aBlock if the key is not found"

        <category: 'accessing'>
        ^ProcessVariable key: key
    ]

    associationAt: key [
        "Answer the value associated to the given key, or the result of evaluating
         aBlock if the key is not found"

        <category: 'accessing'>
        ^ProcessVariable key: key
    ]

    keys [
        "Answer a kind of Set containing the keys of the receiver"

        <category: 'accessing'>
        ^Processor activeProcess environment keys
    ]

    includesKey: key [
        "Answer whether the receiver contains the given key"

        <category: 'dictionary testing'>
        ^Processor activeProcess environment includesKey: key
    ]

    removeAllKeys: keys [
        "Remove all the keys in keys, without raising any errors"

        <category: 'dictionary removing'>
        keys do: [:key | self removeKey: key ifAbsent: []]
    ]

    removeAllKeys: keys ifAbsent: aBlock [
        "Remove all the keys in keys, passing the missing keys as parameters
         to aBlock as they're encountered"

        <category: 'dictionary removing'>
        keys do: [:key | self removeKey: key ifAbsent: [aBlock value: key]]
    ]

    remove: anAssociation [
        "Remove anAssociation's key from the dictionary"

        <category: 'dictionary removing'>
	^Processor activeProcess environment removeKey: anAssociation key
	    ifAbsent: []
    ]

    remove: anAssociation ifAbsent: aBlock [
        "Remove anAssociation's key from the dictionary"

        <category: 'dictionary removing'>
	^Processor activeProcess environment removeKey: anAssociation key
	    ifAbsent: aBlock
    ]

    removeKey: aSymbol [
        "Remove the aSymbol key from the dictionary"

        <category: 'dictionary removing'>
	^Processor activeProcess environment removeKey: aSymbol ifAbsent: []
    ]

    removeKey: aSymbol ifAbsent: aBlock [
        "Remove the aSymbol key from the dictionary"

        <category: 'dictionary removing'>
	^Processor activeProcess environment removeKey: aSymbol ifAbsent: aBlock
    ]
]