-
Notifications
You must be signed in to change notification settings - Fork 1
/
OSProcess.pck.st
14737 lines (11727 loc) · 527 KB
/
OSProcess.pck.st
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'From Cuis 5.0 of 7 November 2016 [latest update: #3345] on 1 August 2018 at 1:23:13 am'!
'Description OSProcess provides access to operating system functions, including pipes, child process creation, and control of the Squeak VM process.'!
!provides: 'OSProcess' 1 7!
!requires: 'Network-Kernel' 1 1 nil!
!requires: 'SqueakCompatibility' 1 4 nil!
SystemOrganization addCategory: #'OSProcess-Base'!
SystemOrganization addCategory: #'OSProcess-Mac'!
SystemOrganization addCategory: #'OSProcess-OS2'!
SystemOrganization addCategory: #'OSProcess-RiscOS'!
SystemOrganization addCategory: #'OSProcess-Unix'!
SystemOrganization addCategory: #'OSProcess-Win32'!
SystemOrganization addCategory: #'OSProcess-AIO'!
SystemOrganization addCategory: #'OSProcess-Tests'!
!classDefinition: #OSProcessAccessor category: #'OSProcess-Base'!
Model subclass: #OSProcessAccessor
instanceVariableNames: 'sessionIdentifier grimReaper canObtainSessionIdentifierFromPlugin'
classVariableNames: 'EmulateWin32FileLocking FileLockRegistry ThisOSProcessAccessor UseIOHandle'
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'OSProcessAccessor class' category: #'OSProcess-Base'!
OSProcessAccessor class
instanceVariableNames: ''!
!classDefinition: #MacOSProcessAccessor category: #'OSProcess-Mac'!
OSProcessAccessor subclass: #MacOSProcessAccessor
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Mac'!
!classDefinition: 'MacOSProcessAccessor class' category: #'OSProcess-Mac'!
MacOSProcessAccessor class
instanceVariableNames: ''!
!classDefinition: #OS2OSProcessAccessor category: #'OSProcess-OS2'!
OSProcessAccessor subclass: #OS2OSProcessAccessor
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-OS2'!
!classDefinition: 'OS2OSProcessAccessor class' category: #'OSProcess-OS2'!
OS2OSProcessAccessor class
instanceVariableNames: ''!
!classDefinition: #RiscOSProcessAccessor category: #'OSProcess-RiscOS'!
OSProcessAccessor subclass: #RiscOSProcessAccessor
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-RiscOS'!
!classDefinition: 'RiscOSProcessAccessor class' category: #'OSProcess-RiscOS'!
RiscOSProcessAccessor class
instanceVariableNames: ''!
!classDefinition: #UnixOSProcessAccessor category: #'OSProcess-Unix'!
OSProcessAccessor subclass: #UnixOSProcessAccessor
instanceVariableNames: 'sigChldSemaphore'
classVariableNames: 'ThisProcessPid'
poolDictionaries: ''
category: 'OSProcess-Unix'!
!classDefinition: 'UnixOSProcessAccessor class' category: #'OSProcess-Unix'!
UnixOSProcessAccessor class
instanceVariableNames: ''!
!classDefinition: #WindowsOSProcessAccessor category: #'OSProcess-Win32'!
OSProcessAccessor subclass: #WindowsOSProcessAccessor
instanceVariableNames: 'sigChldSemaphore semaIndex childWatcherThread'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Win32'!
!classDefinition: 'WindowsOSProcessAccessor class' category: #'OSProcess-Win32'!
WindowsOSProcessAccessor class
instanceVariableNames: ''!
!classDefinition: #AioEventHandler category: #'OSProcess-AIO'!
Model subclass: #AioEventHandler
instanceVariableNames: 'semaphore semaIndex handlerProc descriptor'
classVariableNames: 'AioPluginPresent'
poolDictionaries: ''
category: 'OSProcess-AIO'!
!classDefinition: 'AioEventHandler class' category: #'OSProcess-AIO'!
AioEventHandler class
instanceVariableNames: ''!
!classDefinition: #PseudoAioEventHandler category: #'OSProcess-AIO'!
Model subclass: #PseudoAioEventHandler
instanceVariableNames: 'eventGenerator'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-AIO'!
!classDefinition: 'PseudoAioEventHandler class' category: #'OSProcess-AIO'!
PseudoAioEventHandler class
instanceVariableNames: ''!
!classDefinition: #AttachableFileStream category: #'OSProcess-Base'!
StandardFileStream subclass: #AttachableFileStream
instanceVariableNames: 'autoClose'
classVariableNames: 'UseIOHandle'
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'AttachableFileStream class' category: #'OSProcess-Base'!
AttachableFileStream class
instanceVariableNames: ''!
!classDefinition: #AsyncFileReadStream category: #'OSProcess-Base'!
AttachableFileStream subclass: #AsyncFileReadStream
instanceVariableNames: 'eventHandler'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'AsyncFileReadStream class' category: #'OSProcess-Base'!
AsyncFileReadStream class
instanceVariableNames: ''!
!classDefinition: #BufferedAsyncFileReadStream category: #'OSProcess-Base'!
AsyncFileReadStream subclass: #BufferedAsyncFileReadStream
instanceVariableNames: 'nonBlockingMode readBuffer readSyncSemaphore dataAvailableSemaphore'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'BufferedAsyncFileReadStream class' category: #'OSProcess-Base'!
BufferedAsyncFileReadStream class
instanceVariableNames: ''!
!classDefinition: #ExternalPipe category: #'OSProcess-Base'!
Stream subclass: #ExternalPipe
instanceVariableNames: 'writer reader blocking'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'ExternalPipe class' category: #'OSProcess-Base'!
ExternalPipe class
instanceVariableNames: ''!
!classDefinition: #OSPipe category: #'OSProcess-Base'!
ExternalPipe subclass: #OSPipe
instanceVariableNames: 'nextChar'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'OSPipe class' category: #'OSProcess-Base'!
OSPipe class
instanceVariableNames: ''!
!classDefinition: #AbstractUnixProcessFileLockingTestCase category: #'OSProcess-Tests'!
TestCase subclass: #AbstractUnixProcessFileLockingTestCase
instanceVariableNames: 'accessor fileStream delay remoteProcess initialCompatibilitySetting'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Tests'!
!classDefinition: 'AbstractUnixProcessFileLockingTestCase class' category: #'OSProcess-Tests'!
AbstractUnixProcessFileLockingTestCase class
instanceVariableNames: ''!
!classDefinition: #UnixProcessUnixFileLockingTestCase category: #'OSProcess-Tests'!
AbstractUnixProcessFileLockingTestCase subclass: #UnixProcessUnixFileLockingTestCase
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Tests'!
!classDefinition: 'UnixProcessUnixFileLockingTestCase class' category: #'OSProcess-Tests'!
UnixProcessUnixFileLockingTestCase class
instanceVariableNames: ''!
!classDefinition: #UnixProcessWin32FileLockingTestCase category: #'OSProcess-Tests'!
AbstractUnixProcessFileLockingTestCase subclass: #UnixProcessWin32FileLockingTestCase
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Tests'!
!classDefinition: 'UnixProcessWin32FileLockingTestCase class' category: #'OSProcess-Tests'!
UnixProcessWin32FileLockingTestCase class
instanceVariableNames: ''!
!classDefinition: #AioEventHandlerTestCase category: #'OSProcess-Tests'!
TestCase subclass: #AioEventHandlerTestCase
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Tests'!
!classDefinition: 'AioEventHandlerTestCase class' category: #'OSProcess-Tests'!
AioEventHandlerTestCase class
instanceVariableNames: ''!
!classDefinition: #OSPipeTestCase category: #'OSProcess-Tests'!
TestCase subclass: #OSPipeTestCase
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Tests'!
!classDefinition: 'OSPipeTestCase class' category: #'OSProcess-Tests'!
OSPipeTestCase class
instanceVariableNames: ''!
!classDefinition: #UnixProcessAccessorTestCase category: #'OSProcess-Tests'!
TestCase subclass: #UnixProcessAccessorTestCase
instanceVariableNames: 'accessor'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Tests'!
!classDefinition: 'UnixProcessAccessorTestCase class' category: #'OSProcess-Tests'!
UnixProcessAccessorTestCase class
instanceVariableNames: ''!
!classDefinition: #UnixProcessFileLockTestCase category: #'OSProcess-Tests'!
TestCase subclass: #UnixProcessFileLockTestCase
instanceVariableNames: 'fileStream'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Tests'!
!classDefinition: 'UnixProcessFileLockTestCase class' category: #'OSProcess-Tests'!
UnixProcessFileLockTestCase class
instanceVariableNames: ''!
!classDefinition: #UnixProcessTestCase category: #'OSProcess-Tests'!
TestCase subclass: #UnixProcessTestCase
instanceVariableNames: 'thisOSProcess'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Tests'!
!classDefinition: 'UnixProcessTestCase class' category: #'OSProcess-Tests'!
UnixProcessTestCase class
instanceVariableNames: ''!
!classDefinition: #OSFileLock category: #'OSProcess-Base'!
Object subclass: #OSFileLock
instanceVariableNames: 'fileStream exclusive'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'OSFileLock class' category: #'OSProcess-Base'!
OSFileLock class
instanceVariableNames: ''!
!classDefinition: #OSFileRegionLock category: #'OSProcess-Base'!
OSFileLock subclass: #OSFileRegionLock
instanceVariableNames: 'interval'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'OSFileRegionLock class' category: #'OSProcess-Base'!
OSFileRegionLock class
instanceVariableNames: ''!
!classDefinition: #OSProcess category: #'OSProcess-Base'!
Object subclass: #OSProcess
instanceVariableNames: 'pid'
classVariableNames: 'UseIOHandle'
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'OSProcess class' category: #'OSProcess-Base'!
OSProcess class
instanceVariableNames: ''!
!classDefinition: #ExternalOSProcess category: #'OSProcess-Base'!
OSProcess subclass: #ExternalOSProcess
instanceVariableNames: 'runState initialStdIn initialStdOut initialStdErr'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'ExternalOSProcess class' category: #'OSProcess-Base'!
ExternalOSProcess class
instanceVariableNames: ''!
!classDefinition: #ExternalMacOSProcess category: #'OSProcess-Mac'!
ExternalOSProcess subclass: #ExternalMacOSProcess
instanceVariableNames: 'ppid exitStatus'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Mac'!
!classDefinition: 'ExternalMacOSProcess class' category: #'OSProcess-Mac'!
ExternalMacOSProcess class
instanceVariableNames: ''!
!classDefinition: #ExternalOS2Process category: #'OSProcess-OS2'!
ExternalOSProcess subclass: #ExternalOS2Process
instanceVariableNames: 'ppid exitStatus'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-OS2'!
!classDefinition: 'ExternalOS2Process class' category: #'OSProcess-OS2'!
ExternalOS2Process class
instanceVariableNames: ''!
!classDefinition: #ExternalRiscOSProcess category: #'OSProcess-RiscOS'!
ExternalOSProcess subclass: #ExternalRiscOSProcess
instanceVariableNames: 'ppid exitStatus'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-RiscOS'!
!classDefinition: 'ExternalRiscOSProcess class' category: #'OSProcess-RiscOS'!
ExternalRiscOSProcess class
instanceVariableNames: ''!
!classDefinition: #ExternalUnixOSProcess category: #'OSProcess-Unix'!
ExternalOSProcess subclass: #ExternalUnixOSProcess
instanceVariableNames: 'ppid pwd exitStatus programName arguments initialEnvironment'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Unix'!
!classDefinition: 'ExternalUnixOSProcess class' category: #'OSProcess-Unix'!
ExternalUnixOSProcess class
instanceVariableNames: ''!
!classDefinition: #ExternalWindowsOSProcess category: #'OSProcess-Win32'!
ExternalOSProcess subclass: #ExternalWindowsOSProcess
instanceVariableNames: 'ppid exitStatus handle threads commandLine pwd'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Win32'!
!classDefinition: 'ExternalWindowsOSProcess class' category: #'OSProcess-Win32'!
ExternalWindowsOSProcess class
instanceVariableNames: ''!
!classDefinition: #ThisOSProcess category: #'OSProcess-Base'!
OSProcess subclass: #ThisOSProcess
instanceVariableNames: 'sessionID stdIn stdOut stdErr processAccessor childProcessList accessProtect'
classVariableNames: 'ChildListSize ThisInstance'
poolDictionaries: ''
category: 'OSProcess-Base'!
!classDefinition: 'ThisOSProcess class' category: #'OSProcess-Base'!
ThisOSProcess class
instanceVariableNames: ''!
!classDefinition: #MacProcess category: #'OSProcess-Mac'!
ThisOSProcess subclass: #MacProcess
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Mac'!
!classDefinition: 'MacProcess class' category: #'OSProcess-Mac'!
MacProcess class
instanceVariableNames: ''!
!classDefinition: #OS2Process category: #'OSProcess-OS2'!
ThisOSProcess subclass: #OS2Process
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-OS2'!
!classDefinition: 'OS2Process class' category: #'OSProcess-OS2'!
OS2Process class
instanceVariableNames: ''!
!classDefinition: #RiscOSProcess category: #'OSProcess-RiscOS'!
ThisOSProcess subclass: #RiscOSProcess
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-RiscOS'!
!classDefinition: 'RiscOSProcess class' category: #'OSProcess-RiscOS'!
RiscOSProcess class
instanceVariableNames: ''!
!classDefinition: #UnixProcess category: #'OSProcess-Unix'!
ThisOSProcess subclass: #UnixProcess
instanceVariableNames: 'ppid pthread path programName arguments environment'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Unix'!
!classDefinition: 'UnixProcess class' category: #'OSProcess-Unix'!
UnixProcess class
instanceVariableNames: ''!
!classDefinition: #WindowsProcess category: #'OSProcess-Win32'!
ThisOSProcess subclass: #WindowsProcess
instanceVariableNames: 'processHandle environment mainThread threads'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Win32'!
!classDefinition: 'WindowsProcess class' category: #'OSProcess-Win32'!
WindowsProcess class
instanceVariableNames: ''!
!classDefinition: #UnixProcessExitStatus category: #'OSProcess-Unix'!
Object subclass: #UnixProcessExitStatus
instanceVariableNames: 'intValue'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Unix'!
!classDefinition: 'UnixProcessExitStatus class' category: #'OSProcess-Unix'!
UnixProcessExitStatus class
instanceVariableNames: ''!
!classDefinition: #WindowsThread category: #'OSProcess-Win32'!
Object subclass: #WindowsThread
instanceVariableNames: 'threadID handle runState'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-Win32'!
!classDefinition: 'WindowsThread class' category: #'OSProcess-Win32'!
WindowsThread class
instanceVariableNames: ''!
!classDefinition: #AioEventHandlerExample category: #'OSProcess-AIO'!
Object subclass: #AioEventHandlerExample
instanceVariableNames: 'handler ioStream'
classVariableNames: ''
poolDictionaries: ''
category: 'OSProcess-AIO'!
!classDefinition: 'AioEventHandlerExample class' category: #'OSProcess-AIO'!
AioEventHandlerExample class
instanceVariableNames: ''!
!OSProcessAccessor commentStamp: 'dtl 7/7/2010 07:58' prior: 0!
I am an abstract class whose subclasses provide access to an operating system process, such as the process in which the Squeak VM is currently running. My subclasses collaborate with instances of OSProcess subclasses.
The single instance ThisOSProcessAccessor provides access to the OS process in which the virtual machine is running. On Unix, this instance sets a signal handler to respond to externally generated sigchld signals. This must be done after each image restart in order to call a primitive which informs the VM of the identity of the semaphore to signal. A similar mechanism is used for Windows to obtain exit status of external OS processes. ThisOSProcessor maintains a process that waits on child exit events and updates a dependent OSProcess of changes to external OS processes.
When an image is restarted on a different kind of platform, a new instance is assigned to ThisOSProcessAccessor to provide access to the virtual machine OS process.
!
!MacOSProcessAccessor commentStamp: '<historical>' prior: 0!
I provide access to an operating system process, such as the process in which the Squeak VM is currently running. I am based on the Macintosh process model.!
!OS2OSProcessAccessor commentStamp: '<historical>' prior: 0!
I provide access to an operating system process, such as the process in which the Squeak VM is currently running. I am based on the OS2 process model.!
!RiscOSProcessAccessor commentStamp: '<historical>' prior: 0!
I provide access to the operating system process in which the Squeak VM is currently running. I am based on the RiscOS task model. There is only one instance of me, and instances of RiscOSProcess depend on me to provide access to the operating system process which they represent. I know how to create child processes. I use a semaphore to receive signals when child processes die, and I notify my dependents (instances ofRiscOSProcess) when these events occur.
!
!UnixOSProcessAccessor commentStamp: '<historical>' prior: 0!
I provide access to the operating system process in which the Squeak VM is currently running. I am based on the Unix process model. There is only one instance of me, and instances of UnixOSProcess depend on me to provide access to the operating system process which they represent.
I know how to create child processes. I use a semaphore to receive signals when child processes die, and I notify my dependents (instances of UnixOSProcess) when these events occur.
!
!WindowsOSProcessAccessor commentStamp: '<historical>' prior: 0!
I provide access to an operating system process, such as the process in which the Squeak VM is currently running. I am based on the Win32 process model for Windows and Windows NT.!
!AioEventHandler commentStamp: 'dtl 11/25/2006 15:55' prior: 0!
AioEventHandler responds to external IO events, such as data available on a file descriptor. When an external IO event is received, an instance of AioEventHandler sends #changed to itself to notify its dependents that the event has occurred.!
!PseudoAioEventHandler commentStamp: 'dtl 11/25/2006 10:42' prior: 0!
PseudoAioEventHandler is a replacement for AioEventHandler for use when an AioPlugin is not present. It creates a polling loop by generating #changed: events periodically. With a real AioEventHandler, events are generated only when actual IO activity occurs, while the PseudoAioEventHandler produces regularly timed events regardless of whether any actual IO changes have happened.!
!AttachableFileStream commentStamp: '<historical>' prior: 0!
I am a stream on an input or output channel provided by the underlying operating system. I behave like an ordinary file stream, except that I can attach myself to an input or output stream which has already been opened by the underlying operating system.!
!AsyncFileReadStream commentStamp: 'dtl 7/9/2003 21:04' prior: 0!
AsyncFileReadStream implements event-driven read behavior on a file stream. Whenever data is available, a #changed event is generated. An AsyncFileReadStream expects to have a client object respond immediately to the change notification by reading the available data, otherwise a possibly endless stream of change notifications will be generated.
AsyncFileReadStream requires aio support in the AioPlugin module.!
!BufferedAsyncFileReadStream commentStamp: 'dtl 3/7/2006 06:55' prior: 0!
BufferedAsyncFileReadStream adds output buffering behavior to an event driven file stream, permitting blocking reads without risk of blocking the Squeak VM. This is useful for OS pipes, for which Squeak may wish to read and write the pipe without concern for VM deadlocks.
A BufferedAsyncFileReadStream may be set for either blocking or nonblocking reads. When in blocking mode, a Smalltalk Process that requests a read will be blocked until data is available, but the VM will not be blocked and other Smalltalk Processes can proceed normally.
Whenever data becomes available, a dataAvailableSemaphore is signalled and a #changed event is generated.!
!ExternalPipe commentStamp: 'dtl 3/10/2006 11:06' prior: 0!
I represent a pipe provided by the underlying operating system, such as a Unix pipe. I have a reader stream and a writer stream which behave similarly to a read-only FileStream and a writeable FileStream.
Subclasses implement buffering behavior for the reader end of a pipe.!
!OSPipe commentStamp: 'dtl 3/8/2006 07:27' prior: 0!
I represent a pipe provided by the underlying operating system, such as a Unix pipe. I have a reader stream and a writer stream which behave similarly to a read-only FileStream and a writeable FileStream.
I use a single-character buffer to implement #peek without losing data from the external OS pipe.!
!AbstractUnixProcessFileLockingTestCase commentStamp: 'dtl 4/30/2006 14:02' prior: 0!
Test file locking with the UnixOSProcessPlugin. The test suite requires that OSProcess and CommandShell be loaded in the image.
These tests rely on a remote Squeak image to test file locks between cooperating Unix processes. This may be timing dependent (see #delay, set in #setUp, and cleanup in #tearDown). In case of intermittent failures, try running the failed test individually. In some cases it may be necessary to restart Squeak in order to clear leftover file locks from previous failed tests.!
!UnixProcessUnixFileLockingTestCase commentStamp: 'dtl 4/30/2006 14:03' prior: 0!
Test file locking with the UnixOSProcessPlugin using Unix file locking semantics. The test suite requires that OSProcess and CommandShell be loaded in the image.
These tests rely on a remote Squeak image to test file locks between cooperating Unix processes. This may be timing dependent (see #delay, set in #setUp, and cleanup in #tearDown). In case of intermittent failures, try running the failed test individually. In some cases it may be necessary to restart Squeak in order to clear leftover file locks from previous failed tests.!
!UnixProcessWin32FileLockingTestCase commentStamp: 'dtl 4/30/2006 14:03' prior: 0!
Test file locking with the UnixOSProcessPlugin using Windows file locking semantics. The test suite requires that OSProcess and CommandShell be loaded in the image.
These tests rely on a remote Squeak image to test file locks between cooperating Unix processes. This may be timing dependent (see #delay, set in #setUp, and cleanup in #tearDown). In case of intermittent failures, try running the failed test individually. In some cases it may be necessary to restart Squeak in order to clear leftover file locks from previous failed tests.!
!AioEventHandlerTestCase commentStamp: 'dtl 7/10/2005 15:41' prior: 0!
Test AioEventHandler and AioPlugin. Provides fair coverage of IO readable events, minimal coverage of IO writable events, and no real coverage for IO exception events. The writable events and exception events probably work, but this test suite will not prove it.!
!OSPipeTestCase commentStamp: '<historical>' prior: 0!
Test operation of OSPipe in blocking and nonBlocking mode.!
!UnixProcessAccessorTestCase commentStamp: '<historical>' prior: 0!
Unit tests for the UnixProcessAccessor.!
!UnixProcessFileLockTestCase commentStamp: 'dtl 3/7/2005 21:57' prior: 0!
This test case was provided by Julian Fitzell. It provides more file locking tests in addition to those in UnitProcessFileLockingTestCase.!
!UnixProcessTestCase commentStamp: '<historical>' prior: 0!
Unit tests for the Unix portion of OSProcess.!
!OSFileLock commentStamp: 'dtl 2/23/2004 19:36' prior: 0!
I describe the region representing the entire addressable space of an external file, including regions that have not yet been allocated for use by the file. On platforms that support file locking, an OSFileLock is used to describe a lock on the entire file.
!
!OSFileRegionLock commentStamp: 'jf 2/22/2004 19:50' prior: 0!
I describe an addressable region of contiguous bytes in an external file. On platforms that support file locking, an OSFileRegionLock is used to specify a portion of the file to be locked.
!
!OSProcess commentStamp: '<historical>' prior: 0!
I represent an operating system process, such as the process in which the Squeak VM is currently running. My subclasses implement system specific features for Unix, Windows, MacOS, or other operating systems.
!
!ExternalOSProcess commentStamp: '<historical>' prior: 0!
I represent an OSProcess other than the process in which this Squeak is executing. I maintain information about the state of the external process during and after the lifetime of the process.!
!ExternalMacOSProcess commentStamp: '<historical>' prior: 0!
I represent an external MacOS process other than the process in which this Squeak is executing. I maintain information about the state of the external process during and after the lifetime of the process. In particular, I hold the exit status of the process after it completes execution. When the external process changes state (e.g. it exits), the VM signals a Squeak semaphore. A singleton MacOSProcessAccessor maintains a process which waits on the semaphore, and sends a changed: #childProcessStatus message to itself, thereby notifying its dependent MacOSProcess (a singleton) to check the status of all its ExternalMacOSProcess children, and #update: them accordingly.!
!ExternalOS2Process commentStamp: '<historical>' prior: 0!
I represent an external OS2 process other than the process in which this Squeak is executing. I maintain information about the state of the external process during and after the lifetime of the process. In particular, I hold the exit status of the process after it completes execution. When the external process changes state (e.g. it exits), the VM signals a Squeak semaphore. A singleton OS2ProcessAccessor maintains a process which waits on the semaphore, and sends a changed: #childProcessStatus message to itself, thereby notifying its dependent OS2Process (a singleton) to check the status of all its ExternalOS2Process children, and #update: them accordingly.!
!ExternalRiscOSProcess commentStamp: '<historical>' prior: 0!
I represent an external RiscOS task other than the process in which this Squeak is executing. I maintain information about the state of the external task during and after the lifetime of the task. In particular, I hold the exit status of the task after it completes execution. When the external task changes state (e.g. it exits), the VM signals a Squeak semaphore. A singleton RiscOSProcessAccessor maintains a process which waits on the semaphore, and sends a changed: #childProcessStatus message to itself, thereby notifying its dependent RiscOSProcess (a singleton) to check the status of all its ExternalRiscOSProcess children, and #update: them accordingly.
!
!ExternalUnixOSProcess commentStamp: '<historical>' prior: 0!
I represent an external Unix process other than the process in which this Squeak is executing. I maintain information about the state of the external process during and after the lifetime of the process. In particular, I hold the exit status of the process after it completes execution. When the external process changes state (e.g. it exits), the VM signals a Squeak semaphore. A singleton UnixProcessAccessor maintains a process which waits on the semaphore, and sends a changed: #childProcessStatus message to itself, thereby notifying its dependent UnixProcess (a singleton) to check the status of all its ExternalUnixProcess children, and #update: them accordingly.!
!ExternalWindowsOSProcess commentStamp: '<historical>' prior: 0!
I represent an external Windows process other than the process in which this Squeak is executing. I maintain information about the state of the external process during and after the lifetime of the process. In particular, I hold the exit status of the process after it completes execution. When the external process changes state (e.g. it exits), the VM signals a Squeak semaphore. A singleton WindowsOSProcessAccessor maintains a process which waits on the semaphore, and sends a changed: #childProcessStatus message to itself, thereby notifying its dependent WindowsOSProcess (a singleton) to check the status of all its ExternalWindowsOSProcess children, and #update: them accordingly.!
!ThisOSProcess commentStamp: '<historical>' prior: 0!
I represent the operating system process in which the Squeak VM is currently running. My subclasses implement system specific features for Unix, Windows, MacOS, or other operating systems by collaborating with corresponding subclasses of OSProcessAccessor to provide primitive access to the external operating system.
!
!MacProcess commentStamp: '<historical>' prior: 0!
I represent a Macintosh operating system process, such as the process in which the Squeak VM is currently running. I collaborate with an instance of MacOSProcessAccessor to provide primitive access to the external operating system. My instance variables are maintained as a convenience to allow inspection of an OSProcess. Access to these variables should always be done with my accessor methods, which update the instance variables by querying my MacOSProcessAccessor.!
!OS2Process commentStamp: '<historical>' prior: 0!
I represent an OS2 operating system process, such as the process in which the Squeak VM is currently running. I collaborate with an instance of OS2OSProcessAccessor to provide primitive access to the external operating system. My instance variables are maintained as a convenience to allow inspection of an OSProcess. Access to these variables should always be done with my accessor methods, which update the instance variables by querying my OS2OSProcessAccessor.!
!RiscOSProcess commentStamp: '<historical>' prior: 0!
I represent an Acorn RiscOS operating system task, such as the task in which the Squeak VM is currently running. I collaborate with a singleton instance of RiscOSProcessAccessor to provide primitive access to the external operating system. My instance variables are maintained as a convenience to allow inspection of a RiscOSProcess. Access to these variables should always be done with my accessor methods, which update the instance variables by querying my RiscOSProcessAccessor.
!
!UnixProcess commentStamp: '<historical>' prior: 0!
I represent the Unix operating system process in which this Squeak session is running. I collaborate with an instance of UnixOSProcessAccessor to provide access to the external operating system. My instance variables are updated when my process accessor changes, allowing them to be monitored with a Smalltalk inspector.
!
!WindowsProcess commentStamp: 'dtl 9/25/2005 16:31' prior: 0!
I represent a Windows operating system process, such as the process in which the Squeak VM is currently running. I collaborate with an instance of WindowsOSProcessAccessor to provide primitive access to the external operating system. My instance variables are maintained as a convenience to allow inspection of an OSProcess. Access to these variables should always be done with my accessor methods, which update the instance variables by querying my WindowsOSProcessAccessor.
My process ID and process handle (a Win32 HANDLE) are held by my pid and processHandle variables. The main thread for this process is held by my mainThread variable.
Standard input, output, and error streams are available, and my be used when the console is open (WindowsProcess>>openConsole). They can also be reassigned to file streams (WindowsOSProcessAccessor>>setStdOut:).
When external processes are created, they are added to my allMyChildren collection, and a thread is created to wait for any of them to exit. This thread is held by my childWatcherThread instance variable while the thread is active, and is also added to my threads collection.
Whenever a child process exits, the childWatcherThread will signal a Semaphore (a Smalltalk Semaphore, not a Windows semaphore), then exit. A Squeak process in my processAccessor waits on this Semaphore, and sends an 'update: #childProcessStatus' message to me. In response to this, I update the status of my active child processes, one or more of which will have exited. If any of my child processes are still active, I set a new childWatcherThread to wait for them to exit.
Note that some Windows applications will exit their main process after creating another application process. These applications will appear to Squeak as if they have exited immediately, even though the application is running.!
!UnixProcessExitStatus commentStamp: 'dtl 8/23/2012 22:48' prior: 0!
A UnixProcessExitStatus represents the exit status of a unix process. This is an integer bit field answered by the wait() system call that contains information about exit status of the process. The meaning of the bit field varies according to the cause of process exit.
Following a normal process exit, the status may be decoded to provide a small positive integer value in the range 0 - 255, which is the value that is presented by a unix shell as the exit status of a program. If terminated by a signal, the corresponding value is the signal number of the signal that caused process exit.
UnixExitStatus decodes the process exit status in a manner compatible with a typical GNU unix implementation. It is not guaranteed to be portable and may produce misleading results on other unix systems.
!
!WindowsThread commentStamp: '<historical>' prior: 0!
I represent a thread of execution within a Windows process. May threadID is a unique
identifier for the thread, and my handle is a Windows HANDLE to the thread. My handle
should be closed when the thread exits.!
!AioEventHandlerExample commentStamp: 'dtl 7/5/2003 18:38' prior: 0!
Demonstrate asynchronous read handers for file streams, OS pipes, standard input, and sockets. See class category "examples". Some examples require OSProcess.!
!OSProcessAccessor methodsFor: 'plugin identification' stamp: 'dtl 10/1/2005 10:41'!
aioModuleName
"Answer a string containing the module name string for the AIO plugin."
"OSProcess accessor aioModuleName"
^ self subclassResponsibility! !
!OSProcessAccessor methodsFor: 'plugin identification' stamp: 'dtl 10/1/2005 10:41'!
aioVersionString
"Answer a string containing the version string for the AIO plugin."
"OSProcess accessor aioVersionString"
^ self subclassResponsibility! !
!OSProcessAccessor methodsFor: 'plugin identification' stamp: 'dtl 10/1/2005 10:41'!
osppModuleName
"Answer a string containing the module name string for the OSPP plugin."
"OSProcess accessor osppModuleName"
^ self subclassResponsibility! !
!OSProcessAccessor methodsFor: 'plugin identification' stamp: 'dtl 10/1/2005 10:41'!
osppModuleVersionString
"Answer a string containing the version string for the OSPP plugin."
"OSProcess accessor osppModuleVersionString"
^ self subclassResponsibility! !
!OSProcessAccessor methodsFor: 'plugin identification' stamp: 'dtl 10/1/2005 10:41'!
xdcpModuleName
"Answer a string containing the module name string for the display control plugin."
"OSProcess accessor xdcpModuleName"
^ self subclassResponsibility! !
!OSProcessAccessor methodsFor: 'plugin identification' stamp: 'dtl 10/1/2005 10:42'!
xdcpVersionString
"Answer a string containing the version string for the display control plugin."
"OSProcess accessor xdcpVersionString"
^ self subclassResponsibility! !
!OSProcessAccessor methodsFor: 'testing' stamp: 'dtl 10/18/2001 22:58'!
canAccessSystem
"Answer true if it is possible to access the external process. Concrete subclasses should
know how to answer true."
^ false
! !
!OSProcessAccessor methodsFor: 'testing' stamp: 'dtl 2/14/2004 11:43'!
canForwardExternalSignals
"Answer true if it is possible to forward OS signals to a Smalltalk Semaphore."
^ false
! !
!OSProcessAccessor methodsFor: 'testing' stamp: 'dtl 8/8/2002 15:13'!
handlesOsSignals
"True if OS signals can be handled and forwarded to the image"
^ false! !
!OSProcessAccessor methodsFor: 'file lock registry' stamp: 'dtl 4/9/2005 22:44'!
canAcquireLock: anOSFileLockDescriptor
"Answer true if the file lock cache will permit fileLock to be acquired. This method
does not guarantee that the underlying OS will grant the lock."
^ (self fileLockRegistry anySatisfy:
[:ld | ld isActive and: [ld conflictsWith: anOSFileLockDescriptor]]) not! !
!OSProcessAccessor methodsFor: 'file lock registry' stamp: 'dtl 3/5/2005 13:21'!
emulateWin32FileLocking
"Answer the current value of this preference"
^ EmulateWin32FileLocking! !
!OSProcessAccessor methodsFor: 'file lock registry' stamp: 'dtl 9/24/2009 21:36'!
fileLockRegistry
^ FileLockRegistry ifNil: [FileLockRegistry := Set new]
! !
!OSProcessAccessor methodsFor: 'file lock registry' stamp: 'dtl 3/5/2005 13:06'!
register: fileRegionLock
"If an object equal to fileRegionLock exists in the registry, answer it. Otherwise, add
fileRegionLock to the registry and answer fileRegionLock."
^ (self fileLockRegistry like: fileRegionLock)
ifNil: [self fileLockRegistry add: fileRegionLock]
! !
!OSProcessAccessor methodsFor: 'file lock registry' stamp: 'dtl 4/10/2005 15:05'!
registeredLocksForFile: aFileStream
"Answer all lock descriptors associated with aFileStream"
^ self fileLockRegistry select: [:ea | ea fileStream = aFileStream]
! !
!OSProcessAccessor methodsFor: 'file lock registry' stamp: 'dtl 1/20/2018 19:20:59'!
removeInactiveLocks
"Go through the lock cache and remove any that have been left
behind after their streams were closed."
^ self fileLockRegistry copy do: [:ea | ea isActive ifFalse: [self fileLockRegistry remove: ea]]! !
!OSProcessAccessor methodsFor: 'file lock registry' stamp: 'dtl 3/5/2005 13:07'!
unregister: fileRegionLock
"If an object equal to fileRegionLock exists in the registry, remove it and
answer the object. Otherwise answer nil."
^ self fileLockRegistry remove: fileRegionLock ifAbsent: [nil]
! !
!OSProcessAccessor methodsFor: 'accessing' stamp: 'dtl 4/7/2007 10:19'!
canObtainSessionIdentifierFromPlugin
^ canObtainSessionIdentifierFromPlugin
ifNil: [canObtainSessionIdentifierFromPlugin := self primGetSession notNil]! !
!OSProcessAccessor methodsFor: 'accessing' stamp: 'dtl 2/27/2015 19:54'!
grimReaper
"Answer the value of grimReaper"
^ grimReaper! !
!OSProcessAccessor methodsFor: 'accessing' stamp: 'dtl 2/27/2015 19:54'!
grimReaper: anObject
"Set the value of grimReaper"
grimReaper := anObject! !
!OSProcessAccessor methodsFor: 'accessing' stamp: 'dtl 3/2/2002 08:32'!
sessionIdentifier
^ sessionIdentifier ifNil: [sessionIdentifier := self getSessionIdentifier]
! !
!OSProcessAccessor methodsFor: 'session identification' stamp: 'dtl 1/15/2018 10:12:22'!
getSessionIdentifier
"Call a primitive to obtain the unique identifier for this Squeak session. If the
primitive fails, try to deduce the session identifier from an instance of
StandardFileStream. Some versions of the OSProcessPlugin may not be able to
obtain a session ID, so this provides a mechanism for obtaining the session ID
indirectly if necessary."
"OSProcess accessor getSessionIdentifier"
| session |
session := self primGetSession.
session ifNil: [session := self getSessionIdentifierFromSourcesFile].
^ session
! !
!OSProcessAccessor methodsFor: 'session identification' stamp: 'dtl 1/20/2018 19:21:57'!
getSessionIdentifierFromSourcesFile
"Deduce the session identifier from an existing open FileStream on the sources file.
This is an unreliable method, because it assumes knowledge of the internal structure
of the SQFile data structure.
Deprecated:
As of approximately Squeak 3.8 and beyond, the session id has been moved to the
first slot of the data structure. This method will not work for a Squeak VM beyond
that point, and will not work for any 64 bit VM. However, an reliable means of
obtaining sessionID is now available (#getSessionIdentifier), so this method is retained
only for backwards compatibility to allow OSPP to be built on an older VMMaker."
"OSProcess accessor getSessionIdentifierFromSourcesFile"
| s id |
s := SourceFiles first.
s ifNil: [^ nil].
^ (Smalltalk hasClassNamed: #IOHandle)
ifTrue: [(s ioHandle perform: #getHandle) copyFrom: 5 to: 8]
ifFalse: [(id := s fileID) ifNotNil: [id copyFrom: 5 to: 8]]
! !
!OSProcessAccessor methodsFor: 'session identification' stamp: 'dtl 3/2/2002 09:07'!
primGetSession
"Subclasses should override if they know how to obtain the session identifier."
^ nil! !
!OSProcessAccessor methodsFor: 'standard IO handles' stamp: 'dtl 9/25/2005 16:07'!
getStdErrHandle
"Answer the handle (a SQFile data structure in interp.c) for the standard error for the
OS process in which I am currently executing."
^ self subclassResponsibility
! !
!OSProcessAccessor methodsFor: 'standard IO handles' stamp: 'dtl 9/25/2005 16:07'!
getStdInHandle
"Answer the handle (a SQFile data structure in interp.c) for the standard input for the
OS process in which I am currently executing."
^ self subclassResponsibility
! !
!OSProcessAccessor methodsFor: 'standard IO handles' stamp: 'dtl 9/25/2005 16:06'!
getStdOutHandle
"Answer the handle (a SQFile data structure in interp.c) for the standard output for the
OS process in which I am currently executing."
^ self subclassResponsibility
! !
!OSProcessAccessor methodsFor: 'private - IOHandle' stamp: 'dtl 1/20/2018 19:22:28'!
handleFromAccessor: aByteArrayOrIOAccessor
UseIOHandle
ifTrue: [aByteArrayOrIOAccessor isNil
ifTrue: [^ nil]
ifFalse: [^ aByteArrayOrIOAccessor perform: #asSQFileStruct]]
ifFalse: [^ aByteArrayOrIOAccessor]! !
!OSProcessAccessor methodsFor: 'private - IOHandle' stamp: 'dtl 1/3/2004 21:21'!
handleFromFileStream: aFileStream
^ UseIOHandle
ifTrue: [self handleFromAccessor: aFileStream ioHandle]
ifFalse: [aFileStream fileID]
! !
!OSProcessAccessor methodsFor: 'private - IOHandle' stamp: 'dtl 1/20/2018 19:18:06'!
ioAccessorFromSQFile: aByteArray
"Answer an object which represents an IO channel. If IOHandle is present in
this image, use it; otherwise just answer aByteArray."
UseIOHandle
ifTrue: [^ (Smalltalk at: #IOHandle) perform: #newFromSqFileStruct: with: aByteArray]
ifFalse: [^ aByteArray]! !
!OSProcessAccessor methodsFor: 'initialize - release' stamp: 'dtl 2/27/2015 19:51'!
initialize
canObtainSessionIdentifierFromPlugin := nil.
self canObtainSessionIdentifierFromPlugin.
sessionIdentifier := nil.
self sessionIdentifier.
! !
!OSProcessAccessor methodsFor: 'initialize - release' stamp: 'ThierryGoubier 7/27/2017 22:37'!
newPid
"This image is now being run in a new VM process with different pid. Pause the handling
of child processes, and remove references to child processes that no longer pertain to
the current VM process."
grimReaper notNil
ifTrue: [ grimReaper terminate.
grimReaper := nil ].
self changed: #pid.
self restartChildWatcherProcess! !
!OSProcessAccessor methodsFor: 'initialize - release' stamp: 'dtl 2/28/2015 18:31'!
restartChildWatcherProcess
self subclassResponsibility! !
!OSProcessAccessor methodsFor: 'file testing' stamp: 'dtl 11/28/2010 14:04'!
isAtEndOfFile: anIOHandle
"Answer whether the file represented by anIOHandle is at end of file, as determined
by a call to feof(). This is different from StandardFileStream>>primAtEnd: which answers
true if the file pointer is at the end of the file, but which does not call feof() to
determine that an end of file condition has occurred. The difference is significant
if aSqFileStruct represents a pipe or a device file, which may not be positionable
in the sense of a conventional disk file."
^ self primTestEndOfFileFlag: (self handleFromAccessor: anIOHandle)
! !
!OSProcessAccessor methodsFor: 'file testing' stamp: 'dtl 4/8/2007 10:49'!
primTestEndOfFileFlag: aSqFileStruct
"Answer whether the file represented by aSqFileStruct is at end of file, as determined
by a call to feof(). This is different from StandardFileStream>>primAtEnd: which answers
true if the file pointer is at the end of the file, but which does not call feof() to
determine that an end of file condition has occurred. The difference is significant
if aSqFileStruct represents a pipe or a device file, which may not be positionable
in the sense of a conventional disk file."
^ self subclassResponsibility
! !
!OSProcessAccessor methodsFor: 'platform identification' stamp: 'dtl 8/24/2003 09:18'!
isResponsibleForThisPlatform
"Answer true is this is an instance of the class which is responsible for representing
the OS process for the Squeak VM running on the current platform. A false answer is
usually the result of running the image on a different platform and VM."
^ self class isResponsibleForThisPlatform! !
!OSProcessAccessor methodsFor: 'pipe open' stamp: 'ThierryGoubier 7/19/2017 22:00'!
makePipeHandles
"Create a pipe, and answer an array of two IO accessors for the pipe
reader and writer."
"OSProcess accessor makePipeHandles"
| p |
p := self primCreatePipe.
p isNil
ifFalse: [ ^ p collect: [ :e | self ioAccessorFromSQFile: e ] ].
^ nil! !
!OSProcessAccessor methodsFor: 'file control' stamp: 'dtl 2/11/2001 15:37'!
setNonBlocking: anIOHandle
"Convert anIOHandle to an SQFile data structure and call primitive to set it non-blocking."
^ self subclassResponsibility
! !
!OSProcessAccessor class methodsFor: 'concrete subclasses' stamp: 'dtl 3/5/2005 12:04'!
concreteClass
"OSProcessAccessor concreteClass"
^ self subclasses
detect: [:c | c isResponsibleForThisPlatform]
ifNone: [self notify: self printString,
': No concrete class implementation available for system type ',
OSProcess platformName printString.
nil]
! !
!OSProcessAccessor class methodsFor: 'initialize-release' stamp: 'dtl 3/5/2005 13:24'!
emulateWin32FileLocking: trueOrFalse
"This is a preference that controls whether file locking will attempt to emulation
Win32 behavior, in which a lock request will fail if the requested region overlaps
a region for which there is an existing lock. This behavior is valid only for locks
managed within a single Squeak image, and will not produce the expected results
for a Squeak image cooperating with another Squeak image, or with some other
external program.
Use of the Win32 emulation may result in performance penalties for an application
that performs a large number of lock requests, such as a database."
"self emulateWin32FileLocking: true"
"self emulateWin32FileLocking: false"
EmulateWin32FileLocking := trueOrFalse
! !
!OSProcessAccessor class methodsFor: 'initialize-release' stamp: 'dtl 12/14/2013 09:15'!
initialize
"OSProcessAccessor initialize"
UseIOHandle := (Smalltalk hasClassNamed: #IOHandle).
ThisOSProcessAccessor := nil.
self emulateWin32FileLocking: false.
self allSubInstances do: [:e | e finalize]
! !
!OSProcessAccessor class methodsFor: 'instance creation' stamp: 'dtl 12/14/2013 09:15'!
forThisOSProcess
"Answer a single instance corresponding to the OS process in which this
Smalltalk image is executing."
"OSProcessAccessor forThisOSProcess"
ThisOSProcessAccessor
ifNotNil: [ThisOSProcessAccessor isResponsibleForThisPlatform
ifTrue:
["Common case, platform has not changed"
^ThisOSProcessAccessor ]
ifFalse:
["We are running on a different platform, so start a new accessor"
ThisOSProcessAccessor changed: #invalidProcessAccessor.
ThisOSProcessAccessor finalize]].
^ ThisOSProcessAccessor := self concreteClass basicNew initialize
! !
!OSProcessAccessor class methodsFor: 'instance creation' stamp: 'dtl 3/2/2002 08:29'!
new
self inform: 'use OSProcessAccessor>>forThisOSProcess to create or obtain the OSProcess instance for this Smalltalk session.'.
^ nil! !
!OSProcessAccessor class methodsFor: 'platform identification' stamp: 'dtl 8/24/2003 09:17'!
isResponsibleForThisPlatform
"Answer true if an instance of this class is responsible for representing the
OS process for the Squeak VM running on the current platform."
^ self subclassResponsibility! !
!MacOSProcessAccessor methodsFor: 'external process access' stamp: 'dtl 2/23/2002 05:57'!
primGetSession
"Answer the unique identifier for this session of Smalltalk running in this OS Process."
^ nil
! !
!MacOSProcessAccessor class methodsFor: 'platform identification' stamp: 'dtl 8/30/2003 17:44'!
isResponsibleForThisPlatform
"Answer true if this class is responsible for representing the OS process for the
Squeak VM running on the current platform."
^ OSProcess isNonUnixMac
! !
!OS2OSProcessAccessor methodsFor: 'external process access' stamp: 'dtl 2/23/2002 05:56'!
primGetSession
"Answer the unique identifier for this session of Smalltalk running in this OS Process."
^ nil
! !
!OS2OSProcessAccessor class methodsFor: 'platform identification' stamp: 'dtl 8/30/2003 17:47'!
isResponsibleForThisPlatform
"Answer true if this class is responsible for representing the OS process for the
Squeak VM running on the current platform."
^ OSProcess isOS2
! !
!RiscOSProcessAccessor methodsFor: 'fork and exec' stamp: 'dtl 1/6/2001 23:15'!
primForkAndExec: executableFile
withArgs: anArrayOfArgumentStrings
argCount: numberOfArgumentStrings
withEnv: anArrayOfEnvironmentStrings