638 examples |
638 examples |
639 " |
639 " |
640 various queries |
640 various queries |
641 [exBegin] |
641 [exBegin] |
642 Transcript |
642 Transcript |
643 showCR:'hello ' , (OpenVMSOperatingSystem getLoginName) |
643 showCR:'hello ' , (OperatingSystem getLoginName) |
644 [exEnd] |
644 [exEnd] |
645 |
645 |
646 [exBegin] |
646 [exBegin] |
647 OpenVMSOperatingSystem isUNIXlike ifTrue:[ |
647 OperatingSystem isUNIXlike ifTrue:[ |
648 Transcript showCR:'this is some UNIX-like OS' |
648 Transcript showCR:'this is some UNIX-like OS' |
649 ] ifFalse:[ |
649 ] ifFalse:[ |
650 Transcript showCR:'this OS is not UNIX-like' |
650 Transcript showCR:'this OS is not UNIX-like' |
651 ] |
651 ] |
652 [exEnd] |
652 [exEnd] |
653 |
653 |
654 [exBegin] |
654 [exBegin] |
655 Transcript |
655 Transcript |
656 showCR:'this machine is called ' , OpenVMSOperatingSystem getHostName |
656 showCR:'this machine is called ' , OperatingSystem getHostName |
657 [exEnd] |
657 [exEnd] |
658 |
658 |
659 [exBegin] |
659 [exBegin] |
660 Transcript |
660 Transcript |
661 showCR:('this machine is in the ' |
661 showCR:('this machine is in the ' |
662 , OpenVMSOperatingSystem getDomainName |
662 , OperatingSystem getDomainName |
663 , ' domain') |
663 , ' domain') |
664 [exEnd] |
664 [exEnd] |
665 |
665 |
666 [exBegin] |
666 [exBegin] |
667 Transcript |
667 Transcript |
668 showCR:('this machine''s CPU is a ' |
668 showCR:('this machine''s CPU is a ' |
669 , OpenVMSOperatingSystem getCPUType |
669 , OperatingSystem getCPUType |
670 ) |
670 ) |
671 [exEnd] |
671 [exEnd] |
672 |
672 |
673 [exBegin] |
673 [exBegin] |
674 Transcript showCR:'executing ls command ...'. |
674 Transcript showCR:'executing ls command ...'. |
675 OpenVMSOperatingSystem executeCommand:'ls'. |
675 OperatingSystem executeCommand:'ls'. |
676 Transcript showCR:'... done.'. |
676 Transcript showCR:'... done.'. |
677 [exEnd] |
677 [exEnd] |
678 |
678 |
679 locking a file |
679 locking a file |
680 (should be executed on two running smalltalks - not in two threads): |
680 (should be executed on two running smalltalks - not in two threads): |
684 f := 'testFile' asFilename readWriteStream. |
684 f := 'testFile' asFilename readWriteStream. |
685 |
685 |
686 10 timesRepeat:[ |
686 10 timesRepeat:[ |
687 'about to lock ...' printCR. |
687 'about to lock ...' printCR. |
688 [ |
688 [ |
689 OpenVMSOperatingSystem |
689 OperatingSystem |
690 lockFD:(f fileDescriptor) |
690 lockFD:(f fileDescriptor) |
691 shared:false |
691 shared:false |
692 blocking:false |
692 blocking:false |
693 ] whileFalse:[ |
693 ] whileFalse:[ |
694 'process ' print. OpenVMSOperatingSystem getProcessId print. ' is waiting' printCR. |
694 'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR. |
695 Delay waitForSeconds:1 |
695 Delay waitForSeconds:1 |
696 ]. |
696 ]. |
697 'LOCKED ...' printCR. |
697 'LOCKED ...' printCR. |
698 Delay waitForSeconds:10. |
698 Delay waitForSeconds:10. |
699 'unlock ...' printCR. |
699 'unlock ...' printCR. |
700 (OpenVMSOperatingSystem |
700 (OperatingSystem |
701 unlockFD:(f fileDescriptor)) printCR. |
701 unlockFD:(f fileDescriptor)) printCR. |
702 Delay waitForSeconds:3. |
702 Delay waitForSeconds:3. |
703 ] |
703 ] |
704 [exBegin] |
704 [exBegin] |
705 " |
705 " |
2601 ! |
2601 ! |
2602 |
2602 |
2603 exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory |
2603 exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory |
2604 "Internal lowLevel entry for combined fork & exec for WIN32" |
2604 "Internal lowLevel entry for combined fork & exec for WIN32" |
2605 |
2605 |
2606 |path| |
|
2607 self isMSWINDOWSlike ifTrue:[ |
|
2608 aDirectory isNil ifTrue:[ |
|
2609 path := nil. |
|
2610 ] ifFalse:[ |
|
2611 path := aDirectory asFilename pathName asFilename osNameForDirectory. |
|
2612 (path endsWith:':') ifTrue:[ |
|
2613 path := path , '\'. |
|
2614 ]. |
|
2615 ]. |
|
2616 ^ self primExec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp inPath:path |
|
2617 ]. |
|
2618 ^ self primitiveFailed |
2606 ^ self primitiveFailed |
2619 |
2607 |
2620 "Modified: 31.1.1998 / 10:54:24 / md" |
2608 "Modified: 31.1.1998 / 10:54:24 / md" |
2621 ! |
2609 ! |
2622 |
2610 |
2714 ^ aBlock value:exitStatus |
2702 ^ aBlock value:exitStatus |
2715 ]. |
2703 ]. |
2716 ^ true. |
2704 ^ true. |
2717 |
2705 |
2718 " |
2706 " |
2719 OpenVMSOperatingSystem executeCommand:'sleep 30' onError:[]. |
2707 OperatingSystem executeCommand:'sleep 30' onError:[]. |
2720 OpenVMSOperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. |
2708 OperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. |
2721 OpenVMSOperatingSystem executeCommand:'ls -l' onError:[]. |
2709 OperatingSystem executeCommand:'ls -l' onError:[]. |
2722 OpenVMSOperatingSystem executeCommand:'invalidCommand' onError:[:status| status inspect]. |
2710 OperatingSystem executeCommand:'invalidCommand' onError:[:status| status inspect]. |
2723 OpenVMSOperatingSystem executeCommand:'rm /tmp/foofoofoofoo'onError:[:status | status inspect]. |
2711 OperatingSystem executeCommand:'rm /tmp/foofoofoofoo'onError:[:status | status inspect]. |
2724 " |
2712 " |
2725 |
2713 |
2726 "Created: 22.12.1995 / 14:49:59 / stefan" |
2714 "Created: 22.12.1995 / 14:49:59 / stefan" |
2727 "Modified: 25.3.1997 / 11:06:43 / stefan" |
2715 "Modified: 25.3.1997 / 11:06:43 / stefan" |
2728 "Modified: 19.4.1997 / 18:14:41 / cg" |
2716 "Modified: 19.4.1997 / 18:14:41 / cg" |
2760 ^ aBlock value:exitStatus |
2748 ^ aBlock value:exitStatus |
2761 ]. |
2749 ]. |
2762 ^ true. |
2750 ^ true. |
2763 |
2751 |
2764 " |
2752 " |
2765 OpenVMSOperatingSystem executeCommand:'sleep 30' onError:[]. |
2753 OperatingSystem executeCommand:'sleep 30' onError:[]. |
2766 OpenVMSOperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. |
2754 OperatingSystem executeCommand:'pwd' onError:[:status|status inspect]. |
2767 OpenVMSOperatingSystem executeCommand:'ls -l' onError:[]. |
2755 OperatingSystem executeCommand:'ls -l' onError:[]. |
2768 OpenVMSOperatingSystem executeCommand:'invalidCommand' onError:[:status| status inspect]. |
2756 OperatingSystem executeCommand:'invalidCommand' onError:[:status| status inspect]. |
2769 OpenVMSOperatingSystem executeCommand:'rm /tmp/foofoofoofoo'onError:[:status | status inspect]. |
2757 OperatingSystem executeCommand:'rm /tmp/foofoofoofoo'onError:[:status | status inspect]. |
2770 " |
2758 " |
2771 |
2759 |
2772 "Created: 28.1.1998 / 14:12:15 / md" |
2760 "Created: 28.1.1998 / 14:12:15 / md" |
2773 ! |
2761 ! |
2774 |
2762 |
2896 |
2884 |
2897 |in out err shellAndArgs| |
2885 |in out err shellAndArgs| |
2898 |
2886 |
2899 anExternalInStream notNil ifTrue:[ |
2887 anExternalInStream notNil ifTrue:[ |
2900 in := anExternalInStream fileDescriptor. |
2888 in := anExternalInStream fileDescriptor. |
2901 ] ifFalse:[ |
2889 "/ ] ifFalse:[ |
2902 self isUNIXlike ifTrue:[ |
2890 "/ self isUNIXlike ifTrue:[ |
2903 in := '/dev/null' asFilename readStream fileDescriptor |
2891 "/ in := '/dev/null' asFilename readStream fileDescriptor |
2904 ] |
2892 "/ ] |
2905 ]. |
2893 ]. |
2906 anExternalOutStream notNil ifTrue:[ |
2894 anExternalOutStream notNil ifTrue:[ |
2907 out := anExternalOutStream fileDescriptor. |
2895 out := anExternalOutStream fileDescriptor. |
2908 ]. |
2896 ]. |
2909 anExternalErrStream notNil ifTrue:[ |
2897 anExternalErrStream notNil ifTrue:[ |
2996 "/ ^ self executeCommand:('mkdir ', newPathName) |
2984 "/ ^ self executeCommand:('mkdir ', newPathName) |
2997 |
2985 |
2998 self primitiveFailed |
2986 self primitiveFailed |
2999 |
2987 |
3000 " |
2988 " |
3001 OpenVMSOperatingSystem createDirectory:'foo' |
2989 OperatingSystem createDirectory:'foo' |
3002 " |
2990 " |
3003 |
2991 |
3004 "Modified: 20.12.1995 / 11:24:13 / stefan" |
2992 "Modified: 20.12.1995 / 11:24:13 / stefan" |
3005 "Modified: 29.6.1996 / 14:06:54 / cg" |
2993 "Modified: 29.6.1996 / 14:06:54 / cg" |
3006 ! |
2994 ! |
3081 "/ or not supported by OS |
3069 "/ or not supported by OS |
3082 "/ |
3070 "/ |
3083 ^ self primitiveFailed |
3071 ^ self primitiveFailed |
3084 |
3072 |
3085 " |
3073 " |
3086 OpenVMSOperatingSystem createDirectory:'foo' |
3074 OperatingSystem createDirectory:'foo' |
3087 OpenVMSOperatingSystem removeDirectory:'foo' |
3075 OperatingSystem removeDirectory:'foo' |
3088 " |
3076 " |
3089 ! |
3077 ! |
3090 |
3078 |
3091 removeFile:fullPathName |
3079 removeFile:fullPathName |
3092 "remove the file named 'fullPathName'; return true if successful. |
3080 "remove the file named 'fullPathName'; return true if successful. |
3203 |
3191 |
3204 !OpenVMSOperatingSystem class methodsFor:'file access rights'! |
3192 !OpenVMSOperatingSystem class methodsFor:'file access rights'! |
3205 |
3193 |
3206 accessMaskFor:aSymbol |
3194 accessMaskFor:aSymbol |
3207 "return the access bits mask for numbers as returned by |
3195 "return the access bits mask for numbers as returned by |
3208 OpenVMSOperatingSystem>>accessModeOf: |
3196 OperatingSystem>>accessModeOf: |
3209 and expected by OpenVMSOperatingSystem>>changeAccessModeOf:to:. |
3197 and expected by OperatingSystem>>changeAccessModeOf:to:. |
3210 Since these numbers are OS dependent, always use the mask |
3198 Since these numbers are OS dependent, always use the mask |
3211 (never hardcode 8rxxx into your code)." |
3199 (never hardcode 8rxxx into your code)." |
3212 |
3200 |
3213 %{ /* NOCONTEXT */ |
3201 %{ /* NOCONTEXT */ |
3214 # ifndef S_IRUSR |
3202 # ifndef S_IRUSR |
3254 } |
3242 } |
3255 %}. |
3243 %}. |
3256 ^ self primitiveFailed |
3244 ^ self primitiveFailed |
3257 |
3245 |
3258 " |
3246 " |
3259 OpenVMSOperatingSystem accessMaskFor:#readUser |
3247 OperatingSystem accessMaskFor:#readUser |
3260 " |
3248 " |
3261 ! |
3249 ! |
3262 |
3250 |
3263 accessModeOf:aPathName |
3251 accessModeOf:aPathName |
3264 "return a number representing access rights rwxrwxrwx for owner, |
3252 "return a number representing access rights rwxrwxrwx for owner, |
3265 group and others. Return nil if such a file does not exist. |
3253 group and others. Return nil if such a file does not exist. |
3266 Notice that the returned number is OS dependent - use the |
3254 Notice that the returned number is OS dependent - use the |
3267 modeMasks as returned by OpenVMSOperatingSystem>>accessMaskFor:" |
3255 modeMasks as returned by OperatingSystem>>accessMaskFor:" |
3268 |
3256 |
3269 " |
3257 " |
3270 this could have been implemented as: |
3258 this could have been implemented as: |
3271 (self infoOf:aPathName) at:#mode |
3259 (self infoOf:aPathName) at:#mode |
3272 but for huge directory searches the code below is faster |
3260 but for huge directory searches the code below is faster |
3612 from:1 |
3600 from:1 |
3613 to:n |
3601 to:n |
3614 compressTabs:false final:nil |
3602 compressTabs:false final:nil |
3615 |
3603 |
3616 " |
3604 " |
3617 OpenVMSOperatingSystem compressPath:'./..' |
3605 OperatingSystem compressPath:'./..' |
3618 OpenVMSOperatingSystem compressPath:'/foo/bar/baz/..' |
3606 OperatingSystem compressPath:'/foo/bar/baz/..' |
3619 OpenVMSOperatingSystem compressPath:'foo/bar/baz/..' |
3607 OperatingSystem compressPath:'foo/bar/baz/..' |
3620 OpenVMSOperatingSystem compressPath:'foo/bar/baz/../' |
3608 OperatingSystem compressPath:'foo/bar/baz/../' |
3621 OpenVMSOperatingSystem compressPath:'foo/bar/baz/..///' |
3609 OperatingSystem compressPath:'foo/bar/baz/..///' |
3622 OpenVMSOperatingSystem compressPath:'///foo/bar/baz/..///' |
3610 OperatingSystem compressPath:'///foo/bar/baz/..///' |
3623 " |
3611 " |
3624 |
3612 |
3625 "Modified: 1.11.1996 / 20:13:48 / cg" |
3613 "Modified: 1.11.1996 / 20:13:48 / cg" |
3626 ! |
3614 ! |
3627 |
3615 |
3874 ^ info |
3862 ^ info |
3875 ]. |
3863 ]. |
3876 ^ self primitiveFailed |
3864 ^ self primitiveFailed |
3877 |
3865 |
3878 " |
3866 " |
3879 OpenVMSOperatingSystem infoOf:'/' |
3867 OperatingSystem infoOf:'/' |
3880 (OpenVMSOperatingSystem infoOf:'/') uid |
3868 (OperatingSystem infoOf:'/') uid |
3881 (OpenVMSOperatingSystem infoOf:'/') accessed |
3869 (OperatingSystem infoOf:'/') accessed |
3882 " |
3870 " |
3883 ! |
3871 ! |
3884 |
3872 |
3885 isDirectory:aPathName |
3873 isDirectory:aPathName |
3886 "return true, if 'aPathName' is a valid directory path name. |
3874 "return true, if 'aPathName' is a valid directory path name. |
3970 "return true, if the given file is a symbolic link" |
3958 "return true, if the given file is a symbolic link" |
3971 |
3959 |
3972 ^ (self linkInfoOf:aPathName) notNil |
3960 ^ (self linkInfoOf:aPathName) notNil |
3973 |
3961 |
3974 " |
3962 " |
3975 OpenVMSOperatingSystem isSymbolicLink:'Make.proto' |
3963 OperatingSystem isSymbolicLink:'Make.proto' |
3976 OpenVMSOperatingSystem isSymbolicLink:'Makefile' |
3964 OperatingSystem isSymbolicLink:'Makefile' |
3977 " |
3965 " |
3978 ! |
3966 ! |
3979 |
3967 |
3980 isValidPath:aPathName |
3968 isValidPath:aPathName |
3981 "return true, if 'aPathName' is a valid path name |
3969 "return true, if 'aPathName' is a valid path name |
4085 path := self compressPath:path |
4073 path := self compressPath:path |
4086 ]. |
4074 ]. |
4087 ^ path. |
4075 ^ path. |
4088 |
4076 |
4089 " |
4077 " |
4090 OpenVMSOperatingSystem pathNameOf:'.' |
4078 OperatingSystem pathNameOf:'.' |
4091 OpenVMSOperatingSystem pathNameOf:'../smalltalk/../smalltalk' |
4079 OperatingSystem pathNameOf:'../smalltalk/../smalltalk' |
4092 OpenVMSOperatingSystem pathNameOf:'../../..' |
4080 OperatingSystem pathNameOf:'../../..' |
4093 OpenVMSOperatingSystem pathNameOf:'..' |
4081 OperatingSystem pathNameOf:'..' |
4094 OpenVMSOperatingSystem pathNameOf:'/tmp////' |
4082 OperatingSystem pathNameOf:'/tmp////' |
4095 OpenVMSOperatingSystem pathNameOf:'/foo/bar' |
4083 OperatingSystem pathNameOf:'/foo/bar' |
4096 OpenVMSOperatingSystem pathNameOf:'/foo/bar/' |
4084 OperatingSystem pathNameOf:'/foo/bar/' |
4097 OpenVMSOperatingSystem pathNameOf:'/foo/bar//' |
4085 OperatingSystem pathNameOf:'/foo/bar//' |
4098 " |
4086 " |
4099 |
4087 |
4100 "Modified: 29.11.1996 / 18:02:12 / stefan" |
4088 "Modified: 29.11.1996 / 18:02:12 / stefan" |
4101 "Modified: 10.1.1997 / 19:10:42 / cg" |
4089 "Modified: 10.1.1997 / 19:10:42 / cg" |
4102 ! |
4090 ! |
4231 i := self infoOf:aPathName. |
4219 i := self infoOf:aPathName. |
4232 i notNil ifTrue:[^ i accessed]. |
4220 i notNil ifTrue:[^ i accessed]. |
4233 ^ nil. |
4221 ^ nil. |
4234 |
4222 |
4235 " |
4223 " |
4236 OpenVMSOperatingSystem timeOfLastAccess:'/' |
4224 OperatingSystem timeOfLastAccess:'/' |
4237 " |
4225 " |
4238 ! |
4226 ! |
4239 |
4227 |
4240 timeOfLastChange:aPathName |
4228 timeOfLastChange:aPathName |
4241 "return the time, when the file was last changed. |
4229 "return the time, when the file was last changed. |
4343 i := self infoOf:aPathName. |
4331 i := self infoOf:aPathName. |
4344 i notNil ifTrue:[^ i type]. |
4332 i notNil ifTrue:[^ i type]. |
4345 ^ nil. |
4333 ^ nil. |
4346 |
4334 |
4347 " |
4335 " |
4348 OpenVMSOperatingSystem typeOf:'/' |
4336 OperatingSystem typeOf:'/' |
4349 OpenVMSOperatingSystem typeOf:'.' |
4337 OperatingSystem typeOf:'.' |
4350 OpenVMSOperatingSystem typeOf:'Make.proto' |
4338 OperatingSystem typeOf:'Make.proto' |
4351 OpenVMSOperatingSystem typeOf:'resources/motif.style' |
4339 OperatingSystem typeOf:'resources/motif.style' |
4352 " |
4340 " |
4353 ! |
4341 ! |
4354 |
4342 |
4355 volumeNameOf:aPathString |
4343 volumeNameOf:aPathString |
4356 "return the volumeName of the argument, aPath |
4344 "return the volumeName of the argument, aPath |
4357 - thats the name of the volume where aPath is. |
4345 - thats the name of the volume where aPath is. |
4358 Not all OpenVMSOperatingSystem support/use volumes; on unix, |
4346 Not all OperatingSystems support/use volumes; on unix, |
4359 this always returns an empty string." |
4347 this always returns an empty string." |
4360 |
4348 |
4361 |idx| |
4349 |idx| |
4362 |
4350 |
4363 self isVMSlike ifTrue:[ |
4351 idx := aPathString indexOf:$:. |
4364 idx := aPathString indexOf:$:. |
4352 idx ~~ 0 ifTrue:[ |
4365 idx ~~ 0 ifTrue:[ |
4353 ^ aPathString copyTo:(idx - 1). |
4366 ^ aPathString copyTo:(idx - 1). |
|
4367 ]. |
|
4368 ^ '' |
|
4369 ]. |
|
4370 self isMSDOSlike ifTrue:[ |
|
4371 (aPathString at:2) == $: ifTrue:[ |
|
4372 ^ (aPathString at:1) asString. |
|
4373 ] |
|
4374 ]. |
4354 ]. |
4375 ^ '' |
4355 ^ '' |
4376 ! ! |
4356 ! ! |
4377 |
4357 |
4378 !OpenVMSOperatingSystem class methodsFor:'interrupts & signals'! |
4358 !OpenVMSOperatingSystem class methodsFor:'interrupts & signals'! |
4382 Dont confuse Unix signals with smalltalk signals. |
4362 Dont confuse Unix signals with smalltalk signals. |
4383 WARNING: for some signals, it is no good idea to revert to default; |
4363 WARNING: for some signals, it is no good idea to revert to default; |
4384 for example, the default for SIGINT (i.e. ^C) is to exit; while the |
4364 for example, the default for SIGINT (i.e. ^C) is to exit; while the |
4385 default for SIGQUIT (^ \) is to dump core. |
4365 default for SIGQUIT (^ \) is to dump core. |
4386 Also, NOTICE that signal numbers are not portable between unix |
4366 Also, NOTICE that signal numbers are not portable between unix |
4387 systems - use OpenVMSOperatingSystem sigXXX to get the numeric value for |
4367 systems - use OperatingSystem sigXXX to get the numeric value for |
4388 a signal." |
4368 a signal." |
4389 |
4369 |
4390 %{ /* NOCONTEXT */ |
4370 %{ /* NOCONTEXT */ |
4391 |
4371 |
4392 if (__isSmallInteger(signalNumber)) { |
4372 if (__isSmallInteger(signalNumber)) { |
4402 ^ self primitiveFailed |
4382 ^ self primitiveFailed |
4403 |
4383 |
4404 "you better save a snapshot image before trying this ..." |
4384 "you better save a snapshot image before trying this ..." |
4405 " |
4385 " |
4406 'if you hit ^C now, Smalltalk will exit immediately' printNewline. |
4386 'if you hit ^C now, Smalltalk will exit immediately' printNewline. |
4407 OpenVMSOperatingSystem defaultSignal:(OpenVMSOperatingSystem sigINT). |
4387 OperatingSystem defaultSignal:(OperatingSystem sigINT). |
4408 1 to:1000000 do:[:i| ]. |
4388 1 to:1000000 do:[:i| ]. |
4409 OpenVMSOperatingSystem enableSignal:(OpenVMSOperatingSystem sigINT). |
4389 OperatingSystem enableSignal:(OperatingSystem sigINT). |
4410 'normal ^C handling again.' printNewline |
4390 'normal ^C handling again.' printNewline |
4411 " |
4391 " |
4412 ! |
4392 ! |
4413 |
4393 |
4414 disableIOInterruptsOn:fd |
4394 disableIOInterruptsOn:fd |
4451 Dont confuse Unix signals with smalltalk signals. |
4431 Dont confuse Unix signals with smalltalk signals. |
4452 WARNING: for some signals, it is no good idea to disable |
4432 WARNING: for some signals, it is no good idea to disable |
4453 them; for example, disabling the SIGINT signal turns off ^C |
4433 them; for example, disabling the SIGINT signal turns off ^C |
4454 handling. |
4434 handling. |
4455 Also, NOTICE that signal numbers are not portable between unix |
4435 Also, NOTICE that signal numbers are not portable between unix |
4456 systems - use OpenVMSOperatingSystem sigXXX to get the numeric value for |
4436 systems - use OperatingSystem sigXXX to get the numeric value for |
4457 a signal. |
4437 a signal. |
4458 Use only for fully debugged stand alone applications." |
4438 Use only for fully debugged stand alone applications." |
4459 |
4439 |
4460 %{ /* NOCONTEXT */ |
4440 %{ /* NOCONTEXT */ |
4461 |
4441 |
4476 " |
4456 " |
4477 ^ self primitiveFailed |
4457 ^ self primitiveFailed |
4478 |
4458 |
4479 " |
4459 " |
4480 'now, ^C is totally ignored ...' printNewline. |
4460 'now, ^C is totally ignored ...' printNewline. |
4481 OpenVMSOperatingSystem disableSignal:(OpenVMSOperatingSystem sigINT). |
4461 OperatingSystem disableSignal:(OperatingSystem sigINT). |
4482 1 to:1000000 do:[:i| ]. |
4462 1 to:1000000 do:[:i| ]. |
4483 OpenVMSOperatingSystem enableSignal:(OpenVMSOperatingSystem sigINT). |
4463 OperatingSystem enableSignal:(OperatingSystem sigINT). |
4484 '^C handled again.' printNewline |
4464 '^C handled again.' printNewline |
4485 " |
4465 " |
4486 ! |
4466 ! |
4487 |
4467 |
4488 disableTimer |
4468 disableTimer |
4648 The signal will be delivered to one of the standard handlers |
4628 The signal will be delivered to one of the standard handlers |
4649 (SIGINT, SIGQUIT, etc) or to a general handler, which |
4629 (SIGINT, SIGQUIT, etc) or to a general handler, which |
4650 sends #signalInterrupt:. |
4630 sends #signalInterrupt:. |
4651 |
4631 |
4652 NOTICE that signal numbers are not portable between unix |
4632 NOTICE that signal numbers are not portable between unix |
4653 systems - use OpenVMSOperatingSystem sigXXX to get the numeric value for |
4633 systems - use OperatingSystem sigXXX to get the numeric value for |
4654 a signal." |
4634 a signal." |
4655 |
4635 |
4656 %{ /* NOCONTEXT */ |
4636 %{ /* NOCONTEXT */ |
4657 |
4637 |
4658 #ifdef NSIG |
4638 #ifdef NSIG |
4959 "kill a unix process. |
4939 "kill a unix process. |
4960 The process terminates immediately and has no chance to perform any cleanup actions. |
4940 The process terminates immediately and has no chance to perform any cleanup actions. |
4961 |
4941 |
4962 WARNING: in order to avoid zombie processes (on unix), |
4942 WARNING: in order to avoid zombie processes (on unix), |
4963 you have to fetch the processes exitstatus with |
4943 you have to fetch the processes exitstatus with |
4964 OpenVMSOperatingSystem>>getStatusOfProcess:aProcessId." |
4944 OperatingSystem>>getStatusOfProcess:aProcessId." |
4965 |
4945 |
4966 self isMSWINDOWSlike ifTrue:[ |
4946 self sendSignal:(self sigKILL) to:processId. |
4967 self primTerminateProcess:processId |
4947 |
4968 ] ifFalse:[ |
|
4969 self sendSignal:(self sigKILL) to:processId. |
|
4970 ]. |
|
4971 "Modified: 28.12.1995 / 15:06:18 / stefan" |
4948 "Modified: 28.12.1995 / 15:06:18 / stefan" |
4972 ! |
4949 ! |
4973 |
4950 |
4974 sendSignal:signalNumber to:processId |
4951 sendSignal:signalNumber to:processId |
4975 "send a unix signal to some process (maybe myself). |
4952 "send a unix signal to some process (maybe myself). |
4977 |
4954 |
4978 Do not confuse UNIX signals with Smalltalk-Signals. |
4955 Do not confuse UNIX signals with Smalltalk-Signals. |
4979 |
4956 |
4980 WARNING: in order to avoid zombie processes (on unix), |
4957 WARNING: in order to avoid zombie processes (on unix), |
4981 you may have to fetch the processes exitstatus with |
4958 you may have to fetch the processes exitstatus with |
4982 OpenVMSOperatingSystem>>getStatusOfProcess:aProcessId |
4959 OperatingSystem>>getStatusOfProcess:aProcessId |
4983 if the signal terminates that process." |
4960 if the signal terminates that process." |
4984 |
4961 |
4985 %{ |
4962 %{ |
4986 if (__bothSmallInteger(signalNumber, processId)) { |
4963 if (__bothSmallInteger(signalNumber, processId)) { |
4987 if (kill(__intVal(processId), __intVal(signalNumber)) < 0) { |
4964 if (kill(__intVal(processId), __intVal(signalNumber)) < 0) { |
5066 "terminate a unix process. |
5043 "terminate a unix process. |
5067 The process has a chance to do some cleanup. |
5044 The process has a chance to do some cleanup. |
5068 |
5045 |
5069 WARNING: in order to avoid zombie processes (on unix), |
5046 WARNING: in order to avoid zombie processes (on unix), |
5070 you may have to fetch the processes exitstatus with |
5047 you may have to fetch the processes exitstatus with |
5071 OpenVMSOperatingSystem>>getStatusOfProcess:aProcessId." |
5048 OperatingSystem>>getStatusOfProcess:aProcessId." |
5072 |
5049 |
5073 ^ UnsupportedOperationSignal raise. |
5050 ^ UnsupportedOperationSignal raise. |
5074 ! |
5051 ! |
5075 |
5052 |
5076 terminateProcessGroup:processGroupId |
5053 terminateProcessGroup:processGroupId |
5077 "terminate a unix process group. |
5054 "terminate a unix process group. |
5078 The process has a chance to do some cleanup. |
5055 The process has a chance to do some cleanup. |
5079 |
5056 |
5080 WARNING: in order to avoid zombie processes (on unix), |
5057 WARNING: in order to avoid zombie processes (on unix), |
5081 you may have to fetch the processes exitstatus with |
5058 you may have to fetch the processes exitstatus with |
5082 OpenVMSOperatingSystem>>getStatusOfProcess:aProcessId." |
5059 OperatingSystem>>getStatusOfProcess:aProcessId." |
5083 |
5060 |
5084 ^ UnsupportedOperationSignal raise. |
5061 ^ UnsupportedOperationSignal raise. |
5085 ! ! |
5062 ! ! |
5086 |
5063 |
5087 !OpenVMSOperatingSystem class methodsFor:'ipc support - UNIX'! |
5064 !OpenVMSOperatingSystem class methodsFor:'ipc support - UNIX'! |
5311 # endif |
5288 # endif |
5312 #endif |
5289 #endif |
5313 %}. |
5290 %}. |
5314 name isNil ifTrue:[ |
5291 name isNil ifTrue:[ |
5315 name := self getEnvironment:'DOMAIN'. |
5292 name := self getEnvironment:'DOMAIN'. |
5316 name isNil ifTrue:[ |
5293 "/ name isNil ifTrue:[ |
5317 OpenVMSOperatingSystem isUNIXlike ifTrue:[ |
5294 "/ OperatingSystem isUNIXlike ifTrue:[ |
5318 name := self getCommandOutputFrom:'domainname' |
5295 "/ name := self getCommandOutputFrom:'domainname' |
5319 ] |
5296 "/ ] |
5320 ] |
5297 "/ ] |
5321 ]. |
5298 ]. |
5322 name isNil ifTrue:[ |
5299 name isNil ifTrue:[ |
5323 "/ sometimes, we can extract the domainName from the hostName ... |
5300 "/ sometimes, we can extract the domainName from the hostName ... |
5324 hostName := self getHostName. |
5301 hostName := self getHostName. |
5325 hostName notNil ifTrue:[ |
5302 hostName notNil ifTrue:[ |
5360 %} |
5337 %} |
5361 . |
5338 . |
5362 ^ nil |
5339 ^ nil |
5363 |
5340 |
5364 " |
5341 " |
5365 OpenVMSOperatingSystem getEnvironment:'LANG' |
5342 OperatingSystem getEnvironment:'LANG' |
5366 OpenVMSOperatingSystem getEnvironment:'LOGIN' |
5343 OperatingSystem getEnvironment:'LOGIN' |
5367 OpenVMSOperatingSystem getEnvironment:'HOME' |
5344 OperatingSystem getEnvironment:'HOME' |
5368 OpenVMSOperatingSystem getEnvironment:'NNTPSERVER' |
5345 OperatingSystem getEnvironment:'NNTPSERVER' |
5369 OpenVMSOperatingSystem getEnvironment:'MAIL' |
5346 OperatingSystem getEnvironment:'MAIL' |
5370 OpenVMSOperatingSystem getEnvironment:'PATH' |
5347 OperatingSystem getEnvironment:'PATH' |
5371 " |
5348 " |
5372 ! |
5349 ! |
5373 |
5350 |
5374 getHostName |
5351 getHostName |
5375 "return the hostname we are running on - if there is |
5352 "return the hostname we are running on - if there is |
5838 dom notNil ifTrue:[info at:#domain put:dom]. |
5815 dom notNil ifTrue:[info at:#domain put:dom]. |
5839 info at:#osType put:(self getOSType). |
5816 info at:#osType put:(self getOSType). |
5840 ^ info |
5817 ^ info |
5841 |
5818 |
5842 " |
5819 " |
5843 OpenVMSOperatingSystem getSystemInfo |
5820 OperatingSystem getSystemInfo |
5844 " |
5821 " |
5845 ! |
|
5846 |
|
5847 getSystemType |
|
5848 "return a string giving the type of system we're running on. |
|
5849 This is almost the same as getOSType, but the returned string |
|
5850 is slightly different for some systems (i.e. iris vs. irix). |
|
5851 Dont depend on this - use getOSType. I dont really see a point |
|
5852 here ... |
|
5853 (except for slight differences between next/mach and other machs)" |
|
5854 |
|
5855 ^ self getOSType |
|
5856 |
|
5857 " |
|
5858 OpenVMSOperatingSystem getSystemType |
|
5859 " |
|
5860 ! |
|
5861 |
|
5862 getWindowsDirectory |
|
5863 "internal interface - only for Windows based systems. |
|
5864 Return the windows directory |
|
5865 (which - depending on the system - may be \WINNT, \WINDOWS or whatever) |
|
5866 On non-windows systems, nil is returned." |
|
5867 |
|
5868 ^ nil |
|
5869 |
|
5870 " |
|
5871 OpenVMSOperatingSystem getWindowsDirectory |
|
5872 " |
|
5873 ! |
|
5874 |
|
5875 getWindowsSystemDirectory |
|
5876 "internal interface - only for Windows based systems. |
|
5877 Return the windows system directory |
|
5878 (which - depending on the system - may be \WINNT\SYSTEM32, |
|
5879 \WINDOWS\SYSTEM or whatever) |
|
5880 On non-windows systems, nil is returned." |
|
5881 |
|
5882 ^ nil |
|
5883 |
|
5884 " |
|
5885 OpenVMSOperatingSystem getWindowsSystemDirectory |
|
5886 " |
|
5887 ! |
|
5888 |
|
5889 isBSDlike |
|
5890 "return true, if the OS we're running on is a 'real' unix." |
|
5891 |
|
5892 ^ false |
|
5893 ! |
|
5894 |
|
5895 isMAClike |
|
5896 "return true, if running on a macOS (but not on A/UX)" |
|
5897 |
|
5898 ^ false |
|
5899 ! |
|
5900 |
|
5901 isMSDOSlike |
|
5902 "return true, if the OS we're running on is msdos like |
|
5903 (in contrast to unix-like). |
|
5904 This returns true for any of msdos, win32s, win95, |
|
5905 winNT and os/2." |
|
5906 |
|
5907 ^ false |
|
5908 ! |
|
5909 |
|
5910 isMSWINDOWSlike |
|
5911 "return true, if running on a MS-Windows like system. |
|
5912 This returns true for any of win32s, win95 and winNT." |
|
5913 |
|
5914 ^ false |
|
5915 ! |
|
5916 |
|
5917 isOS2like |
|
5918 "return true, if the OS we're running on is OS2 like. |
|
5919 Only returns true for a plain OS/2 system." |
|
5920 |
|
5921 ^ false |
|
5922 ! |
|
5923 |
|
5924 isUNIXlike |
|
5925 "return true, if the OS we're running on is a unix like." |
|
5926 |
|
5927 ^ false |
|
5928 ! |
5822 ! |
5929 |
5823 |
5930 isVMSlike |
5824 isVMSlike |
5931 "return true, if the OS we're running in is VMS (or openVMS)." |
5825 "return true, if the OS we're running in is VMS (or openVMS)." |
5932 |
5826 |
6012 d at:#fractionalDigits put:2 . |
5906 d at:#fractionalDigits put:2 . |
6013 d at:#positiveSign put:'+' . |
5907 d at:#positiveSign put:'+' . |
6014 d at:#negativeSign put:'-' . |
5908 d at:#negativeSign put:'-' . |
6015 d at:#positiveSignPrecedesCurrencySymbol put:true . |
5909 d at:#positiveSignPrecedesCurrencySymbol put:true . |
6016 d at:#negativeSignPrecedesCurrencySymbol put:false . |
5910 d at:#negativeSignPrecedesCurrencySymbol put:false . |
6017 OpenVMSOperatingSystem setLocaleInfo:d |
5911 OperatingSystem setLocaleInfo:d |
6018 " |
5912 " |
6019 ! |
5913 ! |
6020 |
5914 |
6021 supportsChildInterrupts |
5915 supportsChildInterrupts |
6022 "return true, if the OS supports childProcess termination signalling |
5916 "return true, if the OS supports childProcess termination signalling |
6023 through interrupts (i.e. SIGCHILD)" |
5917 through interrupts (i.e. SIGCHILD)" |
6024 |
5918 |
6025 ^ true |
5919 ^ true |
6026 |
5920 |
6027 " |
5921 " |
6028 OpenVMSOperatingSystem supportsChildInterrupts |
5922 OperatingSystem supportsChildInterrupts |
6029 " |
5923 " |
6030 ! |
5924 ! |
6031 |
5925 |
6032 supportsIOInterrupts |
5926 supportsIOInterrupts |
6033 "return true, if the OS supports IO availability interrupts |
5927 "return true, if the OS supports IO availability interrupts |
6552 |
6446 |
6553 %}. |
6447 %}. |
6554 ^ (seconds * 1000) + millis |
6448 ^ (seconds * 1000) + millis |
6555 |
6449 |
6556 " |
6450 " |
6557 OpenVMSOperatingSystem getOSTime printCR. |
6451 OperatingSystem getOSTime printCR. |
6558 Delay waitForSeconds:0.2. |
6452 Delay waitForSeconds:0.2. |
6559 OpenVMSOperatingSystem getOSTime printCR. |
6453 OperatingSystem getOSTime printCR. |
6560 " |
6454 " |
6561 ! |
6455 ! |
6562 |
6456 |
6563 millisecondDelay:millis |
6457 millisecondDelay:millis |
6564 "delay execution for millis milliseconds or until the next event |
6458 "delay execution for millis milliseconds or until the next event |
6601 self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta. |
6495 self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta. |
6602 now := OpenVMSOperatingSystem getMillisecondTime. |
6496 now := OpenVMSOperatingSystem getMillisecondTime. |
6603 ] |
6497 ] |
6604 |
6498 |
6605 " |
6499 " |
6606 OpenVMSOperatingSystem millisecondDelay:2000 |
6500 OperatingSystem millisecondDelay:2000 |
6607 " |
6501 " |
6608 ! |
6502 ! |
6609 |
6503 |
6610 sleep:numberOfSeconds |
6504 sleep:numberOfSeconds |
6611 "{ Pragma: +optSpace }" |
6505 "{ Pragma: +optSpace }" |
6612 |
6506 |
6613 "cease ANY action for some time. This suspends the whole smalltalk |
6507 "cease ANY action for some time. This suspends the whole smalltalk |
6614 (unix-) process for some time. |
6508 (unix-) process for some time. |
6615 Not really useful since not even low-prio processes and interrupt |
6509 Not really useful since not even low-prio processes and interrupt |
6616 handling will run during the sleep. |
6510 handling will run during the sleep. |
6617 Use either OpenVMSOperatingSystem>>millisecondDelay: (which makes all |
6511 Use either OperatingSystem>>millisecondDelay: (which makes all |
6618 threads sleep, but handles interrupts) or use a Delay (which makes |
6512 threads sleep, but handles interrupts) or use a Delay (which makes |
6619 only the calling thread sleep)." |
6513 only the calling thread sleep)." |
6620 |
6514 |
6621 %{ /* NOCONTEXT */ |
6515 %{ /* NOCONTEXT */ |
6622 |
6516 |
6703 ^ gecos |
6597 ^ gecos |
6704 ]. |
6598 ]. |
6705 ^ self getUserNameFromID:userID |
6599 ^ self getUserNameFromID:userID |
6706 |
6600 |
6707 " |
6601 " |
6708 OpenVMSOperatingSystem getFullUserNameFromID:0 |
6602 OperatingSystem getFullUserNameFromID:0 |
6709 OpenVMSOperatingSystem getFullUserNameFromID:(OpenVMSOperatingSystem getUserID) |
6603 OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID) |
6710 |
6604 |
6711 OpenVMSOperatingSystem getUserNameFromID:(OpenVMSOperatingSystem getUserID) |
6605 OperatingSystem getUserNameFromID:(OperatingSystem getUserID) |
6712 " |
6606 " |
6713 |
6607 |
6714 "Modified: 15.7.1996 / 12:44:21 / cg" |
6608 "Modified: 15.7.1996 / 12:44:21 / cg" |
6715 ! |
6609 ! |
6716 |
6610 |
6892 ]. |
6786 ]. |
6893 |
6787 |
6894 ^ '? (' , aNumber printString , ')' |
6788 ^ '? (' , aNumber printString , ')' |
6895 |
6789 |
6896 " |
6790 " |
6897 OpenVMSOperatingSystem getUserNameFromID:0 |
6791 OperatingSystem getUserNameFromID:0 |
6898 OpenVMSOperatingSystem getUserNameFromID:100 |
6792 OperatingSystem getUserNameFromID:100 |
6899 OpenVMSOperatingSystem getUserNameFromID:9991 |
6793 OperatingSystem getUserNameFromID:9991 |
6900 " |
6794 " |
6901 ! |
6795 ! |
6902 |
6796 |
6903 userInfoOf:aNameOrID |
6797 userInfoOf:aNameOrID |
6904 "{ Pragma: +optSpace }" |
6798 "{ Pragma: +optSpace }" |
6976 uid notNil ifTrue:[info at:#uid put:uid]. |
6870 uid notNil ifTrue:[info at:#uid put:uid]. |
6977 gid notNil ifTrue:[info at:#gid put:gid]. |
6871 gid notNil ifTrue:[info at:#gid put:gid]. |
6978 ^ info |
6872 ^ info |
6979 |
6873 |
6980 " |
6874 " |
6981 OpenVMSOperatingSystem userInfoOf:'root' |
6875 OperatingSystem userInfoOf:'root' |
6982 OpenVMSOperatingSystem userInfoOf:1 |
6876 OperatingSystem userInfoOf:1 |
6983 OpenVMSOperatingSystem userInfoOf:'claus' |
6877 OperatingSystem userInfoOf:'claus' |
6984 OpenVMSOperatingSystem userInfoOf:'fooBar' |
6878 OperatingSystem userInfoOf:'fooBar' |
6985 OpenVMSOperatingSystem userInfoOf:(OpenVMSOperatingSystem getUserID) |
6879 OperatingSystem userInfoOf:(OperatingSystem getUserID) |
6986 " |
6880 " |
6987 ! ! |
6881 ! ! |
6988 |
6882 |
6989 !OpenVMSOperatingSystem class methodsFor:'waiting for events'! |
6883 !OpenVMSOperatingSystem class methodsFor:'waiting for events'! |
6990 |
6884 |
7193 } |
7087 } |
7194 } |
7088 } |
7195 } |
7089 } |
7196 |
7090 |
7197 if (__isNonNilObject(exceptFdArray)) { |
7091 if (__isNonNilObject(exceptFdArray)) { |
7198 if (! __isArray(exceptFdArray)) { |
7092 if (! __isArrayLike(exceptFdArray)) { |
7199 goto fail; |
7093 goto fail; |
7200 } |
7094 } |
7201 count = __arraySize(exceptFdArray); |
7095 count = __arraySize(exceptFdArray); |
7202 for (i=0; i<count;i++) { |
7096 for (i=0; i<count;i++) { |
7203 fd = __ArrayInstPtr(exceptFdArray)->a_element[i]; |
7097 fd = __ArrayInstPtr(exceptFdArray)->a_element[i]; |