OpenVMSOperatingSystem.st
changeset 3794 ac9a76e16fef
parent 3563 16ccd4cefcbe
child 3801 b4b3d6a6e48f
equal deleted inserted replaced
3793:aff27e755ffd 3794:ac9a76e16fef
   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 "
  1317 %{  /* NOCONTEXT */
  1317 %{  /* NOCONTEXT */
  1318 
  1318 
  1319      RETURN ( __MKSMALLINT(errno) );
  1319      RETURN ( __MKSMALLINT(errno) );
  1320 %}
  1320 %}
  1321      "
  1321      "
  1322       OpenVMSOperatingSystem currentErrorNumber
  1322       OperatingSystem currentErrorNumber
  1323      "
  1323      "
  1324 !
  1324 !
  1325 
  1325 
  1326 errorNumberFor:aSymbol
  1326 errorNumberFor:aSymbol
  1327     "given a symbolic error, return the numeric;
  1327     "given a symbolic error, return the numeric;
  2340     }
  2340     }
  2341 %}.
  2341 %}.
  2342     ^ Array with:sym with:text
  2342     ^ Array with:sym with:text
  2343 
  2343 
  2344     "
  2344     "
  2345      OpenVMSOperatingSystem errorSymbolAndTextForNumber:4
  2345      OperatingSystem errorSymbolAndTextForNumber:4
  2346     "
  2346     "
  2347 ! !
  2347 ! !
  2348 
  2348 
  2349 !OpenVMSOperatingSystem class methodsFor:'executing OS commands'!
  2349 !OpenVMSOperatingSystem class methodsFor:'executing OS commands'!
  2350 
  2350 
  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 !
  3042     "/ this OperatingSystem does not support links
  3030     "/ this OperatingSystem does not support links
  3043     "/
  3031     "/
  3044     ^ false.
  3032     ^ false.
  3045 
  3033 
  3046     "
  3034     "
  3047      OpenVMSOperatingSystem recursiveCreateDirectory:'foo/bar/baz'
  3035      OperatingSystem recursiveCreateDirectory:'foo/bar/baz'
  3048      OpenVMSOperatingSystem recursiveRemoveDirectory:'foo'
  3036      OperatingSystem recursiveRemoveDirectory:'foo'
  3049     "
  3037     "
  3050 
  3038 
  3051     "Modified: 7.3.1996 / 15:26:30 / cg"
  3039     "Modified: 7.3.1996 / 15:26:30 / cg"
  3052 !
  3040 !
  3053 
  3041 
  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.
  3143     }
  3131     }
  3144 %}.
  3132 %}.
  3145     ^ self primitiveFailed
  3133     ^ self primitiveFailed
  3146 
  3134 
  3147     "
  3135     "
  3148      OpenVMSOperatingSystem renameFile:'foo' to:'bar'
  3136      OperatingSystem renameFile:'foo' to:'bar'
  3149     "
  3137     "
  3150 !
  3138 !
  3151 
  3139 
  3152 truncateFile:aPathName to:newSize
  3140 truncateFile:aPathName to:newSize
  3153     "change a files size return true on success, false on failure.
  3141     "change a files size return true on success, false on failure.
  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
  3294     }
  3282     }
  3295 %}.
  3283 %}.
  3296    ^ self primitiveFailed
  3284    ^ self primitiveFailed
  3297 
  3285 
  3298    "
  3286    "
  3299     (OpenVMSOperatingSystem accessModeOf:'/') printStringRadix:8
  3287     (OperatingSystem accessModeOf:'/') printStringRadix:8
  3300    "
  3288    "
  3301 !
  3289 !
  3302 
  3290 
  3303 changeAccessModeOf:aPathName to:modeBits
  3291 changeAccessModeOf:aPathName to:modeBits
  3304     "change the access rights of aPathName to the OS dependent modeBits.
  3292     "change the access rights of aPathName to the OS dependent modeBits.
  3443 #endif
  3431 #endif
  3444 %}.
  3432 %}.
  3445     ^ false
  3433     ^ false
  3446 
  3434 
  3447     "
  3435     "
  3448      OpenVMSOperatingSystem supportsFileLocks
  3436      OperatingSystem supportsFileLocks
  3449     "
  3437     "
  3450 !
  3438 !
  3451 
  3439 
  3452 supportsNonBlockingFileLocks
  3440 supportsNonBlockingFileLocks
  3453     "return true, if the OS supports nonBlocking file locking
  3441     "return true, if the OS supports nonBlocking file locking
  3463 #endif
  3451 #endif
  3464 %}.
  3452 %}.
  3465     ^ false
  3453     ^ false
  3466 
  3454 
  3467     "
  3455     "
  3468      OpenVMSOperatingSystem supportsNonBlockingFileLocks
  3456      OperatingSystem supportsNonBlockingFileLocks
  3469     "
  3457     "
  3470 !
  3458 !
  3471 
  3459 
  3472 supportsSharedLocks
  3460 supportsSharedLocks
  3473     "return true, if the OS supports shared (i.e. multiple reader)
  3461     "return true, if the OS supports shared (i.e. multiple reader)
  3483 #endif
  3471 #endif
  3484 %}.
  3472 %}.
  3485     ^ false
  3473     ^ false
  3486 
  3474 
  3487     "
  3475     "
  3488      OpenVMSOperatingSystem supportsNonBlockingFileLocks
  3476      OperatingSystem supportsNonBlockingFileLocks
  3489     "
  3477     "
  3490 !
  3478 !
  3491 
  3479 
  3492 supportsSymbolicLinks
  3480 supportsSymbolicLinks
  3493     "return true, if the OS supports symbolic links on files/directories.
  3481     "return true, if the OS supports symbolic links on files/directories.
  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. 
  4274     i := self infoOf:aPathName.
  4262     i := self infoOf:aPathName.
  4275     i notNil ifTrue:[^ i modified].
  4263     i notNil ifTrue:[^ i modified].
  4276     ^ nil.
  4264     ^ nil.
  4277 
  4265 
  4278     "
  4266     "
  4279      OpenVMSOperatingSystem timeOfLastChange:'/'
  4267      OperatingSystem timeOfLastChange:'/'
  4280     "
  4268     "
  4281 !
  4269 !
  4282 
  4270 
  4283 typeOf:aPathName
  4271 typeOf:aPathName
  4284     "return the type of a file as a symbol; for nonexistent files,
  4272     "return the type of a file as a symbol; for nonexistent files,
  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:[
  5335     ].
  5312     ].
  5336     DomainName := name.
  5313     DomainName := name.
  5337     ^ name
  5314     ^ name
  5338 
  5315 
  5339     "
  5316     "
  5340      OpenVMSOperatingSystem getDomainName
  5317      OperatingSystem getDomainName
  5341     "
  5318     "
  5342 
  5319 
  5343     "Modified: 26.4.1996 / 10:04:54 / stefan"
  5320     "Modified: 26.4.1996 / 10:04:54 / stefan"
  5344 !
  5321 !
  5345 
  5322 
  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
  5409 # endif
  5386 # endif
  5410 #endif
  5387 #endif
  5411 %}.
  5388 %}.
  5412     name isNil ifTrue:[
  5389     name isNil ifTrue:[
  5413 	name := self getEnvironment:'HOST'.
  5390 	name := self getEnvironment:'HOST'.
  5414 	name isNil ifTrue:[
  5391 "/	name isNil ifTrue:[
  5415 	    OpenVMSOperatingSystem isUNIXlike ifTrue:[
  5392 "/	    OperatingSystem isUNIXlike ifTrue:[
  5416 		name := self getCommandOutputFrom:'hostname'
  5393 "/		name := self getCommandOutputFrom:'hostname'
  5417 	    ]
  5394 "/	    ]
  5418 	]
  5395 "/	]
  5419     ].
  5396     ].
  5420     name isNil ifTrue:[
  5397     name isNil ifTrue:[
  5421 	'OpenVMSOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
  5398 	'OpenVMSOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
  5422 	name := 'unknown'.
  5399 	name := 'unknown'.
  5423     ] ifFalse:[
  5400     ] ifFalse:[
  5431     ].
  5408     ].
  5432     HostName := name.
  5409     HostName := name.
  5433     ^ name
  5410     ^ name
  5434 
  5411 
  5435     "
  5412     "
  5436      OpenVMSOperatingSystem getHostName
  5413      OperatingSystem getHostName
  5437     "
  5414     "
  5438 !
  5415 !
  5439 
  5416 
  5440 getLocaleInfo
  5417 getLocaleInfo
  5441     "return a dictionary filled with values from the locale information;
  5418     "return a dictionary filled with values from the locale information;
  5681     }
  5658     }
  5682 %}.
  5659 %}.
  5683     ^ info
  5660     ^ info
  5684 
  5661 
  5685     "
  5662     "
  5686      OpenVMSOperatingSystem getLocaleInfo
  5663      OperatingSystem getLocaleInfo
  5687     "
  5664     "
  5688 
  5665 
  5689     "Created: 23.12.1995 / 14:19:20 / cg"
  5666     "Created: 23.12.1995 / 14:19:20 / cg"
  5690 !
  5667 !
  5691 
  5668 
  5701     pid = getpid();
  5678     pid = getpid();
  5702 #endif
  5679 #endif
  5703     RETURN ( __MKSMALLINT(pid) );
  5680     RETURN ( __MKSMALLINT(pid) );
  5704 %}
  5681 %}
  5705     "
  5682     "
  5706      OpenVMSOperatingSystem getProcessId
  5683      OperatingSystem getProcessId
  5707     "
  5684     "
  5708 !
  5685 !
  5709 
  5686 
  5710 getSystemID
  5687 getSystemID
  5711     "if supported by the OS, return the systemID;
  5688     "if supported by the OS, return the systemID;
  5736 #endif
  5713 #endif
  5737 %}.
  5714 %}.
  5738     ^ 'unknown'
  5715     ^ 'unknown'
  5739 
  5716 
  5740     "
  5717     "
  5741      OpenVMSOperatingSystem getSystemID
  5718      OperatingSystem getSystemID
  5742     "
  5719     "
  5743 !
  5720 !
  5744 
  5721 
  5745 getSystemInfo
  5722 getSystemInfo
  5746     "return info on the system weare running on.
  5723     "return info on the system weare running on.
  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 
  5962 
  5856 
  5963 %{  /* NOCONTEXT */
  5857 %{  /* NOCONTEXT */
  5964     RETURN ( __MKSMALLINT(MAXPATHLEN) );
  5858     RETURN ( __MKSMALLINT(MAXPATHLEN) );
  5965 %}
  5859 %}
  5966     "
  5860     "
  5967      OpenVMSOperatingSystem maxPathLength   
  5861      OperatingSystem maxPathLength   
  5968     "
  5862     "
  5969 !
  5863 !
  5970 
  5864 
  5971 pathSeparator
  5865 pathSeparator
  5972     "return the character which separates items in the PATH variable"
  5866     "return the character which separates items in the PATH variable"
  5982      I.e. it is much less specific than getOSType or getSystemType."
  5876      I.e. it is much less specific than getOSType or getSystemType."
  5983 
  5877 
  5984     ^ #vms
  5878     ^ #vms
  5985 
  5879 
  5986     "
  5880     "
  5987      OpenVMSOperatingSystem platformName
  5881      OperatingSystem platformName
  5988     "
  5882     "
  5989 
  5883 
  5990     "Modified: 20.6.1997 / 17:37:26 / cg"
  5884     "Modified: 20.6.1997 / 17:37:26 / cg"
  5991 !
  5885 !
  5992 
  5886 
  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 
  6038     "
  5932     "
  6039 
  5933 
  6040     ^ false
  5934     ^ false
  6041 
  5935 
  6042     "
  5936     "
  6043      OpenVMSOperatingSystem supportsIOInterrupts 
  5937      OperatingSystem supportsIOInterrupts 
  6044     "
  5938     "
  6045 !
  5939 !
  6046 
  5940 
  6047 supportsNonBlockingIO
  5941 supportsNonBlockingIO
  6048     "return true, if the OS supports nonblocking IO."
  5942     "return true, if the OS supports nonblocking IO."
  6053 #endif
  5947 #endif
  6054 %}.
  5948 %}.
  6055     ^ false
  5949     ^ false
  6056 
  5950 
  6057     "
  5951     "
  6058      OpenVMSOperatingSystem supportsNonBlockingIO  
  5952      OperatingSystem supportsNonBlockingIO  
  6059     "
  5953     "
  6060 !
  5954 !
  6061 
  5955 
  6062 supportsSelect
  5956 supportsSelect
  6063     "return true, if the OS supports selecting on multiple
  5957     "return true, if the OS supports selecting on multiple
  6066      intervals for I/O becoming ready."
  5960      intervals for I/O becoming ready."
  6067 
  5961 
  6068     ^ false "/ for now ... 
  5962     ^ false "/ for now ... 
  6069 
  5963 
  6070     "
  5964     "
  6071      OpenVMSOperatingSystem supportsSelect 
  5965      OperatingSystem supportsSelect 
  6072     "
  5966     "
  6073 ! !
  5967 ! !
  6074 
  5968 
  6075 !OpenVMSOperatingSystem class methodsFor:'private'!
  5969 !OpenVMSOperatingSystem class methodsFor:'private'!
  6076 
  5970 
  6134     day = __MKSMALLINT(tmPtr->tm_mday);
  6028     day = __MKSMALLINT(tmPtr->tm_mday);
  6135 %}.
  6029 %}.
  6136     aBlock value:year value:month value:day
  6030     aBlock value:year value:month value:day
  6137 
  6031 
  6138     "
  6032     "
  6139      OpenVMSOperatingSystem computeDatePartsOf:0 for:[:y :m :d |
  6033      OperatingSystem computeDatePartsOf:0 for:[:y :m :d |
  6140 	y printCR. m printCR. d printCR
  6034 	y printCR. m printCR. d printCR
  6141      ]
  6035      ]
  6142     "
  6036     "
  6143 !
  6037 !
  6144 
  6038 
  6173 	^ osSeconds * 1000 + millis
  6067 	^ osSeconds * 1000 + millis
  6174     ].    
  6068     ].    
  6175     ^ self primitiveFailed
  6069     ^ self primitiveFailed
  6176 
  6070 
  6177     "
  6071     "
  6178      OpenVMSOperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
  6072      OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
  6179     "
  6073     "
  6180 
  6074 
  6181 !
  6075 !
  6182 
  6076 
  6183 computeTimeAndDateFrom:osTime
  6077 computeTimeAndDateFrom:osTime
  6239     ret at:10 put:yDay.
  6133     ret at:10 put:yDay.
  6240     ret at:11 put:wDay.
  6134     ret at:11 put:wDay.
  6241     ^ ret
  6135     ^ ret
  6242 
  6136 
  6243     "
  6137     "
  6244      OpenVMSOperatingSystem computeTimeAndDateFrom:0
  6138      OperatingSystem computeTimeAndDateFrom:0
  6245     "
  6139     "
  6246 !
  6140 !
  6247 
  6141 
  6248 computeTimePartsOf:osTime for:aBlock
  6142 computeTimePartsOf:osTime for:aBlock
  6249     "compute hours, minutes, seconds and milliseconds from the osTime 
  6143     "compute hours, minutes, seconds and milliseconds from the osTime 
  6268     seconds = __MKSMALLINT(tmPtr->tm_sec);
  6162     seconds = __MKSMALLINT(tmPtr->tm_sec);
  6269 %}.
  6163 %}.
  6270     aBlock value:hours value:minutes value:seconds value:millis
  6164     aBlock value:hours value:minutes value:seconds value:millis
  6271 
  6165 
  6272     "
  6166     "
  6273      OpenVMSOperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
  6167      OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
  6274 	h printCR. m printCR. s printCR. millis printCR
  6168 	h printCR. m printCR. s printCR. millis printCR
  6275      ]
  6169      ]
  6276     "
  6170     "
  6277 !
  6171 !
  6278 
  6172 
  6333     ret at:10 put:yDay.
  6227     ret at:10 put:yDay.
  6334     ret at:11 put:wDay.
  6228     ret at:11 put:wDay.
  6335     ^ ret
  6229     ^ ret
  6336 
  6230 
  6337     "
  6231     "
  6338      OpenVMSOperatingSystem computeUTCTimeAndDateFrom:0
  6232      OperatingSystem computeUTCTimeAndDateFrom:0
  6339     "
  6233     "
  6340 !
  6234 !
  6341 
  6235 
  6342 computeUTCTimePartsOf:osTime for:aBlock
  6236 computeUTCTimePartsOf:osTime for:aBlock
  6343     "compute hours, minutes, seconds and milliseconds from the osTime 
  6237     "compute hours, minutes, seconds and milliseconds from the osTime 
  6360     seconds = __MKSMALLINT(tmPtr->tm_sec);
  6254     seconds = __MKSMALLINT(tmPtr->tm_sec);
  6361 %}.
  6255 %}.
  6362     aBlock value:hours value:minutes value:seconds value:millis
  6256     aBlock value:hours value:minutes value:seconds value:millis
  6363 
  6257 
  6364     "
  6258     "
  6365      OpenVMSOperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli |
  6259      OperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli |
  6366 	h printCR. m printCR. s printCR. milli printCR
  6260 	h printCR. m printCR. s printCR. milli printCR
  6367      ]
  6261      ]
  6368     "
  6262     "
  6369 !
  6263 !
  6370 
  6264 
  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 
  6629      argument not integer
  6523      argument not integer
  6630     "
  6524     "
  6631     ^ self primitiveFailed
  6525     ^ self primitiveFailed
  6632 
  6526 
  6633     "
  6527     "
  6634      OpenVMSOperatingSystem sleep:2
  6528      OperatingSystem sleep:2
  6635     "
  6529     "
  6636 ! !
  6530 ! !
  6637 
  6531 
  6638 !OpenVMSOperatingSystem class methodsFor:'users & groups'!
  6532 !OpenVMSOperatingSystem class methodsFor:'users & groups'!
  6639 
  6533 
  6655     /* --- return same as getGroupID --- */
  6549     /* --- return same as getGroupID --- */
  6656 %}.
  6550 %}.
  6657     ^ self getGroupID
  6551     ^ self getGroupID
  6658 
  6552 
  6659     "
  6553     "
  6660      OpenVMSOperatingSystem getEffectiveGroupID
  6554      OperatingSystem getEffectiveGroupID
  6661     "
  6555     "
  6662 !
  6556 !
  6663 
  6557 
  6664 getEffectiveUserID
  6558 getEffectiveUserID
  6665     "{ Pragma: +optSpace }"
  6559     "{ Pragma: +optSpace }"
  6679     /* --- return same as getUserID --- */
  6573     /* --- return same as getUserID --- */
  6680 %}.
  6574 %}.
  6681     ^ self getUserID
  6575     ^ self getUserID
  6682 
  6576 
  6683     "
  6577     "
  6684      OpenVMSOperatingSystem getEffectiveUserID
  6578      OperatingSystem getEffectiveUserID
  6685     "
  6579     "
  6686 !
  6580 !
  6687 
  6581 
  6688 getFullUserNameFromID:userID
  6582 getFullUserNameFromID:userID
  6689     "{ Pragma: +optSpace }"
  6583     "{ Pragma: +optSpace }"
  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 
  6733 #endif
  6627 #endif
  6734 %}.
  6628 %}.
  6735     ^ 1 "just a dummy for systems which do not have userIDs"
  6629     ^ 1 "just a dummy for systems which do not have userIDs"
  6736 
  6630 
  6737     "
  6631     "
  6738      OpenVMSOperatingSystem getGroupID
  6632      OperatingSystem getGroupID
  6739     "
  6633     "
  6740 !
  6634 !
  6741 
  6635 
  6742 getGroupNameFromID:aNumber
  6636 getGroupNameFromID:aNumber
  6743     "{ Pragma: +optSpace }"
  6637     "{ Pragma: +optSpace }"
  6760 #endif /* unix-like */
  6654 #endif /* unix-like */
  6761 %}.
  6655 %}.
  6762     ^ '???'
  6656     ^ '???'
  6763 
  6657 
  6764     "
  6658     "
  6765      OpenVMSOperatingSystem getGroupNameFromID:0
  6659      OperatingSystem getGroupNameFromID:0
  6766      OpenVMSOperatingSystem getGroupNameFromID:10
  6660      OperatingSystem getGroupNameFromID:10
  6767     "
  6661     "
  6768 !
  6662 !
  6769 
  6663 
  6770 getHomeDirectory
  6664 getHomeDirectory
  6771     "{ Pragma: +optSpace }"
  6665     "{ Pragma: +optSpace }"
  6774      (i.e. yours)"
  6668      (i.e. yours)"
  6775 
  6669 
  6776     ^ OpenVMSOperatingSystem getEnvironment:'HOME'
  6670     ^ OpenVMSOperatingSystem getEnvironment:'HOME'
  6777 
  6671 
  6778     "
  6672     "
  6779      OpenVMSOperatingSystem getHomeDirectory
  6673      OperatingSystem getHomeDirectory
  6780     "
  6674     "
  6781 
  6675 
  6782     "Modified: 24.1.1997 / 11:32:13 / cg"
  6676     "Modified: 24.1.1997 / 11:32:13 / cg"
  6783 !
  6677 !
  6784 
  6678 
  6832     }
  6726     }
  6833 
  6727 
  6834     RETURN ( __MKSTRING(name) );
  6728     RETURN ( __MKSTRING(name) );
  6835 %}.
  6729 %}.
  6836     "
  6730     "
  6837      OpenVMSOperatingSystem getLoginName
  6731      OperatingSystem getLoginName
  6838     "
  6732     "
  6839 !
  6733 !
  6840 
  6734 
  6841 getUserID
  6735 getUserID
  6842     "{ Pragma: +optSpace }"
  6736     "{ Pragma: +optSpace }"
  6857 #endif
  6751 #endif
  6858 %}.
  6752 %}.
  6859     ^ 1 "just a dummy for systems which do not have userIDs"
  6753     ^ 1 "just a dummy for systems which do not have userIDs"
  6860 
  6754 
  6861     "
  6755     "
  6862      OpenVMSOperatingSystem getUserID
  6756      OperatingSystem getUserID
  6863     "
  6757     "
  6864 !
  6758 !
  6865 
  6759 
  6866 getUserNameFromID:aNumber
  6760 getUserNameFromID:aNumber
  6867     "{ Pragma: +optSpace }"
  6761     "{ Pragma: +optSpace }"
  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 
  7040 "/ show:' code: '; show:code; show:' core:'; showCR:core.
  6934 "/ show:' code: '; show:code; show:' core:'; showCR:core.
  7041 
  6935 
  7042     ^ OSProcessStatus pid:pid status:status code:code core:core
  6936     ^ OSProcessStatus pid:pid status:status code:code core:core
  7043 
  6937 
  7044     "
  6938     "
  7045      OpenVMSOperatingSystem childProcessWait:false
  6939      OperatingSystem childProcessWait:false
  7046     "
  6940     "
  7047 
  6941 
  7048     "Created: 5.1.1996 / 16:39:14 / stefan"
  6942     "Created: 5.1.1996 / 16:39:14 / stefan"
  7049 !
  6943 !
  7050 
  6944 
  7156 	FD_ZERO(&wset);
  7050 	FD_ZERO(&wset);
  7157 	FD_ZERO(&eset);
  7051 	FD_ZERO(&eset);
  7158 
  7052 
  7159 	maxF = -1;
  7053 	maxF = -1;
  7160 	if (__isNonNilObject(readFdArray)) {
  7054 	if (__isNonNilObject(readFdArray)) {
  7161 	    if (! __isArray(readFdArray)) {
  7055 	    if (! __isArrayLike(readFdArray)) {
  7162 		goto fail;    
  7056 		goto fail;    
  7163 	    }
  7057 	    }
  7164 	    count = __arraySize(readFdArray);
  7058 	    count = __arraySize(readFdArray);
  7165 
  7059 
  7166 	    for (i=0; i<count;i++) {
  7060 	    for (i=0; i<count;i++) {
  7175 		}
  7069 		}
  7176 	    }
  7070 	    }
  7177 	}
  7071 	}
  7178 
  7072 
  7179 	if (__isNonNilObject(writeFdArray)) {
  7073 	if (__isNonNilObject(writeFdArray)) {
  7180 	    if (! __isArray(writeFdArray)) {
  7074 	    if (! __isArrayLike(writeFdArray)) {
  7181 		goto fail;    
  7075 		goto fail;    
  7182 	    }
  7076 	    }
  7183 	    count = __arraySize(writeFdArray);
  7077 	    count = __arraySize(writeFdArray);
  7184 	    for (i=0; i<count;i++) {
  7078 	    for (i=0; i<count;i++) {
  7185 		fd = __ArrayInstPtr(writeFdArray)->a_element[i];
  7079 		fd = __ArrayInstPtr(writeFdArray)->a_element[i];
  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];
  7613 ! !
  7507 ! !
  7614 
  7508 
  7615 !OpenVMSOperatingSystem class methodsFor:'documentation'!
  7509 !OpenVMSOperatingSystem class methodsFor:'documentation'!
  7616 
  7510 
  7617 version
  7511 version
  7618     ^ '$Header: /cvs/stx/stx/libbasic/OpenVMSOperatingSystem.st,v 1.6 1998-06-12 16:02:03 cg Exp $'
  7512     ^ '$Header: /cvs/stx/stx/libbasic/OpenVMSOperatingSystem.st,v 1.7 1998-08-27 14:24:42 cg Exp $'
  7619 ! !
  7513 ! !
  7620 OpenVMSOperatingSystem initialize!
  7514 OpenVMSOperatingSystem initialize!