author | Stefan Vogel <sv@exept.de> |
Tue, 11 Dec 2001 21:21:45 +0100 | |
changeset 6306 | 0e4cc1ce9245 |
parent 6301 | f95d23e6da4d |
child 6334 | cbb0e8c8c1a5 |
permissions | -rw-r--r-- |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
6050 | 3 |
All Rights Reserved |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5 |
This software is furnished under a license and may be used |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6 |
only in accordance with the terms of that license and with the |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7 |
inclusion of the above copyright notice. This software may not |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8 |
be provided or otherwise made available to, or used by, any |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9 |
other person. No title to or ownership of the software is |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
10 |
hereby transferred. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
11 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
12 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
13 |
"{ Package: 'stx:libbasic' }" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
14 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
15 |
AbstractOperatingSystem subclass:#UnixOperatingSystem |
5035 | 16 |
instanceVariableNames:'' |
17 |
classVariableNames:'HostName DomainName SlowFork ForkFailed CurrentDirectory' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'OS-Unix' |
|
20 |
! |
|
21 |
||
6301 | 22 |
Object subclass:#FileDescriptorHandle |
23 |
instanceVariableNames:'fd' |
|
24 |
classVariableNames:'OpenFiles' |
|
25 |
poolDictionaries:'' |
|
26 |
privateIn:UnixOperatingSystem |
|
27 |
! |
|
28 |
||
29 |
OSFileHandle subclass:#FilePointerHandle |
|
30 |
instanceVariableNames:'' |
|
31 |
classVariableNames:'' |
|
32 |
poolDictionaries:'' |
|
33 |
privateIn:UnixOperatingSystem |
|
34 |
! |
|
35 |
||
5854 | 36 |
Object subclass:#FileStatusInfo |
37 |
instanceVariableNames:'type mode uid gid size id accessed modified statusChanged path' |
|
5035 | 38 |
classVariableNames:'' |
39 |
poolDictionaries:'' |
|
40 |
privateIn:UnixOperatingSystem |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
41 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
42 |
|
5854 | 43 |
Object subclass:#OSProcessStatus |
44 |
instanceVariableNames:'pid status code core' |
|
5035 | 45 |
classVariableNames:'' |
46 |
poolDictionaries:'' |
|
47 |
privateIn:UnixOperatingSystem |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
48 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
49 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
50 |
!UnixOperatingSystem primitiveDefinitions! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
51 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
52 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
53 |
#if defined(_AIX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
54 |
# ifndef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
55 |
# define WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
56 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
57 |
# ifndef WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
58 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
59 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
60 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
61 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
62 |
#ifdef LINUX |
4882
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
63 |
# define __xxUSE_GNU /* new */ |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
64 |
# undef HAS_UTS_DOMAINNAME |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
65 |
|
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
66 |
# ifndef _STDIO_H_INCLUDED_ |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
67 |
# include <stdio.h> |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
68 |
# define _STDIO_H_INCLUDED_ |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
69 |
# endif |
3956
51f1a9a4d63f
changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents:
3943
diff
changeset
|
70 |
|
51f1a9a4d63f
changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents:
3943
diff
changeset
|
71 |
# ifndef _SYS_TYPES_H_INCLUDED_ |
51f1a9a4d63f
changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents:
3943
diff
changeset
|
72 |
# include <sys/types.h> |
51f1a9a4d63f
changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents:
3943
diff
changeset
|
73 |
# define _SYS_TYPES_H_INCLUDED_ |
51f1a9a4d63f
changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents:
3943
diff
changeset
|
74 |
# endif |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
75 |
/* use inline string macros */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
76 |
# define __STRINGDEFS__ |
5886 | 77 |
# include "linuxIntern.h" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
78 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
79 |
# ifndef WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
80 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
81 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
82 |
# define WANT_SHM |
3544
a654f7ac3a6e
solaris has no setenv / unsetenv
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
83 |
# define HAS_SETENV |
a654f7ac3a6e
solaris has no setenv / unsetenv
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
84 |
# define HAS_UNSETENV |
5886 | 85 |
# include <time.h> |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
86 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
87 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
88 |
#ifdef IRIX5 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
89 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
90 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
91 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
92 |
#ifdef ultrix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
93 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
94 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
95 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
96 |
#ifdef hpux |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
97 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
98 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
99 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
100 |
#ifdef solaris |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
101 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
102 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
103 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
104 |
#if defined(SYSV4) && defined(i386) /* e.g. unixware */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
105 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
106 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
107 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
108 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
109 |
* notice: although many systems' include files |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
110 |
* already block against multiple inclusion, some |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
111 |
* do not. Therefore, this is done here again. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
112 |
* (it does not hurt) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
113 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
114 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
115 |
#ifdef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
116 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
117 |
# ifndef NO_SYS_PARAM_H |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
118 |
# include <sys/param.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
119 |
# define _SYS_PARAM_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
120 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
121 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
122 |
# include <errno.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
123 |
# define _ERRNO_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
124 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
125 |
# include <sys/stat.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
126 |
# define _SYS_STAT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
127 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
128 |
#endif /* WANT_REALPATH */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
129 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
130 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
131 |
#ifdef WANT_SHM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
132 |
extern int shmctl(), shmget(), shmdt(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
133 |
extern char * shmat(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
134 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
135 |
# include <sys/types.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
136 |
# define _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
137 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
138 |
# include <sys/ipc.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
139 |
# define _SYS_IPC_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
140 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
141 |
# include <sys/shm.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
142 |
# define _SYS_SHM_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
143 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
144 |
#endif /* WANT_SHM */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
145 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
146 |
#ifdef IRIX5 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
147 |
# include <sys/syssgi.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
148 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
149 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
150 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
151 |
#ifdef transputer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
152 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
153 |
# define unlink(f) ((remove(f) == 0) ? 0 : -1) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
154 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
155 |
#else /* not transputer */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
156 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
157 |
# ifndef _SIGNAL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
158 |
# include <signal.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
159 |
# define _SIGNAL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
160 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
161 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
162 |
# ifdef SYSV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
163 |
# ifndef _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
164 |
# include <sys/types.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
165 |
# define _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
166 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
167 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
168 |
# ifndef _SYS_PARAM_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
169 |
# ifndef NO_SYS_PARAM_H |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
170 |
# include <sys/param.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
171 |
# define _SYS_PARAM_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
172 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
173 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
174 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
175 |
# ifndef _SYS_TIMES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
176 |
# include <sys/times.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
177 |
# define _SYS_TIMES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
178 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
179 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
180 |
# ifndef _SYS_FILE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
181 |
# include <sys/file.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
182 |
# define _SYS_FILE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
183 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
184 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
185 |
# if ! defined(sco3_2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
186 |
# ifndef _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
187 |
# include <unistd.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
188 |
# define _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
189 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
190 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
191 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
192 |
# if defined(isc3_2) || defined(sco3_2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
193 |
# ifndef _SYS_TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
194 |
# include <sys/time.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
195 |
# define _SYS_TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
196 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
197 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
198 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
199 |
# if !defined(isc3_2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
200 |
# if defined(PCS) && defined(mips) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
201 |
# include "/usr/include/bsd/sys/time.h" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
202 |
# include "/usr/include/sys/time.h" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
203 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
204 |
# ifndef _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
205 |
# include <time.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
206 |
# define _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
207 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
208 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
209 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
210 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
211 |
# if defined(isc3_2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
212 |
# include <sys/bsdtypes.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
213 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
214 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
215 |
# else /* not SYSV */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
216 |
|
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
217 |
# ifndef _SYS_TIME_H_INCLUDED_ |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
218 |
# include <sys/time.h> |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
219 |
# define _SYS_TIME_H_INCLUDED_ |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
220 |
# endif |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
221 |
|
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
222 |
# ifndef _SYS_TYPES_H_INCLUDED_ |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
223 |
# include <sys/types.h> |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
224 |
# define _SYS_TYPES_H_INCLUDED_ |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
225 |
# endif |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
226 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
227 |
# endif /* not SYSV */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
228 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
229 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
230 |
# ifdef aix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
231 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
232 |
# ifndef _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
233 |
# include <time.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
234 |
# define _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
235 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
236 |
# ifndef _SYS_SELECT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
237 |
# include <sys/select.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
238 |
# define _SYS_SELECT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
239 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
240 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
241 |
# endif /* aix */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
242 |
|
4882
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
243 |
# ifndef _STDIO_H_INCLUDED_ |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
244 |
# include <stdio.h> |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
245 |
# define _STDIO_H_INCLUDED_ |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
246 |
# endif |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
247 |
|
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
248 |
# ifndef _PWD_H_INCLUDED_ |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
249 |
# include <pwd.h> |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
250 |
# define _PWD_H_INCLUDED_ |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
251 |
# endif |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
252 |
|
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
253 |
# ifndef NO_GRP_H |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
254 |
# ifndef _GRP_H_INCLUDED_ |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
255 |
# include <grp.h> |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
256 |
# define _GRP_H_INCLUDED_ |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
257 |
# endif |
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
258 |
# endif |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
259 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
260 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
261 |
# ifndef _SYS_STAT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
262 |
# include <sys/stat.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
263 |
# define _SYS_STAT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
264 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
265 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
266 |
# ifndef _SYS_FILE_H_INCLUDED_ |
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
267 |
# include <sys/file.h> |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
268 |
# define _SYS_FILE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
269 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
270 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
271 |
# ifndef _ERRNO_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
272 |
# include <errno.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
273 |
# define _ERRNO_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
274 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
275 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
276 |
# ifndef _FCNTL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
277 |
# include <fcntl.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
278 |
# define _FCNTL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
279 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
280 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
281 |
# ifndef _IOCTL_H_INCLUDED_ |
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
282 |
# include <sys/ioctl.h> |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
283 |
# define _IOCTL_H_INCLUDED_ |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
284 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
285 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
286 |
# if defined(LINUX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
287 |
# define HAS_LOCALECONV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
288 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
289 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
290 |
# if defined (HAS_LOCALECONV) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
291 |
# ifndef _LOCALE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
292 |
# include <locale.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
293 |
# define _LOCALE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
294 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
295 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
296 |
|
6050 | 297 |
# if defined (HAS_FTIME) |
298 |
# include <sys/timeb.h> |
|
299 |
# endif |
|
300 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
301 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
302 |
* posix systems should define these ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
303 |
* but on some (older) systems, they are not. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
304 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
305 |
# ifndef S_IXUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
306 |
# ifdef S_IEXEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
307 |
# define S_IXUSR S_IEXEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
308 |
# define S_IXGRP (S_IEXEC>>3) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
309 |
# define S_IXOTH (S_IEXEC>>6) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
310 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
311 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
312 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
313 |
# ifndef S_IXUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
314 |
# define S_IXUSR 0100 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
315 |
# define S_IXGRP 0010 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
316 |
# define S_IXOTH 0001 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
317 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
318 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
319 |
# ifndef S_IRUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
320 |
# define S_IRUSR 0400 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
321 |
# define S_IRGRP 0040 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
322 |
# define S_IROTH 0004 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
323 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
324 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
325 |
# ifndef S_IWUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
326 |
# define S_IWUSR 0200 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
327 |
# define S_IWGRP 0020 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
328 |
# define S_IWOTH 0002 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
329 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
330 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
331 |
# ifndef MAXPATHLEN |
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
332 |
# ifndef NO_SYS_PARAM_H |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
333 |
# include <sys/param.h> |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
334 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
335 |
# ifndef MAXPATHLEN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
336 |
# ifdef FILENAME_MAX /* i.e. MSDOS_LIKE */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
337 |
# define MAXPATHLEN FILENAME_MAX |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
338 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
339 |
# ifdef MAX_PATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
340 |
# define MAXPATHLEN MAX_PATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
341 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
342 |
# define MAXPATHLEN 1024 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
343 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
344 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
345 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
346 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
347 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
348 |
# if defined(HAS_UNAME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
349 |
# include <sys/utsname.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
350 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
351 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
352 |
# if defined(SYSV4) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
353 |
# include <stropts.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
354 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
355 |
|
4285 | 356 |
# ifndef aix |
357 |
# include <sys/termios.h> |
|
358 |
# endif |
|
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
359 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
360 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
361 |
* NeXT has no pid_t |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
362 |
* and no sigemptyset |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
363 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
364 |
# ifdef NEXT3 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
365 |
typedef int pid_t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
366 |
# define sigemptyset(set) ((*(set) = 0L), 0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
367 |
# define HAS_GETDOMAINNAME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
368 |
# define NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
369 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
370 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
371 |
# ifdef sunos |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
372 |
# undef NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
373 |
# undef HAS_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
374 |
# define HAS_WAIT3 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
375 |
# define HAS_SIGACTION |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
376 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
377 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
378 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
379 |
* some (BSD ?) have no timezone global, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
380 |
* but provide the info in struct timezone. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
381 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
382 |
# if defined(ultrix) || defined(sunos) || defined(NEXT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
383 |
# define HAS_NO_TIMEZONE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
384 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
385 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
386 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
387 |
* sigaction dummies (you won't believe these call themself ``POSIX'' systems ...) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
388 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
389 |
# ifndef SA_RESTART |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
390 |
# define SA_RESTART 0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
391 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
392 |
# ifndef SA_SIGINFO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
393 |
# define SA_SIGINFO 0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
394 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
395 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
396 |
# if defined(HAS_WAITPID) || defined(HAS_WAIT3) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
397 |
# include <sys/wait.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
398 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
399 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
400 |
# if defined(HAS_SYSINFO) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
401 |
# include <sys/systeminfo.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
402 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
403 |
|
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
404 |
# ifdef LINUX |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
405 |
# include <linux/kernel.h> |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
406 |
# include <linux/sys.h> |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
407 |
# endif |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
408 |
|
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
409 |
# if defined(HAS_GETSYSINFO) |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
410 |
# include <sys/sysinfo.h> |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
411 |
# include <machine/hal_sysinfo.h> |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
412 |
# include <machine/hal/cpuconf.h> |
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
413 |
# endif |
3737 | 414 |
|
415 |
# if defined(HAS_SYSCONF) |
|
416 |
# ifndef _UNISTD_H_INCLUDED_ |
|
417 |
# include <unistd.h> |
|
418 |
# define _UNISTD_H_INCLUDED_ |
|
419 |
# endif |
|
420 |
# endif |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
421 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
422 |
#endif /* not transputer */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
423 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
424 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
425 |
* on some systems errno is a macro ... check for it here |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
426 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
427 |
#ifndef errno |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
428 |
extern errno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
429 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
430 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
431 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
432 |
* some (old ?) systems do not define this ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
433 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
434 |
#if !defined(R_OK) && !defined(_AIX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
435 |
# define R_OK 4 /* Test for Read permission */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
436 |
# define W_OK 2 /* Test for Write permission */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
437 |
# define X_OK 1 /* Test for eXecute permission */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
438 |
# define F_OK 0 /* Test for existence of File */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
439 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
440 |
|
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
441 |
#define SIGHANDLER_ARG |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
442 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
443 |
#ifdef sunos |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
444 |
# define NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
445 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
446 |
#ifdef NEXT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
447 |
# define NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
448 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
449 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
450 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
451 |
* not all systems have time_t and off_t |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
452 |
* explicit add of those we know to have ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
453 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
454 |
#ifdef __osf__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
455 |
# define TIME_T time_t |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
456 |
# define OFF_T off_t |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
457 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
458 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
459 |
#ifndef TIME_T |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
460 |
# define TIME_T long |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
461 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
462 |
#ifndef OFF_T |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
463 |
# define OFF_T long |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
464 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
465 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
466 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
467 |
* where is the timezone info ? |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
468 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
469 |
#if defined(HAS_NO_TIMEZONE) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
470 |
# if defined(HAS_NO_TM_GMTOFF) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
471 |
# define TIMEZONE(tmPtr) 0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
472 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
473 |
# define TIMEZONE(tmPtr) ((tmPtr)->tm_gmtoff) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
474 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
475 |
#else |
5656
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
476 |
# if defined(HAS_ALTZONE) |
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
477 |
# define TIMEZONE(tmPtr) ((tmPtr)->tm_isdst == 0 ? timezone : altzone) |
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
478 |
# else /*!HAS_ALTZONE*/ |
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
479 |
# define TIMEZONE(tmPtr) ((tmPtr)->tm_isdst == 0 ? timezone : timezone-3600) |
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
480 |
# endif /*!HAS_ALTZONE*/ |
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
481 |
#endif |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
482 |
|
3595
5fbfb33cd373
oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
483 |
#ifndef CONST |
5fbfb33cd373
oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
484 |
# ifdef __GNUC__ |
5fbfb33cd373
oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
485 |
# define CONST const |
5fbfb33cd373
oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
486 |
# else |
5fbfb33cd373
oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
487 |
# define CONST /* nothing */ |
5fbfb33cd373
oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
488 |
# endif |
5fbfb33cd373
oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
489 |
#endif |
5fbfb33cd373
oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents:
3575
diff
changeset
|
490 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
491 |
%} |
5656
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
492 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
493 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
494 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
495 |
!UnixOperatingSystem primitiveFunctions! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
496 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
497 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
498 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
499 |
* some systems' system() is broken in that it does not correctly |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
500 |
* handle EINTR and returns failure even though it actually succeeded. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
501 |
* (LINUX is one of them) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
502 |
* Here is a fixed version. If you encounter EINTR returns from |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
503 |
* UnixOperatingSystem>>executeCommand, you ought to define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
504 |
* in the xxxIntern.h file to get this fixed version. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
505 |
* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
506 |
* As an added BONUS, this system() enables interrupts while waiting |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
507 |
* for the child which enables other threads to continue. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
508 |
* (i.e. it is RT safe) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
509 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
510 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
511 |
#if defined(WANT_SYSTEM) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
512 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
513 |
/* # define DPRINTF(x) printf x */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
514 |
# define DPRINTF(x) /* nothing */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
515 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
516 |
# ifndef _STDDEF_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
517 |
# include <stddef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
518 |
# define _STDDEF_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
519 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
520 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
521 |
# ifndef _STDLIB_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
522 |
# include <stdlib.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
523 |
# define _STDLIB_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
524 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
525 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
526 |
# ifndef _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
527 |
# include <unistd.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
528 |
# define _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
529 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
530 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
531 |
# ifndef _SYS_WAIT_H_INCLUDED |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
532 |
# include <sys/wait.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
533 |
# define _SYS_WAIT_H_INCLUDED |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
534 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
535 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
536 |
# ifndef _SIGNAL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
537 |
# include <signal.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
538 |
# define _SIGNAL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
539 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
540 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
541 |
# ifndef _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
542 |
# include <sys/types.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
543 |
# define _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
544 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
545 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
546 |
# if (!defined(HAVE_GNU_LD) && !defined (__ELF__)) || !defined(LINUX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
547 |
# define __environ environ |
4882
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
548 |
# if 1 /* !defined(LINUX) */ |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
549 |
# define __sigemptyset sigemptyset |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
550 |
# define __sigaction sigaction |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
551 |
# define __sigaddset sigaddset |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
552 |
# define __sigprocmask sigprocmask |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
553 |
# define __execve execve |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
554 |
# define __wait wait |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
555 |
# define __waitpid waitpid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
556 |
# if defined(HAS_VFORK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
557 |
# define FORK vfork |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
558 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
559 |
# define FORK fork |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
560 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
561 |
# endif /* ! LINUX */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
562 |
extern char **environ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
563 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
564 |
|
4882
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
565 |
# define __sigprocmask sigprocmask |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
566 |
# define __execve execve |
fb4dafb482fb
make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents:
4853
diff
changeset
|
567 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
568 |
# define SHELL_PATH "/bin/sh" /* Path of the shell. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
569 |
# define SHELL_NAME "sh" /* Name to give it. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
570 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
571 |
# ifndef FORK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
572 |
# define FORK __fork |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
573 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
574 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
575 |
static int |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
576 |
mySystem(line) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
577 |
register CONST char *line; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
578 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
579 |
int status, save; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
580 |
pid_t pid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
581 |
struct sigaction sa, intr, quit; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
582 |
sigset_t block, omask; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
583 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
584 |
if (line == NULL) |
6050 | 585 |
return -1; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
586 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
587 |
sa.sa_handler = SIG_IGN; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
588 |
sa.sa_flags = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
589 |
__sigemptyset (&sa.sa_mask); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
590 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
591 |
if (__sigaction (SIGINT, &sa, &intr) < 0) { |
6050 | 592 |
DPRINTF(("1: errno=%d\n", errno)); |
593 |
return -1; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
594 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
595 |
if (__sigaction (SIGQUIT, &sa, &quit) < 0) { |
6050 | 596 |
save = errno; |
597 |
(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL); |
|
598 |
errno = save; |
|
599 |
DPRINTF(("2: errno=%d\n", errno)); |
|
600 |
return -1; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
601 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
602 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
603 |
__sigemptyset (&block); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
604 |
__sigaddset (&block, SIGCHLD); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
605 |
save = errno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
606 |
if (__sigprocmask(SIG_BLOCK, &block, &omask) < 0) { |
6050 | 607 |
if (errno == ENOSYS) |
608 |
errno = save; |
|
609 |
else { |
|
610 |
save = errno; |
|
611 |
(void) __sigaction(SIGINT, &intr, (struct sigaction *) NULL); |
|
612 |
(void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); |
|
613 |
errno = save; |
|
614 |
DPRINTF(("3: errno=%d\n", errno)); |
|
615 |
return -1; |
|
616 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
617 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
618 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
619 |
pid = FORK (); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
620 |
if (pid == (pid_t) 0) { |
6050 | 621 |
/* Child side. */ |
622 |
CONST char *new_argv[4]; |
|
623 |
new_argv[0] = SHELL_NAME; |
|
624 |
new_argv[1] = "-c"; |
|
625 |
new_argv[2] = line; |
|
626 |
new_argv[3] = NULL; |
|
627 |
||
628 |
/* Restore the signals. */ |
|
629 |
(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL); |
|
630 |
(void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); |
|
631 |
(void) __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL); |
|
632 |
||
633 |
/* Exec the shell. */ |
|
634 |
(void) __execve (SHELL_PATH, (char *CONST *) new_argv, __environ); |
|
635 |
_exit (127); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
636 |
} else { |
6050 | 637 |
if (pid < (pid_t) 0) { |
638 |
/* The fork failed. */ |
|
639 |
DPRINTF(("4: errno=%d\n", errno)); |
|
640 |
status = -1; |
|
641 |
} else { |
|
642 |
/* Parent side. */ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
643 |
#ifdef NO_WAITPID |
6050 | 644 |
pid_t child; |
645 |
||
646 |
do { |
|
647 |
__BEGIN_INTERRUPTABLE__ |
|
648 |
child = __wait (&status); |
|
649 |
__END_INTERRUPTABLE__ |
|
650 |
if (child < 0 && errno != EINTR) { |
|
651 |
DPRINTF(("5: errno=%d\n", errno)); |
|
652 |
status = -1; |
|
653 |
break; |
|
654 |
} |
|
655 |
} while (child != pid); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
656 |
#else |
6050 | 657 |
pid_t child; |
658 |
||
659 |
/* claus: the original did not care for EINTR here ... */ |
|
660 |
do { |
|
661 |
__BEGIN_INTERRUPTABLE__ |
|
662 |
child = __waitpid (pid, &status, 0); |
|
663 |
__END_INTERRUPTABLE__ |
|
664 |
} while ((child != pid) && (errno == EINTR)); |
|
665 |
if (child != pid) { |
|
666 |
DPRINTF(("6: errno=%d\n", errno)); |
|
667 |
status = -1; |
|
668 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
669 |
#endif /* NO_WAITPID */ |
6050 | 670 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
671 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
672 |
save = errno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
673 |
if ((__sigaction (SIGINT, &intr, (struct sigaction *) NULL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
674 |
| __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
675 |
| __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL)) != 0) { |
6050 | 676 |
if (errno == ENOSYS) { |
677 |
errno = save; |
|
678 |
} else { |
|
679 |
status = -1; |
|
680 |
DPRINTF(("7: errno=%d\n", errno)); |
|
681 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
682 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
683 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
684 |
return status; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
685 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
686 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
687 |
# define __wait wait |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
688 |
#endif /* WANT_SYSTEM */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
689 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
690 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
691 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
692 |
* some systems do not have realpath(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
693 |
* the alternative of reading from a 'pwp'-pipe |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
694 |
* is way too slow. Here is a realpath for the rest of us. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
695 |
* define WANT_REALPATH in the xxxIntern-file to get it. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
696 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
697 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
698 |
#if defined(HAS_REALPATH) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
699 |
# undef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
700 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
701 |
#if !defined(HAS_GETWD) && !defined(HAS_GETCWD) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
702 |
# undef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
703 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
704 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
705 |
#if defined(WANT_REALPATH) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
706 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
707 |
# ifndef NULL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
708 |
# define NULL (char *)0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
709 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
710 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
711 |
# define MAX_READLINKS 32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
712 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
713 |
# ifndef MAXPATHLEN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
714 |
# define MAXPATHLEN 1024 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
715 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
716 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
717 |
static |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
718 |
char *realpath(path, resolved_path) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
719 |
char *path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
720 |
char resolved_path []; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
721 |
{ |
6050 | 722 |
char copy_path[MAXPATHLEN]; |
723 |
char link_path[MAXPATHLEN]; |
|
724 |
char *new_path = resolved_path; |
|
725 |
char *max_path; |
|
726 |
int readlinks = 0; |
|
727 |
int n; |
|
728 |
||
729 |
/* Make a copy of the source path since we may need to modify it. */ |
|
730 |
strcpy(copy_path, path); |
|
731 |
path = copy_path; |
|
732 |
max_path = copy_path + MAXPATHLEN - 2; |
|
733 |
/* If it's a relative pathname use getwd for starters. */ |
|
734 |
if (*path != '/') { |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
735 |
#ifdef HAS_GETCWD |
6050 | 736 |
new_path = getcwd(new_path, MAXPATHLEN - 1); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
737 |
#else |
6050 | 738 |
new_path = getwd(new_path); |
739 |
#endif |
|
740 |
if (new_path == NULL) |
|
741 |
return(NULL); |
|
742 |
||
743 |
new_path += strlen(new_path); |
|
744 |
if (new_path[-1] != '/') |
|
745 |
*new_path++ = '/'; |
|
746 |
} |
|
747 |
else { |
|
748 |
*new_path++ = '/'; |
|
749 |
path++; |
|
750 |
} |
|
751 |
/* Expand each slash-separated pathname component. */ |
|
752 |
while (*path != '\0') { |
|
753 |
/* Ignore stray "/". */ |
|
754 |
if (*path == '/') { |
|
755 |
path++; |
|
756 |
continue; |
|
757 |
} |
|
758 |
if (*path == '.') { |
|
759 |
/* Ignore ".". */ |
|
760 |
if (path[1] == '\0' || path[1] == '/') { |
|
761 |
path++; |
|
762 |
continue; |
|
763 |
} |
|
764 |
if (path[1] == '.') { |
|
765 |
if (path[2] == '\0' || path[2] == '/') { |
|
766 |
path += 2; |
|
767 |
/* Ignore ".." at root. */ |
|
768 |
if (new_path == resolved_path + 1) |
|
769 |
continue; |
|
770 |
/* Handle ".." by backing up. */ |
|
771 |
while ((--new_path)[-1] != '/') |
|
772 |
; |
|
773 |
continue; |
|
774 |
} |
|
775 |
} |
|
776 |
} |
|
777 |
/* Safely copy the next pathname component. */ |
|
778 |
while (*path != '\0' && *path != '/') { |
|
779 |
if (path > max_path) { |
|
780 |
errno = ENAMETOOLONG; |
|
781 |
return NULL; |
|
782 |
} |
|
783 |
*new_path++ = *path++; |
|
784 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
785 |
#ifdef S_IFLNK |
6050 | 786 |
/* Protect against infinite loops. */ |
787 |
if (readlinks++ > MAX_READLINKS) { |
|
788 |
errno = ELOOP; |
|
789 |
return NULL; |
|
790 |
} |
|
791 |
/* See if latest pathname component is a symlink. */ |
|
792 |
*new_path = '\0'; |
|
793 |
n = readlink(resolved_path, link_path, MAXPATHLEN - 1); |
|
794 |
if (n < 0) { |
|
795 |
/* EINVAL means the file exists but isn't a symlink. */ |
|
796 |
if (errno != EINVAL) |
|
797 |
return NULL; |
|
798 |
} |
|
799 |
else { |
|
800 |
/* Note: readlink doesn't add the null byte. */ |
|
801 |
link_path[n] = '\0'; |
|
802 |
if (*link_path == '/') |
|
803 |
/* Start over for an absolute symlink. */ |
|
804 |
new_path = resolved_path; |
|
805 |
else |
|
806 |
/* Otherwise back up over this component. */ |
|
807 |
while (*(--new_path) != '/') |
|
808 |
; |
|
809 |
/* Safe sex check. */ |
|
810 |
if (strlen(path) + n >= MAXPATHLEN) { |
|
811 |
errno = ENAMETOOLONG; |
|
812 |
return NULL; |
|
813 |
} |
|
814 |
/* Insert symlink contents into path. */ |
|
815 |
strcat(link_path, path); |
|
816 |
strcpy(copy_path, link_path); |
|
817 |
path = copy_path; |
|
818 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
819 |
#endif /* S_IFLNK */ |
6050 | 820 |
*new_path++ = '/'; |
821 |
} |
|
822 |
/* Delete trailing slash but don't whomp a lone slash. */ |
|
823 |
if (new_path != resolved_path + 1 && new_path[-1] == '/') |
|
824 |
new_path--; |
|
825 |
/* Make sure it's null terminated. */ |
|
826 |
*new_path = '\0'; |
|
827 |
return resolved_path; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
828 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
829 |
# define HAS_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
830 |
#endif /* WANT_REALPATH && not HAS_REALPATH */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
831 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
832 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
833 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
834 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
835 |
!UnixOperatingSystem class methodsFor:'documentation'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
836 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
837 |
copyright |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
838 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
839 |
COPYRIGHT (c) 1988 by Claus Gittinger |
6050 | 840 |
All Rights Reserved |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
841 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
842 |
This software is furnished under a license and may be used |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
843 |
only in accordance with the terms of that license and with the |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
844 |
inclusion of the above copyright notice. This software may not |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
845 |
be provided or otherwise made available to, or used by, any |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
846 |
other person. No title to or ownership of the software is |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
847 |
hereby transferred. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
848 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
849 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
850 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
851 |
documentation |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
852 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
853 |
this class realizes access to most (all ?) required operating system services; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
854 |
some of it is very specific for unix, so do not depend on |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
855 |
things available here in your applications |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
856 |
- some may not be found in other OS's or be slightly different ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
857 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
858 |
(On the other hand: I do not want to hide all features |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
859 |
from you - in some situations it MAY be interesting to be |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
860 |
able to get down to a select or fork system call easily (at least on Unix systems). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
861 |
You decide - portability vs. functionality) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
862 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
863 |
[Class variables:] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
864 |
|
6050 | 865 |
HostName <String> remembered hostname |
866 |
||
867 |
DomainName <String> remembered domainname |
|
868 |
||
869 |
SlowFork <Boolean> if set, fork and popen are avoided; |
|
870 |
(more or less obsolete now) |
|
871 |
||
872 |
||
873 |
CurrentDirectory <String> remembered currentDirectories path |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
874 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
875 |
[author:] |
6050 | 876 |
Claus Gittinger |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
877 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
878 |
[see also:] |
6050 | 879 |
OSProcessStatus |
880 |
Filename Date Time |
|
881 |
ExternalStream FileStream PipeStream Socket |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
882 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
883 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
884 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
885 |
examples |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
886 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
887 |
various queries |
6050 | 888 |
[exBegin] |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
889 |
Transcript |
6050 | 890 |
showCR:'hello ' , (OperatingSystem getLoginName) |
891 |
[exEnd] |
|
892 |
||
893 |
[exBegin] |
|
3793 | 894 |
OperatingSystem isUNIXlike ifTrue:[ |
6050 | 895 |
Transcript showCR:'this is some UNIX-like OS' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
896 |
] ifFalse:[ |
6050 | 897 |
Transcript showCR:'this OS is not UNIX-like' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
898 |
] |
6050 | 899 |
[exEnd] |
900 |
||
901 |
[exBegin] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
902 |
Transcript |
6050 | 903 |
showCR:'this machine is called ' , OperatingSystem getHostName |
904 |
[exEnd] |
|
905 |
||
906 |
[exBegin] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
907 |
Transcript |
6050 | 908 |
showCR:('this machine is in the ' |
909 |
, OperatingSystem getDomainName |
|
910 |
, ' domain') |
|
911 |
[exEnd] |
|
912 |
||
913 |
[exBegin] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
914 |
Transcript |
6050 | 915 |
showCR:('this machine''s CPU is a ' |
916 |
, OperatingSystem getCPUType |
|
917 |
) |
|
918 |
[exEnd] |
|
919 |
||
920 |
[exBegin] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
921 |
Transcript showCR:'executing ls command ...'. |
3795 | 922 |
OperatingSystem executeCommand:'ls'. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
923 |
Transcript showCR:'... done.'. |
6050 | 924 |
[exEnd] |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
925 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
926 |
locking a file |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
927 |
(should be executed on two running smalltalks - not in two threads): |
6050 | 928 |
[exBegin] |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
929 |
|f| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
930 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
931 |
f := 'testFile' asFilename readWriteStream. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
932 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
933 |
10 timesRepeat:[ |
6050 | 934 |
'about to lock ...' printCR. |
935 |
[ |
|
936 |
OperatingSystem |
|
937 |
lockFD:(f fileDescriptor) |
|
938 |
shared:false |
|
939 |
blocking:false |
|
940 |
] whileFalse:[ |
|
941 |
'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR. |
|
942 |
Delay waitForSeconds:1 |
|
943 |
]. |
|
944 |
'LOCKED ...' printCR. |
|
945 |
Delay waitForSeconds:10. |
|
946 |
'unlock ...' printCR. |
|
947 |
(OperatingSystem |
|
948 |
unlockFD:(f fileDescriptor)) printCR. |
|
949 |
Delay waitForSeconds:3. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
950 |
] |
6050 | 951 |
[exBegin] |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
952 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
953 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
954 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
955 |
!UnixOperatingSystem class methodsFor:'initialization'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
956 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
957 |
initialize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
958 |
"initialize the class" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
959 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
960 |
ObjectMemory addDependent:self. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
961 |
HostName := nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
962 |
DomainName := nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
963 |
LastErrorNumber := nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
964 |
PipeFailed := false. |
4395
53122eb3ce70
clear ForkFailed flag; made it a classVar
Claus Gittinger <cg@exept.de>
parents:
4380
diff
changeset
|
965 |
ForkFailed := false. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
966 |
SlowFork := false. |
3943 | 967 |
CurrentDirectory := nil. |
968 |
||
969 |
"Modified: / 11.12.1998 / 16:35:39 / cg" |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
970 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
971 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
972 |
update:something with:aParameter from:changedObject |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
973 |
"catch image restart and flush some cached data" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
974 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
975 |
something == #earlyRestart ifTrue:[ |
6050 | 976 |
" |
977 |
flush cached data/info |
|
978 |
" |
|
979 |
HostName := nil. |
|
980 |
DomainName := nil. |
|
981 |
LastErrorNumber := nil. |
|
982 |
PipeFailed := false. |
|
983 |
SlowFork := false. |
|
984 |
ForkFailed := false. |
|
985 |
CurrentDirectory := nil. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
986 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
987 |
|
3943 | 988 |
"Created: / 15.6.1996 / 15:22:37 / cg" |
989 |
"Modified: / 7.1.1997 / 19:36:11 / stefan" |
|
990 |
"Modified: / 11.12.1998 / 16:22:48 / cg" |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
991 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
992 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
993 |
!UnixOperatingSystem class methodsFor:'OS signal constants'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
994 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
995 |
sigABRT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
996 |
"return the signal number for SIGABRT - 0 if not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
997 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
998 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
999 |
^ self signalNamed:#SIGABRT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1000 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1001 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1002 |
OperatingSystem sigABRT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1003 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1004 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1005 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1006 |
sigALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1007 |
"return the signal number for SIGALRM - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1008 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1009 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1010 |
^ self signalNamed:#SIGALRM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1011 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1012 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1013 |
OperatingSystem sigALRM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1014 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1015 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1016 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1017 |
sigBREAK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1018 |
"return the signal number for SIGBREAK - 0 if not supported. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1019 |
This is an MSDOS specific signal" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1020 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1021 |
^ self signalNamed:#SIGBREAK |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1022 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1023 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1024 |
OperatingSystem sigBREAK |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1025 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1026 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1027 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1028 |
sigBUS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1029 |
"return the signal number for SIGBUS - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1030 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1031 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1032 |
^ self signalNamed:#SIGBUS |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1033 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1034 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1035 |
OperatingSystem sigBUS |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1036 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1037 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1038 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1039 |
sigCHLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1040 |
"return the signal number for SIGCHLD - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1041 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1042 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1043 |
^ self signalNamed:#SIGCHLD |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1044 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1045 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1046 |
OperatingSystem sigCHLD |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1047 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1048 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1049 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1050 |
sigCONT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1051 |
"return the signal number for SIGCONT - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1052 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1053 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1054 |
^ self signalNamed:#SIGCONT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1055 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1056 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1057 |
OperatingSystem sigCONT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1058 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1059 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1060 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1061 |
sigDANGER |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1062 |
"return the signal number for SIGDANGER - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1063 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1064 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1065 |
^ self signalNamed:#SIGDANGER |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1066 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1067 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1068 |
OperatingSystem sigDANGER |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1069 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1070 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1071 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1072 |
sigEMT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1073 |
"return the signal number for SIGEMT - 0 if not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1074 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1075 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1076 |
^ self signalNamed:#SIGEMT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1077 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1078 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1079 |
OperatingSystem sigEMT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1080 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1081 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1082 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1083 |
sigFP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1084 |
"return the signal number for SIGFP - 0 if not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1085 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1086 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1087 |
^ self signalNamed:#SIGFPE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1088 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1089 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1090 |
OperatingSystem sigFP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1091 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1092 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1093 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1094 |
sigGRANT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1095 |
"return the signal number for SIGGRANT - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1096 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1097 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1098 |
^ self signalNamed:#SIGGRANT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1099 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1100 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1101 |
OperatingSystem sigGRANT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1102 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1103 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1104 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1105 |
sigHUP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1106 |
"return the signal number for SIGHUP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1107 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1108 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1109 |
^ self signalNamed:#SIGHUP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1110 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1111 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1112 |
OperatingSystem sigHUP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1113 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1114 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1115 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1116 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1117 |
sigILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1118 |
"return the signal number for SIGILL - 0 if not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1119 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1120 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1121 |
^ self signalNamed:#SIGILL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1122 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1123 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1124 |
OperatingSystem sigILL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1125 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1126 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1127 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1128 |
sigINT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1129 |
"return the signal number for SIGINT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1130 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1131 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1132 |
^ self signalNamed:#SIGINT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1133 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1134 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1135 |
OperatingSystem sigINT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1136 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1137 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1138 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1139 |
sigIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1140 |
"return the signal number for SIGIO - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1141 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1142 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1143 |
^ self signalNamed:#SIGIO |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1144 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1145 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1146 |
OperatingSystem sigIO |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1147 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1148 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1149 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1150 |
sigIOT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1151 |
"return the signal number for SIGIOT - 0 if not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1152 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1153 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1154 |
^ self signalNamed:#SIGIOT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1155 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1156 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1157 |
OperatingSystem sigIOT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1158 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1159 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1160 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1161 |
sigKILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1162 |
"return the signal number for SIGKILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1163 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1164 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1165 |
^ self signalNamed:#SIGKILL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1166 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1167 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1168 |
OperatingSystem sigKILL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1169 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1170 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1171 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1172 |
sigLOST |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1173 |
"return the signal number for SIGLOST - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1174 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1175 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1176 |
^ self signalNamed:#SIGLOST |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1177 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1178 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1179 |
OperatingSystem sigLOST |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1180 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1181 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1182 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1183 |
sigMIGRATE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1184 |
"return the signal number for SIGMIGRATE - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1185 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1186 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1187 |
^ self signalNamed:#SIGMIGRATE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1188 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1189 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1190 |
OperatingSystem sigMIGRATE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1191 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1192 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1193 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1194 |
sigMSG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1195 |
"return the signal number for SIGMSG - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1196 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1197 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1198 |
^ self signalNamed:#SIGMSG |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1199 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1200 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1201 |
OperatingSystem sigMSG |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1202 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1203 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1204 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1205 |
sigPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1206 |
"return the signal number for SIGPIPE - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1207 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1208 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1209 |
^ self signalNamed:#SIGPIPE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1210 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1211 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1212 |
OperatingSystem sigPIPE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1213 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1214 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1215 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1216 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1217 |
sigPOLL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1218 |
"return the signal number for SIGPOLL - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1219 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1220 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1221 |
^ self signalNamed:#SIGPOLL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1222 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1223 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1224 |
OperatingSystem sigPOLL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1225 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1226 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1227 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1228 |
sigPRE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1229 |
"return the signal number for SIGPRE - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1230 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1231 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1232 |
^ self signalNamed:#SIGPRE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1233 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1234 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1235 |
OperatingSystem sigPRE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1236 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1237 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1238 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1239 |
sigPROF |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1240 |
"return the signal number for SIGPROF - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1241 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1242 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1243 |
^ self signalNamed:#SIGPROF |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1244 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1245 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1246 |
OperatingSystem sigPROF |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1247 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1248 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1249 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1250 |
sigPWR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1251 |
"return the signal number for SIGPWR - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1252 |
(not available on all systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1253 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1254 |
^ self signalNamed:#SIGPWR |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1255 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1256 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1257 |
OperatingSystem sigPWR |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1258 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1259 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1260 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1261 |
sigQUIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1262 |
"return the signal number for SIGQUIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1263 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1264 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1265 |
^ self signalNamed:#SIGQUIT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1266 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1267 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1268 |
OperatingSystem sigQUIT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1269 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1270 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1271 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1272 |
sigRETRACT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1273 |
"return the signal number for SIGRETRACT - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1274 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1275 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1276 |
^ self signalNamed:#SIGRETRACT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1277 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1278 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1279 |
OperatingSystem sigRETRACT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1280 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1281 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1282 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1283 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1284 |
sigSAK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1285 |
"return the signal number for SIGSAK - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1286 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1287 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1288 |
^ self signalNamed:#SIGSAK |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1289 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1290 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1291 |
OperatingSystem sigSAK |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1292 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1293 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1294 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1295 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1296 |
sigSEGV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1297 |
"return the signal number for SIGSEGV - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1298 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1299 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1300 |
^ self signalNamed:#SIGSEGV |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1301 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1302 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1303 |
OperatingSystem sigSEGV |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1304 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1305 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1306 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1307 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1308 |
sigSOUND |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1309 |
"return the signal number for SIGSOUND - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1310 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1311 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1312 |
^ self signalNamed:#SIGSOUND |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1313 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1314 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1315 |
OperatingSystem sigSOUND |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1316 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1317 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1318 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1319 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1320 |
sigSTOP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1321 |
"return the signal number for SIGSTOP - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1322 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1323 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1324 |
^ self signalNamed:#SIGSTOP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1325 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1326 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1327 |
OperatingSystem sigSTOP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1328 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1329 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1330 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1331 |
sigSYS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1332 |
"return the signal number for SIGSYS - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1333 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1334 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1335 |
^ self signalNamed:#SIGSYS |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1336 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1337 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1338 |
OperatingSystem sigSYS |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1339 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1340 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1341 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1342 |
sigTERM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1343 |
"return the signal number for SIGTERM - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1344 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1345 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1346 |
^ self signalNamed:#SIGTERM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1347 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1348 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1349 |
OperatingSystem sigTERM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1350 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1351 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1352 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1353 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1354 |
sigTRAP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1355 |
"return the signal number for SIGTRAP - 0 if not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1356 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1357 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1358 |
^ self signalNamed:#SIGTRAP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1359 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1360 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1361 |
OperatingSystem sigTRAP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1362 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1363 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1364 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1365 |
sigTSTP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1366 |
"return the signal number for SIGTSTP - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1367 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1368 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1369 |
^ self signalNamed:#SIGTSTP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1370 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1371 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1372 |
OperatingSystem sigTSTP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1373 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1374 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1375 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1376 |
sigTTIN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1377 |
"return the signal number for SIGTTIN - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1378 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1379 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1380 |
^ self signalNamed:#SIGTTIN |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1381 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1382 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1383 |
OperatingSystem sigTTIN |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1384 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1385 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1386 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1387 |
sigTTOU |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1388 |
"return the signal number for SIGTTOU - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1389 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1390 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1391 |
^ self signalNamed:#SIGTTOU |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1392 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1393 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1394 |
OperatingSystem sigTTOU |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1395 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1396 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1397 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1398 |
sigURG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1399 |
"return the signal number for SIGURG - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1400 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1401 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1402 |
^ self signalNamed:#SIGURG |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1403 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1404 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1405 |
OperatingSystem sigURG |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1406 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1407 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1408 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1409 |
sigUSR1 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1410 |
"return the signal number for SIGUSR1 - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1411 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1412 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1413 |
^ self signalNamed:#SIGUSR1 |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1414 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1415 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1416 |
OperatingSystem sigUSR1 |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1417 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1418 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1419 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1420 |
sigUSR2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1421 |
"return the signal number for SIGUSR2 - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1422 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1423 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1424 |
^ self signalNamed:#SIGUSR2 |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1425 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1426 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1427 |
OperatingSystem sigUSR2 |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1428 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1429 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1430 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1431 |
sigVTALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1432 |
"return the signal number for SIGVTALRM - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1433 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1434 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1435 |
^ self signalNamed:#SIGVTALRM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1436 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1437 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1438 |
OperatingSystem sigVTALRM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1439 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1440 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1441 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1442 |
sigWINCH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1443 |
"return the signal number for SIGWINCH - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1444 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1445 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1446 |
^ self signalNamed:#SIGWINCH |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1447 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1448 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1449 |
OperatingSystem sigWINCH |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1450 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1451 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1452 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1453 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1454 |
sigXCPU |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1455 |
"return the signal number for SIGXCPU - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1456 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1457 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1458 |
^ self signalNamed:#SIGXCPU |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1459 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1460 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1461 |
OperatingSystem sigXCPU |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1462 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1463 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1464 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1465 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1466 |
sigXFSZ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1467 |
"return the signal number for SIGXFSZ - 0 if not supported |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1468 |
(the numeric value is not the same across unix-systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1469 |
|
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1470 |
^ self signalNamed:#SIGXFSZ |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1471 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1472 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1473 |
OperatingSystem sigXFSZ |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1474 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1475 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1476 |
! |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1477 |
|
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1478 |
signalNamed:signalName |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1479 |
"return the signal number for a named signal (must be a symbol) |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1480 |
Return 0 if that signal is not supported by the OS |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1481 |
(NOTICE: the numeric value is not the same across unix-systems, |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1482 |
therefore do not remember or hardcode those numbers in the application)" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1483 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1484 |
%{ /* NOCONTEXT */ |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1485 |
#ifdef SIGABRT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1486 |
if (signalName == @symbol(SIGABRT)) { |
6050 | 1487 |
RETURN ( __MKSMALLINT(SIGABRT) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1488 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1489 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1490 |
#ifdef SIGALRM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1491 |
if (signalName == @symbol(SIGALRM)) { |
6050 | 1492 |
RETURN ( __MKSMALLINT(SIGALRM) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1493 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1494 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1495 |
#ifdef SIGBREAK |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1496 |
if (signalName == @symbol(SIGBREAK)) { |
6050 | 1497 |
RETURN ( __MKSMALLINT(SIGBREAK) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1498 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1499 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1500 |
#ifdef SIGBUS |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1501 |
if (signalName == @symbol(SIGBUS)) { |
6050 | 1502 |
RETURN ( __MKSMALLINT(SIGBUS) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1503 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1504 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1505 |
#ifdef SIGCHLD |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1506 |
if ((signalName == @symbol(SIGCHLD)) |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1507 |
|| (signalName == @symbol(SIGCLD)) ) { |
6050 | 1508 |
RETURN ( __MKSMALLINT(SIGCHLD) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1509 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1510 |
#else |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1511 |
# if defined(SIGCLD) |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1512 |
if ((signalName == @symbol(SIGCHLD)) |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1513 |
|| (signalName == @symbol(SIGCLD)) ) { |
6050 | 1514 |
RETURN ( __MKSMALLINT(SIGCLD) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1515 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1516 |
# endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1517 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1518 |
#ifdef SIGCONT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1519 |
if (signalName == @symbol(SIGCONT)) { |
6050 | 1520 |
RETURN ( __MKSMALLINT(SIGCONT) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1521 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1522 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1523 |
#ifdef SIGDANGER |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1524 |
if (signalName == @symbol(SIGDANGER)) { |
6050 | 1525 |
RETURN ( __MKSMALLINT(SIGDANGER) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1526 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1527 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1528 |
#ifdef SIGEMT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1529 |
if (signalName == @symbol(SIGEMT)) { |
6050 | 1530 |
RETURN ( __MKSMALLINT(SIGEMT) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1531 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1532 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1533 |
#ifdef SIGFPE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1534 |
if (signalName == @symbol(SIGFPE)) { |
6050 | 1535 |
RETURN ( __MKSMALLINT(SIGFPE) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1536 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1537 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1538 |
#ifdef SIGGRANT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1539 |
if (signalName == @symbol(SIGGRANT)) { |
6050 | 1540 |
RETURN ( __MKSMALLINT(SIGGRANT) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1541 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1542 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1543 |
#ifdef SIGHUP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1544 |
if (signalName == @symbol(SIGHUP)) { |
6050 | 1545 |
RETURN ( __MKSMALLINT(SIGHUP) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1546 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1547 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1548 |
#ifdef SIGILL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1549 |
if (signalName == @symbol(SIGILL)) { |
6050 | 1550 |
RETURN ( __MKSMALLINT(SIGILL) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1551 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1552 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1553 |
#ifdef SIGINT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1554 |
if (signalName == @symbol(SIGINT)) { |
6050 | 1555 |
RETURN ( __MKSMALLINT(SIGINT) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1556 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1557 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1558 |
#ifdef SIGIO |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1559 |
if (signalName == @symbol(SIGIO)) { |
6050 | 1560 |
RETURN ( __MKSMALLINT(SIGIO) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1561 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1562 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1563 |
#ifdef SIGIOT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1564 |
if (signalName == @symbol(SIGIOT)) { |
6050 | 1565 |
RETURN ( __MKSMALLINT(SIGIOT) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1566 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1567 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1568 |
#ifdef SIGKILL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1569 |
if (signalName == @symbol(SIGKILL)) { |
6050 | 1570 |
RETURN ( __MKSMALLINT(SIGKILL) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1571 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1572 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1573 |
#ifdef SIGLOST |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1574 |
if (signalName == @symbol(SIGLOST)) { |
6050 | 1575 |
RETURN ( __MKSMALLINT(SIGLOST) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1576 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1577 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1578 |
#ifdef SIGMIGRATE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1579 |
if (signalName == @symbol(SIGMIGRATE)) { |
6050 | 1580 |
RETURN ( __MKSMALLINT(SIGMIGRATE) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1581 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1582 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1583 |
#ifdef SIGMSG |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1584 |
if (signalName == @symbol(SIGMSG)) { |
6050 | 1585 |
RETURN ( __MKSMALLINT(SIGMSG) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1586 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1587 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1588 |
#ifdef SIGPIPE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1589 |
if (signalName == @symbol(SIGPIPE)) { |
6050 | 1590 |
RETURN ( __MKSMALLINT(SIGPIPE) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1591 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1592 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1593 |
#ifdef SIGPOLL |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1594 |
if (signalName == @symbol(SIGPOLL)) { |
6050 | 1595 |
RETURN ( __MKSMALLINT(SIGPOLL) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1596 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1597 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1598 |
#ifdef SIGPRE |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1599 |
if (signalName == @symbol(SIGPRE)) { |
6050 | 1600 |
RETURN ( __MKSMALLINT(SIGPRE) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1601 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1602 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1603 |
#ifdef SIGPROF |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1604 |
if (signalName == @symbol(SIGPROF)) { |
6050 | 1605 |
RETURN ( __MKSMALLINT(SIGPROF) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1606 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1607 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1608 |
#ifdef SIGPWR |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1609 |
if (signalName == @symbol(SIGPWR)) { |
6050 | 1610 |
RETURN ( __MKSMALLINT(SIGPWR) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1611 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1612 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1613 |
#ifdef SIGQUIT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1614 |
if (signalName == @symbol(SIGQUIT)) { |
6050 | 1615 |
RETURN ( __MKSMALLINT(SIGQUIT) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1616 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1617 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1618 |
#ifdef SIGRETRACT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1619 |
if (signalName == @symbol(SIGRETRACT)) { |
6050 | 1620 |
RETURN ( __MKSMALLINT(SIGRETRACT) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1621 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1622 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1623 |
#ifdef SIGSAK |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1624 |
if (signalName == @symbol(SIGSAK)) { |
6050 | 1625 |
RETURN ( __MKSMALLINT(SIGSAK) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1626 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1627 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1628 |
#ifdef SIGSEGV |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1629 |
if (signalName == @symbol(SIGSEGV)) { |
6050 | 1630 |
RETURN ( __MKSMALLINT(SIGSEGV) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1631 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1632 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1633 |
#ifdef SIGSOUND |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1634 |
if (signalName == @symbol(SIGSOUND)) { |
6050 | 1635 |
RETURN ( __MKSMALLINT(SIGSOUND) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1636 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1637 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1638 |
#ifdef SIGSTOP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1639 |
if (signalName == @symbol(SIGSTOP)) { |
6050 | 1640 |
RETURN ( __MKSMALLINT(SIGSTOP) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1641 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1642 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1643 |
#ifdef SIGSYS |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1644 |
if (signalName == @symbol(SIGSYS)) { |
6050 | 1645 |
RETURN ( __MKSMALLINT(SIGSYS) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1646 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1647 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1648 |
#ifdef SIGTERM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1649 |
if (signalName == @symbol(SIGTERM)) { |
6050 | 1650 |
RETURN ( __MKSMALLINT(SIGTERM) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1651 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1652 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1653 |
#ifdef SIGTRAP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1654 |
if (signalName == @symbol(SIGTRAP)) { |
6050 | 1655 |
RETURN ( __MKSMALLINT(SIGTRAP) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1656 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1657 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1658 |
#ifdef SIGTSTP |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1659 |
if (signalName == @symbol(SIGTSTP)) { |
6050 | 1660 |
RETURN ( __MKSMALLINT(SIGTSTP) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1661 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1662 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1663 |
#ifdef SIGTTIN |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1664 |
if (signalName == @symbol(SIGTTIN)) { |
6050 | 1665 |
RETURN ( __MKSMALLINT(SIGTTIN) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1666 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1667 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1668 |
#ifdef SIGTTOU |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1669 |
if (signalName == @symbol(SIGTTOU)) { |
6050 | 1670 |
RETURN ( __MKSMALLINT(SIGTTOU) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1671 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1672 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1673 |
#ifdef SIGURG |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1674 |
if (signalName == @symbol(SIGURG)) { |
6050 | 1675 |
RETURN ( __MKSMALLINT(SIGURG) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1676 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1677 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1678 |
#ifdef SIGUSR1 |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1679 |
if (signalName == @symbol(SIGUSR1)) { |
6050 | 1680 |
RETURN ( __MKSMALLINT(SIGUSR1) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1681 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1682 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1683 |
#ifdef SIGUSR2 |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1684 |
if (signalName == @symbol(SIGUSR2)) { |
6050 | 1685 |
RETURN ( __MKSMALLINT(SIGUSR2) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1686 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1687 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1688 |
#ifdef SIGVTALRM |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1689 |
if (signalName == @symbol(SIGVTALRM)) { |
6050 | 1690 |
RETURN ( __MKSMALLINT(SIGVTALRM) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1691 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1692 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1693 |
#ifdef SIGWINCH |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1694 |
if (signalName == @symbol(SIGWINCH)) { |
6050 | 1695 |
RETURN ( __MKSMALLINT(SIGWINCH) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1696 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1697 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1698 |
#ifdef SIGXCPU |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1699 |
if (signalName == @symbol(SIGXCPU)) { |
6050 | 1700 |
RETURN ( __MKSMALLINT(SIGXCPU) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1701 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1702 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1703 |
#ifdef SIGXFSZ |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1704 |
if (signalName == @symbol(SIGXFSZ)) { |
6050 | 1705 |
RETURN ( __MKSMALLINT(SIGXFSZ) ); |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1706 |
} |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1707 |
#endif |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1708 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1709 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1710 |
%} |
5404
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1711 |
" |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1712 |
OperatingSystem signalNamed:#SIGABRT |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1713 |
OperatingSystem signalNamed:#SIGCHLD |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1714 |
OperatingSystem signalNamed:#SIGXFSZ |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1715 |
OperatingSystem signalNamed:#SIGSOUND |
633f3ccac244
reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents:
5233
diff
changeset
|
1716 |
" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1717 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1718 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1719 |
!UnixOperatingSystem class methodsFor:'error messages'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1720 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1721 |
currentErrorNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1722 |
"returns the OS's last error nr (i.e. the value of errno). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1723 |
Notice, that the value of this flag is only valid immediately |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1724 |
after the error occurred - it gets updated with every other |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1725 |
request to the OS. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1726 |
Use lastErrorNumber - currentErrorNumber is invalidated by |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1727 |
many, many internal calls." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1728 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1729 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1730 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1731 |
RETURN ( __MKSMALLINT(errno) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1732 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1733 |
" |
3795 | 1734 |
OperatingSystem currentErrorNumber |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1735 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1736 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1737 |
|
6287 | 1738 |
errorHolderForNumber:errNr |
1739 |
"return an osErrorHolder for the given error number (as returned by a system call)." |
|
1740 |
||
1741 |
|sym typ holder| |
|
1742 |
||
1743 |
%{ |
|
1744 |
/* claus: |
|
1745 |
* I made this primitive code, since errnos are not |
|
1746 |
* standard across unixes |
|
1747 |
*/ |
|
1748 |
||
1749 |
typ = @symbol(defaultOsErrorSignal); |
|
1750 |
sym = @symbol(ERROR_OTHER); |
|
1751 |
||
1752 |
if (__isSmallInteger(errNr)) { |
|
1753 |
switch ( __intVal(errNr)) { |
|
1754 |
/* |
|
1755 |
* POSIX errnos - these should be defined |
|
1756 |
*/ |
|
1757 |
#ifdef EPERM |
|
1758 |
case EPERM: |
|
1759 |
sym = @symbol(EPERM); |
|
1760 |
typ = @symbol(noPermissionsSignal); |
|
1761 |
break; |
|
1762 |
#endif |
|
1763 |
#ifdef ENOENT |
|
1764 |
case ENOENT: |
|
1765 |
sym = @symbol(ENOENT); |
|
1766 |
typ = @symbol(nonexistentSignal); |
|
1767 |
break; |
|
1768 |
#endif |
|
1769 |
#ifdef ESRCH |
|
1770 |
case ESRCH: |
|
1771 |
sym = @symbol(ESRCH); |
|
1772 |
typ = @symbol(unavailableReferentSignal); |
|
1773 |
break; |
|
1774 |
#endif |
|
1775 |
#ifdef EINTR |
|
1776 |
case EINTR: |
|
1777 |
sym = @symbol(EINTR); |
|
1778 |
typ = @symbol(transientErrorSignal); |
|
1779 |
break; |
|
1780 |
#endif |
|
1781 |
#ifdef EIO |
|
1782 |
case EIO: |
|
1783 |
sym = @symbol(EIO); |
|
1784 |
typ = @symbol(transferFaultSignal); |
|
1785 |
break; |
|
1786 |
#endif |
|
1787 |
#ifdef ENXIO |
|
1788 |
case ENXIO: |
|
1789 |
sym = @symbol(ENXIO); |
|
1790 |
typ = @symbol(unavailableReferentSignal); |
|
1791 |
break; |
|
1792 |
#endif |
|
1793 |
#ifdef E2BIG |
|
1794 |
case E2BIG: |
|
1795 |
sym = @symbol(E2BIG); |
|
1796 |
typ = @symbol(invalidArgumentsSignal); |
|
1797 |
break; |
|
1798 |
#endif |
|
1799 |
#ifdef ENOEXEC |
|
1800 |
case ENOEXEC: |
|
1801 |
sym = @symbol(ENOEXEC); |
|
1802 |
typ = @symbol(inappropriateOperationSignal); |
|
1803 |
break; |
|
1804 |
#endif |
|
1805 |
#ifdef EBADF |
|
1806 |
case EBADF: |
|
1807 |
sym = @symbol(EBADF); |
|
1808 |
typ = @symbol(badAccessorSignal); |
|
1809 |
break; |
|
1810 |
#endif |
|
1811 |
#ifdef ECHILD |
|
1812 |
case ECHILD: |
|
1813 |
sym = @symbol(ECHILD); |
|
1814 |
typ = @symbol(informationSignal); |
|
1815 |
break; |
|
1816 |
#endif |
|
1817 |
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN) |
|
1818 |
case EAGAIN: |
|
1819 |
sym = @symbol(EAGAIN); |
|
1820 |
typ = @symbol(notReadySignal); |
|
1821 |
break; |
|
1822 |
#endif |
|
1823 |
#ifdef ENOMEM |
|
1824 |
case ENOMEM: |
|
1825 |
sym = @symbol(ENOMEM); |
|
1826 |
typ = @symbol(noMemorySignal); |
|
1827 |
break; |
|
1828 |
#endif |
|
1829 |
#ifdef EACCES |
|
1830 |
case EACCES: |
|
1831 |
sym = @symbol(EACCES); |
|
1832 |
typ = @symbol(noPermissionsSignal); |
|
1833 |
break; |
|
1834 |
#endif |
|
1835 |
#ifdef EFAULT |
|
1836 |
case EFAULT: |
|
1837 |
sym = @symbol(EFAULT); |
|
1838 |
typ = @symbol(invalidArgumentsSignal); |
|
1839 |
break; |
|
1840 |
#endif |
|
1841 |
#ifdef EBUSY |
|
1842 |
case EBUSY: |
|
1843 |
sym = @symbol(EBUSY); |
|
1844 |
typ = @symbol(unavailableReferentSignal); |
|
1845 |
break; |
|
1846 |
#endif |
|
1847 |
#ifdef EEXIST |
|
1848 |
case EEXIST: |
|
1849 |
sym = @symbol(EEXIST); |
|
1850 |
typ = @symbol(existingReferentSignal); |
|
1851 |
break; |
|
1852 |
#endif |
|
1853 |
#ifdef EXDEV |
|
1854 |
case EXDEV: |
|
1855 |
sym = @symbol(EXDEV); |
|
1856 |
typ = @symbol(inappropriateReferentSignal); |
|
1857 |
break; |
|
1858 |
#endif |
|
1859 |
#ifdef ENODEV |
|
1860 |
case ENODEV: |
|
1861 |
sym = @symbol(ENODEV); |
|
1862 |
typ = @symbol(inaccessibleSignal); |
|
1863 |
break; |
|
1864 |
#endif |
|
1865 |
#ifdef ENOTDIR |
|
1866 |
case ENOTDIR: |
|
1867 |
sym = @symbol(ENOTDIR); |
|
1868 |
typ = @symbol(inappropriateOperationSignal); |
|
1869 |
break; |
|
1870 |
#endif |
|
1871 |
#ifdef EISDIR |
|
1872 |
case EISDIR: |
|
1873 |
sym = @symbol(EISDIR); |
|
1874 |
typ = @symbol(inappropriateOperationSignal); |
|
1875 |
break; |
|
1876 |
#endif |
|
1877 |
#ifdef EINVAL |
|
1878 |
case EINVAL: |
|
1879 |
sym = @symbol(EINVAL); |
|
1880 |
typ = @symbol(invalidArgumentsSignal); |
|
1881 |
break; |
|
1882 |
#endif |
|
1883 |
#ifdef ENFILE |
|
1884 |
case ENFILE: |
|
1885 |
sym = @symbol(ENFILE); |
|
1886 |
typ = @symbol(noResourcesSignal); |
|
1887 |
break; |
|
1888 |
#endif |
|
1889 |
#ifdef EMFILE |
|
1890 |
case EMFILE: |
|
1891 |
sym = @symbol(EMFILE); |
|
1892 |
typ = @symbol(noResourcesSignal); |
|
1893 |
break; |
|
1894 |
#endif |
|
1895 |
#ifdef ENOTTY |
|
1896 |
case ENOTTY: |
|
1897 |
sym = @symbol(ENOTTY); |
|
1898 |
typ = @symbol(inappropriateOperationSignal); |
|
1899 |
break; |
|
1900 |
#endif |
|
1901 |
#ifdef EFBIG |
|
1902 |
case EFBIG: |
|
1903 |
sym = @symbol(EFBIG); |
|
1904 |
typ = @symbol(noResourcesSignal); |
|
1905 |
break; |
|
1906 |
#endif |
|
1907 |
#ifdef ENOSPC |
|
1908 |
case ENOSPC: |
|
1909 |
sym = @symbol(ENOSPC); |
|
1910 |
typ = @symbol(noResourcesSignal); |
|
1911 |
break; |
|
1912 |
#endif |
|
1913 |
#ifdef ESPIPE |
|
1914 |
case ESPIPE: |
|
1915 |
sym = @symbol(ESPIPE); |
|
1916 |
typ = @symbol(inappropriateOperationSignal); |
|
1917 |
break; |
|
1918 |
#endif |
|
1919 |
#ifdef EROFS |
|
1920 |
case EROFS: |
|
1921 |
sym = @symbol(EROFS); |
|
1922 |
typ = @symbol(inappropriateOperationSignal); |
|
1923 |
break; |
|
1924 |
#endif |
|
1925 |
#ifdef EMLINK |
|
1926 |
case EMLINK: |
|
1927 |
sym = @symbol(EMLINK); |
|
1928 |
typ = @symbol(rangeErrorSignal); |
|
1929 |
break; |
|
1930 |
#endif |
|
1931 |
#ifdef EPIPE |
|
1932 |
case EPIPE: |
|
1933 |
sym = @symbol(EPIPE); |
|
1934 |
typ = @symbol(peerFaultSignal); |
|
1935 |
break; |
|
1936 |
#endif |
|
1937 |
#ifdef EDOM |
|
1938 |
case EDOM: |
|
1939 |
sym = @symbol(EDOM); |
|
1940 |
typ = @symbol(rangeErrorSignal); |
|
1941 |
break; |
|
1942 |
#endif |
|
1943 |
#ifdef ERANGE |
|
1944 |
case ERANGE: |
|
1945 |
sym = @symbol(ERANGE); |
|
1946 |
typ = @symbol(rangeErrorSignal); |
|
1947 |
break; |
|
1948 |
#endif |
|
1949 |
#ifdef EDEADLK |
|
1950 |
# if EDEADLK != EWOULDBLOCK |
|
1951 |
case EDEADLK: |
|
1952 |
sym = @symbol(EDEADLK); |
|
1953 |
typ = @symbol(noResourcesSignal); |
|
1954 |
break; |
|
1955 |
# endif |
|
1956 |
#endif |
|
1957 |
#ifdef ENAMETOOLONG |
|
1958 |
case ENAMETOOLONG: |
|
1959 |
sym = @symbol(ENAMETOOLONG); |
|
1960 |
typ = @symbol(rangeErrorSignal); |
|
1961 |
break; |
|
1962 |
#endif |
|
1963 |
#ifdef ENOLCK |
|
1964 |
case ENOLCK: |
|
1965 |
sym = @symbol(ENOLCK); |
|
1966 |
typ = @symbol(inappropriateOperationSignal); |
|
1967 |
break; |
|
1968 |
#endif |
|
1969 |
#ifdef ENOSYS |
|
1970 |
case ENOSYS: |
|
1971 |
sym = @symbol(ENOSYS); |
|
1972 |
typ = @symbol(inappropriateOperationSignal); |
|
1973 |
break; |
|
1974 |
#endif |
|
1975 |
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) |
|
1976 |
case ENOTEMPTY: |
|
1977 |
sym = @symbol(ENOTEMPTY); |
|
1978 |
typ = @symbol(inappropriateReferentSignal); |
|
1979 |
break; |
|
1980 |
#endif |
|
1981 |
#ifdef EILSEQ |
|
1982 |
case EILSEQ: |
|
1983 |
sym = @symbol(EILSEQ); |
|
1984 |
typ = @symbol(transferFaultSignal); |
|
1985 |
break; |
|
1986 |
#endif |
|
1987 |
/* |
|
1988 |
* XPG3 errnos - defined on most systems |
|
1989 |
*/ |
|
1990 |
#ifdef ENOTBLK |
|
1991 |
case ENOTBLK: |
|
1992 |
sym = @symbol(ENOTBLK); |
|
1993 |
typ = @symbol(inappropriateReferentSignal); |
|
1994 |
break; |
|
1995 |
#endif |
|
1996 |
#ifdef ETXTBSY |
|
1997 |
case ETXTBSY: |
|
1998 |
sym = @symbol(ETXTBSY); |
|
1999 |
typ = @symbol(inaccessibleSignal); |
|
2000 |
break; |
|
2001 |
#endif |
|
2002 |
/* |
|
2003 |
* some others |
|
2004 |
*/ |
|
2005 |
#ifdef EWOULDBLOCK |
|
2006 |
case EWOULDBLOCK: |
|
2007 |
sym = @symbol(EWOULDBLOCK); |
|
2008 |
typ = @symbol(notReadySignal); |
|
2009 |
break; |
|
2010 |
#endif |
|
2011 |
#ifdef ENOMSG |
|
2012 |
case ENOMSG: |
|
2013 |
sym = @symbol(ENOMSG); |
|
2014 |
typ = @symbol(noDataSignal); |
|
2015 |
break; |
|
2016 |
#endif |
|
2017 |
#ifdef ELOOP |
|
2018 |
case ELOOP: |
|
2019 |
sym = @symbol(ELOOP); |
|
2020 |
typ = @symbol(rangeErrorSignal); |
|
2021 |
break; |
|
2022 |
#endif |
|
2023 |
||
2024 |
/* |
|
2025 |
* some stream errors |
|
2026 |
*/ |
|
2027 |
#ifdef ETIME |
|
2028 |
case ETIME: |
|
2029 |
sym = @symbol(ETIME); |
|
2030 |
typ = @symbol(peerFaultSignal); |
|
2031 |
break; |
|
2032 |
#endif |
|
2033 |
#ifdef ENOSR |
|
2034 |
case ENOSR: |
|
2035 |
sym = @symbol(ENOSR); |
|
2036 |
typ = @symbol(noResourcesSignal); |
|
2037 |
break; |
|
2038 |
#endif |
|
2039 |
#ifdef ENOSTR |
|
2040 |
case ENOSTR: |
|
2041 |
sym = @symbol(ENOSTR); |
|
2042 |
typ = @symbol(inappropriateReferentSignal); |
|
2043 |
break; |
|
2044 |
#endif |
|
2045 |
#ifdef ECOMM |
|
2046 |
case ECOMM: |
|
2047 |
sym = @symbol(ECOMM); |
|
2048 |
typ = @symbol(transferFaultSignal); |
|
2049 |
break; |
|
2050 |
#endif |
|
2051 |
#ifdef EPROTO |
|
2052 |
case EPROTO: |
|
2053 |
sym = @symbol(EPROTO); |
|
2054 |
typ = @symbol(inappropriateOperationSignal); |
|
2055 |
break; |
|
2056 |
#endif |
|
2057 |
/* |
|
2058 |
* nfs errors |
|
2059 |
*/ |
|
2060 |
#ifdef ESTALE |
|
2061 |
case ESTALE: |
|
2062 |
sym = @symbol(ESTALE); |
|
2063 |
typ = @symbol(unavailableReferentSignal); |
|
2064 |
break; |
|
2065 |
#endif |
|
2066 |
#ifdef EREMOTE |
|
2067 |
case EREMOTE: |
|
2068 |
sym = @symbol(EREMOTE); |
|
2069 |
typ = @symbol(rangeErrorSignal); |
|
2070 |
break; |
|
2071 |
#endif |
|
2072 |
/* |
|
2073 |
* some networking errors |
|
2074 |
*/ |
|
2075 |
#ifdef EINPROGRESS |
|
2076 |
case EINPROGRESS: |
|
2077 |
sym = @symbol(EINPROGRESS); |
|
2078 |
typ = @symbol(operationStartedSignal); |
|
2079 |
break; |
|
2080 |
#endif |
|
2081 |
#ifdef EALREADY |
|
2082 |
case EALREADY: |
|
2083 |
sym = @symbol(EALREADY); |
|
2084 |
typ = @symbol(operationStartedSignal); |
|
2085 |
break; |
|
2086 |
#endif |
|
2087 |
#ifdef ENOTSOCK |
|
2088 |
case ENOTSOCK: |
|
2089 |
sym = @symbol(ENOTSOCK); |
|
2090 |
typ = @symbol(inappropriateOperationSignal); |
|
2091 |
break; |
|
2092 |
#endif |
|
2093 |
#ifdef EDESTADDRREQ |
|
2094 |
case EDESTADDRREQ: |
|
2095 |
sym = @symbol(EDESTADDRREQ); |
|
2096 |
typ = @symbol(underspecifiedSignal); |
|
2097 |
break; |
|
2098 |
#endif |
|
2099 |
#ifdef EMSGSIZE |
|
2100 |
case EMSGSIZE: |
|
2101 |
sym = @symbol(EMSGSIZE); |
|
2102 |
typ = @symbol(rangeErrorSignal); |
|
2103 |
break; |
|
2104 |
#endif |
|
2105 |
#ifdef EPROTOTYPE |
|
2106 |
case EPROTOTYPE: |
|
2107 |
sym = @symbol(EPROTOTYPE); |
|
2108 |
typ = @symbol(wrongSubtypeForOperationSignal); |
|
2109 |
break; |
|
2110 |
#endif |
|
2111 |
#ifdef ENOPROTOOPT |
|
2112 |
case ENOPROTOOPT: |
|
2113 |
sym = @symbol(ENOPROTOOPT); |
|
2114 |
typ = @symbol(unsupportedOperationSignal); |
|
2115 |
break; |
|
2116 |
#endif |
|
2117 |
#ifdef EPROTONOSUPPORT |
|
2118 |
case EPROTONOSUPPORT: |
|
2119 |
sym = @symbol(EPROTONOSUPPORT); |
|
2120 |
typ = @symbol(unsupportedOperationSignal); |
|
2121 |
break; |
|
2122 |
#endif |
|
2123 |
#ifdef ESOCKTNOSUPPORT |
|
2124 |
case ESOCKTNOSUPPORT: |
|
2125 |
sym = @symbol(ESOCKTNOSUPPORT); |
|
2126 |
typ = @symbol(unsupportedOperationSignal); |
|
2127 |
break; |
|
2128 |
#endif |
|
2129 |
#ifdef EOPNOTSUPP |
|
2130 |
case EOPNOTSUPP: |
|
2131 |
sym = @symbol(EOPNOTSUPP); |
|
2132 |
typ = @symbol(inappropriateOperationSignal); |
|
2133 |
break; |
|
2134 |
#endif |
|
2135 |
#ifdef EPFNOSUPPORT |
|
2136 |
case EPFNOSUPPORT: |
|
2137 |
sym = @symbol(EPFNOSUPPORT); |
|
2138 |
typ = @symbol(unsupportedOperationSignal); |
|
2139 |
break; |
|
2140 |
#endif |
|
2141 |
#ifdef EAFNOSUPPORT |
|
2142 |
case EAFNOSUPPORT: |
|
2143 |
sym = @symbol(EAFNOSUPPORT); |
|
2144 |
typ = @symbol(unsupportedOperationSignal); |
|
2145 |
break; |
|
2146 |
#endif |
|
2147 |
#ifdef EADDRINUSE |
|
2148 |
case EADDRINUSE: |
|
2149 |
sym = @symbol(EADDRINUSE); |
|
2150 |
typ = @symbol(existingReferentSignal); |
|
2151 |
break; |
|
2152 |
#endif |
|
2153 |
#ifdef EADDRNOTAVAIL |
|
2154 |
case EADDRNOTAVAIL: |
|
2155 |
sym = @symbol(EADDRNOTAVAIL); |
|
2156 |
typ = @symbol(noPermissionsSignal); |
|
2157 |
break; |
|
2158 |
#endif |
|
2159 |
#ifdef ETIMEDOUT |
|
2160 |
case ETIMEDOUT: |
|
2161 |
sym = @symbol(ETIMEDOUT); |
|
2162 |
typ = @symbol(peerFaultSignal); |
|
2163 |
break; |
|
2164 |
#endif |
|
2165 |
#ifdef ECONNREFUSED |
|
2166 |
case ECONNREFUSED: |
|
2167 |
sym = @symbol(ECONNREFUSED); |
|
2168 |
typ = @symbol(peerFaultSignal); |
|
2169 |
break; |
|
2170 |
#endif |
|
2171 |
#ifdef ENETDOWN |
|
2172 |
case ENETDOWN: |
|
2173 |
sym = @symbol(ENETDOWN); |
|
2174 |
typ = @symbol(peerFaultSignal); |
|
2175 |
break; |
|
2176 |
#endif |
|
2177 |
#ifdef ENETUNREACH |
|
2178 |
case ENETUNREACH: |
|
2179 |
sym = @symbol(ENETUNREACH); |
|
2180 |
typ = @symbol(peerFaultSignal); |
|
2181 |
break; |
|
2182 |
#endif |
|
2183 |
#ifdef ENETRESET |
|
2184 |
case ENETRESET: |
|
2185 |
sym = @symbol(ENETRESET); |
|
2186 |
typ = @symbol(peerFaultSignal); |
|
2187 |
break; |
|
2188 |
#endif |
|
2189 |
#ifdef ECONNABORTED |
|
2190 |
case ECONNABORTED: |
|
2191 |
sym = @symbol(ECONNABORTED); |
|
2192 |
typ = @symbol(peerFaultSignal); |
|
2193 |
break; |
|
2194 |
#endif |
|
2195 |
#ifdef ECONNRESET |
|
2196 |
case ECONNRESET: |
|
2197 |
sym = @symbol(ECONNRESET); |
|
2198 |
typ = @symbol(peerFaultSignal); |
|
2199 |
break; |
|
2200 |
#endif |
|
2201 |
#ifdef EISCONN |
|
2202 |
case EISCONN: |
|
2203 |
sym = @symbol(EISCONN); |
|
2204 |
typ = @symbol(unpreparedOperationSignal); |
|
2205 |
break; |
|
2206 |
#endif |
|
2207 |
#ifdef ENOTCONN |
|
2208 |
case ENOTCONN: |
|
2209 |
sym = @symbol(ENOTCONN); |
|
2210 |
typ = @symbol(unpreparedOperationSignal); |
|
2211 |
break; |
|
2212 |
#endif |
|
2213 |
#ifdef ESHUTDOWN |
|
2214 |
case ESHUTDOWN: |
|
2215 |
sym = @symbol(ESHUTDOWN); |
|
2216 |
typ = @symbol(unpreparedOperationSignal); |
|
2217 |
break; |
|
2218 |
#endif |
|
2219 |
#ifdef EHOSTDOWN |
|
2220 |
case EHOSTDOWN: |
|
2221 |
sym = @symbol(EHOSTDOWN); |
|
2222 |
typ = @symbol(peerFaultSignal); |
|
2223 |
break; |
|
2224 |
#endif |
|
2225 |
#ifdef EHOSTUNREACH |
|
2226 |
case EHOSTUNREACH: |
|
2227 |
sym = @symbol(EHOSTUNREACH); |
|
2228 |
typ = @symbol(peerFaultSignal); |
|
2229 |
break; |
|
2230 |
#endif |
|
2231 |
||
2232 |
default: |
|
2233 |
break; |
|
2234 |
} |
|
2235 |
} |
|
2236 |
%}. |
|
2237 |
holder := OSErrorHolder new. |
|
2238 |
holder errorSymbol:sym errorCategory:typ. |
|
2239 |
^ holder |
|
2240 |
||
2241 |
" |
|
2242 |
OperatingSystem errorHolderForNumber:4 |
|
2243 |
self errorHolderForNumber:(self errorNumberFor:#EPERM) |
|
2244 |
self errorHolderForNumber:(self errorNumberFor:#EIO) |
|
2245 |
self errorHolderForNumber:(self errorNumberFor:#ENXIO) |
|
2246 |
" |
|
2247 |
! |
|
2248 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2249 |
errorNumberFor:aSymbol |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2250 |
"given a symbolic error, return the numeric; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2251 |
(i.e. errorNumberFor:#EBADF returns EBADF's value). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2252 |
Use this, since error numbers are really not standard across unix systems." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2253 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2254 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2255 |
OBJ sym = aSymbol; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2256 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2257 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2258 |
* POSIX errnos - these should be defined |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2259 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2260 |
#ifdef EPERM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2261 |
if (sym == @symbol(EPERM)) { |
6287 | 2262 |
RETURN ( __MKSMALLINT(EPERM) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2263 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2264 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2265 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2266 |
#ifdef ENOENT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2267 |
if (sym == @symbol(ENOENT)) { |
6287 | 2268 |
RETURN ( __MKSMALLINT(ENOENT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2269 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2270 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2271 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2272 |
#ifdef ESRCH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2273 |
if (sym == @symbol(ESRCH)) { |
6287 | 2274 |
RETURN ( __MKSMALLINT(ESRCH) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2275 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2276 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2277 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2278 |
#ifdef EINTR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2279 |
if (sym == @symbol(EINTR)) { |
6287 | 2280 |
RETURN ( __MKSMALLINT(EINTR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2281 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2282 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2283 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2284 |
#ifdef EIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2285 |
if (sym == @symbol(EIO)) { |
6287 | 2286 |
RETURN ( __MKSMALLINT(EIO) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2287 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2288 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2289 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2290 |
#ifdef ENXIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2291 |
if (sym == @symbol(ENXIO)) { |
6287 | 2292 |
RETURN ( __MKSMALLINT(ENXIO) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2293 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2294 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2295 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2296 |
#ifdef E2BIG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2297 |
if (sym == @symbol(E2BIG)) { |
6287 | 2298 |
RETURN ( __MKSMALLINT(E2BIG) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2299 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2300 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2301 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2302 |
#ifdef ENOEXEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2303 |
if (sym == @symbol(ENOEXEC)) { |
6287 | 2304 |
RETURN ( __MKSMALLINT(ENOEXEC) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2305 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2306 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2307 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2308 |
#ifdef EBADF |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2309 |
if (sym == @symbol(EBADF)) { |
6287 | 2310 |
RETURN ( __MKSMALLINT(EBADF) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2311 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2312 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2313 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2314 |
#ifdef ECHILD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2315 |
if (sym == @symbol(ECHILD)) { |
6287 | 2316 |
RETURN ( __MKSMALLINT(ECHILD) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2317 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2318 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2319 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2320 |
#if defined(EAGAIN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2321 |
if (sym == @symbol(EAGAIN)) { |
6287 | 2322 |
RETURN ( __MKSMALLINT(EAGAIN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2323 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2324 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2325 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2326 |
#ifdef ENOMEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2327 |
if (sym == @symbol(ENOMEM)) { |
6287 | 2328 |
RETURN ( __MKSMALLINT(ENOMEM) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2329 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2330 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2331 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2332 |
#ifdef EACCES |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2333 |
if (sym == @symbol(EACCES)) { |
6287 | 2334 |
RETURN ( __MKSMALLINT(EACCES) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2335 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2336 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2337 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2338 |
#ifdef EFAULT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2339 |
if (sym == @symbol(EFAULT)) { |
6287 | 2340 |
RETURN ( __MKSMALLINT(EFAULT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2341 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2342 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2343 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2344 |
#ifdef EBUSY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2345 |
if (sym == @symbol(EBUSY)) { |
6287 | 2346 |
RETURN ( __MKSMALLINT(EBUSY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2347 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2348 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2349 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2350 |
#ifdef EXDEV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2351 |
if (sym == @symbol(EXDEV)) { |
6287 | 2352 |
RETURN ( __MKSMALLINT(EXDEV) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2353 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2354 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2355 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2356 |
#ifdef ENODEV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2357 |
if (sym == @symbol(ENODEV)) { |
6287 | 2358 |
RETURN ( __MKSMALLINT(ENODEV) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2359 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2360 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2361 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2362 |
#ifdef ENOTDIR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2363 |
if (sym == @symbol(ENOTDIR)) { |
6287 | 2364 |
RETURN ( __MKSMALLINT(ENOTDIR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2365 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2366 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2367 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2368 |
#ifdef EISDIR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2369 |
if (sym == @symbol(EISDIR)) { |
6287 | 2370 |
RETURN ( __MKSMALLINT(EISDIR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2371 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2372 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2373 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2374 |
#ifdef EINVAL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2375 |
if (sym == @symbol(EINVAL)) { |
6287 | 2376 |
RETURN ( __MKSMALLINT(EINVAL) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2377 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2378 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2379 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2380 |
#ifdef ENFILE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2381 |
if (sym == @symbol(ENFILE)) { |
6287 | 2382 |
RETURN ( __MKSMALLINT(ENFILE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2383 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2384 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2385 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2386 |
#ifdef EMFILE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2387 |
if (sym == @symbol(EMFILE)) { |
6287 | 2388 |
RETURN ( __MKSMALLINT(EMFILE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2389 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2390 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2391 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2392 |
#ifdef ENOTTY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2393 |
if (sym == @symbol(ENOTTY)) { |
6287 | 2394 |
RETURN ( __MKSMALLINT(ENOTTY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2395 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2396 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2397 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2398 |
#ifdef EFBIG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2399 |
if (sym == @symbol(EFBIG)) { |
6287 | 2400 |
RETURN ( __MKSMALLINT(EFBIG) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2401 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2402 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2403 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2404 |
#ifdef ENOSPC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2405 |
if (sym == @symbol(ENOSPC)) { |
6287 | 2406 |
RETURN ( __MKSMALLINT(ENOSPC) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2407 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2408 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2409 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2410 |
#ifdef ESPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2411 |
if (sym == @symbol(ESPIPE)) { |
6287 | 2412 |
RETURN ( __MKSMALLINT(ESPIPE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2413 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2414 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2415 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2416 |
#ifdef EROFS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2417 |
if (sym == @symbol(EROFS)) { |
6287 | 2418 |
RETURN ( __MKSMALLINT(EROFS) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2419 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2420 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2421 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2422 |
#ifdef EMLINK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2423 |
if (sym == @symbol(EMLINK)) { |
6287 | 2424 |
RETURN ( __MKSMALLINT(EMLINK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2425 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2426 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2427 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2428 |
#ifdef EPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2429 |
if (sym == @symbol(EPIPE)) { |
6287 | 2430 |
RETURN ( __MKSMALLINT(EPIPE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2431 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2432 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2433 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2434 |
#ifdef EDOM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2435 |
if (sym == @symbol(EDOM)) { |
6287 | 2436 |
RETURN ( __MKSMALLINT(EDOM) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2437 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2438 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2439 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2440 |
#ifdef ERANGE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2441 |
if (sym == @symbol(ERANGE)) { |
6287 | 2442 |
RETURN ( __MKSMALLINT(ERANGE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2443 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2444 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2445 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2446 |
#ifdef EDEADLK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2447 |
if (sym == @symbol(EDEADLK)) { |
6287 | 2448 |
RETURN ( __MKSMALLINT(EDEADLK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2449 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2450 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2451 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2452 |
#ifdef ENAMETOOLONG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2453 |
if (sym == @symbol(ENAMETOOLONG)) { |
6287 | 2454 |
RETURN ( __MKSMALLINT(ENAMETOOLONG) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2455 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2456 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2457 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2458 |
#ifdef ENOLCK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2459 |
if (sym == @symbol(ENOLCK)) { |
6287 | 2460 |
RETURN ( __MKSMALLINT(ENOLCK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2461 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2462 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2463 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2464 |
#ifdef ENOSYS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2465 |
if (sym == @symbol(ENOSYS)) { |
6287 | 2466 |
RETURN ( __MKSMALLINT(ENOSYS) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2467 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2468 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2469 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2470 |
#ifdef ENOTEMPTY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2471 |
if (sym == @symbol(ENOTEMPTY)) { |
6287 | 2472 |
RETURN ( __MKSMALLINT(ENOTEMPTY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2473 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2474 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2475 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2476 |
#ifdef EEXIST |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2477 |
if (sym == @symbol(EEXIST)) { |
6287 | 2478 |
RETURN ( __MKSMALLINT(EEXIST) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2479 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2480 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2481 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2482 |
#ifdef EILSEQ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2483 |
if (sym == @symbol(EILSEQ)) { |
6287 | 2484 |
RETURN ( __MKSMALLINT(EILSEQ) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2485 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2486 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2487 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2488 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2489 |
* XPG3 errnos - defined on most systems |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2490 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2491 |
#ifdef ENOTBLK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2492 |
if (sym == @symbol(ENOTBLK)) { |
6287 | 2493 |
RETURN ( __MKSMALLINT(ENOTBLK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2494 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2495 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2496 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2497 |
#ifdef ETXTBSY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2498 |
if (sym == @symbol(ETXTBSY)) { |
6287 | 2499 |
RETURN ( __MKSMALLINT(ETXTBSY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2500 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2501 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2502 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2503 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2504 |
* some others |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2505 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2506 |
#ifdef EWOULDBLOCK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2507 |
if (sym == @symbol(EWOULDBLOCK)) { |
6287 | 2508 |
RETURN ( __MKSMALLINT(EWOULDBLOCK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2509 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2510 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2511 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2512 |
#ifdef ENOMSG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2513 |
if (sym == @symbol(ENOMSG)) { |
6287 | 2514 |
RETURN ( __MKSMALLINT(ENOMSG) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2515 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2516 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2517 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2518 |
#ifdef ELOOP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2519 |
if (sym == @symbol(ELOOP)) { |
6287 | 2520 |
RETURN ( __MKSMALLINT(ELOOP) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2521 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2522 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2523 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2524 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2525 |
* some stream errors |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2526 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2527 |
#ifdef ETIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2528 |
if (sym == @symbol(ETIME)) { |
6287 | 2529 |
RETURN ( __MKSMALLINT(ETIME) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2530 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2531 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2532 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2533 |
#ifdef ENOSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2534 |
if (sym == @symbol(ENOSR)) { |
6287 | 2535 |
RETURN ( __MKSMALLINT(ENOSR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2536 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2537 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2538 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2539 |
#ifdef ENOSTR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2540 |
if (sym == @symbol(ENOSTR)) { |
6287 | 2541 |
RETURN ( __MKSMALLINT(ENOSTR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2542 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2543 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2544 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2545 |
#ifdef ECOMM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2546 |
if (sym == @symbol(ECOMM)) { |
6287 | 2547 |
RETURN ( __MKSMALLINT(ECOMM) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2548 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2549 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2550 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2551 |
#ifdef EPROTO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2552 |
if (sym == @symbol(EPROTO)) { |
6287 | 2553 |
RETURN ( __MKSMALLINT(EPROTO) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2554 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2555 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2556 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2557 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2558 |
* nfs errors |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2559 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2560 |
#ifdef ESTALE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2561 |
if (sym == @symbol(ESTALE)) { |
6287 | 2562 |
RETURN ( __MKSMALLINT(ESTALE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2563 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2564 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2565 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2566 |
#ifdef EREMOTE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2567 |
if (sym == @symbol(EREMOTE)) { |
6287 | 2568 |
RETURN ( __MKSMALLINT(EREMOTE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2569 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2570 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2571 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2572 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2573 |
* some networking errors |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2574 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2575 |
#ifdef EINPROGRESS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2576 |
if (sym == @symbol(EINPROGRESS)) { |
6287 | 2577 |
RETURN ( __MKSMALLINT(EINPROGRESS) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2578 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2579 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2580 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2581 |
#ifdef EALREADY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2582 |
if (sym == @symbol(EALREADY)) { |
6287 | 2583 |
RETURN ( __MKSMALLINT(EALREADY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2584 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2585 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2586 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2587 |
#ifdef ENOTSOCK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2588 |
if (sym == @symbol(ENOTSOCK)) { |
6287 | 2589 |
RETURN ( __MKSMALLINT(ENOTSOCK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2590 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2591 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2592 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2593 |
#ifdef EDESTADDRREQ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2594 |
if (sym == @symbol(EDESTADDRREQ)) { |
6287 | 2595 |
RETURN ( __MKSMALLINT(EDESTADDRREQ) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2596 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2597 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2598 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2599 |
#ifdef EMSGSIZE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2600 |
if (sym == @symbol(EMSGSIZE)) { |
6287 | 2601 |
RETURN ( __MKSMALLINT(EMSGSIZE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2602 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2603 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2604 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2605 |
#ifdef EPROTOTYPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2606 |
if (sym == @symbol(EPROTOTYPE)) { |
6287 | 2607 |
RETURN ( __MKSMALLINT(EPROTOTYPE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2608 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2609 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2610 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2611 |
#ifdef ENOPROTOOPT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2612 |
if (sym == @symbol(ENOPROTOOPT)) { |
6287 | 2613 |
RETURN ( __MKSMALLINT(ENOPROTOOPT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2614 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2615 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2616 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2617 |
#ifdef EPROTONOSUPPORT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2618 |
if (sym == @symbol(EPROTONOSUPPORT)) { |
6287 | 2619 |
RETURN ( __MKSMALLINT(EPROTONOSUPPORT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2620 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2621 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2622 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2623 |
#ifdef ESOCKTNOSUPPORT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2624 |
if (sym == @symbol(ESOCKTNOSUPPORT)) { |
6287 | 2625 |
RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2626 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2627 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2628 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2629 |
#ifdef EOPNOTSUPP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2630 |
if (sym == @symbol(EOPNOTSUPP)) { |
6287 | 2631 |
RETURN ( __MKSMALLINT(EOPNOTSUPP) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2632 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2633 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2634 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2635 |
#ifdef EPFNOSUPPORT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2636 |
if (sym == @symbol(EPFNOSUPPORT)) { |
6287 | 2637 |
RETURN ( __MKSMALLINT(EPFNOSUPPORT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2638 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2639 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2640 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2641 |
#ifdef EAFNOSUPPORT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2642 |
if (sym == @symbol(EAFNOSUPPORT)) { |
6287 | 2643 |
RETURN ( __MKSMALLINT(EAFNOSUPPORT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2644 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2645 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2646 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2647 |
#ifdef EADDRINUSE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2648 |
if (sym == @symbol(EADDRINUSE)) { |
6287 | 2649 |
RETURN ( __MKSMALLINT(EADDRINUSE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2650 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2651 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2652 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2653 |
#ifdef EADDRNOTAVAIL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2654 |
if (sym == @symbol(EADDRNOTAVAIL)) { |
6287 | 2655 |
RETURN ( __MKSMALLINT(EADDRNOTAVAIL) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2656 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2657 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2658 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2659 |
#ifdef ETIMEDOUT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2660 |
if (sym == @symbol(ETIMEDOUT)) { |
6287 | 2661 |
RETURN ( __MKSMALLINT(ETIMEDOUT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2662 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2663 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2664 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2665 |
#ifdef ECONNREFUSED |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2666 |
if (sym == @symbol(ECONNREFUSED)) { |
6287 | 2667 |
RETURN ( __MKSMALLINT(ECONNREFUSED) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2668 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2669 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2670 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2671 |
#ifdef ENETDOWN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2672 |
if (sym == @symbol(ENETDOWN)) { |
6287 | 2673 |
RETURN ( __MKSMALLINT(ENETDOWN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2674 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2675 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2676 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2677 |
#ifdef ENETUNREACH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2678 |
if (sym == @symbol(ENETUNREACH)) { |
6287 | 2679 |
RETURN ( __MKSMALLINT(ENETUNREACH) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2680 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2681 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2682 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2683 |
#ifdef ENETRESET |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2684 |
if (sym == @symbol(ENETRESET)) { |
6287 | 2685 |
RETURN ( __MKSMALLINT(ENETRESET) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2686 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2687 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2688 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2689 |
#ifdef ECONNABORTED |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2690 |
if (sym == @symbol(ECONNABORTED)) { |
6287 | 2691 |
RETURN ( __MKSMALLINT(ECONNABORTED) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2692 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2693 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2694 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2695 |
#ifdef ECONNRESET |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2696 |
if (sym == @symbol(ECONNRESET)) { |
6287 | 2697 |
RETURN ( __MKSMALLINT(ECONNRESET) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2698 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2699 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2700 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2701 |
#ifdef EISCONN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2702 |
if (sym == @symbol(EISCONN)) { |
6287 | 2703 |
RETURN ( __MKSMALLINT(EISCONN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2704 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2705 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2706 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2707 |
#ifdef ENOTCONN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2708 |
if (sym == @symbol(ENOTCONN)) { |
6287 | 2709 |
RETURN ( __MKSMALLINT(ENOTCONN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2710 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2711 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2712 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2713 |
#ifdef ESHUTDOWN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2714 |
if (sym == @symbol(ESHUTDOWN)) { |
6287 | 2715 |
RETURN ( __MKSMALLINT(ESHUTDOWN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2716 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2717 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2718 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2719 |
#ifdef EHOSTDOWN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2720 |
if (sym == @symbol(EHOSTDOWN)) { |
6287 | 2721 |
RETURN ( __MKSMALLINT(EHOSTDOWN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2722 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2723 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2724 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2725 |
#ifdef EHOSTUNREACH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2726 |
if (sym == @symbol(EHOSTUNREACH)) { |
6287 | 2727 |
RETURN ( __MKSMALLINT(EHOSTUNREACH) ); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2728 |
} |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2729 |
#endif |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2730 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2731 |
^ -1 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2732 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2733 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2734 |
!UnixOperatingSystem class methodsFor:'executing OS commands'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2735 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2736 |
commandAndArgsForOSCommand:aCommandString |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2737 |
"get a shell and shell arguments for command execution" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2738 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2739 |
|shell args| |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2740 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2741 |
"/ |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2742 |
"/ '/bin/sh -c <command>' |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2743 |
"/ |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2744 |
shell := '/bin/sh'. |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2745 |
args := Array with:'sh' with:'-c' with:aCommandString. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2746 |
^ Array with:shell with:args |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2747 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2748 |
"Modified: / 20.1.1998 / 16:57:19 / md" |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2749 |
"Modified: / 5.6.1998 / 17:40:48 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2750 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2751 |
|
3663 | 2752 |
exec:aCommandPath withArguments:argColl environment:env fileDescriptors:fdColl closeDescriptors:closeFdColl fork:doFork newPgrp:newPgrp inDirectory:aDirectory |
2753 |
"Internal lowLevel entry for combined fork & exec; |
|
2754 |
||
2755 |
If fork is false (chain a command): |
|
6050 | 2756 |
execute the OS command specified by the argument, aCommandPath, with |
2757 |
arguments in argArray (no arguments, if nil). |
|
2758 |
If successful, this method does not return and smalltalk is gone. |
|
2759 |
If not successful, it does return. |
|
2760 |
Normal use is with forkForCommand. |
|
3663 | 2761 |
|
2762 |
If fork is true (subprocess command execution): |
|
6050 | 2763 |
fork a child to do the above. |
2764 |
The process id of the child process is returned; nil if the fork failed. |
|
3663 | 2765 |
|
2766 |
fdArray contains the filedescriptors, to be used for the child (if fork is true). |
|
6050 | 2767 |
fdArray[1] = 15 -> use fd 15 as stdin. |
2768 |
If an element of the array is set to nil, the corresponding filedescriptor |
|
2769 |
will be closed for the child. |
|
2770 |
fdArray[0] == StdIn for child |
|
2771 |
fdArray[1] == StdOut for child |
|
2772 |
fdArray[2] == StdErr for child |
|
2773 |
on VMS, these must be channels as returned by createMailBox. |
|
3663 | 2774 |
|
2775 |
closeFdArray contains descriptors that will be closed in the subprocess. |
|
6050 | 2776 |
closeDescriptors are ignored in the WIN32 & VMS versions. |
3663 | 2777 |
|
2778 |
If newPgrp is true, the subprocess will be established in a new process group. |
|
6050 | 2779 |
The processgroup will be equal to id. |
2780 |
newPgrp is not used on WIN32 and VMS systems. |
|
3663 | 2781 |
|
2782 |
env specifies environment variables which are passed differently from |
|
2783 |
the current environment. If non-nil, it must be a dictionary providing |
|
2784 |
key-value pairs for changed/added environment variables. |
|
2785 |
To pass a variable as empty (i.e. unset), pass a nil value. |
|
2786 |
||
2787 |
Notice: this used to be two separate ST-methods; however, in order to use |
|
6050 | 2788 |
vfork on some machines, it had to be merged into one, to avoid write |
2789 |
accesses to ST/X memory from the vforked-child. |
|
2790 |
The code below only does read accesses." |
|
3663 | 2791 |
|
2792 |
|envPairs argArray fdArray closeFdArray dirName| |
|
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2793 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2794 |
env notNil ifTrue:[ |
6050 | 2795 |
envPairs := OrderedCollection new. |
2796 |
env keysAndValuesDo:[:key :val | |
|
2797 |
envPairs add:key; add:val |
|
2798 |
]. |
|
2799 |
envPairs := envPairs asArray. |
|
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2800 |
]. |
3625 | 2801 |
argColl notNil ifTrue:[ |
6050 | 2802 |
argArray := argColl asArray |
3625 | 2803 |
]. |
2804 |
fdColl notNil ifTrue:[ |
|
6050 | 2805 |
fdArray := fdColl asArray |
3625 | 2806 |
]. |
2807 |
closeFdColl notNil ifTrue:[ |
|
6050 | 2808 |
closeFdArray := closeFdColl asArray |
3663 | 2809 |
]. |
2810 |
aDirectory notNil ifTrue:[ |
|
6050 | 2811 |
dirName := aDirectory asFilename name |
3625 | 2812 |
]. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2813 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2814 |
%{ /* STACK: 16000 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2815 |
char **argv; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2816 |
int nargs, i, id; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2817 |
OBJ arg; |
3564
eefdb0c79055
made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents:
3563
diff
changeset
|
2818 |
extern char **environ; |
3571 | 2819 |
char **_env, **_nEnv; |
3801
b4b3d6a6e48f
oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents:
3795
diff
changeset
|
2820 |
#ifndef __isArrayLike |
b4b3d6a6e48f
oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents:
3795
diff
changeset
|
2821 |
# define __isArrayLike __isArray |
b4b3d6a6e48f
oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents:
3795
diff
changeset
|
2822 |
#endif |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2823 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2824 |
if (__isString(aCommandPath) && |
6050 | 2825 |
((argArray == nil) || __isArrayLike(argArray)) && |
2826 |
((fdArray == nil) || __isArrayLike(fdArray)) && |
|
2827 |
((closeFdArray == nil) || __isArrayLike(closeFdArray)) |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2828 |
) { |
6050 | 2829 |
nargs = argArray == nil ? 0 : __arraySize(argArray); |
2830 |
argv = (char **) malloc(sizeof(char *) * (nargs + 1)); |
|
2831 |
if (argv) { |
|
2832 |
int nOldEnv, nNewEnv; |
|
2833 |
||
2834 |
for (i=0; i < nargs; i++) { |
|
2835 |
arg = __ArrayInstPtr(argArray)->a_element[i]; |
|
2836 |
if (__isString(arg)) { |
|
2837 |
argv[i] = (char *) __stringVal(arg); |
|
2838 |
} else { |
|
2839 |
argv[i] = ""; |
|
2840 |
} |
|
2841 |
} |
|
2842 |
argv[i] = NULL; |
|
2843 |
||
2844 |
/* |
|
2845 |
* number of new items in environment .. |
|
2846 |
*/ |
|
2847 |
nNewEnv = 0; |
|
2848 |
if ((envPairs != nil) && __isArrayLike(envPairs)) { |
|
2849 |
nNewEnv = __arraySize(envPairs) / 2; |
|
2850 |
} |
|
2851 |
||
2852 |
if (nNewEnv == 0) { |
|
2853 |
_nEnv = environ; |
|
2854 |
} else { |
|
2855 |
_env = environ; |
|
2856 |
/* |
|
2857 |
* get size of environment |
|
2858 |
*/ |
|
2859 |
nOldEnv = 0; |
|
2860 |
if (_env) { |
|
2861 |
while (*_env) { |
|
2862 |
nOldEnv++; |
|
2863 |
_env++; |
|
2864 |
} |
|
2865 |
} |
|
2866 |
||
2867 |
/* |
|
2868 |
* generate a new environment |
|
2869 |
* I have not found a spec which defines if |
|
2870 |
* items at the end overwrite previous definitions, |
|
2871 |
* or if the first encountered definition is valid. |
|
2872 |
* To be prepared for any case, simply add the new definitions |
|
2873 |
* at both ends - that should do it in any case. |
|
2874 |
* Someone with more know-how may want to fix this. |
|
2875 |
*/ |
|
2876 |
_nEnv = (char **)malloc(sizeof(char *) * (nNewEnv + nOldEnv + nNewEnv + 1)); |
|
2877 |
if (_nEnv) { |
|
2878 |
char **eO, **eN; |
|
2879 |
||
2880 |
eN = _nEnv; |
|
2881 |
if (nNewEnv) { |
|
2882 |
/* |
|
2883 |
* add new items at the front ... |
|
2884 |
*/ |
|
2885 |
int i; |
|
2886 |
||
2887 |
for (i=0; (i+1)<__arraySize(envPairs); i+=2) { |
|
2888 |
OBJ t; |
|
2889 |
char *var, *val, *e; |
|
2890 |
||
2891 |
t = __ArrayInstPtr(envPairs)->a_element[i]; |
|
2892 |
if (__isString(t) || __isSymbol(t)) { |
|
2893 |
var = (char *)__stringVal(t); |
|
2894 |
t = __ArrayInstPtr(envPairs)->a_element[i+1]; |
|
2895 |
if (__isString(t) || __isSymbol(t)) { |
|
2896 |
val = (char *)__stringVal(t); |
|
2897 |
} else { |
|
2898 |
val = NULL; |
|
2899 |
} |
|
2900 |
if (val != NULL) { |
|
2901 |
e = (char *)malloc(strlen(var) + 1 + strlen(val) + 1); |
|
2902 |
strcpy(e, var); |
|
2903 |
strcat(e, "="); |
|
2904 |
strcat(e, val); |
|
2905 |
} else { |
|
2906 |
e = (char *)malloc(strlen(var) + 1 + 1); |
|
2907 |
strcpy(e, var); |
|
2908 |
strcat(e, "="); |
|
2909 |
} |
|
2910 |
*eN++ = e; |
|
2911 |
} |
|
2912 |
} |
|
2913 |
} |
|
2914 |
||
2915 |
if (nOldEnv) { |
|
2916 |
/* |
|
2917 |
* append old environment |
|
2918 |
*/ |
|
2919 |
eO = environ; |
|
2920 |
while (*eN = *eO++) { |
|
2921 |
eN++; |
|
2922 |
} |
|
2923 |
} |
|
2924 |
||
2925 |
if (nNewEnv) { |
|
2926 |
/* |
|
2927 |
* new items again at the end |
|
2928 |
*/ |
|
2929 |
for (eO = _nEnv, i=0; i<nNewEnv; i++) { |
|
2930 |
*eN++ = *eO++; |
|
2931 |
} |
|
2932 |
||
2933 |
*eN = NULL; |
|
2934 |
} |
|
2935 |
} |
|
2936 |
} |
|
2937 |
||
2938 |
if (doFork == true) { |
|
2939 |
/* |
|
2940 |
* fork a subprocess. |
|
2941 |
*/ |
|
2942 |
int nfd, nclose; |
|
2943 |
||
2944 |
nfd = fdArray == nil ? 0 : __arraySize(fdArray); |
|
2945 |
nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray); |
|
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2946 |
#ifdef HAS_VFORK |
6050 | 2947 |
id = vfork(); |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2948 |
#else |
6050 | 2949 |
id = fork(); |
2950 |
#endif |
|
2951 |
if (id == 0) { |
|
2952 |
/* |
|
2953 |
** In child. |
|
2954 |
** first: dup filedescriptors |
|
2955 |
*/ |
|
2956 |
for (i = 0; i < nfd; i++) { |
|
2957 |
OBJ fd; |
|
2958 |
int rslt; |
|
2959 |
||
2960 |
fd = __ArrayInstPtr(fdArray)->a_element[i]; |
|
2961 |
if (__isSmallInteger(fd) && (__intVal(fd) != i)) { |
|
2962 |
do { |
|
2963 |
rslt = dup2(__intVal(fd), i); |
|
2964 |
} while ((rslt < 0) && (errno == EINTR)); |
|
2965 |
} |
|
2966 |
} |
|
2967 |
/* |
|
2968 |
** second: close unused filedescriptors |
|
2969 |
*/ |
|
2970 |
for (i = 0; i < nfd; i++) { |
|
2971 |
if (__ArrayInstPtr(fdArray)->a_element[i] == nil) { |
|
2972 |
close(i); |
|
2973 |
} |
|
2974 |
} |
|
2975 |
/* |
|
2976 |
** third: close filedescriptors |
|
2977 |
*/ |
|
2978 |
for (i = 0; i < nclose; i++) { |
|
2979 |
OBJ fd; |
|
2980 |
||
2981 |
fd = __ArrayInstPtr(closeFdArray)->a_element[i]; |
|
2982 |
if (__isSmallInteger(fd)) { |
|
2983 |
close(__intVal(fd)); |
|
2984 |
} |
|
2985 |
} |
|
2986 |
||
2987 |
if (newPgrp == true) { |
|
3564
eefdb0c79055
made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents:
3563
diff
changeset
|
2988 |
#ifndef NEXT |
6050 | 2989 |
setsid(); |
3564
eefdb0c79055
made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents:
3563
diff
changeset
|
2990 |
#endif |
3555
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
2991 |
#if defined(TIOCSCTTY) |
6050 | 2992 |
ioctl(0, TIOCSCTTY, 0) ; |
3561 | 2993 |
#endif |
2994 |
||
3555
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
2995 |
#if defined(TIOCSPGRP) |
6050 | 2996 |
{ |
2997 |
int pgrp = getpid(); |
|
2998 |
||
2999 |
ioctl(0, TIOCSPGRP, (char *)&pgrp); |
|
3000 |
} |
|
3555
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3001 |
#endif |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3002 |
#if defined(_POSIX_JOB_CONTROL) |
6050 | 3003 |
(void) setpgid(0, 0); |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3004 |
#else |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3005 |
# if defined(BSD) || defined(LINUX) |
6050 | 3006 |
(void) setpgrp(0); |
3007 |
# endif |
|
3008 |
#endif |
|
3009 |
} |
|
3010 |
||
3011 |
if (dirName != nil) { |
|
3012 |
chdir(__stringVal(dirName)); |
|
3013 |
} |
|
3014 |
||
3015 |
execve(__stringVal(aCommandPath), argv, _nEnv); |
|
3016 |
/* should not be reached */ |
|
3017 |
_exit(127); /* POSIX 2 compatible exit value */ |
|
3018 |
} |
|
3019 |
||
3020 |
} else { |
|
3021 |
if (dirName != nil) { |
|
3022 |
chdir(__stringVal(dirName)); |
|
3023 |
} |
|
3024 |
/* |
|
3025 |
* no subprocess (i.e. transfer to another program) |
|
3026 |
*/ |
|
3027 |
execve(__stringVal(aCommandPath), argv, _nEnv); |
|
3028 |
/* |
|
3029 |
* should not be reached |
|
3030 |
* (well, it is, if you pass a wrong command-path) |
|
3031 |
*/ |
|
3032 |
id = -1; |
|
3033 |
} |
|
3034 |
||
3035 |
if (nNewEnv && (_nEnv != NULL)) { |
|
3036 |
/* |
|
3037 |
* free new environment stuff |
|
3038 |
*/ |
|
3039 |
for (i=0; i<nNewEnv;i++) { |
|
3040 |
char *e = _nEnv[i]; |
|
3041 |
||
3042 |
if (e) { |
|
3043 |
free(e); |
|
3044 |
} |
|
3045 |
} |
|
3046 |
free(_nEnv); |
|
3047 |
} |
|
3048 |
||
3049 |
free(argv); |
|
3050 |
||
3051 |
/* |
|
3052 |
* In parent: succes or failure |
|
3053 |
*/ |
|
3054 |
if (id == -1) { |
|
3055 |
RETURN (nil); |
|
3056 |
} else { |
|
3057 |
RETURN (__MKSMALLINT(id)); |
|
3058 |
} |
|
3059 |
} |
|
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3060 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3061 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3062 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3063 |
path-argument not string |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3064 |
or argArray not an array/nil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3065 |
or malloc failed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3066 |
or not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3067 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3068 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3069 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3070 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3071 |
|id| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3072 |
|
3795 | 3073 |
id := OperatingSystem fork. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3074 |
id == 0 ifTrue:[ |
6050 | 3075 |
'I am the child'. |
3076 |
OperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp'). |
|
3077 |
'not reached'. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3078 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3079 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3080 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3081 |
|id| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3082 |
|
3795 | 3083 |
id := OperatingSystem fork. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3084 |
id == 0 ifTrue:[ |
6050 | 3085 |
'I am the child'. |
3086 |
OperatingSystem |
|
3087 |
exec:'/bin/sh' |
|
3088 |
withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2'). |
|
3089 |
'not reached'. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3090 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3091 |
id printNL. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3092 |
(Delay forSeconds:3.5) wait. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3093 |
'killing ...' printNL. |
3795 | 3094 |
OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id. |
3095 |
OperatingSystem sendSignal:(OperatingSystem sigKILL) to:id |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3096 |
" |
3564
eefdb0c79055
made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents:
3563
diff
changeset
|
3097 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3098 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3099 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3100 |
executeCommand:aCommandString inDirectory:aDirectory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3101 |
"much like #executeCommand:, but changes the current directory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3102 |
for the command. Since this is OS specific, use this instead of |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3103 |
hardwiring any 'cd ..' command strings into your applictions." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3104 |
|
4018 | 3105 |
^ self |
6050 | 3106 |
executeCommand:aCommandString |
3107 |
inputFrom:nil |
|
3108 |
outputTo:nil |
|
3109 |
errorTo:nil |
|
3110 |
inDirectory:aDirectory asFilename name |
|
3111 |
onError:[:status| false]. |
|
4018 | 3112 |
|
3113 |
"/ | cmd | |
|
3114 |
"/ |
|
3115 |
"/ "/ unix - prepend a 'cd' to the command |
|
3116 |
"/ |
|
3117 |
"/ cmd := 'cd ' , aDirectory asFilename name, '; ' , aCommandString. |
|
3118 |
"/ ^ self executeCommand:cmd |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3119 |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3120 |
"Modified: / 20.1.1998 / 17:03:03 / md" |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3121 |
"Modified: / 5.6.1998 / 19:01:29 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3122 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3123 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3124 |
fork |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3125 |
"fork a new (HEAVY-weight) unix process. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3126 |
Not supported with MSDOS & VMS systems. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3127 |
Dont confuse this with Block>>fork, which creates |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3128 |
lightweight smalltalk processes. This method will return |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3129 |
0 to the child process, and a non-zero number (which is the childs |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3130 |
unix-process-id) to the parent (original) process. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3131 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3132 |
In normal situations, you dont need to use this low level entry; see |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3133 |
#startProcess: and #executCommand: for higher level interfaces." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3134 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3135 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3136 |
int pid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3137 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3138 |
pid = fork(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3139 |
RETURN ( __MKUINT(pid) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3140 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3141 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3142 |
"/ not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3143 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3144 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3145 |
^ UnsupportedOperationSignal raise |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3146 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3147 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3148 |
|id| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3149 |
|
3795 | 3150 |
id := OperatingSystem fork. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3151 |
id == 0 ifTrue:[ |
6050 | 3152 |
'I am the child process' printCR. |
3153 |
OperatingSystem exit |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3154 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3155 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3156 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3157 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3158 |
getStatusOfProcess:aProcessId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3159 |
"wait for a process to terminate and fetch its exit status. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3160 |
This is required to avoid zombie processes." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3161 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3162 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3163 |
int status; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3164 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3165 |
if (__isSmallInteger(aProcessId)) { |
6050 | 3166 |
pid_t pid = (pid_t)(__intVal(aProcessId)); |
3167 |
{ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3168 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3169 |
# ifdef NO_WAITPID |
6050 | 3170 |
pid_t child; |
3171 |
||
3172 |
do { |
|
3173 |
__BEGIN_INTERRUPTABLE__ |
|
3174 |
child = __wait (&status); |
|
3175 |
__END_INTERRUPTABLE__ |
|
3176 |
if (child < 0 && errno != EINTR) { |
|
3177 |
fprintf(stderr, "OS: child-wait errno=%d\n", errno); |
|
3178 |
status = -1; |
|
3179 |
break; |
|
3180 |
} |
|
3181 |
} while (child != pid); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3182 |
# else |
6050 | 3183 |
pid_t child; |
3184 |
||
3185 |
/* claus: the original did not care for EINTR here ... */ |
|
3186 |
do { |
|
3187 |
__BEGIN_INTERRUPTABLE__ |
|
3188 |
child = __waitpid (pid, &status, 0); |
|
3189 |
__END_INTERRUPTABLE__ |
|
3190 |
} while ((child != pid) && (errno == EINTR)); |
|
3191 |
if (child != pid) { |
|
3192 |
fprintf(stderr, "OS: child-waitpid errno=%d\n", errno); |
|
3193 |
status = -1; |
|
3194 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3195 |
# endif /* NO_WAITPID */ |
6050 | 3196 |
} |
3197 |
RETURN ( __MKSMALLINT(status)); |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3198 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3199 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3200 |
self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3201 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3202 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3203 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3204 |
pathOfCommand:aCommand |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3205 |
"find where aCommand's executable file is; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3206 |
return its full pathName if there is such a command, otherwise |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3207 |
return nil." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3208 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3209 |
|path f fExt| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3210 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3211 |
aCommand asFilename isAbsolute ifTrue:[ |
6050 | 3212 |
^ aCommand |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3213 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3214 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3215 |
path := self getEnvironment:'PATH'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3216 |
path notNil ifTrue:[ |
6050 | 3217 |
(path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path | |
3218 |
path isEmpty ifTrue:[ |
|
3219 |
f := aCommand asFilename |
|
3220 |
] ifFalse:[ |
|
3221 |
f := path asFilename construct:aCommand. |
|
3222 |
]. |
|
3223 |
self executableFileExtensions do:[:ext | |
|
3224 |
ext notEmpty ifTrue:[ |
|
3225 |
fExt := (f pathName , ext) asFilename. |
|
3226 |
] ifFalse:[ |
|
3227 |
fExt := f. |
|
3228 |
]. |
|
3229 |
fExt isExecutable ifTrue:[ |
|
3230 |
^ fExt pathName |
|
3231 |
]. |
|
3232 |
]. |
|
3233 |
]. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3234 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3235 |
^ nil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3236 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3237 |
"unix: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3238 |
|
3795 | 3239 |
OperatingSystem pathOfCommand:'fooBar' |
3240 |
OperatingSystem pathOfCommand:'ls' |
|
3241 |
OperatingSystem pathOfCommand:'cvs' |
|
3242 |
OperatingSystem pathOfCommand:'stx' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3243 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3244 |
"windows: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3245 |
|
3795 | 3246 |
OperatingSystem pathOfCommand:'windbg' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3247 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3248 |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3249 |
"Modified: / 5.6.1998 / 19:03:32 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3250 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3251 |
|
3928 | 3252 |
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream inDirectory:dir |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3253 |
"start executing the OS command as specified by the argument, aCommandString |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3254 |
as a separate process; do not wait for the command to finish. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3255 |
The commandString is passed to a shell for execution - see the description of |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3256 |
'sh -c' in your UNIX manual ('cmd.com' in your MSDOS manual). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3257 |
The command gets stdIn, stdOut and stdErr assigned from the arguments; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3258 |
each may be nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3259 |
Return the processId if successful, nil otherwise. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3260 |
Use #monitorPid:action: for synchronization and exec status return, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3261 |
or #killProcess: to stop it." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3262 |
|
4436
318297e533a6
use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
3263 |
|in out err shellAndArgs rslt| |
318297e533a6
use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
3264 |
|
4753 | 3265 |
aCommandString isNil ifTrue:[^ nil]. |
3266 |
||
4436
318297e533a6
use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
3267 |
(in := anExternalInStream) isNil ifTrue:[ |
6050 | 3268 |
in := '/dev/null' asFilename readStream |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3269 |
]. |
4436
318297e533a6
use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
3270 |
(out := anExternalOutStream) isNil ifTrue:[ |
6050 | 3271 |
out := '/dev/null' asFilename writeStream |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3272 |
]. |
4436
318297e533a6
use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
3273 |
(err := anExternalErrStream) isNil ifTrue:[ |
6050 | 3274 |
anExternalOutStream isNil ifTrue:[ |
3275 |
err := out |
|
3276 |
] ifFalse:[ |
|
3277 |
err := '/dev/null' asFilename writeStream |
|
3278 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3279 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3280 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3281 |
shellAndArgs := self commandAndArgsForOSCommand:aCommandString. |
4753 | 3282 |
|
4436
318297e533a6
use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
3283 |
rslt := self |
6050 | 3284 |
exec:(shellAndArgs at:1) |
3285 |
withArguments:(shellAndArgs at:2) |
|
3286 |
fileDescriptors:(Array with:in fileDescriptor |
|
3287 |
with:out fileDescriptor |
|
3288 |
with:err fileDescriptor) |
|
3289 |
closeDescriptors:nil |
|
3290 |
fork:true |
|
3291 |
newPgrp:true "/ false |
|
3292 |
inDirectory:dir. |
|
4436
318297e533a6
use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
3293 |
|
318297e533a6
use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents:
4395
diff
changeset
|
3294 |
^ rslt |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3295 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3296 |
"blocking at current prio (i.e. only higher prio threads execute): |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3297 |
|
3795 | 3298 |
OperatingSystem executeCommand:'ls -l > out'. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3299 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3300 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3301 |
"non-blocking (lower prio threads continue): |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3302 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3303 |
|in out err pid sema| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3304 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3305 |
in := 'out' asFilename readStream. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3306 |
out := 'out2' asFilename writeStream. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3307 |
err := 'err' asFilename writeStream. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3308 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3309 |
sema := Semaphore new. |
3795 | 3310 |
pid := OperatingSystem startProcess:'sleep 10; grep drw' inputFrom:in outputTo:out errorTo:err. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3311 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3312 |
The following will no longer work. monitorPid has disappeared |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3313 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3314 |
pid notNil ifTrue:[ |
6050 | 3315 |
Processor monitorPid:pid action:[:OSstatus | sema signal ]. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3316 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3317 |
in close. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3318 |
out close. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3319 |
err close. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3320 |
sema wait. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3321 |
Transcript showCR:'finished' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3322 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3323 |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3324 |
"Modified: / 21.3.1997 / 10:04:35 / dq" |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3325 |
"Modified: / 15.7.1997 / 16:03:51 / stefan" |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3326 |
"Modified: / 5.6.1998 / 19:03:51 / cg" |
3928 | 3327 |
"Created: / 12.11.1998 / 14:39:20 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3328 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3329 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3330 |
!UnixOperatingSystem class methodsFor:'file access'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3331 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3332 |
closeFd:anInteger |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3333 |
"low level close of a filedescriptor" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3334 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3335 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3336 |
if (__isSmallInteger(anInteger)) { |
5203 | 3337 |
if (@global(ExternalStream:FileOpenTrace) == true) { |
3338 |
fprintf(stderr, "close [UnixOp] fd=%d\n", __intVal(anInteger)); |
|
3339 |
} |
|
6050 | 3340 |
close(__intVal(anInteger)); |
3341 |
RETURN(self); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3342 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3343 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3344 |
^ self primitiveFailed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3345 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3346 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3347 |
createDirectory:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3348 |
"create a new directory with name 'aPathName', which may be an absolute |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3349 |
path, or relative to the current directory. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3350 |
Return true if successful (or the directory existed already), false if failed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3351 |
This is a low-level entry - use Filename protocol for compatibility." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3352 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3353 |
"/ if it already exists this is ok |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3354 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3355 |
(self isDirectory:aPathName) ifTrue:[^ true]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3356 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3357 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3358 |
if (__isString(aPathName)) { |
6050 | 3359 |
int ret; |
3360 |
||
3361 |
ret = mkdir(__stringVal(aPathName), 0755); |
|
3362 |
if (ret < 0) { |
|
3363 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3364 |
RETURN (false); |
|
3365 |
} |
|
3366 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3367 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3368 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3369 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3370 |
"/ self isUNIXlike ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3371 |
"/ ^ self executeCommand:('mkdir 2>/dev/null ', newPathName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3372 |
"/ ]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3373 |
"/ ^ self executeCommand:('mkdir ', newPathName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3374 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3375 |
self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3376 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3377 |
" |
3795 | 3378 |
OperatingSystem createDirectory:'foo' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3379 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3380 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3381 |
"Modified: 20.12.1995 / 11:24:13 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3382 |
"Modified: 29.6.1996 / 14:06:54 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3383 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3384 |
|
6301 | 3385 |
createFileForReadAppend:pathName |
3386 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3387 |
^ self open:pathName attributes:#(O_RDWR O_APPEND O_CREAT) mode:nil |
6301 | 3388 |
! |
3389 |
||
3390 |
createFileForReadWrite:pathName |
|
3391 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3392 |
^ self open:pathName attributes:#(O_RDWR O_CREAT O_TRUNC) mode:nil |
6301 | 3393 |
! |
3394 |
||
3759 | 3395 |
createHardLinkFrom:oldPath to:newPath |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3396 |
"link the file 'oldPath' to 'newPath'. The link will be a hard link. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3397 |
Return true if successful, false if not." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3398 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3399 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3400 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3401 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3402 |
if (__isString(oldPath) && __isString(newPath)) { |
6050 | 3403 |
__BEGIN_INTERRUPTABLE__ |
3404 |
do { |
|
3405 |
ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath)); |
|
3406 |
} while (ret < 0 && errno == EINTR); |
|
3407 |
__END_INTERRUPTABLE__ |
|
3408 |
if (ret < 0) { |
|
3409 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3410 |
RETURN ( false ); |
|
3411 |
} |
|
3412 |
RETURN (true); |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3413 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3414 |
%}. |
3759 | 3415 |
"/ |
3416 |
"/ bad argument(s) given |
|
3417 |
"/ |
|
3418 |
^ self primitiveFailed |
|
3419 |
||
3420 |
" |
|
3795 | 3421 |
OperatingSystem linkFile:'foo' to:'bar' |
3759 | 3422 |
" |
3423 |
! |
|
3424 |
||
3425 |
createSymbolicLinkFrom:oldPath to:newPath |
|
3426 |
"make a symbolic link for 'newPath' to the file 'oldPath'. |
|
3427 |
The link will be a soft (symbolic) link. |
|
3428 |
Return true if successful, false if not." |
|
3429 |
||
3430 |
%{ |
|
3431 |
#ifdef S_IFLNK |
|
3432 |
int ret; |
|
3433 |
||
3434 |
if (__isString(oldPath) && __isString(newPath)) { |
|
6050 | 3435 |
__BEGIN_INTERRUPTABLE__ |
3436 |
do { |
|
3437 |
ret = symlink((char *) __stringVal(oldPath), (char *) __stringVal(newPath)); |
|
3438 |
} while (ret < 0 && errno == EINTR); |
|
3439 |
__END_INTERRUPTABLE__ |
|
3440 |
if (ret < 0) { |
|
3441 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3442 |
RETURN ( false ); |
|
3443 |
} |
|
3444 |
RETURN (true); |
|
3759 | 3445 |
} |
3446 |
#endif |
|
3447 |
%}. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3448 |
(oldPath isString not or:[newPath isString not]) ifTrue:[ |
6050 | 3449 |
"/ |
3450 |
"/ bad argument(s) given |
|
3451 |
"/ |
|
3452 |
^ self primitiveFailed |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3453 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3454 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3455 |
"/ |
3759 | 3456 |
"/ this Unix does not seem to support symbolic links |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3457 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3458 |
^ UnsupportedOperationSignal raise |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3459 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3460 |
" |
3795 | 3461 |
OperatingSystem symbolicLinkFile:'foo' to:'bar' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3462 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3463 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3464 |
|
6301 | 3465 |
open:path attributes:attributes mode:modeInteger |
3466 |
"open a file, return an os specific fileHandle. |
|
3467 |
openmode is a symbol defining the way to open |
|
3468 |
valid modes are: |
|
3469 |
#O_RDONLY |
|
3470 |
#O_RDWR |
|
3471 |
#O_WRONLY |
|
3472 |
#O_CREAT |
|
3473 |
#O_APPEND |
|
3474 |
#O_SYNC |
|
3475 |
#O_LARGEFILE |
|
3476 |
||
3477 |
This is a private entry, but maybe useful to open/create a file in a special mode, |
|
3478 |
which is proprietrary to the operatingSystem." |
|
3479 |
||
3480 |
|error fileDescriptor| |
|
3481 |
||
3482 |
%{ |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3483 |
OBJ *ap; |
6301 | 3484 |
int nAttributes; |
3485 |
int fd; |
|
3486 |
int mode, openFlags = 0; |
|
3487 |
int n; |
|
3488 |
||
3489 |
if (!__isString(path)) { |
|
3490 |
error = @symbol(badArgument1); |
|
3491 |
goto err; |
|
3492 |
} |
|
3493 |
if (!__isArray(attributes)) { |
|
3494 |
error = @symbol(badArgument2); |
|
3495 |
goto err; |
|
3496 |
} |
|
3497 |
if (modeInteger == nil) { |
|
3498 |
mode = 0644; |
|
3499 |
} else if (__isSmallInteger(modeInteger)) { |
|
3500 |
mode = __intVal(modeInteger); |
|
3501 |
} else { |
|
3502 |
error = @symbol(badArgument3); |
|
3503 |
goto err; |
|
3504 |
} |
|
3505 |
||
3506 |
nAttributes = __arraySize(attributes); |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3507 |
for (n = 0, ap = __ArrayInstPtr(attributes)->a_element; |
6301 | 3508 |
n < nAttributes; |
3509 |
n++) { |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3510 |
OBJ attribute = ap[n]; |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3511 |
|
6301 | 3512 |
if (attribute == @symbol(O_RDONLY)) { |
3513 |
openFlags |= O_RDONLY; |
|
3514 |
} else if (attribute == @symbol(O_RDWR)) { |
|
3515 |
openFlags |= O_RDWR; |
|
3516 |
} else if (attribute == @symbol(O_WRONLY)) { |
|
3517 |
openFlags |= O_WRONLY; |
|
3518 |
} else if (attribute == @symbol(O_CREAT)) { |
|
3519 |
openFlags |= O_CREAT; |
|
3520 |
} else if (attribute == @symbol(O_APPEND)) { |
|
3521 |
openFlags |= O_APPEND; |
|
3522 |
} else if (attribute == @symbol(O_EXCL)) { |
|
3523 |
openFlags |= O_EXCL; |
|
3524 |
} else if (attribute == @symbol(O_TRUNC)) { |
|
3525 |
openFlags |= O_TRUNC; |
|
3526 |
} else if (attribute == @symbol(O_LARGEFILE)) { |
|
3527 |
#ifdef O_LARGEFILE |
|
3528 |
openFlags |= O_LARGEFILE; |
|
3529 |
#else |
|
3530 |
error = @symbol(badArgument2); |
|
3531 |
goto err; |
|
3532 |
#endif |
|
3533 |
} else if (attribute == @symbol(O_SYNC)) { |
|
3534 |
#ifdef O_SYNC |
|
3535 |
openFlags |= O_SYNC; |
|
3536 |
#else |
|
3537 |
error = @symbol(badArgument2); |
|
3538 |
goto err; |
|
3539 |
#endif |
|
3540 |
} |
|
3541 |
} |
|
3542 |
||
3543 |
#if defined(O_NONBLOCK) |
|
3544 |
openFlags |= O_NONBLOCK; |
|
3545 |
#else |
|
3546 |
# if defined(O_NDELAY) |
|
3547 |
openFlags |= O_NDELAY; |
|
3548 |
# endif |
|
3549 |
#endif |
|
3550 |
||
3551 |
again: |
|
3552 |
fd = open((char *) __stringVal(path), openFlags, mode); |
|
3553 |
if (fd < 0) { |
|
3554 |
if (errno == EINTR) { |
|
3555 |
__HANDLE_INTERRUPTS__; |
|
3556 |
goto again; |
|
3557 |
} else { |
|
3558 |
error = __MKSMALLINT(errno); |
|
3559 |
goto err; |
|
3560 |
} |
|
3561 |
} |
|
3562 |
fileDescriptor = __MKSMALLINT(fd); |
|
3563 |
err:; |
|
3564 |
%}. |
|
3565 |
^ fileDescriptor notNil ifTrue:[ |
|
3566 |
FileDescriptorHandle for:fileDescriptor. |
|
3567 |
] ifFalse:[ |
|
3568 |
(self errorHolderForNumber:error) reportError |
|
3569 |
]. |
|
3570 |
||
3571 |
" |
|
3572 |
self open:'/etc/hosts' attributes:#(O_RDONLY) mode:nil |
|
3573 |
self open:'/tmp/xxzz' attributes:#(O_RDWR O_CREAT) mode:8r611 |
|
3574 |
self open:'/etc/passwd' attributes:#(O_RDWR) mode:nil |
|
3575 |
self open:'/no one knows this file' attributes:#(O_RDONLY) mode:nil |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3576 |
self open:'foo/bar/baz' attributes:#(O_RDWR O_CREAT) mode:nil |
6301 | 3577 |
" |
3578 |
! |
|
3579 |
||
3580 |
openFileForAppend:pathName |
|
3581 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3582 |
^ self open:pathName attributes:#(O_RDWR O_APPEND) mode:nil |
6301 | 3583 |
! |
3584 |
||
3585 |
openFileForRead:pathName |
|
3586 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3587 |
^ self open:pathName attributes:#(O_RDONLY) mode:nil |
6301 | 3588 |
! |
3589 |
||
3590 |
openFileForReadAppend:pathName |
|
3591 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3592 |
^ self open:pathName attributes:#(O_RDWR O_APPEND) mode:nil |
6301 | 3593 |
! |
3594 |
||
3595 |
openFileForReadWrite:pathName |
|
3596 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3597 |
^ self open:pathName attributes:#(O_RDWR) mode:nil |
6301 | 3598 |
! |
3599 |
||
3600 |
openFileForWrite:pathName |
|
3601 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
3602 |
^ self open:pathName attributes:#(O_WRONLY) mode:nil |
6301 | 3603 |
! |
3604 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3605 |
recursiveCopyDirectory:sourcePathName to:destination |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3606 |
"copy the directory named 'sourcePathName' and all contained files/directories to 'destination'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3607 |
Return true if successful." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3608 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3609 |
^ self executeCommand:('cp -rf ' , sourcePathName, ' ', destination) |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3610 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3611 |
"Modified: / 5.6.1998 / 18:33:57 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3612 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3613 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3614 |
recursiveRemoveDirectory:fullPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3615 |
"remove the directory named 'fullPathName' and all contained files/directories. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3616 |
Return true if successful." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3617 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3618 |
^ self executeCommand:('rm -rf ' , fullPathName) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3619 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3620 |
" |
3795 | 3621 |
OperatingSystem recursiveCreateDirectory:'foo/bar/baz' |
3622 |
OperatingSystem recursiveRemoveDirectory:'foo' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3623 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3624 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3625 |
"Modified: / 5.6.1998 / 18:34:03 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3626 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3627 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3628 |
removeDirectory:fullPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3629 |
"remove the directory named 'fullPathName'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3630 |
The directory must be empty and you must have appropriate access rights. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3631 |
Return true if successful, false if directory is not empty or no permission. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3632 |
This is a lowLevel entry - use Filename protocol for compatibility." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3633 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3634 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3635 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3636 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3637 |
if (__isString(fullPathName)) { |
6050 | 3638 |
__BEGIN_INTERRUPTABLE__ |
3639 |
do { |
|
3640 |
ret = rmdir((char *) __stringVal(fullPathName)); |
|
3641 |
} while (ret < 0 && errno == EINTR); |
|
3642 |
__END_INTERRUPTABLE__ |
|
3643 |
if (ret < 0) { |
|
3644 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3645 |
RETURN ( false ); |
|
3646 |
} |
|
3647 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3648 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3649 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3650 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3651 |
"/ either not a string argument, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3652 |
"/ or not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3653 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3654 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3655 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3656 |
" |
3795 | 3657 |
OperatingSystem createDirectory:'foo' |
3658 |
OperatingSystem removeDirectory:'foo' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3659 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3660 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3661 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3662 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3663 |
removeFile:fullPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3664 |
"remove the file named 'fullPathName'; return true if successful. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3665 |
This is a lowLevel entry - use Filename protocol for compatibility." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3666 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3667 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3668 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3669 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3670 |
if (__isString(fullPathName)) { |
6050 | 3671 |
__BEGIN_INTERRUPTABLE__ |
3672 |
do { |
|
3673 |
ret = unlink((char *) __stringVal(fullPathName)); |
|
3674 |
} while (ret < 0 && errno == EINTR); |
|
3675 |
__END_INTERRUPTABLE__ |
|
3676 |
if (ret < 0) { |
|
3677 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3678 |
RETURN ( false ); |
|
3679 |
} |
|
3680 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3681 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3682 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3683 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3684 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3685 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3686 |
renameFile:oldPath to:newPath |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3687 |
"rename the file 'oldPath' to 'newPath'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3688 |
Someone else has to care for the names to be correct and |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3689 |
correct for the OS used - therefore, this should not be called |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3690 |
directlt. Instead, use Filename protocol to rename; this cares for |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3691 |
any invalid names. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3692 |
Returns true if successful, false if not" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3693 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3694 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3695 |
int ret, eno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3696 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3697 |
if (__isString(oldPath) && __isString(newPath)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3698 |
#if defined(HAS_RENAME) |
6050 | 3699 |
__BEGIN_INTERRUPTABLE__ |
3700 |
do { |
|
3701 |
ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath)); |
|
3702 |
} while (ret < 0 && errno == EINTR); |
|
3703 |
__END_INTERRUPTABLE__ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3704 |
#else |
6050 | 3705 |
ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath)); |
3706 |
if (ret >= 0) { |
|
3707 |
ret = unlink((char *) __stringVal(oldPath)); |
|
3708 |
if (ret < 0) { |
|
3709 |
eno = errno; |
|
3710 |
unlink((char *) __stringVal(newPath)); |
|
3711 |
errno = eno; |
|
3712 |
} |
|
3713 |
} |
|
3714 |
#endif |
|
3715 |
if (ret < 0) { |
|
3716 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3717 |
RETURN ( false ); |
|
3718 |
} |
|
3719 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3720 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3721 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3722 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3723 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3724 |
" |
3795 | 3725 |
OperatingSystem renameFile:'foo' to:'bar' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3726 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3727 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3728 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3729 |
truncateFile:aPathName to:newSize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3730 |
"change a files size return true on success, false on failure. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3731 |
This may not be supported on all architectures. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3732 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3733 |
This is a low-level entry - use Filename protocol." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3734 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3735 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3736 |
#ifdef HAS_TRUNCATE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3737 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3738 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3739 |
if (__isString(aPathName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3740 |
&& __isSmallInteger(newSize)) { |
6050 | 3741 |
__BEGIN_INTERRUPTABLE__ |
3742 |
do { |
|
3743 |
ret = truncate((char *) __stringVal(aPathName), __intVal(newSize)); |
|
3744 |
} while (ret < 0 && errno == EINTR); |
|
3745 |
__END_INTERRUPTABLE__ |
|
3746 |
if (ret < 0) { |
|
3747 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3748 |
RETURN ( false ); |
|
3749 |
} |
|
3750 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3751 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3752 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3753 |
# ifdef HAS_FTRUNCATE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3754 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3755 |
int fd; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3756 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3757 |
if (__isString(aPathName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3758 |
&& __isSmallInteger(newSize)) { |
6050 | 3759 |
do { |
3760 |
fd = open((char *) __stringVal(aPathName), 2); |
|
3761 |
} while (fd < 0 && errno == EINTR); |
|
3762 |
if (fd < 0) { |
|
3763 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3764 |
RETURN ( false ); |
|
3765 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3766 |
|
6050 | 3767 |
ret = ftruncate(fd, __intVal(newSize)); |
3768 |
close(fd); |
|
3769 |
if (ret < 0) { |
|
3770 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3771 |
RETURN ( false ); |
|
3772 |
} |
|
3773 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3774 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3775 |
# endif /* using FTRUNCATE */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3776 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3777 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3778 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3779 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3780 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3781 |
!UnixOperatingSystem class methodsFor:'file access rights'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3782 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3783 |
accessMaskFor:aSymbol |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3784 |
"return the access bits mask for numbers as returned by |
3795 | 3785 |
OperatingSystem>>accessModeOf: |
3786 |
and expected by OperatingSystem>>changeAccessModeOf:to:. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3787 |
Since these numbers are OS dependent, always use the mask |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3788 |
(never hardcode 8rxxx into your code)." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3789 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3790 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3791 |
# ifndef S_IRUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3792 |
/* posix systems should define these ... */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3793 |
# define S_IRUSR 0400 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3794 |
# define S_IWUSR 0200 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3795 |
# define S_IXUSR 0100 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3796 |
# define S_IRGRP 0040 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3797 |
# define S_IWGRP 0020 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3798 |
# define S_IXGRP 0010 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3799 |
# define S_IROTH 0004 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3800 |
# define S_IWOTH 0002 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3801 |
# define S_IXOTH 0001 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3802 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3803 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3804 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3805 |
if (aSymbol == @symbol(readUser)) { |
6050 | 3806 |
RETURN ( __MKSMALLINT(S_IRUSR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3807 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3808 |
if (aSymbol == @symbol(writeUser)) { |
6050 | 3809 |
RETURN ( __MKSMALLINT(S_IWUSR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3810 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3811 |
if (aSymbol == @symbol(executeUser)) { |
6050 | 3812 |
RETURN ( __MKSMALLINT(S_IXUSR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3813 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3814 |
if (aSymbol == @symbol(readGroup)) { |
6050 | 3815 |
RETURN ( __MKSMALLINT(S_IRGRP) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3816 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3817 |
if (aSymbol == @symbol(writeGroup)) { |
6050 | 3818 |
RETURN ( __MKSMALLINT(S_IWGRP) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3819 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3820 |
if (aSymbol == @symbol(executeGroup)) { |
6050 | 3821 |
RETURN ( __MKSMALLINT(S_IXGRP) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3822 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3823 |
if (aSymbol == @symbol(readOthers)) { |
6050 | 3824 |
RETURN ( __MKSMALLINT(S_IROTH) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3825 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3826 |
if (aSymbol == @symbol(writeOthers)) { |
6050 | 3827 |
RETURN ( __MKSMALLINT(S_IWOTH) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3828 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3829 |
if (aSymbol == @symbol(executeOthers)) { |
6050 | 3830 |
RETURN ( __MKSMALLINT(S_IXOTH) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3831 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3832 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3833 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3834 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3835 |
" |
3795 | 3836 |
OperatingSystem accessMaskFor:#readUser |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3837 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3838 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3839 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3840 |
accessModeOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3841 |
"return a number representing access rights rwxrwxrwx for owner, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3842 |
group and others. Return nil if such a file does not exist. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3843 |
Notice that the returned number is OS dependent - use the |
3795 | 3844 |
modeMasks as returned by OperatingSystem>>accessMaskFor:" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3845 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3846 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3847 |
this could have been implemented as: |
6050 | 3848 |
(self infoOf:aPathName) at:#mode |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3849 |
but for huge directory searches the code below is faster |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3850 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3851 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3852 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3853 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3854 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3855 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3856 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3857 |
# ifdef TRACE_STAT_CALLS |
6050 | 3858 |
printf("stat on '%s' for accessMode\n", __stringVal(aPathName)); |
3859 |
# endif |
|
3860 |
__BEGIN_INTERRUPTABLE__ |
|
3861 |
do { |
|
3862 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
3863 |
} while ((ret < 0) && (errno == EINTR)); |
|
3864 |
__END_INTERRUPTABLE__ |
|
3865 |
||
3866 |
if (ret < 0) { |
|
3867 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3868 |
RETURN ( nil ); |
|
3869 |
} |
|
3870 |
RETURN ( __MKSMALLINT(buf.st_mode & 0777) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3871 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3872 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3873 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3874 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3875 |
" |
3795 | 3876 |
(OperatingSystem accessModeOf:'/') printStringRadix:8 |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3877 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3878 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3879 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3880 |
changeAccessModeOf:aPathName to:modeBits |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3881 |
"change the access rights of aPathName to the OS dependent modeBits. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3882 |
You should construct this mask using accessMaskFor, to be OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3883 |
independent. Return true if changed, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3884 |
false if such a file does not exist or change was not allowd." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3885 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3886 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3887 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3888 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3889 |
if (__isString(aPathName) && __isSmallInteger(modeBits)) { |
6050 | 3890 |
__BEGIN_INTERRUPTABLE__ |
3891 |
do { |
|
3892 |
ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits)); |
|
3893 |
} while (ret < 0 && errno == EINTR); |
|
3894 |
__END_INTERRUPTABLE__ |
|
3895 |
if (ret < 0) { |
|
3896 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3897 |
RETURN ( false ); |
|
3898 |
} |
|
3899 |
RETURN ( true ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3900 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3901 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3902 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3903 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3904 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3905 |
!UnixOperatingSystem class methodsFor:'file locking'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3906 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3907 |
lockFD:aFileDescriptor shared:isSharedReadLock blocking:blockIfLocked |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3908 |
"set a lock on the file represented by aFileDescriptor. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3909 |
(such as returned by ExternalStream>>fileDescriptor). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3910 |
On some systems, only advisory locks are available - |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3911 |
these depends on other accessors to also perform the locking operation. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3912 |
If they do not, they may still access the file |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3913 |
(on some systems, locks are mandatory, on others, they are advisory). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3914 |
The isSharedReadLock argument (if true) specifies if multiple readers |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3915 |
are to be allowed - if false, they are not. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3916 |
On some systems, all locks are non-exclusive locks. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3917 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3918 |
Returns true, if the lock was aquired, false otherwise. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3919 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3920 |
Notice, that not all OS's support these locks; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3921 |
on some, this may simply be a no-op. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3922 |
Also notice, that some systems block the process, to wait for the lock. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3923 |
This can (again: on some systems) be avoided by passing a false blockIfLocked |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3924 |
argument." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3925 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3926 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3927 |
if (__isSmallInteger(aFileDescriptor)) { |
6050 | 3928 |
int fd = __intVal(aFileDescriptor); |
3929 |
int lockArg; |
|
3930 |
||
3931 |
/* |
|
3932 |
* claus: sigh - each one has a different interface ... |
|
3933 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3934 |
#if defined(F_SETLK) |
6050 | 3935 |
{ |
3936 |
/* |
|
3937 |
* new fcntl(SETLK) interface; |
|
3938 |
* available on SYSV4 and Linux |
|
3939 |
*/ |
|
3940 |
struct flock flock; |
|
3941 |
||
3942 |
if (isSharedReadLock == true) { |
|
3943 |
flock.l_type = F_RDLCK; |
|
3944 |
} else { |
|
3945 |
flock.l_type = F_WRLCK; |
|
3946 |
} |
|
3947 |
flock.l_whence = 0; |
|
3948 |
flock.l_start = 0; |
|
3949 |
flock.l_len = 0; |
|
3950 |
lockArg = F_SETLK; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3951 |
# if defined(F_SETLKW) |
6050 | 3952 |
if (blockIfLocked == true) { |
3953 |
lockArg = F_SETLKW; |
|
3954 |
} |
|
3955 |
# endif |
|
3956 |
if (fcntl(fd, lockArg, &flock) != -1) { |
|
3957 |
RETURN (true); |
|
3958 |
} |
|
3959 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3960 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3961 |
#else /* no F_SETLK available */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3962 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3963 |
# if defined(LOCK_EX) && defined(LOCK_UN) |
6050 | 3964 |
/* |
3965 |
* BSD 4.3 advisory locks |
|
3966 |
*/ |
|
3967 |
lockArg = LOCK_EX; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3968 |
# if defined(LOCK_SH) |
6050 | 3969 |
if (isSharedReadLock == true) { |
3970 |
lockArg = LOCK_SH |
|
3971 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3972 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3973 |
# if defined(LOCK_NB) |
6050 | 3974 |
if (blockIfLocked == false) { |
3975 |
lockArg |= LOCK_NB; |
|
3976 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3977 |
# endif |
6050 | 3978 |
if (flock(fd, lockArg) != -1) { |
3979 |
RETURN (true); |
|
3980 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3981 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3982 |
# else /* no flock available */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3983 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3984 |
# if defined(F_LOCK) && defined(F_UNLOCK) |
6050 | 3985 |
/* |
3986 |
* SYSV3 advisory locks |
|
3987 |
*/ |
|
3988 |
if (lockf(fd, F_LOCK, 0) != -1) { |
|
3989 |
RETURN (true); |
|
3990 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3991 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3992 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3993 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3994 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3995 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3996 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3997 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3998 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3999 |
supportsFileLinks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4000 |
"return true, if the OS supports file links (hard links). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4001 |
Typically, only unix returns true here." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4002 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4003 |
^ true |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4004 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4005 |
"Modified: / 5.6.1998 / 18:35:01 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4006 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4007 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4008 |
supportsFileLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4009 |
"return true, if the OS supports file locking" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4010 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4011 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4012 |
#if defined(F_SETLK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4013 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4014 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4015 |
# if defined(LOCK_EX) && defined(LOCK_UN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4016 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4017 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4018 |
# if defined(F_LOCK) && defined(F_UNLOCK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4019 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4020 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4021 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4022 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4023 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4024 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4025 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4026 |
" |
3795 | 4027 |
OperatingSystem supportsFileLocks |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4028 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4029 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4030 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4031 |
supportsNonBlockingFileLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4032 |
"return true, if the OS supports nonBlocking file locking |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4033 |
(i.e. with immediate return instead of waiting for the lock)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4034 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4035 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4036 |
#if defined(F_SETLK) && defined(F_SETLKW) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4037 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4038 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4039 |
# if defined(LOCK_EX) && defined(LOCK_UN) && defined(LOCK_NB) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4040 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4041 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4042 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4043 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4044 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4045 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4046 |
" |
3795 | 4047 |
OperatingSystem supportsNonBlockingFileLocks |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4048 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4049 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4050 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4051 |
supportsSharedLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4052 |
"return true, if the OS supports shared (i.e. multiple reader) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4053 |
file locking." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4054 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4055 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4056 |
#if defined(F_SETLK) && defined(F_RDLCK) && defined(F_WRLCK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4057 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4058 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4059 |
# if defined(LOCK_EX) && defined(LOCK_SH) && defined(LOCK_UN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4060 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4061 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4062 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4063 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4064 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4065 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4066 |
" |
3795 | 4067 |
OperatingSystem supportsNonBlockingFileLocks |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4068 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4069 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4070 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4071 |
unlockFD:aFileDescriptor |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4072 |
"clear a file lock on the file represented by aFileDescriptor, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4073 |
which was previously aquired by #lockFD:. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4074 |
Return false, if the unlock failed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4075 |
(which may happens when a wrong fd is passed, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4076 |
no lock was set previously, or the systsem does not support locks). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4077 |
Notice, that not all OS's support file locks; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4078 |
on some, this may simply be a no-op." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4079 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4080 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4081 |
if (__isSmallInteger(aFileDescriptor)) { |
6050 | 4082 |
int fd = __intVal(aFileDescriptor); |
4083 |
||
4084 |
/* |
|
4085 |
* claus: sigh - each one has a different interface ... |
|
4086 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4087 |
#if defined(F_SETLK) |
6050 | 4088 |
{ |
4089 |
/* |
|
4090 |
* new fcntl(SETLK) interface; |
|
4091 |
* available on SYSV4 and Linux |
|
4092 |
*/ |
|
4093 |
struct flock flock; |
|
4094 |
||
4095 |
flock.l_type = F_UNLCK; |
|
4096 |
flock.l_whence = 0; |
|
4097 |
flock.l_start = 0; |
|
4098 |
flock.l_len = 0; |
|
4099 |
if (fcntl(fd, F_SETLK, &flock) != -1) { |
|
4100 |
RETURN (true); |
|
4101 |
} |
|
4102 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4103 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4104 |
#else /* no F_SETLK available */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4105 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4106 |
# if defined(LOCK_EX) && defined(LOCK_UN) |
6050 | 4107 |
/* |
4108 |
* BSD 4.3 advisory locks |
|
4109 |
*/ |
|
4110 |
if (flock(fd, LOCK_UN) != -1) { |
|
4111 |
RETURN (true); |
|
4112 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4113 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4114 |
# else /* no flock available */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4115 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4116 |
# if defined(F_LOCK) && defined(F_UNLOCK) |
6050 | 4117 |
/* |
4118 |
* SYSV3 advisory locks |
|
4119 |
*/ |
|
4120 |
if (lockf(fd, F_UNLOCK, 0) != -1) { |
|
4121 |
RETURN (true); |
|
4122 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4123 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4124 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4125 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4126 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4127 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4128 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4129 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4130 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4131 |
!UnixOperatingSystem class methodsFor:'file queries'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4132 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4133 |
caseSensitiveFilenames |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4134 |
"return true, if the OS has caseSensitive file naming. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4135 |
On MSDOS, this will return false; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4136 |
on a real OS, we return true." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4137 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4138 |
^ true |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4139 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4140 |
"Modified: / 5.6.1998 / 18:35:18 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4141 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4142 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4143 |
compressPath:pathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4144 |
"return the pathName compressed - that is, remove all ..-entries |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4145 |
and . entries. This does not always (in case of symbolic links) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4146 |
return the true pathName and is therefore used as a fallback |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4147 |
if realPath and popen failed." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4148 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4149 |
|names n "{ Class: SmallInteger }" | |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4150 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4151 |
names := pathName |
6050 | 4152 |
asCollectionOfSubstringsSeparatedBy:self fileSeparator. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4153 |
names := names asOrderedCollection. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4154 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4155 |
cut off initial double-slashes |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4156 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4157 |
[names startsWith:#('' '')] whileTrue:[ |
6050 | 4158 |
names removeFirst. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4159 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4160 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4161 |
cut off double-slashes at end |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4162 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4163 |
[names endsWith:#('')] whileTrue:[ |
6050 | 4164 |
names removeLast. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4165 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4166 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4167 |
cut off current-dir at beginning |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4168 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4169 |
n := names size. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4170 |
[(n >= 2) and:[names startsWith:#('.')]] whileTrue:[ |
6050 | 4171 |
names removeFirst. |
4172 |
n := n - 1. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4173 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4174 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4175 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4176 |
cut off parent-dirs at end |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4177 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4178 |
[(n > 2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4179 |
and:[(names endsWith:#('..')) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4180 |
and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[ |
6050 | 4181 |
names removeLast; removeLast. |
4182 |
n := n - 2. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4183 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4184 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4185 |
^ names asStringWith:self fileSeparator |
6050 | 4186 |
from:1 |
4187 |
to:n |
|
4188 |
compressTabs:false final:nil |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4189 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4190 |
" |
3795 | 4191 |
OperatingSystem compressPath:'./..' |
4192 |
OperatingSystem compressPath:'/foo/bar/baz/..' |
|
4193 |
OperatingSystem compressPath:'foo/bar/baz/..' |
|
4194 |
OperatingSystem compressPath:'foo/bar/baz/../' |
|
4195 |
OperatingSystem compressPath:'foo/bar/baz/..///' |
|
4196 |
OperatingSystem compressPath:'///foo/bar/baz/..///' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4197 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4198 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4199 |
"Modified: 1.11.1996 / 20:13:48 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4200 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4201 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4202 |
fileSeparator |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4203 |
"return the character used to separate names in a path. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4204 |
This character differs for MSDOS and other systems, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4205 |
(but those are currently not supported - so this is some |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4206 |
preparation for the future)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4207 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4208 |
^ $/ |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4209 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4210 |
"Modified: / 5.6.1998 / 18:35:24 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4211 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4212 |
|
4223
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4213 |
getDiskInfoOf:aDirectoryPath |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4214 |
"return some disk info. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4215 |
The amountof information returned depends upon the OS, and is |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4216 |
not guaranteed to be consistent across architectures. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4217 |
On unix, the information returned is (at least): |
6050 | 4218 |
freeBytes |
4219 |
totalBytes |
|
4262 | 4220 |
" |
4221 |
||
4222 |
|p outputText keys values n info |
|
4223
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4223 |
fileSystemIdx sizeIdx usedIdx availIdx capacityIdx mountIdx| |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4224 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4225 |
p := PipeStream readingFrom:('df -k ' , aDirectoryPath). |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4226 |
p isNil ifTrue:[^ nil]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4227 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4228 |
[ |
6050 | 4229 |
outputText := p contentsOfEntireFile. |
4223
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4230 |
] valueNowOrOnUnwindDo:[ |
6050 | 4231 |
p close. |
4223
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4232 |
]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4233 |
"/ Transcript showCR:outputText asString. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4234 |
outputText isNil ifTrue:[^ nil]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4235 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4236 |
outputText := outputText asCollectionOfLines. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4237 |
outputText size < 2 ifTrue:[^ nil]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4238 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4239 |
keys := (outputText at:1) asLowercase asCollectionOfWords. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4240 |
values := (outputText at:2) asCollectionOfWords. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4241 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4242 |
"/ we may have to validate the following column indices |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4243 |
"/ on some rude Unix versions ... |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4244 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4245 |
fileSystemIdx := 1. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4246 |
sizeIdx := 2. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4247 |
usedIdx := 3. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4248 |
availIdx := 4. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4249 |
capacityIdx := 5. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4250 |
mountIdx := 6. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4251 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4252 |
values size < 6 ifTrue:[^ nil]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4253 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4254 |
info := IdentityDictionary new. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4255 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4256 |
n := Integer readFrom:(values at:capacityIdx) onError:nil. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4257 |
n notNil ifTrue:[ |
6050 | 4258 |
info at:#percentUsed put:n |
4223
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4259 |
]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4260 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4261 |
n := Integer readFrom:(values at:availIdx) onError:nil. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4262 |
n notNil ifTrue:[ |
6050 | 4263 |
info at:#freeBytes put:(n * 1024) |
4223
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4264 |
]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4265 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4266 |
n := Integer readFrom:(values at:usedIdx) onError:nil. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4267 |
n notNil ifTrue:[ |
6050 | 4268 |
info at:#usedBytes put:(n * 1024) |
4223
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4269 |
]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4270 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4271 |
n := Integer readFrom:(values at:sizeIdx) onError:nil. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4272 |
n notNil ifTrue:[ |
6050 | 4273 |
info at:#totalBytes put:(n * 1024) |
4223
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4274 |
]. |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4275 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4276 |
info at:#mountPoint put:(values at:mountIdx). |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4277 |
info at:#fileSystem put:(values at:fileSystemIdx). |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4278 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4279 |
^ info |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4280 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4281 |
" |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4282 |
OperatingSystem getDiskInfoOf:'/' |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4283 |
OperatingSystem getDiskInfoOf:'.' |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4284 |
" |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4285 |
|
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4286 |
"Modified: / 22.5.1999 / 00:32:13 / cg" |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4287 |
! |
46fd62477cb2
added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents:
4201
diff
changeset
|
4288 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4289 |
getDriveList |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4290 |
"return a list of volumes in the system. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4291 |
On unix, no such thing like a volume exists |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4292 |
- there, a syntetic list with root, home & current is returned. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4293 |
On MSDOS, a list of drive letters is (eventually) returned. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4294 |
On VMS, a list of volumes is (eventually) returned." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4295 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4296 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4297 |
"/ default: retrurn array filled with |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4298 |
"/ root, home and current directories. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4299 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4300 |
^ Array |
6050 | 4301 |
with:'/' |
4302 |
with:(self getHomeDirectory) |
|
4303 |
with:(Filename currentDirectory pathName) |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4304 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4305 |
"Modified: / 5.6.1998 / 18:35:35 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4306 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4307 |
|
4853 | 4308 |
getMountedVolumes |
4309 |
"return info about mounted volumes. |
|
4310 |
The amount of information returned depends upon the OS, and is |
|
4311 |
not guaranteed to be consistent across architectures. |
|
4312 |
On unix, the information returned is (at least): |
|
6050 | 4313 |
mountPoint - mount point |
4314 |
fileSystem - device or NFS-remotePath |
|
4853 | 4315 |
" |
4316 |
||
4317 |
|p outputText keys values info infoEntry| |
|
4318 |
||
4933 | 4319 |
p := PipeStream readingFrom:('df -k'). |
4853 | 4320 |
p isNil ifTrue:[^ nil]. |
4321 |
||
4322 |
[ |
|
6050 | 4323 |
outputText := p contentsOfEntireFile. |
4853 | 4324 |
] valueNowOrOnUnwindDo:[ |
6050 | 4325 |
p close. |
4853 | 4326 |
]. |
4327 |
"/ Transcript showCR:outputText asString. |
|
4328 |
outputText isNil ifTrue:[^ nil]. |
|
4329 |
||
4330 |
outputText := outputText asCollectionOfLines. |
|
4331 |
outputText size < 2 ifTrue:[^ nil]. |
|
4332 |
||
4333 |
keys := (outputText at:1) asLowercase asCollectionOfWords. |
|
4334 |
"/ we may have to validate the following column indices |
|
4335 |
"/ on some rude Unix versions ... |
|
4336 |
||
4337 |
info := OrderedCollection new. |
|
4338 |
||
4339 |
outputText from:2 do:[:line | |
|
6050 | 4340 |
values := line asCollectionOfWords. |
4341 |
||
4342 |
values size >= 2 ifTrue:[ |
|
4343 |
||
4344 |
infoEntry := IdentityDictionary new. |
|
4345 |
infoEntry at:#mountPoint put:(values last). |
|
4346 |
infoEntry at:#fileSystem put:(values first). |
|
4347 |
info add:infoEntry. |
|
4348 |
] |
|
4853 | 4349 |
]. |
4350 |
^ info |
|
4351 |
||
4352 |
" |
|
4353 |
OperatingSystem getMountedVolumes |
|
4354 |
" |
|
4355 |
||
4356 |
"Modified: / 22.5.1999 / 00:32:13 / cg" |
|
4357 |
! |
|
4358 |
||
4201 | 4359 |
getNullDevice |
4360 |
"return the name of the OS's null device" |
|
4361 |
||
4362 |
^ '/dev/null' |
|
4363 |
! |
|
4364 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4365 |
infoOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4366 |
"return some object filled with info for the file 'aPathName'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4367 |
the info (for which corresponding access methods are understood by |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4368 |
the returned object) is: |
6050 | 4369 |
type - a symbol giving the files type |
4370 |
mode - numeric access mode |
|
4371 |
uid - owners user id |
|
4372 |
gid - owners group id |
|
4373 |
size - files size |
|
4374 |
id - files number (i.e. inode number) |
|
4375 |
accessed - last access time (as Timestamp) |
|
4376 |
modified - last modification time (as Timestamp) |
|
4377 |
statusChanged - last status change time (as Timestamp) |
|
4378 |
alternativeName - (windows only:) the MSDOS name of the file |
|
4379 |
recordFormatNumeric - (VMS only:) numeric value of the recordFormat |
|
4380 |
recordFormat - (VMS only:) symbolic value of the recordFormat |
|
4381 |
recordAttributes - (VMS only:) recordAttributes |
|
4382 |
fixedHeaderSize - (VMS only:) fixed header size in a variable record format |
|
4383 |
recordSize - (VMS only:) record size. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4384 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4385 |
Some of the fields may be returned as nil on systems which do not provide |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4386 |
all of the information. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4387 |
Return nil if such a file does not exist. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4388 |
For symbolic links (if supported by the OS), |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4389 |
the info of the pointed-to-file (i.e. the target) is returned; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4390 |
use #linkInfoOf: to get info about the link itself. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4391 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4392 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4393 |
|info type mode uid gid size id |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4394 |
atime mtime ctime |
4380 | 4395 |
aOStime mOStime cOStime| |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4396 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4397 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4398 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4399 |
unsigned INT ino; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4400 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4401 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4402 |
# ifdef TRACE_STAT_CALLS |
6050 | 4403 |
printf("stat on '%s' for info\n", __stringVal(aPathName)); |
4404 |
# endif |
|
4405 |
__BEGIN_INTERRUPTABLE__ |
|
4406 |
do { |
|
4407 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4408 |
} while ((ret < 0) && (errno == EINTR)); |
|
4409 |
__END_INTERRUPTABLE__ |
|
4410 |
||
4411 |
if (ret < 0) { |
|
4412 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4413 |
RETURN ( nil ); |
|
4414 |
} |
|
4415 |
switch (buf.st_mode & S_IFMT) { |
|
4416 |
case S_IFDIR: |
|
4417 |
type = @symbol(directory); |
|
4418 |
break; |
|
4419 |
||
4420 |
case S_IFREG: |
|
4421 |
type = @symbol(regular); |
|
4422 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4423 |
# ifdef S_IFCHR |
6050 | 4424 |
case S_IFCHR: |
4425 |
type = @symbol(characterSpecial); |
|
4426 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4427 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4428 |
# ifdef S_IFBLK |
6050 | 4429 |
case S_IFBLK: |
4430 |
type = @symbol(blockSpecial); |
|
4431 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4432 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4433 |
# ifdef S_IFMPC |
6050 | 4434 |
case S_IFMPC: |
4435 |
type = @symbol(multiplexedCharacterSpecial); |
|
4436 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4437 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4438 |
# ifdef S_IFMPB |
6050 | 4439 |
case S_IFMPB: |
4440 |
type = @symbol(multiplexedBlockSpecial); |
|
4441 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4442 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4443 |
# ifdef S_IFLNK |
6050 | 4444 |
case S_IFLNK: |
4445 |
type = @symbol(symbolicLink); |
|
4446 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4447 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4448 |
# ifdef S_IFSOCK |
6050 | 4449 |
case S_IFSOCK: |
4450 |
type = @symbol(socket); |
|
4451 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4452 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4453 |
# ifdef S_IFIFO |
6050 | 4454 |
case S_IFIFO: |
4455 |
type = @symbol(fifo); |
|
4456 |
break; |
|
4457 |
# endif |
|
4458 |
default: |
|
4459 |
type = @symbol(unknown); |
|
4460 |
break; |
|
4461 |
} |
|
4462 |
||
4463 |
ino = buf.st_ino; |
|
4464 |
id = __MKUINT(ino); |
|
4465 |
||
4466 |
mode = __MKSMALLINT(buf.st_mode & 0777); |
|
4467 |
uid = __MKSMALLINT(buf.st_uid); |
|
4468 |
gid = __MKSMALLINT(buf.st_gid); |
|
4469 |
size = __MKUINT(buf.st_size); |
|
4470 |
aOStime = __MKUINT(buf.st_atime); |
|
4471 |
mOStime = __MKUINT(buf.st_mtime); |
|
4472 |
cOStime = __MKUINT(buf.st_ctime); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4473 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4474 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4475 |
mode notNil ifTrue:[ |
6050 | 4476 |
atime := AbsoluteTime fromOSTime:(aOStime * 1000). |
4477 |
mtime := AbsoluteTime fromOSTime:(mOStime * 1000). |
|
4478 |
ctime := AbsoluteTime fromOSTime:(cOStime * 1000). |
|
4479 |
||
4480 |
info := FileStatusInfo |
|
4481 |
type:type |
|
4482 |
mode:mode |
|
4483 |
uid:uid |
|
4484 |
gid:gid |
|
4485 |
size:size |
|
4486 |
id:id |
|
4487 |
accessed:atime |
|
4488 |
modified:mtime |
|
4489 |
statusChanged:ctime |
|
4490 |
path:nil. |
|
4491 |
^ info |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4492 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4493 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4494 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4495 |
" |
3795 | 4496 |
OperatingSystem infoOf:'/' |
4497 |
(OperatingSystem infoOf:'/') uid |
|
4498 |
(OperatingSystem infoOf:'/') accessed |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4499 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4500 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4501 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4502 |
isDirectory:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4503 |
"return true, if 'aPathName' is a valid directory path name. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4504 |
(i.e. exists and is a directory). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4505 |
This also returns true for symbolic links pointing to a directory; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4506 |
if you need to check for this, use #linkInfo:." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4507 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4508 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4509 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4510 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4511 |
if (__isString(aPathName)) { |
6050 | 4512 |
struct stat buf; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4513 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4514 |
# ifdef TRACE_STAT_CALLS |
6050 | 4515 |
printf("stat on '%s' for isDirectory\n", __stringVal(aPathName)); |
4516 |
# endif |
|
4517 |
__BEGIN_INTERRUPTABLE__ |
|
4518 |
do { |
|
4519 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4520 |
} while ((ret < 0) && (errno == EINTR)); |
|
4521 |
__END_INTERRUPTABLE__ |
|
4522 |
if (ret < 0) { |
|
4523 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4524 |
RETURN ( false ); |
|
4525 |
} |
|
4526 |
RETURN ( ((buf.st_mode & S_IFMT) == S_IFDIR) ? true : false); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4527 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4528 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4529 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4530 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4531 |
"an alternative implementation would be: |
6050 | 4532 |
^ (self infoOf:aPathName) type == #directory |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4533 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4534 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4535 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4536 |
isExecutable:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4537 |
"return true, if the given file is executable. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4538 |
For symbolic links, the pointed-to-file is checked." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4539 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4540 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4541 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4542 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4543 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4544 |
# ifdef TRACE_ACCESS_CALLS |
6050 | 4545 |
printf("access on '%s' for executable\n", __stringVal(aPathName)); |
4546 |
# endif |
|
4547 |
__BEGIN_INTERRUPTABLE__ |
|
4548 |
do { |
|
4549 |
ret = access(__stringVal(aPathName), X_OK); |
|
4550 |
} while ((ret < 0) && (errno == EINTR)); |
|
4551 |
__END_INTERRUPTABLE__ |
|
4552 |
if (ret < 0) { |
|
4553 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4554 |
} |
|
4555 |
RETURN ( ((ret == 0) ? true : false) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4556 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4557 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4558 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4559 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4560 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4561 |
isReadable:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4562 |
"return true, if the file/dir 'aPathName' is readable. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4563 |
For symbolic links, the pointed-to-file is checked." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4564 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4565 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4566 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4567 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4568 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4569 |
# ifdef TRACE_ACCESS_CALLS |
6050 | 4570 |
printf("access on '%s' for readable\n", __stringVal(aPathName)); |
4571 |
# endif |
|
4572 |
__BEGIN_INTERRUPTABLE__ |
|
4573 |
do { |
|
4574 |
ret = access(__stringVal(aPathName), R_OK); |
|
4575 |
} while ((ret < 0) && (errno == EINTR)); |
|
4576 |
__END_INTERRUPTABLE__ |
|
4577 |
if (ret < 0) { |
|
4578 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4579 |
} |
|
4580 |
RETURN ( ((ret == 0) ? true : false) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4581 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4582 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4583 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4584 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4585 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4586 |
isSymbolicLink:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4587 |
"return true, if the given file is a symbolic link" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4588 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4589 |
^ (self linkInfoOf:aPathName) notNil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4590 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4591 |
" |
3795 | 4592 |
OperatingSystem isSymbolicLink:'Make.proto' |
4593 |
OperatingSystem isSymbolicLink:'Makefile' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4594 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4595 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4596 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4597 |
isValidPath:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4598 |
"return true, if 'aPathName' is a valid path name |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4599 |
(i.e. the file or directory exists)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4600 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4601 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4602 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4603 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4604 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4605 |
if (__isString(aPathName) || __isSymbol(aPathName) ) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4606 |
# ifdef TRACE_STAT_CALLS |
6050 | 4607 |
printf("stat on '%s' for isValidPath\n", __stringVal(aPathName)); |
4608 |
# endif |
|
4609 |
__BEGIN_INTERRUPTABLE__ |
|
4610 |
do { |
|
4611 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4612 |
} while ((ret < 0) && (errno == EINTR)); |
|
4613 |
__END_INTERRUPTABLE__ |
|
4614 |
if (ret < 0) { |
|
4615 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4616 |
RETURN (false); |
|
4617 |
} |
|
4618 |
RETURN ( ret ? false : true ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4619 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4620 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4621 |
^ self primitiveFailed |
5407 | 4622 |
|
4623 |
"/ alternative: |
|
4624 |
"/ ^ (self infoOf:aPathName) notNil |
|
4625 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4626 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4627 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4628 |
isWritable:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4629 |
"return true, if the given file is writable. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4630 |
For symbolic links, the pointed-to-file is checked." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4631 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4632 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4633 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4634 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4635 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4636 |
# ifdef TRACE_ACCESS_CALLS |
6050 | 4637 |
printf("access on '%s' for writable\n", __stringVal(aPathName)); |
4638 |
# endif |
|
4639 |
__BEGIN_INTERRUPTABLE__ |
|
4640 |
do { |
|
4641 |
ret = access(__stringVal(aPathName), W_OK); |
|
4642 |
} while ((ret < 0) && (errno == EINTR)); |
|
4643 |
__END_INTERRUPTABLE__ |
|
4644 |
if (ret < 0) { |
|
4645 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4646 |
} |
|
4647 |
RETURN ( ((ret == 0) ? true : false) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4648 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4649 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4650 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4651 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4652 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4653 |
linkInfoOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4654 |
"return a dictionary filled with info for the file 'aPathName', |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4655 |
IFF aPathName is a symbolic link. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4656 |
If aPathName is invalid, or its NOT a symbolic link, nil is returned. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4657 |
(which means, that systems like VMS or MSDOS always return nil here.) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4658 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4659 |
The contents of the dictionary gives info about the link itself, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4660 |
on contrast to #infoOf:, which returns the info of the pointed to file |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4661 |
in case of a symbolic link." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4662 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4663 |
|info type mode uid gid size id atime mtime ctime path| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4664 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4665 |
%{ /* STACK: 1200 */ |
3930 | 4666 |
#if defined(S_IFLNK) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4667 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4668 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4669 |
char pathBuffer[1024]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4670 |
unsigned INT ino; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4671 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4672 |
if (__isString(aPathName)) { |
6050 | 4673 |
__BEGIN_INTERRUPTABLE__ |
4674 |
do { |
|
4675 |
ret = lstat((char *) __stringVal(aPathName), &buf); |
|
4676 |
} while ((ret < 0) && (errno == EINTR)); |
|
4677 |
__END_INTERRUPTABLE__ |
|
4678 |
||
4679 |
if (ret < 0) { |
|
4680 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4681 |
RETURN ( nil ); |
|
4682 |
} |
|
4683 |
switch (buf.st_mode & S_IFMT) { |
|
4684 |
default: |
|
4685 |
RETURN ( nil ); /* not a symbolic link */ |
|
4686 |
||
4687 |
case S_IFLNK: |
|
4688 |
type = @symbol(symbolicLink); |
|
4689 |
break; |
|
4690 |
} |
|
4691 |
||
4692 |
ino = buf.st_ino; |
|
4693 |
id = __MKUINT(ino); |
|
4694 |
||
4695 |
mode = __MKSMALLINT(buf.st_mode & 0777); |
|
4696 |
uid = __MKSMALLINT(buf.st_uid); |
|
4697 |
gid = __MKSMALLINT(buf.st_gid); |
|
4698 |
size = __MKUINT(buf.st_size); |
|
4699 |
atime = __MKUINT(buf.st_atime); |
|
4700 |
mtime = __MKUINT(buf.st_mtime); |
|
4701 |
ctime = __MKUINT(buf.st_ctime); |
|
4702 |
if ((ret = readlink((char *) __stringVal(aPathName), pathBuffer, sizeof(pathBuffer))) < 0) { |
|
4703 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4704 |
RETURN ( nil ); |
|
4705 |
} |
|
4706 |
pathBuffer[ret] = '\0'; /* readlink does not 0-terminate */ |
|
4707 |
path = __MKSTRING(pathBuffer); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4708 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4709 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4710 |
RETURN ( nil ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4711 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4712 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4713 |
mode notNil ifTrue:[ |
6050 | 4714 |
info := IdentityDictionary new. |
4715 |
^ FileStatusInfo |
|
4716 |
type:type |
|
4717 |
mode:mode |
|
4718 |
uid:uid |
|
4719 |
gid:gid |
|
4720 |
size:size |
|
4721 |
id:id |
|
4722 |
accessed:(AbsoluteTime fromOSTime:(atime * 1000)) |
|
4723 |
modified:(AbsoluteTime fromOSTime:(mtime * 1000)) |
|
4724 |
statusChanged:(AbsoluteTime fromOSTime:(ctime * 1000)) |
|
4725 |
path:path |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4726 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4727 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4728 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4729 |
" |
3795 | 4730 |
OperatingSystem infoOf:'Make.proto' |
4731 |
OperatingSystem linkInfoOf:'Make.proto' |
|
4732 |
||
4733 |
OperatingSystem infoOf:'resources/motif.style' |
|
4734 |
OperatingSystem linkInfoOf:'resources/motif.style' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4735 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4736 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4737 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4738 |
parentDirectoryName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4739 |
"return the name used to refer to parent directories. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4740 |
In MSDOS, Unix and other systems this is '..', but maybe different |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4741 |
for other systems. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4742 |
(but those are currently not supported - so this is some |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4743 |
preparation for the future)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4744 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4745 |
^ '..' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4746 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4747 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4748 |
pathNameOf:pathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4749 |
"return the pathName of the argument, aPathString, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4750 |
- thats the full pathname of the directory, starting at '/'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4751 |
This method needs the path to be valid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4752 |
(i.e. all directories must exist, be readable and executable). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4753 |
Notice: if symbolic links are involved, the result may look different |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4754 |
from what you expect." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4755 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4756 |
|p path command| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4757 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4758 |
"some systems have a convenient function for this ..." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4759 |
path := self primPathNameOf:pathName. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4760 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4761 |
path isNil ifTrue:[ |
6050 | 4762 |
(self isValidPath:pathName) ifFalse:[ |
4763 |
p := pathName. |
|
4764 |
[(p size > 1) |
|
4765 |
and:[p endsWith:(self fileSeparator)] |
|
4766 |
] whileTrue:[ |
|
4767 |
p := p copyWithoutLast:1. |
|
4768 |
]. |
|
4769 |
^ p |
|
4770 |
]. |
|
4771 |
||
4772 |
(SlowFork==true or:[PipeFailed==true]) ifFalse:[ |
|
4773 |
PipeStream openErrorSignal handle:[:ex | |
|
4774 |
PipeFailed := true. |
|
4775 |
'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR. |
|
4776 |
ex return. |
|
4777 |
] do:[ |
|
4778 |
"have to fall back ..." |
|
4779 |
command := 'cd "' , pathName , '"; pwd'. |
|
4780 |
p := PipeStream readingFrom:command. |
|
4781 |
]. |
|
4782 |
||
4783 |
(p isNil or:[p atEnd]) ifTrue:[ |
|
4784 |
('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR. |
|
4785 |
] ifFalse:[ |
|
4786 |
path := p nextLine. |
|
4787 |
p close. |
|
4788 |
] |
|
4789 |
]. |
|
4790 |
path isNil ifTrue:[ |
|
4791 |
"/ |
|
4792 |
"/ return the original - there is nothing else can we do |
|
4793 |
"/ |
|
4794 |
path := pathName |
|
4795 |
]. |
|
4796 |
(SlowFork==true or:[ForkFailed==true]) ifTrue:[ |
|
4797 |
path := self compressPath:path |
|
4798 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4799 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4800 |
^ path. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4801 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4802 |
" |
3795 | 4803 |
OperatingSystem pathNameOf:'.' |
4804 |
OperatingSystem pathNameOf:'../smalltalk/../smalltalk' |
|
4805 |
OperatingSystem pathNameOf:'../../..' |
|
4806 |
OperatingSystem pathNameOf:'..' |
|
4807 |
OperatingSystem pathNameOf:'/tmp////' |
|
4808 |
OperatingSystem pathNameOf:'/foo/bar' |
|
4809 |
OperatingSystem pathNameOf:'/foo/bar/' |
|
4810 |
OperatingSystem pathNameOf:'/foo/bar//' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4811 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4812 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4813 |
"Modified: / 29.11.1996 / 18:02:12 / stefan" |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4814 |
"Modified: / 5.6.1998 / 18:37:15 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4815 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4816 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4817 |
primIdOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4818 |
"the actual code to return the fileNumber (i.e. inode number) of a file." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4819 |
|
3780 | 4820 |
%{ |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4821 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4822 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4823 |
unsigned INT ino; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4824 |
OBJ retVal; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4825 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4826 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4827 |
# ifdef TRACE_STAT_CALLS |
6050 | 4828 |
printf("stat on '%s' for id\n", __stringVal(aPathName)); |
4829 |
# endif |
|
4830 |
__BEGIN_INTERRUPTABLE__ |
|
4831 |
do { |
|
4832 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4833 |
} while (ret < 0 && errno == EINTR); |
|
4834 |
__END_INTERRUPTABLE__ |
|
4835 |
if (ret >= 0) { |
|
4836 |
ino = buf.st_ino; |
|
4837 |
retVal = __MKUINT(ino); |
|
4838 |
RETURN (retVal); |
|
4839 |
} |
|
4840 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4841 |
RETURN (nil); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4842 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4843 |
RETURN (nil); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4844 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4845 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4846 |
|
5492 | 4847 |
primInfoOf:aPathName |
4848 |
"for rel5 only" |
|
4849 |
||
4850 |
^ self primitiveFailed |
|
4851 |
||
4852 |
||
4853 |
! |
|
4854 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4855 |
primPathNameOf:pathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4856 |
"return the pathName of the argument, aPathString, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4857 |
- thats the full pathname of the directory, starting at '/'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4858 |
This method here returns nil, if the OS does not provide a |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4859 |
realPath library function. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4860 |
Notice: if symbolic links are involved, the result may look different |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4861 |
from what you expect." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4862 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4863 |
|path| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4864 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4865 |
%{ /* STACK: 16000 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4866 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4867 |
if (__isString(pathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4868 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4869 |
#ifdef HAS_GETCWD |
6050 | 4870 |
if (strcmp(__stringVal(pathName), ".") == 0) { |
4871 |
char nameBuffer[MAXPATHLEN + 1]; |
|
4872 |
||
4873 |
if (@global(CurrentDirectory) == nil) { |
|
4874 |
if (getcwd(nameBuffer, MAXPATHLEN)) { |
|
4875 |
OBJ d; |
|
4876 |
||
4877 |
@global(CurrentDirectory) = d = __MKSTRING(nameBuffer); |
|
4878 |
__GSTORE(d); |
|
4879 |
} |
|
4880 |
} |
|
4881 |
RETURN (@global(CurrentDirectory)); |
|
4882 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4883 |
#endif /* HAS_GETCWD */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4884 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4885 |
#ifdef HAS_REALPATH |
6050 | 4886 |
{ |
4887 |
char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1]; |
|
4888 |
||
4889 |
if (realpath(__stringVal(pathName), nameBuffer)) { |
|
4890 |
RETURN ( __MKSTRING(nameBuffer) ); |
|
4891 |
} |
|
4892 |
RETURN ( nil ); |
|
4893 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4894 |
#endif /* ! HAS_REALPATH */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4895 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4896 |
%}. |
5451 | 4897 |
^ nil |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4898 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4899 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4900 |
timeOfLastAccess:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4901 |
"return the time, when the file was last accessed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4902 |
For nonexistent files, nil is returned." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4903 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4904 |
"could be implemented as: |
6050 | 4905 |
(self infoOf:aPathName) accessed |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4906 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4907 |
|osSeconds i| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4908 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4909 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4910 |
time_t mtime; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4911 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4912 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4913 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4914 |
# ifdef TRACE_STAT_CALLS |
6050 | 4915 |
printf("stat on '%s' for timeOfLastAccess\n", __stringVal(aPathName)); |
4916 |
# endif |
|
4917 |
__BEGIN_INTERRUPTABLE__ |
|
4918 |
do { |
|
4919 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4920 |
} while (ret < 0 && errno == EINTR); |
|
4921 |
__END_INTERRUPTABLE__ |
|
4922 |
if (ret < 0) { |
|
4923 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4924 |
RETURN (nil); |
|
4925 |
} |
|
4926 |
osSeconds = __MKUINT(buf.st_atime); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4927 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4928 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4929 |
osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4930 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4931 |
i := self infoOf:aPathName. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4932 |
i notNil ifTrue:[^ i accessed]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4933 |
^ nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4934 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4935 |
" |
3795 | 4936 |
OperatingSystem timeOfLastAccess:'/' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4937 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4938 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4939 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4940 |
timeOfLastChange:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4941 |
"return the time, when the file was last changed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4942 |
For nonexistent files, nil is returned." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4943 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4944 |
"could be implemented as: |
6050 | 4945 |
(self infoOf:aPathName) modified |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4946 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4947 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4948 |
|osSeconds i| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4949 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4950 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4951 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4952 |
time_t mtime; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4953 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4954 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4955 |
# ifdef TRACE_STAT_CALLS |
6050 | 4956 |
printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName)); |
4957 |
# endif |
|
4958 |
__BEGIN_INTERRUPTABLE__ |
|
4959 |
do { |
|
4960 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4961 |
} while (ret < 0 && errno == EINTR); |
|
4962 |
__END_INTERRUPTABLE__ |
|
4963 |
if (ret < 0) { |
|
4964 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4965 |
RETURN ( nil ); |
|
4966 |
} |
|
4967 |
osSeconds = __MKUINT(buf.st_mtime); |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4968 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4969 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4970 |
osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4971 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4972 |
i := self infoOf:aPathName. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4973 |
i notNil ifTrue:[^ i modified]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4974 |
^ nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4975 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4976 |
" |
3795 | 4977 |
OperatingSystem timeOfLastChange:'/' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4978 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4979 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4980 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4981 |
typeOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4982 |
"return the type of a file as a symbol; for nonexistent files, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4983 |
nil is returned. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4984 |
Notice: for symbolic links, the type of the pointed-to file is returned." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4985 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4986 |
|i| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4987 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4988 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4989 |
this could have been implemented as: |
6050 | 4990 |
(self infoOf:aPathName) type |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4991 |
but for huge directory searches the code below is faster |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4992 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4993 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4994 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4995 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4996 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4997 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4998 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4999 |
# ifdef TRACE_STAT_CALLS |
6050 | 5000 |
printf("stat on '%s' for type\n", __stringVal(aPathName)); |
5001 |
# endif |
|
5002 |
__BEGIN_INTERRUPTABLE__ |
|
5003 |
do { |
|
5004 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
5005 |
} while (ret < 0 && errno == EINTR); |
|
5006 |
__END_INTERRUPTABLE__ |
|
5007 |
if (ret < 0) { |
|
5008 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
5009 |
RETURN ( nil ); |
|
5010 |
} |
|
5011 |
switch (buf.st_mode & S_IFMT) { |
|
5012 |
case S_IFDIR: |
|
5013 |
RETURN ( @symbol(directory) ); |
|
5014 |
case S_IFREG: |
|
5015 |
RETURN ( @symbol(regular) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5016 |
# ifdef S_IFCHR |
6050 | 5017 |
case S_IFCHR: |
5018 |
RETURN ( @symbol(characterSpecial) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5019 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5020 |
# ifdef S_IFBLK |
6050 | 5021 |
case S_IFBLK: |
5022 |
RETURN ( @symbol(blockSpecial) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5023 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5024 |
# ifdef S_IFLNK |
6050 | 5025 |
case S_IFLNK: |
5026 |
RETURN ( @symbol(symbolicLink) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5027 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5028 |
# ifdef S_IFSOCK |
6050 | 5029 |
case S_IFSOCK: |
5030 |
RETURN ( @symbol(socket) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5031 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5032 |
# ifdef S_IFIFO |
6050 | 5033 |
case S_IFIFO: |
5034 |
RETURN ( @symbol(fifo) ); |
|
5035 |
# endif |
|
5036 |
default: |
|
5037 |
RETURN ( @symbol(unknown) ); |
|
5038 |
} |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5039 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5040 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5041 |
i := self infoOf:aPathName. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5042 |
i notNil ifTrue:[^ i type]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5043 |
^ nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5044 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5045 |
" |
3795 | 5046 |
OperatingSystem typeOf:'/' |
5047 |
OperatingSystem typeOf:'.' |
|
5048 |
OperatingSystem typeOf:'Make.proto' |
|
5049 |
OperatingSystem typeOf:'resources/motif.style' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5050 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5051 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5052 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5053 |
volumeNameOf:aPathString |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5054 |
"return the volumeName of the argument, aPath |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5055 |
- thats the name of the volume where aPath is. |
3795 | 5056 |
Not all OperatingSystems support/use volumes; on unix, |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5057 |
this always returns an empty string." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5058 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5059 |
^ '' |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5060 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5061 |
"Modified: / 5.6.1998 / 18:38:11 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5062 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5063 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5064 |
!UnixOperatingSystem class methodsFor:'interrupts & signals'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5065 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5066 |
defaultSignal:signalNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5067 |
"revert to the default action on arrival of a (Unix-)signal. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5068 |
Dont confuse Unix signals with smalltalk signals. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5069 |
WARNING: for some signals, it is no good idea to revert to default; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5070 |
for example, the default for SIGINT (i.e. ^C) is to exit; while the |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5071 |
default for SIGQUIT (^ \) is to dump core. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5072 |
Also, NOTICE that signal numbers are not portable between unix |
3795 | 5073 |
systems - use OperatingSystem sigXXX to get the numeric value for |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5074 |
a signal." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5075 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5076 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5077 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5078 |
if (__isSmallInteger(signalNumber)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5079 |
#ifdef SIG_DFL |
6050 | 5080 |
signal(__intVal(signalNumber), SIG_DFL); |
5081 |
RETURN (self); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5082 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5083 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5084 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5085 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5086 |
this error is triggered on non-integer argument |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5087 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5088 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5089 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5090 |
"you better save a snapshot image before trying this ..." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5091 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5092 |
'if you hit ^C now, Smalltalk will exit immediately' printNewline. |
3795 | 5093 |
OperatingSystem defaultSignal:(OperatingSystem sigINT). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5094 |
1 to:1000000 do:[:i| ]. |
3795 | 5095 |
OperatingSystem enableSignal:(OperatingSystem sigINT). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5096 |
'normal ^C handling again.' printNewline |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5097 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5098 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5099 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5100 |
disableIOInterruptsOn:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5101 |
"turn off IO interrupts for a filedescriptor" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5102 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5103 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5104 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5105 |
int ret, flags, f; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5106 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5107 |
#if (defined(F_GETFL) && defined(F_SETFL) && defined(FASYNC)) || defined(SYSV4) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5108 |
if (__isSmallInteger(fd)) { |
6050 | 5109 |
f = __intVal(fd); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5110 |
# if defined(SYSV4) |
6050 | 5111 |
ret = ioctl(f, I_SETSIG, 0); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5112 |
# else /*! SYSV4*/ |
6050 | 5113 |
flags = fcntl(f, F_GETFL, 0); |
5114 |
/* |
|
5115 |
* if already clear, there is no need for this syscall ... |
|
5116 |
*/ |
|
5117 |
if (flags & FASYNC) { |
|
5118 |
ret = fcntl(f, F_SETFL, flags & ~FASYNC); |
|
5119 |
if (ret >= 0) ret = flags; |
|
5120 |
} else { |
|
5121 |
ret = flags; |
|
5122 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5123 |
# endif /* !SYSV4 */ |
6050 | 5124 |
RETURN ( __MKSMALLINT(ret) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5125 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5126 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5127 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5128 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5129 |
this error is triggered on non-integer argument |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5130 |
or if the OS does not support IO interrupts. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5131 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5132 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5133 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5134 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5135 |
disableSignal:signalNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5136 |
"disable (Unix-) signal processing for signalNumber. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5137 |
Dont confuse Unix signals with smalltalk signals. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5138 |
WARNING: for some signals, it is no good idea to disable |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5139 |
them; for example, disabling the SIGINT signal turns off ^C |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5140 |
handling. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5141 |
Also, NOTICE that signal numbers are not portable between unix |
3795 | 5142 |
systems - use OperatingSystem sigXXX to get the numeric value for |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5143 |
a signal. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5144 |
Use only for fully debugged stand alone applications." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5145 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5146 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5147 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5148 |
if (__isSmallInteger(signalNumber)) { |
6050 | 5149 |
int sigNo = __intVal(signalNumber); |
5150 |
||
5151 |
if (sigNo == 0) { |
|
5152 |
RETURN (self); |
|
5153 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5154 |
#ifdef SIG_IGN |
6050 | 5155 |
signal(sigNo, SIG_IGN); |
5156 |
RETURN (self); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5157 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5158 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5159 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5160 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5161 |
this error is triggered on non-integer argument |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5162 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5163 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5164 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5165 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5166 |
'now, ^C is totally ignored ...' printNewline. |
3795 | 5167 |
OperatingSystem disableSignal:(OperatingSystem sigINT). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5168 |
1 to:1000000 do:[:i| ]. |
3795 | 5169 |
OperatingSystem enableSignal:(OperatingSystem sigINT). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5170 |
'^C handled again.' printNewline |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5171 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5172 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5173 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5174 |
disableTimer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5175 |
"disable timer interrupts. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5176 |
WARNING: |
6050 | 5177 |
the system will not operate correctly with timer interrupts |
5178 |
disabled, because no scheduling or timeouts are possible." |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5179 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5180 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5181 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5182 |
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5183 |
struct itimerval dt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5184 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5185 |
dt.it_interval.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5186 |
dt.it_interval.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5187 |
dt.it_value.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5188 |
dt.it_value.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5189 |
setitimer(ITIMER_REAL, &dt, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5190 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5191 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5192 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5193 |
# if defined(USE_SLOW_ALARM) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5194 |
# if defined(SIGALRM) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5195 |
alarm(0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5196 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5197 |
# endif /* SIGALRM */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5198 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5199 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5200 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5201 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5202 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5203 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5204 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5205 |
enableChildSignalInterrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5206 |
"enable childSignal interrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5207 |
(SIGCHLD, if the architecture supports it). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5208 |
After enabling, these signals will send the message |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5209 |
'childSignalInterrupt' to the ChildSignalInterruptHandler object." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5210 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5211 |
self enableSignal:(self sigCHLD) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5212 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5213 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5214 |
enableIOInterruptsOn:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5215 |
"turn on IO interrupts for a filedescriptor" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5216 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5217 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5218 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5219 |
int ret, flags, f; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5220 |
#ifndef __signalIoInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5221 |
extern void __signalIoInterrupt(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5222 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5223 |
static int firstCall = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5224 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5225 |
#if (defined(F_GETFL) && defined(F_SETFL) && defined(FASYNC)) || defined(SYSV4) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5226 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5227 |
* SIGIO/SIGPOLL - data available for I/O |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5228 |
* (used to wake up waiting processes) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5229 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5230 |
#ifdef SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5231 |
# define THESIGNAL SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5232 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5233 |
# ifdef SIGPOLL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5234 |
# define THESIGNAL SIGPOLL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5235 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5236 |
# ifdef SIGURG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5237 |
# define THESIGNAL SIGURG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5238 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5239 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5240 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5241 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5242 |
if (__isSmallInteger(fd)) { |
6050 | 5243 |
if (firstCall) { |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5244 |
#ifdef HAS_SIGACTION |
6050 | 5245 |
struct sigaction act; |
5246 |
||
5247 |
/* |
|
5248 |
* Do not add SA_RESTART here. A signal can cause a |
|
5249 |
* thread switch, another thread can do a garbage collect |
|
5250 |
* and restarted system calls may write into old |
|
5251 |
* (collected) addresses. |
|
5252 |
*/ |
|
5253 |
||
5254 |
act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */ |
|
5255 |
sigemptyset(&act.sa_mask); |
|
5256 |
act.sa_handler = __signalIoInterrupt; |
|
5257 |
sigaction(THESIGNAL, &act, 0); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5258 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5259 |
# ifdef HAS_SIGVEC |
6050 | 5260 |
struct sigvec vec; |
5261 |
||
5262 |
vec.sv_flags = SV_INTERRUPT; |
|
5263 |
sigemptyset(&vec.sv_mask); |
|
5264 |
vec.sv_handler = __signalIoInterrupt; |
|
5265 |
sigvec(THESIGNAL, &vec, NULL); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5266 |
# else |
6050 | 5267 |
signal(THESIGNAL, __signalIoInterrupt); |
5268 |
# endif |
|
5269 |
#endif |
|
5270 |
firstCall = 0; |
|
5271 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5272 |
#undef THESIGNAL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5273 |
|
6050 | 5274 |
f = __intVal(fd); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5275 |
# if defined(SYSV4) |
6050 | 5276 |
ret = ioctl(f, I_SETSIG, S_INPUT | S_HIPRI | S_ERROR | S_RDNORM | S_RDBAND | S_MSG | S_HANGUP); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5277 |
# else /*! SYSV4*/ |
6050 | 5278 |
flags = fcntl(f, F_GETFL, 0); |
5279 |
/* |
|
5280 |
* if already set, there is no need for this syscall ... |
|
5281 |
*/ |
|
5282 |
if (flags & FASYNC) { |
|
5283 |
ret = flags; |
|
5284 |
} else { |
|
5285 |
ret = fcntl(f, F_SETFL, flags | FASYNC); |
|
5286 |
if (ret >= 0) ret = flags; |
|
5287 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5288 |
# endif /*!SYSV4*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5289 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5290 |
#if defined(F_SETOWN) || defined(FIOSETOWN) |
6050 | 5291 |
{ |
5292 |
int pid; |
|
5293 |
int ok; |
|
5294 |
||
5295 |
pid = getpid(); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5296 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5297 |
# if defined(F_SETOWN) |
6050 | 5298 |
ok = fcntl(f, F_SETOWN, pid); |
5299 |
/* printf("F_SETOWN returns %d (%d)\n", ret, errno); */ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5300 |
# else |
6050 | 5301 |
ok = ioctl(f, FIOSETOWN, &pid); |
5302 |
/* printf("FIOSETOWN returns %d (%d)\n", ret, errno); */ |
|
5303 |
# endif |
|
5304 |
if (ok < 0) { |
|
5305 |
ret = ok; |
|
5306 |
} |
|
5307 |
} |
|
5308 |
#endif |
|
5309 |
RETURN ( __MKUINT(ret) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5310 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5311 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5312 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5313 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5314 |
this error is triggered on non-integer argument |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5315 |
or if the system does not support SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5316 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5317 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5318 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5319 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5320 |
enableSignal:signalNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5321 |
"enable (Unix-)signal processing for signalNumber. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5322 |
Dont confuse Unix signals with smalltalk signals. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5323 |
The signal will be delivered to one of the standard handlers |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5324 |
(SIGINT, SIGQUIT, etc) or to a general handler, which |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5325 |
sends #signalInterrupt:. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5326 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5327 |
NOTICE that signal numbers are not portable between unix |
3795 | 5328 |
systems - use OperatingSystem sigXXX to get the numeric value for |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5329 |
a signal." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5330 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5331 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5332 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5333 |
#ifdef NSIG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5334 |
# define SIG_LIMIT NSIG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5335 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5336 |
# ifdef SIGUSR2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5337 |
# define SIG_LIMIT SIGUSR2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5338 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5339 |
# ifdef SIGUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5340 |
# define SIG_LIMIT SIGUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5341 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5342 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5343 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5344 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5345 |
#if defined(SIGPOLL) && !defined(SIGIO) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5346 |
# define SIGIO SIGPOLL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5347 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5348 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5349 |
#ifdef SIGCHLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5350 |
# define CHILD_SIGNAL SIGCHLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5351 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5352 |
# ifdef SIGCLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5353 |
# define CHILD_SIGNAL SIGCLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5354 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5355 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5356 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5357 |
int sigNr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5358 |
#if defined(SIGINT) || defined(SIGQUIT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5359 |
# ifndef __signalUserInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5360 |
extern void __signalUserInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5361 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5362 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5363 |
#ifdef SIGFPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5364 |
# ifndef __signalFpExceptionInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5365 |
extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5366 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5367 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5368 |
#ifdef SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5369 |
# ifndef __signalIoInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5370 |
extern void __signalIoInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5371 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5372 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5373 |
#ifdef CHILD_SIGNAL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5374 |
# ifndef __signalChildInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5375 |
extern void __signalChildInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5376 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5377 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5378 |
#ifdef SIGPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5379 |
# ifndef __signalPIPEInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5380 |
extern void __signalPIPEInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5381 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5382 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5383 |
#ifdef SIGBUS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5384 |
# ifndef __signalBUSInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5385 |
extern void __signalBUSInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5386 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5387 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5388 |
#ifdef SIGSEGV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5389 |
# ifndef __signalSEGVInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5390 |
extern void __signalSEGVInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5391 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5392 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5393 |
#if defined(SIGILL) || defined(SIGEMT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5394 |
# ifndef __signalTrapInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5395 |
extern void __signalTrapInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5396 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5397 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5398 |
#ifdef SIGALRM |
4105
dd93ca0dc062
removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents:
4102
diff
changeset
|
5399 |
# ifndef __signalTimerInterrupt |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5400 |
extern void __signalTimerInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5401 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5402 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5403 |
#ifndef __signalInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5404 |
extern void __signalInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5405 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5406 |
void (*handler)(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5407 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5408 |
if (__isSmallInteger(signalNumber) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5409 |
&& ((sigNr = __intVal(signalNumber)) >= 0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5410 |
#ifdef SIG_LIMIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5411 |
&& (sigNr <= SIG_LIMIT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5412 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5413 |
) { |
6050 | 5414 |
/* |
5415 |
* standard signals are forced into standard handlers |
|
5416 |
* - all others go into general signalInterrupt |
|
5417 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5418 |
#if defined(SIGPOLL) && defined(SIGIO) |
6050 | 5419 |
if (sigNr == SIGPOLL) |
5420 |
sigNr = SIGIO; |
|
5421 |
#endif |
|
5422 |
switch (sigNr) { |
|
5423 |
case 0: |
|
5424 |
/* enabling a non-supported signal */ |
|
5425 |
RETURN (self); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5426 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5427 |
#ifdef SIGBREAK |
6050 | 5428 |
case SIGBREAK: |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5429 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5430 |
#ifdef SIGINT |
6050 | 5431 |
case SIGINT: |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5432 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5433 |
#ifdef SIGQUIT |
6050 | 5434 |
case SIGQUIT: |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5435 |
#endif |
3780 | 5436 |
#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGBREAK) |
6050 | 5437 |
handler = __signalUserInterrupt; |
5438 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5439 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5440 |
#ifdef SIGFPE |
6050 | 5441 |
case SIGFPE: |
5442 |
handler = __signalFpExceptionInterrupt; |
|
5443 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5444 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5445 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5446 |
#ifdef SIGPIPE |
6050 | 5447 |
case SIGPIPE: |
5448 |
handler = __signalPIPEInterrupt; |
|
5449 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5450 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5451 |
#ifdef SIGBUS |
6050 | 5452 |
case SIGBUS: |
5453 |
handler = __signalBUSInterrupt; |
|
5454 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5455 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5456 |
#ifdef SIGSEGV |
6050 | 5457 |
case SIGSEGV: |
5458 |
handler = __signalSEGVInterrupt; |
|
5459 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5460 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5461 |
#ifdef SIGILL |
6050 | 5462 |
case SIGILL: |
5463 |
handler = __signalTrapInterrupt; |
|
5464 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5465 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5466 |
#ifdef SIGEMT |
6050 | 5467 |
case SIGEMT: |
5468 |
handler = __signalTrapInterrupt; |
|
5469 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5470 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5471 |
#ifdef SIGIO |
6050 | 5472 |
case SIGIO: |
5473 |
handler = __signalIoInterrupt; |
|
5474 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5475 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5476 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5477 |
#ifdef CHILD_SIGNAL |
6050 | 5478 |
case CHILD_SIGNAL: |
5479 |
handler = __signalChildInterrupt; |
|
5480 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5481 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5482 |
#ifdef SIGALRM |
6050 | 5483 |
case SIGALRM: |
5484 |
handler = __signalTimerInterrupt; |
|
5485 |
break; |
|
5486 |
#endif |
|
5487 |
||
5488 |
default: |
|
5489 |
handler = __signalInterrupt; |
|
5490 |
break; |
|
5491 |
} |
|
5492 |
||
5493 |
{ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5494 |
#ifdef HAS_SIGACTION |
6050 | 5495 |
struct sigaction act; |
5496 |
||
5497 |
/* |
|
5498 |
* Do not add SA_RESTART here. A signal can cause a |
|
5499 |
* thread switch, another thread can do a garbage collect |
|
5500 |
* and restarted system calls may write into old |
|
5501 |
* (collected) addresses. |
|
5502 |
*/ |
|
5503 |
||
5504 |
act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */ |
|
5505 |
sigemptyset(&act.sa_mask); |
|
5506 |
act.sa_handler = handler; |
|
5507 |
sigaction(sigNr, &act, 0); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5508 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5509 |
# ifdef HAS_SIGVEC |
6050 | 5510 |
struct sigvec vec; |
5511 |
||
5512 |
vec.sv_flags = SV_INTERRUPT; |
|
5513 |
sigemptyset(&vec.sv_mask); |
|
5514 |
vec.sv_handler = handler; |
|
5515 |
sigvec(sigNr, &vec, NULL); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5516 |
# else |
6050 | 5517 |
(void) signal(sigNr, handler); |
5518 |
# endif |
|
5519 |
#endif |
|
5520 |
} |
|
5521 |
||
5522 |
/* |
|
5523 |
* maybe, we should ret the old enable-status |
|
5524 |
* as boolean here ... |
|
5525 |
*/ |
|
5526 |
RETURN (self); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5527 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5528 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5529 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5530 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5531 |
this error is triggered on non-integer argument, or |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5532 |
if the signal number is not in the valid range (1..NSIG) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5533 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5534 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5535 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5536 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5537 |
enableTimer:milliSeconds |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5538 |
"setup for a timerInterrupt, to be signalled after some (real) time." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5539 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5540 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5541 |
int millis; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5542 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5543 |
millis = __intVal(milliSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5544 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5545 |
#ifdef SIGALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5546 |
{ |
6050 | 5547 |
static int firstCall = 1; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5548 |
# ifndef __signalTimerInterrupt |
6050 | 5549 |
extern void __signalTimerInterrupt(SIGHANDLER_ARG); |
5550 |
# endif |
|
5551 |
||
5552 |
if (firstCall) { |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5553 |
# ifdef HAS_SIGACTION |
6050 | 5554 |
struct sigaction act; |
5555 |
||
5556 |
act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */ |
|
5557 |
sigemptyset(&act.sa_mask); |
|
5558 |
act.sa_handler = __signalTimerInterrupt; |
|
5559 |
sigaction(SIGALRM, &act, 0); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5560 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5561 |
# ifdef HAS_SIGVEC |
6050 | 5562 |
struct sigvec vec; |
5563 |
||
5564 |
vec.sv_flags = SV_INTERRUPT; |
|
5565 |
sigemptyset(&vec.sv_mask); |
|
5566 |
vec.sv_handler = __signalTimerInterrupt; |
|
5567 |
sigvec(SIGALRM, &vec, NULL); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5568 |
# else /* neither SIGACTION nor SIGVEC */ |
6050 | 5569 |
signal(SIGALRM, __signalTimerInterrupt); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5570 |
# endif /* stupid system */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5571 |
# endif |
6050 | 5572 |
firstCall = 0; |
5573 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5574 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5575 |
#endif /* SIGALRM */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5576 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5577 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5578 |
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5579 |
{ |
6050 | 5580 |
struct itimerval dt; |
5581 |
||
5582 |
dt.it_interval.tv_sec = 0; |
|
5583 |
dt.it_interval.tv_usec = 0; |
|
5584 |
dt.it_value.tv_sec = millis / 1000; |
|
5585 |
dt.it_value.tv_usec = (millis % 1000) * 1000; |
|
5586 |
setitimer(ITIMER_REAL, &dt, 0); |
|
5587 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5588 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5589 |
#else /* no ITIMER_REAL */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5590 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5591 |
# ifdef USE_SLOW_ALARM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5592 |
{ |
6050 | 5593 |
/* |
5594 |
* last fallback - use alarm (which only gives 1 second resolution). |
|
5595 |
* If the system does not support any of the above, you have to life |
|
5596 |
* with this. The consequence is that pressing CTRL-C processing and |
|
5597 |
* thread switching will take place much delayed. |
|
5598 |
*/ |
|
5599 |
alarm(1); |
|
5600 |
RETURN(true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5601 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5602 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5603 |
#endif /* ITIMER_REAL */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5604 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5605 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5606 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5607 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5608 |
killProcess:processId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5609 |
"kill a unix process. |
3541
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5610 |
The process has a no chance to do some cleanup. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5611 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5612 |
WARNING: in order to avoid zombie processes (on unix), |
6050 | 5613 |
you may have to fetch the processes exitstatus with |
5614 |
OperatingSystem>>getStatusOfProcess:aProcessId." |
|
3541
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5615 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5616 |
self sendSignal:(self sigKILL) to:processId. |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5617 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5618 |
"Modified: / 10.6.1998 / 11:59:12 / cg" |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5619 |
! |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5620 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5621 |
killProcessGroup:processGroupId |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5622 |
"kill a unix process group. |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5623 |
The process has a no chance to do some cleanup. |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5624 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5625 |
WARNING: in order to avoid zombie processes (on unix), |
6050 | 5626 |
you may have to fetch the processes exitstatus with |
5627 |
OperatingSystem>>getStatusOfProcess:aProcessId." |
|
3541
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5628 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5629 |
self sendSignal:(self sigKILL) to:(processGroupId negated). |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5630 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5631 |
"Created: / 10.6.1998 / 11:59:29 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5632 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5633 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5634 |
sendSignal:signalNumber to:processId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5635 |
"send a unix signal to some process (maybe myself). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5636 |
Returns false if any error occurred, true otherwise. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5637 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5638 |
Do not confuse UNIX signals with Smalltalk-Signals. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5639 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5640 |
WARNING: in order to avoid zombie processes (on unix), |
6050 | 5641 |
you may have to fetch the processes exitstatus with |
5642 |
OperatingSystem>>getStatusOfProcess:aProcessId |
|
5643 |
if the signal terminates that process." |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5644 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5645 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5646 |
if (__bothSmallInteger(signalNumber, processId)) { |
6050 | 5647 |
if (kill(__intVal(processId), __intVal(signalNumber)) < 0) { |
5648 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
5649 |
RETURN ( false ); |
|
5650 |
} |
|
5651 |
RETURN ( true ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5652 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5653 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5654 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5655 |
"/ either invalid argument (non-integers) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5656 |
"/ or not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5657 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5658 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5659 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5660 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5661 |
startSpyTimer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5662 |
"trigger a spyInterrupt, to be signalled after some short (virtual) time. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5663 |
This is used by the old MessageTally for profiling. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5664 |
Should be changed to use real profiling timer if available. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5665 |
On systems, where no virtual timer is available, use the real timer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5666 |
(which is of course less correct). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5667 |
OBSOLETE: the new messageTally runs as a high prio process, not using |
6050 | 5668 |
spy interrupts." |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5669 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5670 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5671 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5672 |
#ifndef __spyInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5673 |
extern void __spyInterrupt(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5674 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5675 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5676 |
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5677 |
struct itimerval dt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5678 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5679 |
# ifdef SIGVTALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5680 |
signal(SIGVTALRM, __spyInterrupt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5681 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5682 |
# ifdef SIGALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5683 |
signal(SIGALRM, __spyInterrupt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5684 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5685 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5686 |
* mhmh - system has neither SIGBTALRM nor SIGALRM ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5687 |
* what should we do here ? |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5688 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5689 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5690 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5691 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5692 |
dt.it_interval.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5693 |
dt.it_interval.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5694 |
dt.it_value.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5695 |
dt.it_value.tv_usec = 1000; /* 1000 Hz */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5696 |
setitimer(ITIMER_VIRTUAL, &dt, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5697 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5698 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5699 |
#endif /* ITIMER_VIRTUAL */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5700 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5701 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5702 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5703 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5704 |
stopSpyTimer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5705 |
"stop spy timing - disable spy timer. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5706 |
OBSOLETE: the new messageTally runs as a high prio process, not using |
6050 | 5707 |
spy interrupts." |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5708 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5709 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5710 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5711 |
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5712 |
struct itimerval dt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5713 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5714 |
dt.it_interval.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5715 |
dt.it_interval.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5716 |
dt.it_value.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5717 |
dt.it_value.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5718 |
setitimer(ITIMER_VIRTUAL, &dt, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5719 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5720 |
#endif /* ITIMER_VIRTUAL */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5721 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5722 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5723 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5724 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5725 |
terminateProcess:processId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5726 |
"terminate a unix process. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5727 |
The process has a chance to do some cleanup. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5728 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5729 |
WARNING: in order to avoid zombie processes (on unix), |
6050 | 5730 |
you may have to fetch the processes exitstatus with |
5731 |
OperatingSystem>>getStatusOfProcess:aProcessId." |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5732 |
|
3540 | 5733 |
self sendSignal:(self sigTERM) to:processId. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5734 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5735 |
"Modified: / 28.12.1995 / 15:05:37 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5736 |
"Modified: / 27.1.1998 / 20:05:47 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5737 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5738 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5739 |
terminateProcessGroup:processGroupId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5740 |
"terminate a unix process group. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5741 |
The process has a chance to do some cleanup. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5742 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5743 |
WARNING: in order to avoid zombie processes (on unix), |
6050 | 5744 |
you may have to fetch the processes exitstatus with |
5745 |
OperatingSystem>>getStatusOfProcess:aProcessId." |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5746 |
|
3540 | 5747 |
self sendSignal:(self sigTERM) to:(processGroupId negated). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5748 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5749 |
"Modified: / 28.12.1995 / 15:05:37 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5750 |
"Created: / 23.4.1996 / 16:40:34 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5751 |
"Modified: / 27.1.1998 / 20:05:59 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5752 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5753 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5754 |
!UnixOperatingSystem class methodsFor:'ipc support - UNIX'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5755 |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5756 |
makePTYPair |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5757 |
"make a pipe, return array with two filedescriptors on success, |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5758 |
nil on failure. |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5759 |
This is a lowLevel entry, not for public use. |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5760 |
See ExternalStream>>makePipe for a more user-friendly, public interface." |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5761 |
|
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5762 |
|fdS fdM| |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5763 |
|
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5764 |
%{ |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5765 |
/* |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5766 |
* Find a pseudo tty to use and open both sides. |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5767 |
* _fdM receives the master file descriptor while _fdS |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5768 |
* receives the slave. The master is opened with O_NDELAY as commonly |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5769 |
* needed in daemons such as rlogind and telnetd. |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5770 |
*/ |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5771 |
|
3536 | 5772 |
#ifdef IRIX5 |
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5773 |
int _fdM, _fdS; |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5774 |
char *line; |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5775 |
|
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5776 |
line = _getpty(&_fdM, O_RDWR|O_NDELAY, 0600, 0); |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5777 |
if ((line != 0) && (_fdM >= 0)) { |
6050 | 5778 |
_fdS = open(line, O_RDWR); |
5779 |
if (_fdS < 0) { |
|
5780 |
(void)close(_fdM); |
|
5781 |
_fdS = _fdM = -1; |
|
5782 |
} |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5783 |
} else { |
6050 | 5784 |
_fdM -1; |
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5785 |
} |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5786 |
if ((_fdM >= 0) && (_fdS >= 0)) { |
6050 | 5787 |
fdM = __MKSMALLINT(_fdM); |
5788 |
fdS = __MKSMALLINT(_fdS); |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5789 |
} |
3542 | 5790 |
# define NO_PTY_TEMPL |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5791 |
#endif /* IRIX5 */ |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5792 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5793 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5794 |
#ifdef LINUX |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5795 |
# define PTY_TEMPL "/dev/ptyXX" |
3970 | 5796 |
# define PT_INDEX 5 |
3550 | 5797 |
# define PTY_1_CHARS "pqrstuabcdevwxyz" |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5798 |
# define PTY_2_CHARS "0123456789abcdef" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5799 |
#endif /* LINUX */ |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5800 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5801 |
#ifdef solaris |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5802 |
# define PTY_TEMPL "/dev/ptyXX" |
3970 | 5803 |
# define PT_INDEX 5 |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5804 |
# define PTY_1_CHARS "pqr" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5805 |
# define PTY_2_CHARS "0123456789abcdef" |
3539 | 5806 |
#endif /* solaris */ |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5807 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5808 |
#ifdef aix |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5809 |
# define PTY_TEMPL "/dev/ptyXX" |
3970 | 5810 |
# define PT_INDEX 5 |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5811 |
# define PTY_1_CHARS "pqr" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5812 |
# define PTY_2_CHARS "0123456789abcdef" |
3539 | 5813 |
#endif /* aix */ |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5814 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5815 |
#ifdef next3 |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5816 |
# define PTY_TEMPL "/dev/ptyXX" |
3970 | 5817 |
# define PT_INDEX 5 |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5818 |
# define PTY_1_CHARS "pqr" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5819 |
# define PTY_2_CHARS "0123456789abcdef" |
3539 | 5820 |
#endif /* next3 */ |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5821 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5822 |
#ifdef hpux |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5823 |
# define PTY_TEMPL "/dev/ptyXX" |
3970 | 5824 |
# define PT_INDEX 5 |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5825 |
# define PTY_1_CHARS "pqrs" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5826 |
# define PTY_2_CHARS "0123456789abcdef" |
3539 | 5827 |
#endif /* hpux */ |
5828 |
||
4262 | 5829 |
#if defined(__osf__) |
5830 |
# define PTY_TEMPL "/dev/ptyXX" |
|
5831 |
# define PT_INDEX 5 |
|
5832 |
# define PTY_1_CHARS "pq" |
|
5833 |
# define PTY_2_CHARS "0123456789abcdef" |
|
5834 |
#endif /* osf1 */ |
|
5835 |
||
5836 |
#if defined(BSD) && !defined(PTY_TEMPL) |
|
3539 | 5837 |
# define PTY_TEMPL "/dev/ptyXX" |
3970 | 5838 |
# define PT_INDEX 5 |
3539 | 5839 |
# define PTY_1_CHARS "p" |
5840 |
# define PTY_2_CHARS "0123456789abcdefghijklmnopqrstuv" |
|
5841 |
#endif /* BSD */ |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5842 |
|
3542 | 5843 |
#ifdef NO_PTY_TEMPL |
5844 |
# undef PTY_TEMPL |
|
5845 |
#endif |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5846 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5847 |
#ifdef PTY_TEMPL |
3542 | 5848 |
# include <grp.h> |
5849 |
||
3981
c2582f877635
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
3970
diff
changeset
|
5850 |
# ifdef OLD /* mhmh - suse linux6 places line into rodata ??? */ |
c2582f877635
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
3970
diff
changeset
|
5851 |
static char line[] = PTY_TEMPL; |
c2582f877635
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
3970
diff
changeset
|
5852 |
# else |
3970 | 5853 |
char line[128]; |
3981
c2582f877635
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
3970
diff
changeset
|
5854 |
# endif |
3575
39723f691a0e
hp-cc does not recognize const keyword
Claus Gittinger <cg@exept.de>
parents:
3571
diff
changeset
|
5855 |
register CONST char *cp1, *cp2; |
3970 | 5856 |
int len, _fdM = -1, _fdS = -1, ttygid; |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5857 |
struct group *gr; |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5858 |
|
3981
c2582f877635
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
3970
diff
changeset
|
5859 |
# ifdef OLD |
c2582f877635
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
3970
diff
changeset
|
5860 |
len = sizeof(PTY_TEMPL) - 1; |
c2582f877635
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
3970
diff
changeset
|
5861 |
# else |
3970 | 5862 |
strcpy(line, PTY_TEMPL); |
5863 |
len = strlen(line); |
|
3981
c2582f877635
renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents:
3970
diff
changeset
|
5864 |
# endif |
3970 | 5865 |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5866 |
if ((gr = getgrnam("tty")) != NULL) |
6050 | 5867 |
ttygid = gr->gr_gid; |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5868 |
else |
6050 | 5869 |
ttygid = -1; |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5870 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5871 |
for (cp1 = PTY_1_CHARS; *cp1; cp1++) { |
6050 | 5872 |
line[len-2] = * cp1; |
5873 |
||
5874 |
for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) { |
|
5875 |
line[PT_INDEX] = 'p'; |
|
5876 |
line[len-1] = *cp2; |
|
5877 |
||
5878 |
if ((_fdM = open(line, O_RDWR, 0)) < 0) { |
|
5879 |
if (errno == ENOENT) { |
|
5880 |
_fdM = _fdS = -1; |
|
5881 |
goto getOutOfHere; /* out of ptys */ |
|
5882 |
} |
|
5883 |
} else { |
|
5884 |
line[PT_INDEX] = 't'; |
|
5885 |
(void) chown( line, getuid(), ttygid ); |
|
5886 |
(void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP ); |
|
5887 |
||
5888 |
if( (_fdS = open(line, O_RDWR, 0)) >= 0 ) { |
|
5889 |
goto getOutOfHere; |
|
5890 |
} |
|
5891 |
(void) close( _fdM ); |
|
5892 |
} |
|
5893 |
} |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5894 |
} |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5895 |
getOutOfHere: ; |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5896 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5897 |
if ((_fdM >= 0) && (_fdS >= 0)) { |
6050 | 5898 |
fdM = __MKSMALLINT(_fdM); |
5899 |
fdS = __MKSMALLINT(_fdS); |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5900 |
} |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5901 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5902 |
#endif /* PTY_TEMPL */ |
3542 | 5903 |
#undef NO_PTY_TEMPL |
5904 |
||
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5905 |
%}. |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5906 |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5907 |
fdM notNil ifTrue:[ |
6050 | 5908 |
^ Array with:fdM with:fdS. |
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5909 |
]. |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5910 |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5911 |
^ nil |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5912 |
! |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5913 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5914 |
makePipe |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5915 |
"make a pipe, return array with two filedescriptors on success, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5916 |
nil on failure. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5917 |
This is a lowLevel entry, not for public use. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5918 |
See ExternalStream>>makePipe for a more user-friendly, public interface." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5919 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5920 |
|fd1 fd2| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5921 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5922 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5923 |
int fds[2]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5924 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5925 |
if (pipe(fds) < 0) { |
6050 | 5926 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
5927 |
RETURN ( nil ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5928 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5929 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5930 |
fd1 = __MKSMALLINT(fds[0]); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5931 |
fd2 = __MKSMALLINT(fds[1]); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5932 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5933 |
fd1 notNil ifTrue:[ |
6050 | 5934 |
^ Array with:fd1 with:fd2. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5935 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5936 |
^ nil |
3556
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5937 |
! |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5938 |
|
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5939 |
setWindowSizeOnFileDescriptor:fd width:w height:h |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5940 |
"emit a TIOCSWINSZ ioctl; (req'd for terminal emulators)" |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5941 |
%{ |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5942 |
#ifdef TIOCSWINSZ |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5943 |
struct winsize wsize; |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5944 |
|
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5945 |
if (__isSmallInteger(fd) |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5946 |
&& __isSmallInteger(w) |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5947 |
&& __isSmallInteger(h)) { |
6050 | 5948 |
wsize.ws_row = (unsigned short)__intVal(h); |
5949 |
wsize.ws_col = (unsigned short)__intVal(w); |
|
5950 |
if (ioctl(__intVal(fd), TIOCSWINSZ, (char *)&wsize) >= 0) { |
|
5951 |
RETURN (true); |
|
5952 |
} |
|
3556
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5953 |
} |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5954 |
#endif |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5955 |
%}. |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5956 |
^ false |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5957 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5958 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5959 |
!UnixOperatingSystem class methodsFor:'misc'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5960 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5961 |
closePid:pid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5962 |
"free pid resource" |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5963 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5964 |
^ true. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5965 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5966 |
"Created: / 28.1.1998 / 14:23:04 / md" |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5967 |
"Modified: / 28.1.1998 / 14:27:18 / md" |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5968 |
"Modified: / 5.6.1998 / 18:38:46 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5969 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5970 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5971 |
slowFork:aBoolean |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5972 |
"set/clear the `avoid-fork-if-possible-because-its-slow' flag. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5973 |
Only used internally on SYSV3 systems" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5974 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5975 |
SlowFork := aBoolean |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5976 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5977 |
"Modified: 22.4.1996 / 13:13:09 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5978 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5979 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5980 |
!UnixOperatingSystem class methodsFor:'os queries'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5981 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5982 |
executableFileExtensions |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5983 |
"return a collection of extensions for executable program files. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5984 |
Only req'd for msdos like systems ..." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5985 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5986 |
^ #('') |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5987 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5988 |
"Created: / 2.5.1997 / 11:42:29 / cg" |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5989 |
"Modified: / 5.6.1998 / 18:38:52 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5990 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5991 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5992 |
getDomainName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5993 |
"return the domain this host is in. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5994 |
Notice: |
6050 | 5995 |
not all systems support this; on some, 'unknown' is returned." |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5996 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5997 |
|name idx hostName| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5998 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5999 |
DomainName notNil ifTrue:[ |
6050 | 6000 |
^ DomainName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6001 |
]. |
5444 | 6002 |
name := self primGetDomainName. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6003 |
name isNil ifTrue:[ |
6050 | 6004 |
"/ fallBack |
6005 |
name := self getEnvironment:'DOMAIN'. |
|
6006 |
name isNil ifTrue:[ |
|
6007 |
name := self getCommandOutputFrom:'domainname' |
|
6008 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6009 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6010 |
name isNil ifTrue:[ |
6050 | 6011 |
"/ sometimes, we can extract the domainName from the hostName ... |
6012 |
hostName := self getHostName. |
|
6013 |
hostName notNil ifTrue:[ |
|
6014 |
idx := hostName indexOf:$.. |
|
6015 |
idx ~~ 0 ifTrue:[ |
|
6016 |
name := hostName copyFrom:idx+1. |
|
6017 |
] |
|
6018 |
]. |
|
6019 |
name isNil ifTrue:[ |
|
6020 |
'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR. |
|
6021 |
name := 'unknown'. |
|
6022 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6023 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6024 |
DomainName := name. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6025 |
^ name |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6026 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6027 |
" |
3795 | 6028 |
OperatingSystem getDomainName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6029 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6030 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6031 |
"Modified: 26.4.1996 / 10:04:54 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6032 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6033 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6034 |
getEnvironment:aStringOrSymbol |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6035 |
"get an environment string" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6036 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6037 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6038 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6039 |
char *env; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6040 |
extern char *getenv(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6041 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6042 |
if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) { |
6050 | 6043 |
env = getenv(__stringVal(aStringOrSymbol)); |
6044 |
if (env) { |
|
6045 |
RETURN ( __MKSTRING(env) ); |
|
6046 |
} |
|
6047 |
RETURN ( nil ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6048 |
} |
3795 | 6049 |
%}. |
5407 | 6050 |
^ self primitiveFailed |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6051 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6052 |
" |
3795 | 6053 |
OperatingSystem getEnvironment:'LANG' |
6054 |
OperatingSystem getEnvironment:'LOGIN' |
|
6055 |
OperatingSystem getEnvironment:'HOME' |
|
6056 |
OperatingSystem getEnvironment:'NNTPSERVER' |
|
6057 |
OperatingSystem getEnvironment:'MAIL' |
|
6058 |
OperatingSystem getEnvironment:'PATH' |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6059 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6060 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6061 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6062 |
getHostName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6063 |
"return the hostname we are running on - if there is |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6064 |
a HOST environment variable, we are much faster here ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6065 |
Notice: |
6050 | 6066 |
not all systems support this; on some, 'unknown' is returned." |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6067 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6068 |
|name idx| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6069 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6070 |
HostName notNil ifTrue:[ |
6050 | 6071 |
^ HostName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6072 |
]. |
5444 | 6073 |
name := self primGetHostName. |
6074 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6075 |
name isNil ifTrue:[ |
6050 | 6076 |
"/ fallBack |
6077 |
name := self getEnvironment:'HOST'. |
|
6078 |
name isNil ifTrue:[ |
|
6079 |
name := self getCommandOutputFrom:'hostname' |
|
6080 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6081 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6082 |
name isNil ifTrue:[ |
6050 | 6083 |
'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR. |
6084 |
name := 'unknown'. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6085 |
] ifFalse:[ |
6050 | 6086 |
"/ on some systems, the hostname already contains the domain. |
6087 |
"/ decompose it here. |
|
6088 |
idx := name indexOf:$.. |
|
6089 |
idx ~~ 0 ifTrue:[ |
|
6090 |
DomainName := name copyFrom:(idx+1). |
|
6091 |
name := name copyTo:(idx-1). |
|
6092 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6093 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6094 |
HostName := name. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6095 |
^ name |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6096 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6097 |
" |
3795 | 6098 |
OperatingSystem getHostName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6099 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6100 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6101 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6102 |
getLocaleInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6103 |
"return a dictionary filled with values from the locale information; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6104 |
Not all fields may be present, depending on the OS's setup and capabilities. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6105 |
Possible fields are: |
6050 | 6106 |
decimalPoint <String> |
6107 |
||
6108 |
thousandsSep <String> |
|
6109 |
||
6110 |
internationalCurrencySymbol <String> |
|
6111 |
||
6112 |
currencySymbol <String> |
|
6113 |
||
6114 |
monetaryDecimalPoint <String> |
|
6115 |
||
6116 |
monetaryThousandsSeparator <String> |
|
6117 |
||
6118 |
positiveSign <String> |
|
6119 |
||
6120 |
negativeSign <String> |
|
6121 |
||
6122 |
internationalFractionalDigits <Integer> |
|
6123 |
||
6124 |
fractionalDigits <Integer> |
|
6125 |
||
6126 |
positiveSignPrecedesCurrencySymbol <Boolean> |
|
6127 |
||
6128 |
negativeSignPrecedesCurrencySymbol <Boolean> |
|
6129 |
||
6130 |
positiveSignSeparatedBySpaceFromCurrencySymbol <Boolean> |
|
6131 |
||
6132 |
negativeSignSeparatedBySpaceFromCurrencySymbol <Boolean> |
|
6133 |
||
6134 |
positiveSignPosition <Symbol> |
|
6135 |
one of: #parenthesesAround, |
|
6136 |
#signPrecedes, |
|
6137 |
#signSuceeds, |
|
6138 |
#signPrecedesCurrencySymbol, |
|
6139 |
#signSuceedsCurrencySymbol |
|
6140 |
||
6141 |
negativeSignPosition <like above> |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6142 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6143 |
it is up to the application to deal with undefined values. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6144 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6145 |
Notice, that (for now), the system does not use this information; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6146 |
it should be used by applications as required. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6147 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6148 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6149 |
|info val| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6150 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6151 |
LocaleInfo notNil ifTrue:[ |
6050 | 6152 |
"/ return the internal info; useful on systems which do not |
6153 |
"/ support this. |
|
6154 |
^ LocaleInfo |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6155 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6156 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6157 |
info := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6158 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6159 |
char *decimalPoint; /* something like "." (US) or "," (german) */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6160 |
char *thousandsSep; /* something like "," (US) or "." (german) */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6161 |
char *intCurrencySymbol; /* international currency symbol; something like "USD " "DM " */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6162 |
char *currencySymbol; /* local currency symbol; something like "USD " "DM " */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6163 |
char *monDecimalPoint; /* money: decimal point */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6164 |
char *monThousandsSep; /* money: thousands sep */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6165 |
char *positiveSign; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6166 |
char *negativeSign; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6167 |
int intFractDigits; /* money: international digits after decPoint */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6168 |
int fractDigits; /* money: local digits after decPoint */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6169 |
int csPosPrecedes; /* money: 1 if currency symbol precedes a positive value; 0 if it sceeds */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6170 |
int csNegPrecedes; /* money: 1 if currency symbol precedes a negative value; 0 if it sceeds */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6171 |
int csPosSepBySpace; /* money: 1 if currency symbol should be separated by a space from a positive value; 0 if no space */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6172 |
int csNegSepBySpace; /* money: 1 if currency symbol should be separated by a space from a negative value; 0 if no space */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6173 |
int csPosSignPosition; /* money: 0: ()'s around the value & currency symbol */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6174 |
int csNegSignPosition; /* 1: sign precedes the value & currency symbol */ |
6050 | 6175 |
/* 2: sign succeeds the value & currency symbol */ |
6176 |
/* 3: sign immediately precedes the currency symbol */ |
|
6177 |
/* 4: sign immediately suceeds the currency symbol */ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6178 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6179 |
#if defined(HAS_LOCALECONV) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6180 |
struct lconv *conf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6181 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6182 |
conf = localeconv(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6183 |
if (conf) { |
6050 | 6184 |
decimalPoint = conf->decimal_point; |
6185 |
thousandsSep = conf->thousands_sep; |
|
6186 |
intCurrencySymbol = conf->int_curr_symbol; |
|
6187 |
currencySymbol = conf->currency_symbol; |
|
6188 |
monDecimalPoint = conf->mon_decimal_point; |
|
6189 |
monThousandsSep = conf->mon_thousands_sep; |
|
6190 |
positiveSign = conf->positive_sign; |
|
6191 |
negativeSign = conf->negative_sign; |
|
6192 |
intFractDigits = conf->int_frac_digits; |
|
6193 |
fractDigits = conf->frac_digits; |
|
6194 |
csPosPrecedes = conf->p_cs_precedes; |
|
6195 |
csNegPrecedes = conf->n_cs_precedes; |
|
6196 |
csPosSepBySpace = conf->p_sep_by_space; |
|
6197 |
csNegSepBySpace = conf->n_sep_by_space; |
|
6198 |
csPosSignPosition = conf->p_sign_posn; |
|
6199 |
csNegSignPosition = conf->n_sign_posn; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6200 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6201 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6202 |
decimalPoint = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6203 |
thousandsSep = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6204 |
intCurrencySymbol = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6205 |
currencySymbol = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6206 |
monDecimalPoint = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6207 |
monThousandsSep = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6208 |
positiveSign = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6209 |
negativeSign =(char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6210 |
intFractDigits = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6211 |
fractDigits = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6212 |
csPosPrecedes = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6213 |
csNegPrecedes = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6214 |
csPosSepBySpace = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6215 |
csNegSepBySpace = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6216 |
csPosSignPosition = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6217 |
csNegSignPosition = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6218 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6219 |
if (decimalPoint) { |
6050 | 6220 |
val = __MKSTRING(decimalPoint); |
6221 |
__AT_PUT_(info, @symbol(decimalPoint), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6222 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6223 |
if (thousandsSep) { |
6050 | 6224 |
val = __MKSTRING(thousandsSep); |
6225 |
__AT_PUT_(info, @symbol(thousandsSeparator), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6226 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6227 |
if (intCurrencySymbol) { |
6050 | 6228 |
val = __MKSTRING(intCurrencySymbol); |
6229 |
__AT_PUT_(info, @symbol(internationCurrencySymbol), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6230 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6231 |
if (currencySymbol) { |
6050 | 6232 |
val = __MKSTRING(currencySymbol); |
6233 |
__AT_PUT_(info, @symbol(currencySymbol), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6234 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6235 |
if (monDecimalPoint) { |
6050 | 6236 |
val = __MKSTRING(monDecimalPoint); |
6237 |
__AT_PUT_(info, @symbol(monetaryDecimalPoint), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6238 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6239 |
if (monThousandsSep) { |
6050 | 6240 |
val = __MKSTRING(monThousandsSep); |
6241 |
__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6242 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6243 |
if (positiveSign) { |
6050 | 6244 |
val = __MKSTRING(positiveSign); |
6245 |
__AT_PUT_(info, @symbol(positiveSign), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6246 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6247 |
if (negativeSign) { |
6050 | 6248 |
val = __MKSTRING(negativeSign); |
6249 |
__AT_PUT_(info, @symbol(negativeSign), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6250 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6251 |
if (intFractDigits >= 0) { |
6050 | 6252 |
__AT_PUT_(info, @symbol(internationalFractionalDigits), __MKSMALLINT(intFractDigits)); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6253 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6254 |
if (fractDigits >= 0) { |
6050 | 6255 |
__AT_PUT_(info, @symbol(fractionalDigits), __MKSMALLINT(fractDigits)); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6256 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6257 |
if (csPosPrecedes >= 0) { |
6050 | 6258 |
if (csPosPrecedes == 0) { |
6259 |
val = false; |
|
6260 |
} else { |
|
6261 |
val = true; |
|
6262 |
} |
|
6263 |
__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6264 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6265 |
if (csNegPrecedes >= 0) { |
6050 | 6266 |
if (csNegPrecedes == 0) { |
6267 |
val = false; |
|
6268 |
} else { |
|
6269 |
val = true; |
|
6270 |
} |
|
6271 |
__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6272 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6273 |
if (csPosSepBySpace >= 0) { |
6050 | 6274 |
if (csPosSepBySpace == 0) { |
6275 |
val = false; |
|
6276 |
} else { |
|
6277 |
val = true; |
|
6278 |
} |
|
6279 |
__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6280 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6281 |
if (csNegSepBySpace >= 0) { |
6050 | 6282 |
if (csNegSepBySpace == 0) { |
6283 |
val = false; |
|
6284 |
} else { |
|
6285 |
val = true; |
|
6286 |
} |
|
6287 |
__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6288 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6289 |
switch (csPosSignPosition) { |
6050 | 6290 |
case 0: |
6291 |
val = @symbol(parenthesesAround); |
|
6292 |
break; |
|
6293 |
||
6294 |
case 1: |
|
6295 |
val = @symbol(signPrecedes); |
|
6296 |
break; |
|
6297 |
||
6298 |
case 2: |
|
6299 |
val = @symbol(signSuceeds); |
|
6300 |
break; |
|
6301 |
||
6302 |
case 3: |
|
6303 |
val = @symbol(signPrecedesCurrencySymbol); |
|
6304 |
break; |
|
6305 |
||
6306 |
case 4: |
|
6307 |
val = @symbol(signSuceedsCurrencySymbol); |
|
6308 |
break; |
|
6309 |
||
6310 |
default: |
|
6311 |
val = nil; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6312 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6313 |
if (val != nil) { |
6050 | 6314 |
__AT_PUT_(info, @symbol(positiveSignPosition), val); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6315 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6316 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6317 |
switch (csNegSignPosition) { |
6050 | 6318 |
case 0: |
6319 |
val = @symbol(parenthesesAround); |
|
6320 |
break; |
|
6321 |
||
6322 |
case 1: |
|
6323 |
val = @symbol(signPrecedes); |
|
6324 |
break; |
|
6325 |
||
6326 |
case 2: |
|
6327 |
val = @symbol(signSuceeds); |
|
6328 |
break; |
|
6329 |
||
6330 |
case 3: |
|
6331 |
val = @symbol(signPrecedesCurrencySymbol); |
|
6332 |
break; |
|
6333 |
||
6334 |
case 4: |
|
6335 |
val = @symbol(signSuceedsCurrencySymbol); |
|
6336 |
break; |
|
6337 |
||
6338 |
default: |
|
6339 |
val = nil; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6340 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6341 |
if (val != nil) { |
6050 | 6342 |
__AT_PUT_(info, @symbol(negativeSignPosition), val); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6343 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6344 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6345 |
^ info |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6346 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6347 |
" |
3795 | 6348 |
OperatingSystem getLocaleInfo |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6349 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6350 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6351 |
"Created: 23.12.1995 / 14:19:20 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6352 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6353 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6354 |
getProcessId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6355 |
"return the (unix-)processId" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6356 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6357 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6358 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6359 |
int pid = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6360 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6361 |
pid = getpid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6362 |
RETURN ( __MKSMALLINT(pid) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6363 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6364 |
" |
3795 | 6365 |
OperatingSystem getProcessId |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6366 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6367 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6368 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6369 |
getSystemID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6370 |
"if supported by the OS, return the systemID; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6371 |
a unique per machine identification. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6372 |
WARNING: |
6050 | 6373 |
not all systems support this; on some, 'unknown' is returned." |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6374 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6375 |
%{ /* NO_CONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6376 |
#if defined(IRIX5) && !defined(HAS_GETHOSTID) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6377 |
char idBuffer[MAXSYSIDSIZE]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6378 |
int retVal; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6379 |
OBJ arr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6380 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6381 |
if ((retVal = syssgi(SGI_SYSID, idBuffer)) == 0) { |
6050 | 6382 |
arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE); |
6383 |
bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE); |
|
6384 |
RETURN (arr); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6385 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6386 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6387 |
#if defined(HAS_GETHOSTID) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6388 |
int runningId; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6389 |
OBJ arr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6390 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6391 |
runningId = gethostid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6392 |
arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6393 |
*(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6394 |
RETURN (arr); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6395 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6396 |
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6397 |
{ |
6050 | 6398 |
char buffer[128]; |
6399 |
||
6400 |
buffer[0] = 0; |
|
6401 |
if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) { |
|
6402 |
buffer[127] = 0; |
|
6403 |
if (strlen(buffer) > 0) { |
|
6404 |
RETURN(__MKSTRING(buffer)); |
|
6405 |
} |
|
6406 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6407 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6408 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6409 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6410 |
^ 'unknown' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6411 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6412 |
" |
3795 | 6413 |
OperatingSystem getSystemID |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6414 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6415 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6416 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6417 |
getSystemInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6418 |
"return info on the system weare running on. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6419 |
If the system supports the uname system call, that info is returned; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6420 |
otherwise, some simulated info is returned. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6421 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6422 |
WARNING: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6423 |
Do not depend on the amount and contents of the returned information, some |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6424 |
systems may return more/less than others. Also, the contents depends on the |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6425 |
OS, for example, linux returns 'ix86', while WIN32 returns 'x86'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6426 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6427 |
This method is mainly provided to augment error reports with some system |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6428 |
information. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6429 |
(in case of system/version specific OS errors, conditional workarounds and patches |
6050 | 6430 |
may be based upon this info). |
4020 | 6431 |
Also, applications could enable/disable buffering or otherwise reduce |
6432 |
their memory usage depending upon the amount of memory installed. |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6433 |
Your application may make use of available information for tuning, |
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6434 |
but should NEVER DEPEND upon this in any way. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6435 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6436 |
The returned info may (or may not) contain: |
6050 | 6437 |
#system -> some operating system identification (irix, Linux, nt, win32s ...) |
6438 |
#version -> OS version (some os version identification) |
|
6439 |
#release -> OS release (3.5, 1.2.1 ...) |
|
6440 |
#node -> some host identification (hostname) |
|
6441 |
#domain -> domain name (hosts domain) |
|
6442 |
#machine -> type of CPU (i586, mips ...) |
|
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6443 |
|
3737 | 6444 |
those are currently returned on some machines (no warranty) |
6445 |
linux: |
|
6050 | 6446 |
#totalRam -> total amount of memory available |
6447 |
#sharedRam -> amount of memory which is shared among processes |
|
6448 |
(i.e. shared code) |
|
6449 |
#bufferRam -> amount used for buffers |
|
6450 |
#swapSize -> total size of swap space |
|
6451 |
#freeSwap -> free amount in swapSpace |
|
6452 |
#extendedInstructions -> extended instruction set info |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6453 |
|
3737 | 6454 |
osf: |
6050 | 6455 |
#physicalRam -> total amount of physical memory |
6456 |
#cpuType -> type of cpu (more detailed than machine) |
|
6457 |
#numberOfCPUs -> number of cpus in box |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6458 |
|
3737 | 6459 |
solaris: |
6050 | 6460 |
#physicalRam -> total amount of physical memory |
6461 |
#availableRam -> total available amount of physical memory (i.e. unused ram) |
|
6462 |
#freeRam -> amount of free memory |
|
6463 |
#numberOfCPUs -> number of cpus in box (online CPUS) |
|
6464 |
[#dCacheSize] -> bytes in data cache (only available on some solaris versions) |
|
6465 |
[#iCacheSize] -> bytes in data cache (only available on some solaris versions) |
|
6466 |
[#instructionSets]-> instruction sets available (only available on some solaris versions) |
|
6467 |
[#platform] -> platform name (only available on some solaris versions) |
|
4020 | 6468 |
|
6469 |
hpux: |
|
6050 | 6470 |
#physicalRam -> total amount of physical memory in box |
6471 |
#activeRealMemory -> ? - read pstat documentation |
|
6472 |
#activeVirtualRam -> ? - read pstat documentation |
|
6473 |
#freeMemory -> ? - read pstat documentation |
|
6474 |
#realMemory -> ? (amount of memory left to user programs) |
|
6475 |
#virtualRam -> ? - read pstat documentation |
|
4101 | 6476 |
" |
6477 |
||
6478 |
|sys node rel ver mach dom mtyp brel info arch cpuType cpuSpeed |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6479 |
physicalRam availableRam totalRam sharedRam bufferRam swapSize freeSwap |
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6480 |
numberOfCPUs pageSize physicalPages availablePages dCacheSize iCacheSize |
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6481 |
virtualRam activeVirtualRam realMemory activeRealMemory freeMemory |
4922 | 6482 |
instructionSets extendedInstructions platform| |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6483 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6484 |
%{ /* STACK: 4096 */ |
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6485 |
#ifdef LINUX |
3696
a0c77f9bdbc7
oops - a.out linux has no sysinfo
Claus Gittinger <cg@exept.de>
parents:
3692
diff
changeset
|
6486 |
# ifdef ELF /* old a.out unixes do not have this ... */ |
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6487 |
/* |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6488 |
* additional info available ... |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6489 |
*/ |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6490 |
struct sysinfo infoBuffer; |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6491 |
|
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6492 |
if (sysinfo(&infoBuffer) >= 0) { |
6050 | 6493 |
totalRam = __MKUINT(infoBuffer.totalram); |
6494 |
sharedRam = __MKUINT(infoBuffer.sharedram); |
|
6495 |
bufferRam = __MKUINT(infoBuffer.bufferram); |
|
6496 |
swapSize = __MKUINT(infoBuffer.totalswap); |
|
6497 |
freeSwap = __MKUINT(infoBuffer.freeswap); |
|
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6498 |
} |
3696
a0c77f9bdbc7
oops - a.out linux has no sysinfo
Claus Gittinger <cg@exept.de>
parents:
3692
diff
changeset
|
6499 |
# endif |
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6500 |
#endif /* LINUX */ |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6501 |
|
4088 | 6502 |
#if defined(hpux) && !defined(__GNUC__) |
4020 | 6503 |
# include <sys/pstat.h> |
6504 |
struct pst_static stat_buf; |
|
6505 |
struct pst_dynamic dynam_buf; |
|
6506 |
||
6507 |
pstat(PSTAT_STATIC,&stat_buf,sizeof(stat_buf),0,0); |
|
6508 |
pstat(PSTAT_DYNAMIC,&dynam_buf,sizeof(dynam_buf),0,0); |
|
6509 |
||
6510 |
physicalRam = __MKUINT(stat_buf.physical_memory/256*1024*1024); |
|
6511 |
virtualRam = __MKUINT(dynam_buf.psd_vm/256*1024*1024); |
|
6512 |
activeVirtualRam = __MKUINT(dynam_buf.psd_avm/256*1024*1024); |
|
6513 |
realMemory = __MKUINT(dynam_buf.psd_rm/256*1024*1024); |
|
6514 |
activeRealMemory = __MKUINT(dynam_buf.psd_arm/256*1024*1024); |
|
6515 |
freeMemory = __MKUINT(dynam_buf.psd_free/256*1024*1024); |
|
6516 |
#endif |
|
6517 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6518 |
#if defined(HAS_UNAME) |
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6519 |
{ |
6050 | 6520 |
struct utsname ubuff; |
6521 |
||
6522 |
if (uname(&ubuff) >= 0) { |
|
6523 |
sys = __MKSTRING(ubuff.sysname); |
|
6524 |
node = __MKSTRING(ubuff.nodename); |
|
6525 |
rel = __MKSTRING(ubuff.release); |
|
6526 |
ver = __MKSTRING(ubuff.version); |
|
6527 |
mach = __MKSTRING(ubuff.machine); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6528 |
# ifdef HAS_UTS_DOMAINNAME |
6050 | 6529 |
dom = __MKSTRING(ubuff.domainname); |
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6530 |
# endif /* no HAS_UTS_DOMAINNAME */ |
6050 | 6531 |
} |
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6532 |
} |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6533 |
|
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6534 |
#else /* no UNAME */ |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6535 |
|
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6536 |
/* |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6537 |
* use fallBack code below |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6538 |
*/ |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6539 |
#endif /* no UNAME */ |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6540 |
|
4922 | 6541 |
#if defined(HAS_SYSINFO) |
6542 |
# if defined(SI_ARCHITECTURE) |
|
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6543 |
if (arch == nil) { |
6050 | 6544 |
char buffer[128]; |
6545 |
||
6546 |
if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) { |
|
6547 |
arch = __MKSTRING(buffer); |
|
6548 |
} |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6549 |
} |
4923 | 6550 |
# endif /* SI_ARCHITECTURE */ |
4922 | 6551 |
|
6552 |
# if defined(SI_ISALIST) |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6553 |
{ |
6050 | 6554 |
char buffer[128]; |
6555 |
||
6556 |
if (sysinfo(SI_ISALIST, buffer, sizeof(buffer))) { |
|
6557 |
instructionSets = __MKSTRING(buffer); |
|
6558 |
} |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6559 |
} |
4922 | 6560 |
# endif /* SI_ISALIST */ |
6561 |
||
6562 |
# if defined(SI_PLATFORM) |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6563 |
{ |
6050 | 6564 |
char buffer[128]; |
6565 |
||
6566 |
if (sysinfo(SI_PLATFORM, buffer, sizeof(buffer))) { |
|
6567 |
platform = __MKSTRING(buffer); |
|
6568 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6569 |
} |
4922 | 6570 |
# endif /* SI_PLATFORM */ |
4934
6579e2e2ad7f
solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6571 |
|
6579e2e2ad7f
solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6572 |
# if defined(SI_RELEASE) |
6579e2e2ad7f
solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6573 |
{ |
6050 | 6574 |
char buffer[128]; |
6575 |
||
6576 |
if (sysinfo(SI_RELEASE, buffer, sizeof(buffer))) { |
|
6577 |
rel = __MKSTRING(buffer); |
|
6578 |
} |
|
4934
6579e2e2ad7f
solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6579 |
} |
6579e2e2ad7f
solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
6580 |
# endif /* SI_RELEASE */ |
4922 | 6581 |
#endif /* HAS_SYSINFO */ |
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6582 |
|
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6583 |
#if defined(HAS_GETDOMAINNAME) |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6584 |
if (dom == nil) { |
6050 | 6585 |
char buffer[128]; |
6586 |
||
6587 |
if (getdomainname(buffer, sizeof(buffer)) == 0) { |
|
6588 |
dom = __MKSTRING(buffer); |
|
6589 |
} |
|
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6590 |
} |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6591 |
#endif /* HAS_GETDOMAINNAME */ |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
6592 |
|
3737 | 6593 |
#if defined(HAS_SYSCONF) |
6594 |
# ifdef _SC_NPROCESSORS_ONLN |
|
6595 |
{ |
|
6050 | 6596 |
long val; |
3737 | 6597 |
|
6050 | 6598 |
val = sysconf(_SC_NPROCESSORS_ONLN); |
6599 |
if (val > 0) { |
|
6600 |
numberOfCPUs = __MKINT(val); |
|
6601 |
} |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6602 |
} |
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6603 |
# endif |
4922 | 6604 |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6605 |
# if defined(_SC_PAGESIZE) |
3737 | 6606 |
{ |
6050 | 6607 |
long val; |
6608 |
||
6609 |
val = sysconf(_SC_PAGESIZE); |
|
6610 |
if (val != -1) { |
|
6611 |
pageSize = __MKUINT(val); |
|
6612 |
} |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6613 |
} |
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6614 |
# endif |
4922 | 6615 |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6616 |
# if defined(_SC_PHYS_PAGES) |
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6617 |
{ |
6050 | 6618 |
long val; |
6619 |
||
6620 |
val = sysconf(_SC_PHYS_PAGES); |
|
6621 |
if (val != -1) { |
|
6622 |
physicalPages = __MKUINT(val); |
|
6623 |
} |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6624 |
} |
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6625 |
# endif |
4922 | 6626 |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6627 |
# if defined(_SC_AVPHYS_PAGES) |
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
6628 |
{ |
6050 | 6629 |
long val; |
6630 |
||
6631 |
val = sysconf(_SC_AVPHYS_PAGES); |
|
6632 |
if (val != -1) { |
|
6633 |
availablePages = __MKUINT(val); |
|
6634 |
} |
|
3737 | 6635 |
} |
6636 |
# endif |
|
4922 | 6637 |
|
3737 | 6638 |
# if defined(_SC_ICACHE_SZ) |
6639 |
{ |
|
6050 | 6640 |
long val; |
6641 |
||
6642 |
val = sysconf(_SC_ICACHE_SZ); |
|
6643 |
if (val != -1) { |
|
6644 |
iCacheSize = __MKUINT(val); |
|
6645 |
} |
|
3737 | 6646 |
} |
6647 |
# endif |
|
4922 | 6648 |
|
3737 | 6649 |
# if defined(_SC_DCACHE_SZ) |
6650 |
{ |
|
6050 | 6651 |
long val; |
3737 | 6652 |
|
6050 | 6653 |
val = sysconf(_SC_DCACHE_SZ); |
6654 |
if (val != -1) { |
|
6655 |
dCacheSize = __MKUINT(val); |
|
6656 |
} |
|
3737 | 6657 |
} |
6658 |
# endif |
|
6659 |
#endif /* HAS_SYSCONF */ |
|
6660 |
||
4101 | 6661 |
#if defined(HAS_GETSYSINFO) |
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6662 |
{ |
6050 | 6663 |
INT index; |
6664 |
int retInt32 = 0; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6665 |
|
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6666 |
# if defined(GSI_CPU) |
6050 | 6667 |
index = 0; |
6668 |
if (getsysinfo(GSI_CPU, &retInt32, sizeof(retInt32), &index, NULL) > 0) { |
|
6669 |
switch (retInt32) { |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6670 |
# ifdef VAX_780 |
6050 | 6671 |
case VAX_780: |
6672 |
cpuType = __MKSTRING("VAX_780"); |
|
6673 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6674 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6675 |
# ifdef VAX_750 |
6050 | 6676 |
case VAX_750: |
6677 |
cpuType = __MKSTRING("VAX_750"); |
|
6678 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6679 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6680 |
# ifdef VAX_730 |
6050 | 6681 |
case VAX_730: |
6682 |
cpuType = __MKSTRING("VAX_730"); |
|
6683 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6684 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6685 |
# ifdef VAX_8600 |
6050 | 6686 |
case VAX_8600: |
6687 |
cpuType = __MKSTRING("VAX_8600"); |
|
6688 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6689 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6690 |
# ifdef VAX_8200 |
6050 | 6691 |
case VAX_8200: |
6692 |
cpuType = __MKSTRING("VAX_8200"); |
|
6693 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6694 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6695 |
# ifdef VAX_8800 |
6050 | 6696 |
case VAX_8800: |
6697 |
cpuType = __MKSTRING("VAX_8800"); |
|
6698 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6699 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6700 |
# ifdef MVAX_I |
6050 | 6701 |
case MVAX_I: |
6702 |
cpuType = __MKSTRING("MVAX_I"); |
|
6703 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6704 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6705 |
# ifdef MVAX_II |
6050 | 6706 |
case MVAX_II: |
6707 |
cpuType = __MKSTRING("MVAX_II"); |
|
6708 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6709 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6710 |
# ifdef V_VAX |
6050 | 6711 |
case V_VAX: |
6712 |
cpuType = __MKSTRING("V_VAX"); |
|
6713 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6714 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6715 |
# ifdef VAX_3600 |
6050 | 6716 |
case VAX_3600: |
6717 |
cpuType = __MKSTRING("VAX_3600"); |
|
6718 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6719 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6720 |
# ifdef VAX_6200 |
6050 | 6721 |
case VAX_6200: |
6722 |
cpuType = __MKSTRING("VAX_6200"); |
|
6723 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6724 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6725 |
# ifdef VAX_3400 |
6050 | 6726 |
case VAX_3400: |
6727 |
cpuType = __MKSTRING("VAX_3400"); |
|
6728 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6729 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6730 |
# ifdef C_VAXSTAR |
6050 | 6731 |
case C_VAXSTAR: |
6732 |
cpuType = __MKSTRING("C_VAXSTAR"); |
|
6733 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6734 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6735 |
# ifdef VAX_60 |
6050 | 6736 |
case VAX_60: |
6737 |
cpuType = __MKSTRING("VAX_60"); |
|
6738 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6739 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6740 |
# ifdef VAX_3900 |
6050 | 6741 |
case VAX_3900: |
6742 |
cpuType = __MKSTRING("VAX_3900"); |
|
6743 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6744 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6745 |
# ifdef DS_3100 |
6050 | 6746 |
case DS_3100: |
6747 |
cpuType = __MKSTRING("DS_3100"); |
|
6748 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6749 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6750 |
# ifdef VAX_8820 |
6050 | 6751 |
case VAX_8820: |
6752 |
cpuType = __MKSTRING("VAX_8820"); |
|
6753 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6754 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6755 |
# ifdef DS_5400 |
6050 | 6756 |
case DS_5400: |
6757 |
cpuType = __MKSTRING("DS_5400"); |
|
6758 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6759 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6760 |
# ifdef DS_5800 |
6050 | 6761 |
case DS_5800: |
6762 |
cpuType = __MKSTRING("DS_5800"); |
|
6763 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6764 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6765 |
# ifdef DS_5000 |
6050 | 6766 |
case DS_5000: |
6767 |
cpuType = __MKSTRING("DS_5000"); |
|
6768 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6769 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6770 |
# ifdef DS_CMAX |
6050 | 6771 |
case DS_CMAX: |
6772 |
cpuType = __MKSTRING("DS_CMAX"); |
|
6773 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6774 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6775 |
# ifdef VAX_6400 |
6050 | 6776 |
case VAX_6400: |
6777 |
cpuType = __MKSTRING("VAX_6400"); |
|
6778 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6779 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6780 |
# ifdef VAXSTAR |
6050 | 6781 |
case VAXSTAR: |
6782 |
cpuType = __MKSTRING("VAXSTAR"); |
|
6783 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6784 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6785 |
# ifdef DS_5500 |
6050 | 6786 |
case DS_5500: |
6787 |
cpuType = __MKSTRING("DS_5500"); |
|
6788 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6789 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6790 |
# ifdef DS_5100 |
6050 | 6791 |
case DS_5100: |
6792 |
cpuType = __MKSTRING("DS_5100"); |
|
6793 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6794 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6795 |
# ifdef VAX_9000 |
6050 | 6796 |
case VAX_9000: |
6797 |
cpuType = __MKSTRING("VAX_9000"); |
|
6798 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6799 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6800 |
# ifdef DS_500_100 |
6050 | 6801 |
case DS_500_100: |
6802 |
cpuType = __MKSTRING("DS_500_100"); |
|
6803 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6804 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6805 |
|
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6806 |
|
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6807 |
# ifdef ALPHA_ADU |
6050 | 6808 |
case ALPHA_ADU: |
6809 |
cpuType = __MKSTRING("ALPHA_ADU"); |
|
6810 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6811 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6812 |
# ifdef DEC_4000 |
6050 | 6813 |
case DEC_4000: |
6814 |
cpuType = __MKSTRING("DEC_4000"); |
|
6815 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6816 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6817 |
# ifdef DEC_3000_500 |
6050 | 6818 |
case DEC_3000_500: |
6819 |
cpuType = __MKSTRING("DEC_3000_500"); |
|
6820 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6821 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6822 |
# ifdef DEC_7000 |
6050 | 6823 |
case DEC_7000: |
6824 |
cpuType = __MKSTRING("DEC_7000"); |
|
6825 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6826 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6827 |
# ifdef DS_5000_300 |
6050 | 6828 |
case DS_5000_300: |
6829 |
cpuType = __MKSTRING("DS_5000_300"); |
|
6830 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6831 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6832 |
# ifdef DEC_3000_300 |
6050 | 6833 |
case DEC_3000_300: |
6834 |
cpuType = __MKSTRING("DEC_3000_300"); |
|
6835 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6836 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6837 |
# ifdef DEC_2000_300 |
6050 | 6838 |
case DEC_2000_300: |
6839 |
cpuType = __MKSTRING("DEC_2000_300"); |
|
6840 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6841 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6842 |
# ifdef DEC_2100_A500 |
6050 | 6843 |
case DEC_2100_A500: |
6844 |
cpuType = __MKSTRING("DEC_2100_A500"); |
|
6845 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6846 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6847 |
# ifdef DEC_2100_A50 |
6050 | 6848 |
case DEC_2100_A50: |
6849 |
cpuType = __MKSTRING("DEC_2100_A50"); |
|
6850 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6851 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6852 |
# ifdef ALPHA_KN20AA |
6050 | 6853 |
case ALPHA_KN20AA: |
6854 |
cpuType = __MKSTRING("ALPHA_KN20AA"); |
|
6855 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6856 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6857 |
# ifdef DEC_21000 |
6050 | 6858 |
case DEC_21000: |
6859 |
cpuType = __MKSTRING("DEC_21000"); |
|
6860 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6861 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6862 |
# ifdef DEC_AXPVME_64 |
6050 | 6863 |
case DEC_AXPVME_64: |
6864 |
cpuType = __MKSTRING("DEC_AXPVME_64"); |
|
6865 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6866 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6867 |
# ifdef DEC_2100_C500 |
6050 | 6868 |
case DEC_2100_C500: |
6869 |
cpuType = __MKSTRING("DEC_2100_C500"); |
|
6870 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6871 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6872 |
# ifdef DEC_AXPPCI_33 |
6050 | 6873 |
case DEC_AXPPCI_33: |
6874 |
cpuType = __MKSTRING("DEC_AXPPCI_33"); |
|
6875 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6876 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6877 |
# ifdef DEC_1000 |
6050 | 6878 |
case DEC_1000: |
6879 |
cpuType = __MKSTRING("DEC_1000"); |
|
6880 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6881 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6882 |
# ifdef EB64_PLUS |
6050 | 6883 |
case EB64_PLUS: |
6884 |
cpuType = __MKSTRING("EB64_PLUS"); |
|
6885 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6886 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6887 |
# ifdef LCA_EB66 |
6050 | 6888 |
case LCA_EB66: |
6889 |
cpuType = __MKSTRING("LCA_EB66"); |
|
6890 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6891 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6892 |
# ifdef ALPHA_EB164 |
6050 | 6893 |
case ALPHA_EB164: |
6894 |
cpuType = __MKSTRING("ALPHA_EB164"); |
|
6895 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6896 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6897 |
# ifdef DEC_EV45_PBP |
6050 | 6898 |
case DEC_EV45_PBP: |
6899 |
cpuType = __MKSTRING("DEC_EV45_PBP"); |
|
6900 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6901 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6902 |
# ifdef DEC_1000A |
6050 | 6903 |
case DEC_1000A: |
6904 |
cpuType = __MKSTRING("DEC_1000A"); |
|
6905 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6906 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6907 |
# ifdef DEC_4100 |
6050 | 6908 |
case DEC_4100: |
6909 |
cpuType = __MKSTRING("DEC_4100"); |
|
6910 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6911 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6912 |
# ifdef DEC_ALPHAVME_224 |
6050 | 6913 |
case DEC_ALPHAVME_224: |
6914 |
cpuType = __MKSTRING("DEC_ALPHAVME_224"); |
|
6915 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6916 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6917 |
# ifdef DEC_1000_5 |
6050 | 6918 |
case DEC_1000_5: |
6919 |
cpuType = __MKSTRING("DEC_1000_5"); |
|
6920 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6921 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6922 |
# ifdef DEC_1000A_5 |
6050 | 6923 |
case DEC_1000A_5: |
6924 |
cpuType = __MKSTRING("DEC_1000A_5"); |
|
6925 |
break; |
|
4101 | 6926 |
# endif |
6927 |
# ifdef DEC_EV56_PBP |
|
6050 | 6928 |
case DEC_EV56_PBP: |
6929 |
cpuType = __MKSTRING("DEC_EV56_PBP"); |
|
6930 |
break; |
|
4101 | 6931 |
# endif |
6932 |
# ifdef ALPHABOOK |
|
6050 | 6933 |
case ALPHABOOK: |
6934 |
cpuType = __MKSTRING("ALPHABOOK"); |
|
6935 |
break; |
|
4101 | 6936 |
# endif |
6937 |
# ifdef DEC_ALPHAVME_320 |
|
6050 | 6938 |
case DEC_ALPHAVME_320: |
6939 |
cpuType = __MKSTRING("DEC_ALPHAVME_320"); |
|
6940 |
break; |
|
4101 | 6941 |
# endif |
6942 |
# ifdef DEC_550 |
|
6050 | 6943 |
case DEC_550: |
6944 |
cpuType = __MKSTRING("DEC_550"); |
|
6945 |
break; |
|
4101 | 6946 |
# endif |
6947 |
# ifdef DEC_6600 |
|
6050 | 6948 |
case DEC_6600: |
6949 |
cpuType = __MKSTRING("DEC_6600"); |
|
6950 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6951 |
# endif |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6952 |
# ifdef UNKN_SYSTEM |
6050 | 6953 |
case UNKN_SYSTEM: |
6954 |
cpuType = __MKSTRING("UNKN_SYSTEM"); |
|
6955 |
break; |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6956 |
# endif |
6050 | 6957 |
default: |
6958 |
cpuType = __MKSTRING("OTHER_DEC_SYSTEM"); |
|
6959 |
break; |
|
6960 |
} |
|
6961 |
} |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6962 |
# endif /* GSI_CPU */ |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6963 |
|
4101 | 6964 |
# if defined(GSI_CPU_INFO) |
6050 | 6965 |
/* |
6966 |
* stupid: OSF1 pre V4.0 has no mhz, but V4.0 has it. |
|
6967 |
* use the GSI_PLATFORM_NAME as a hint - it is only defined in |
|
6968 |
* V4.0 and higher ... (sigh) |
|
6969 |
*/ |
|
4258 | 6970 |
# if defined GSI_PLATFORM_NAME |
6050 | 6971 |
{ |
6972 |
struct cpu_info cpuInfo; |
|
6973 |
||
6974 |
index = 0; |
|
6975 |
if (getsysinfo(GSI_CPU_INFO, &cpuInfo, sizeof(cpuInfo), &index, NULL) > 0) { |
|
6976 |
cpuSpeed = __MKUINT(cpuInfo.mhz); |
|
6977 |
} |
|
6978 |
} |
|
4258 | 6979 |
# endif |
4101 | 6980 |
# endif /* GSI_CPU_INFO */ |
6981 |
||
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6982 |
# if defined(GSI_CPUS_IN_BOX) |
6050 | 6983 |
index = 0; |
6984 |
if (getsysinfo(GSI_CPUS_IN_BOX, &retInt32, sizeof(retInt32), &index, NULL) > 0) { |
|
6985 |
numberOfCPUs = __MKUINT(retInt32); |
|
6986 |
} |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6987 |
# endif /* GSI_CPUS_IN_BOX */ |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6988 |
|
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6989 |
# if defined(GSI_PHYSMEM) |
6050 | 6990 |
index = 0; |
6991 |
if (getsysinfo(GSI_PHYSMEM, &retInt32, sizeof(retInt32), &index, NULL) > 0) { |
|
6992 |
INT bytes = retInt32 * 1024; |
|
6993 |
||
6994 |
physicalRam = __MKUINT(bytes); |
|
6995 |
} |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6996 |
# endif /* GSI_PHYSMEM */ |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
6997 |
|
4101 | 6998 |
# if defined(GSI_PLATFORM_NAME) && (!defined(HAS_SYSINFO) || !defined(SI_PLATFORM)) |
6999 |
{ |
|
6050 | 7000 |
char buffer[128]; |
7001 |
||
7002 |
index = 0; |
|
7003 |
if (getsysinfo(GSI_PLATFORM_NAME, buffer, sizeof(buffer), &index, NULL) > 0) { |
|
7004 |
platform = __MKSTRING(buffer); |
|
7005 |
} |
|
4101 | 7006 |
} |
7007 |
# endif /* GSI_PLATFORM_NAME */ |
|
7008 |
||
7009 |
} |
|
7010 |
#endif /* HAS_GETSYSINFO */ |
|
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
7011 |
|
4922 | 7012 |
{ |
6050 | 7013 |
extern OBJ __getInstructionSetInfo(); |
7014 |
||
7015 |
extendedInstructions = __getInstructionSetInfo(); |
|
4922 | 7016 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7017 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7018 |
sys isNil ifTrue:[ |
6050 | 7019 |
sys := self getSystemType. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7020 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7021 |
node isNil ifTrue:[ |
6050 | 7022 |
node := self getHostName. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7023 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7024 |
dom isNil ifTrue:[ |
6050 | 7025 |
dom := self getDomainName. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7026 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7027 |
mach isNil ifTrue:[ |
6050 | 7028 |
mach := self getCPUType. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7029 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7030 |
arch isNil ifTrue:[ |
6050 | 7031 |
arch := sys. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7032 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7033 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7034 |
info := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7035 |
info at:#system put:sys. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7036 |
info at:#node put:node. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7037 |
rel notNil ifTrue:[info at:#release put:rel]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7038 |
ver notNil ifTrue:[info at:#version put:ver]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7039 |
mach notNil ifTrue:[info at:#machine put:mach]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7040 |
arch notNil ifTrue:[info at:#architecture put:arch]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7041 |
dom notNil ifTrue:[info at:#domain put:dom]. |
3737 | 7042 |
(pageSize notNil and:[physicalPages notNil]) ifTrue:[ |
6050 | 7043 |
physicalRam := pageSize * physicalPages. "/ done here - could be largeInt. |
3737 | 7044 |
]. |
4101 | 7045 |
physicalRam notNil ifTrue:[info at:#physicalRam put:physicalRam]. |
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
7046 |
(pageSize notNil and:[availablePages notNil]) ifTrue:[ |
6050 | 7047 |
availableRam := pageSize * availablePages. "/ done here - could be largeInt. |
7048 |
availableRam notNil ifTrue:[info at:#availableRam put:availableRam]. |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
7049 |
]. |
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
7050 |
totalRam notNil ifTrue:[info at:#totalRam put:totalRam]. |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
7051 |
sharedRam notNil ifTrue:[info at:#sharedRam put:sharedRam]. |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
7052 |
bufferRam notNil ifTrue:[info at:#bufferRam put:bufferRam]. |
4020 | 7053 |
virtualRam notNil ifTrue:[info at:#virtualRam put:virtualRam]. |
7054 |
activeVirtualRam notNil ifTrue:[info at:#activeVirtualRam put:activeVirtualRam]. |
|
7055 |
realMemory notNil ifTrue:[info at:#realMemory put:realMemory]. |
|
7056 |
activeRealMemory notNil ifTrue:[info at:#activeRealMemory put:activeRealMemory]. |
|
7057 |
freeMemory notNil ifTrue:[info at:#freeMemory put:freeMemory]. |
|
3690
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
7058 |
swapSize notNil ifTrue:[info at:#swapSize put:swapSize]. |
7b7c5ff84986
more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents:
3663
diff
changeset
|
7059 |
freeSwap notNil ifTrue:[info at:#freeSwap put:freeSwap]. |
3735
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
7060 |
numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs]. |
3560084b4f83
more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents:
3696
diff
changeset
|
7061 |
cpuType notNil ifTrue:[info at:#cpuType put:cpuType]. |
4101 | 7062 |
cpuSpeed notNil ifTrue:[info at:#cpuSpeed put:cpuSpeed]. |
3737 | 7063 |
dCacheSize notNil ifTrue:[info at:#dCacheSize put:dCacheSize]. |
7064 |
iCacheSize notNil ifTrue:[info at:#iCacheSize put:iCacheSize]. |
|
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
7065 |
instructionSets notNil ifTrue:[info at:#instructionSets put:instructionSets]. |
4922 | 7066 |
extendedInstructions notNil ifTrue:[info at:#extendedInstructions put:(extendedInstructions asOrderedCollection select:[:e | e notNil])]. |
4084
797fd09b7808
more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
7067 |
platform notNil ifTrue:[info at:#platform put:platform]. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7068 |
info at:#osType put:(self getOSType). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7069 |
^ info |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7070 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7071 |
" |
3795 | 7072 |
OperatingSystem getSystemInfo |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7073 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7074 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7075 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7076 |
getSystemType |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7077 |
"return a string giving the type of system we're running on. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7078 |
This is almost the same as getOSType, but the returned string |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7079 |
is slightly different for some systems (i.e. iris vs. irix). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7080 |
Dont depend on this - use getOSType. I dont really see a point |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7081 |
here ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7082 |
(except for slight differences between next/mach and other machs)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7083 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7084 |
|sys| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7085 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7086 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7087 |
# ifdef NEXT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7088 |
# define SYS_STRING "next" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7089 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7090 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7091 |
# ifdef IRIS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7092 |
# define SYS_STRING "iris" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7093 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7094 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7095 |
# ifdef SYS_STRING |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7096 |
sys = __MKSTRING(SYS_STRING); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7097 |
# undef SYS_STRING |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7098 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7099 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7100 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7101 |
sys isNil ifTrue:[ |
6050 | 7102 |
^ self getOSType |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7103 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7104 |
^ sys |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7105 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7106 |
" |
3795 | 7107 |
OperatingSystem getSystemType |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7108 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7109 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7110 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7111 |
isBSDlike |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7112 |
"return true, if the OS we're running on is a 'real' unix." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7113 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7114 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7115 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7116 |
#if defined(BSD) || defined(MACH) || defined(SYSV4) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7117 |
RETURN ( true ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7118 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7119 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7120 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7121 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7122 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7123 |
isUNIXlike |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7124 |
"return true, if the OS we're running on is a unix like." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7125 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7126 |
^ true |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7127 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7128 |
"Modified: / 5.6.1998 / 18:40:39 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7129 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7130 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7131 |
maxFileNameLength |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7132 |
"return the max number of characters in a filename. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7133 |
CAVEAT: |
6050 | 7134 |
Actually, the following is somewhat wrong - some systems |
7135 |
support different sizes, depending on the volume. |
|
7136 |
We return a somewhat conservative number here. |
|
7137 |
Another entry, to query for volume specific max |
|
7138 |
will be added in the future." |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7139 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7140 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7141 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7142 |
/* |
5460 | 7143 |
* TODO: new systems provide a query function for this ... use it |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7144 |
*/ |
5460 | 7145 |
# if defined(MAXFILENAMELEN) |
7146 |
RETURN ( __MKSMALLINT(MAXFILENAMELEN) ); |
|
7147 |
# else |
|
7148 |
# if defined(BSD) || defined(SYSV4) || defined(LONGFILENAMES) |
|
7149 |
RETURN ( __MKSMALLINT(255) ); |
|
7150 |
# endif |
|
7151 |
||
7152 |
# ifdef realIX |
|
7153 |
RETURN ( __MKSMALLINT(127) ); |
|
7154 |
# endif |
|
7155 |
||
7156 |
# ifdef SYSV |
|
7157 |
RETURN ( __MKSMALLINT(14) ); |
|
7158 |
# endif |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7159 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7160 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7161 |
"unix default" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7162 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7163 |
^ 14 |
5460 | 7164 |
|
7165 |
" |
|
7166 |
OperatingSystem maxFileNameLength |
|
7167 |
" |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7168 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7169 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7170 |
maxPathLength |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7171 |
"return the max number of characters in a pathName." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7172 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7173 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7174 |
RETURN ( __MKSMALLINT(MAXPATHLEN) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7175 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7176 |
" |
3795 | 7177 |
OperatingSystem maxPathLength |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7178 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7179 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7180 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7181 |
pathSeparator |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7182 |
"return the character which separates items in the PATH variable" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7183 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7184 |
^ $: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7185 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7186 |
"Created: / 2.5.1997 / 11:36:47 / cg" |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7187 |
"Modified: / 5.6.1998 / 18:41:01 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7188 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7189 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7190 |
platformName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7191 |
"return a string describing the OS platform very we're running on. |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7192 |
This returns #unix for all unix derivatives, |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7193 |
#os2, #win32, #vms or #mac for the others. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7194 |
I.e. it is much less specific than getOSType or getSystemType." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7195 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7196 |
^ #unix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7197 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7198 |
" |
3795 | 7199 |
OperatingSystem platformName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7200 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7201 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7202 |
"Modified: / 5.6.1998 / 18:41:32 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7203 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7204 |
|
5444 | 7205 |
primGetDomainName |
7206 |
"return the domain this host is in. |
|
7207 |
Notice: |
|
6050 | 7208 |
not all systems support this; on some, nil is returned." |
5444 | 7209 |
|
7210 |
%{ /* STACK: 2048 */ |
|
7211 |
#if defined(HAS_GETDOMAINNAME) |
|
7212 |
char buffer[128]; |
|
7213 |
||
7214 |
if (getdomainname(buffer, sizeof(buffer)) == 0) { |
|
6050 | 7215 |
RETURN (__MKSTRING(buffer)); |
5444 | 7216 |
} |
7217 |
#else |
|
7218 |
# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME) |
|
7219 |
struct utsname ubuff; |
|
7220 |
||
7221 |
if (uname(&ubuff) >= 0) { |
|
6050 | 7222 |
RETURN (__MKSTRING(ubuff.domainname)); |
5444 | 7223 |
} |
7224 |
# else |
|
7225 |
# if defined(HAS_SYSINFO) && defined(SI_SRPC_DOMAIN) |
|
7226 |
char buffer[256]; |
|
7227 |
int ret; |
|
7228 |
||
7229 |
if ((ret = sysinfo(SI_SRPC_DOMAIN, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) { |
|
6050 | 7230 |
RETURN (__MKSTRING(buffer)); |
5444 | 7231 |
} |
7232 |
# endif |
|
7233 |
# endif |
|
7234 |
#endif |
|
7235 |
%}. |
|
7236 |
^ nil |
|
7237 |
||
7238 |
" |
|
7239 |
OperatingSystem primGetDomainName |
|
7240 |
" |
|
7241 |
||
7242 |
"Modified: 26.4.1996 / 10:04:54 / stefan" |
|
7243 |
! |
|
7244 |
||
7245 |
primGetHostName |
|
7246 |
"return the hostname we are running on - if there is |
|
7247 |
a HOST environment variable, we are much faster here ... |
|
7248 |
Notice: |
|
6050 | 7249 |
not all systems support this; on some, nil is returned." |
5444 | 7250 |
|
7251 |
%{ /* STACK: 2048 */ |
|
7252 |
#if defined(HAS_GETHOSTNAME) |
|
7253 |
char buffer[256]; |
|
7254 |
||
7255 |
if (gethostname(buffer, sizeof(buffer)) == 0) { |
|
6050 | 7256 |
RETURN (__MKSTRING(buffer)); |
5444 | 7257 |
} |
7258 |
#else |
|
7259 |
# if defined(HAS_UNAME) |
|
7260 |
struct utsname ubuff; |
|
7261 |
||
7262 |
if (uname(&ubuff) >= 0) { |
|
6050 | 7263 |
RETURN (__MKSTRING(ubuff.nodename)); |
5444 | 7264 |
} |
7265 |
# else |
|
7266 |
# if defined(HAS_SYSINFO) && defined(SI_HOSTNAME) |
|
7267 |
char buffer[256]; |
|
7268 |
int ret; |
|
7269 |
||
7270 |
if ((ret = sysinfo(SI_HOSTNAME, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) { |
|
6050 | 7271 |
RETURN (__MKSTRING(buffer)); |
5444 | 7272 |
} |
7273 |
# endif |
|
7274 |
# endif |
|
7275 |
#endif |
|
7276 |
%}. |
|
7277 |
^ nil |
|
7278 |
||
7279 |
" |
|
7280 |
OperatingSystem getHostName |
|
7281 |
" |
|
7282 |
! |
|
7283 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7284 |
setLocaleInfo:anInfoDictionary |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7285 |
"set the locale information; if set, this oerrides the OS's settings. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7286 |
(internal in ST/X only - the OS's settings remain unaffected) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7287 |
See description of fields in #getLocaleInfo. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7288 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7289 |
Notice, that (for now), the system does not use this information; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7290 |
it should be used by applications as required." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7291 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7292 |
LocaleInfo := anInfoDictionary |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7293 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7294 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7295 |
|d| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7296 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7297 |
d := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7298 |
d at:#decimalPoint put:'.' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7299 |
d at:#thousandsSeparator put:',' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7300 |
d at:#currencySymbol put:'USD' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7301 |
d at:#monetaryDecimalPoint put:'.' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7302 |
d at:#monetaryThousandsSeparator put:'.' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7303 |
d at:#fractionalDigits put:2 . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7304 |
d at:#positiveSign put:'+' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7305 |
d at:#negativeSign put:'-' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7306 |
d at:#positiveSignPrecedesCurrencySymbol put:true . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7307 |
d at:#negativeSignPrecedesCurrencySymbol put:false . |
3795 | 7308 |
OperatingSystem setLocaleInfo:d |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7309 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7310 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7311 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7312 |
supportsChildInterrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7313 |
"return true, if the OS supports childProcess termination signalling |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7314 |
through interrupts (i.e. SIGCHILD)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7315 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7316 |
%{ /* NOCONTEXT */ |
3930 | 7317 |
#if defined(SIGCHLD) || defined(SIGCLD) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7318 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7319 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7320 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7321 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7322 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7323 |
" |
3795 | 7324 |
OperatingSystem supportsChildInterrupts |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7325 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7326 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7327 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7328 |
supportsIOInterrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7329 |
"return true, if the OS supports IO availability interrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7330 |
(i.e. SIGPOLL/SIGIO). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7331 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7332 |
Currently, this mechanism does not work on all |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7333 |
systems ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7334 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7335 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7336 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7337 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7338 |
/* positive defines here |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7339 |
* - irix5.2 does not work |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7340 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7341 |
#if defined(LINUX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7342 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7343 |
# if defined(SIGIO) || defined(SIGPOLL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7344 |
# if defined(F_GETFL) && defined(F_SETFL) && defined(FASYNC) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7345 |
# if defined(F_SETOWN) || defined(FIOSETOWN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7346 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7347 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7348 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7349 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7350 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7351 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7352 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7353 |
#endif /* machines where it works */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7354 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7355 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7356 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7357 |
" |
3795 | 7358 |
OperatingSystem supportsIOInterrupts |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7359 |
" |
4934
6579e2e2ad7f
solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents:
4933
diff
changeset
|
7360 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7361 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7362 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7363 |
supportsNonBlockingIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7364 |
"return true, if the OS supports nonblocking IO." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7365 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7366 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7367 |
#if defined(F_GETFL) && defined(F_SETFL) && defined(FNDELAY) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7368 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7369 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7370 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7371 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7372 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7373 |
" |
3795 | 7374 |
OperatingSystem supportsNonBlockingIO |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7375 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7376 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7377 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7378 |
supportsSelect |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7379 |
"return true, if the OS supports selecting on multiple |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7380 |
filedescriptors via select. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7381 |
If false is returned, ProcessorScheduler will poll in 50ms |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7382 |
intervals for I/O becoming ready." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7383 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7384 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7385 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7386 |
#if defined(sco) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7387 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7388 |
* sco has a select, but its broken: always waiting 1 second |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7389 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7390 |
RETURN(false); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7391 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7392 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7393 |
^ true |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7394 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7395 |
" |
3795 | 7396 |
OperatingSystem supportsSelect |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7397 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7398 |
|
3759 | 7399 |
! |
7400 |
||
7401 |
supportsSymbolicLinks |
|
7402 |
"return true, if the OS supports symbolic (soft) links; |
|
7403 |
most UNIX'es do; many other OS's do not." |
|
7404 |
||
7405 |
%{ /* NOCONTEXT */ |
|
7406 |
||
7407 |
#ifdef S_IFLNK |
|
7408 |
/* |
|
7409 |
* assume yes - if that is defined. |
|
7410 |
*/ |
|
7411 |
RETURN(true); |
|
7412 |
#endif |
|
7413 |
%}. |
|
7414 |
^ false |
|
7415 |
||
7416 |
" |
|
7417 |
OperatingSystem supportsSymbolicLinks |
|
7418 |
" |
|
7419 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7420 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7421 |
|
4018 | 7422 |
!UnixOperatingSystem class methodsFor:'path queries'! |
7423 |
||
7424 |
defaultSystemPath |
|
5647
ad054a02bc88
only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents:
5639
diff
changeset
|
7425 |
"add additional directories to the systemPath |
ad054a02bc88
only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents:
5639
diff
changeset
|
7426 |
(but only, if the major version is the same)" |
ad054a02bc88
only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents:
5639
diff
changeset
|
7427 |
|
ad054a02bc88
only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents:
5639
diff
changeset
|
7428 |
|sysPath majorVersionNr minorVersionNr releaseFile s v| |
ad054a02bc88
only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents:
5639
diff
changeset
|
7429 |
|
ad054a02bc88
only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents:
5639
diff
changeset
|
7430 |
majorVersionNr := Smalltalk majorVersionNr. |
4018 | 7431 |
|
7432 |
sysPath := super defaultSystemPath. |
|
7433 |
#( |
|
6050 | 7434 |
'/usr/local/lib/smalltalk' |
7435 |
'/usr/lib/smalltalk' |
|
7436 |
'/lib/smalltalk' |
|
7437 |
'/opt/smalltalk' |
|
4018 | 7438 |
) do:[:d | |
6050 | 7439 |
(d asFilename isDirectory) ifTrue:[ |
7440 |
"/ try to guess a gnu-smalltalk; skip it |
|
7441 |
(d asFilename construct:'initialize.st') exists ifFalse:[ |
|
7442 |
releaseFile := d asFilename construct:'RELEASE'. |
|
7443 |
releaseFile exists ifTrue:[ |
|
7444 |
s := releaseFile readStream. |
|
7445 |
s notNil ifTrue:[ |
|
7446 |
v := Integer readFrom:s onError:-1. |
|
7447 |
s close. |
|
7448 |
v == majorVersionNr ifTrue:[ |
|
7449 |
sysPath add:d |
|
7450 |
] ifFalse:[ |
|
7451 |
('UnixOperatingSystem [info]: ignore files in ' , d asFilename pathName , ' (RELEASE mismatch)') infoPrintCR. |
|
7452 |
] |
|
7453 |
] ifFalse:[ |
|
7454 |
('UnixOperatingSystem [info]: ignore files in ' , d asFilename pathName , ' (RELEASE missing)') infoPrintCR. |
|
7455 |
] |
|
7456 |
] |
|
7457 |
] |
|
7458 |
] |
|
4018 | 7459 |
]. |
7460 |
^ sysPath |
|
5035 | 7461 |
|
7462 |
" |
|
7463 |
OperatingSystem defaultSystemPath |
|
7464 |
" |
|
4018 | 7465 |
! ! |
7466 |
||
3558
5a6c4b491b95
oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents:
3556
diff
changeset
|
7467 |
!UnixOperatingSystem class methodsFor:'private'! |
5a6c4b491b95
oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents:
3556
diff
changeset
|
7468 |
|
5a6c4b491b95
oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents:
3556
diff
changeset
|
7469 |
osProcessStatusClass |
5a6c4b491b95
oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents:
3556
diff
changeset
|
7470 |
^ OSProcessStatus |
5a6c4b491b95
oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents:
3556
diff
changeset
|
7471 |
|
5a6c4b491b95
oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents:
3556
diff
changeset
|
7472 |
"Created: / 12.6.1998 / 16:30:43 / cg" |
5a6c4b491b95
oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents:
3556
diff
changeset
|
7473 |
! ! |
5a6c4b491b95
oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents:
3556
diff
changeset
|
7474 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7475 |
!UnixOperatingSystem class methodsFor:'shared memory access'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7476 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7477 |
shmAttach:id address:addr flags:flags |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7478 |
"low level entry to shmat()-system call. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7479 |
Not supported on all operatingSystems" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7480 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7481 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7482 |
#ifdef WANT_SHM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7483 |
void *address, *shmaddr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7484 |
int shmflg, shmid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7485 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7486 |
if (__isSmallInteger(addr) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7487 |
&& __bothSmallInteger(flags, id)) { |
6050 | 7488 |
shmaddr = (void *) __intVal(addr); |
7489 |
shmflg = __intVal(flags); |
|
7490 |
shmid = __intVal(id); |
|
7491 |
||
7492 |
address = shmat(shmid, shmaddr, shmflg); |
|
7493 |
if (address != (void *)-1) { |
|
7494 |
RETURN (__MKEXTERNALBYTES(addr)); |
|
7495 |
} |
|
7496 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
7497 |
RETURN (nil); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7498 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7499 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7500 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7501 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7502 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7503 |
"Modified: 22.4.1996 / 13:15:12 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7504 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7505 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7506 |
shmDetach:addr |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7507 |
"low level entry to shmdt()-system call. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7508 |
Not supported on all operatingSystems" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7509 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7510 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7511 |
#ifdef WANT_SHM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7512 |
void *shmaddr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7513 |
int rslt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7514 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7515 |
if (__isSmallInteger(addr)) { |
6050 | 7516 |
shmaddr = (void *) __intVal(addr); |
7517 |
||
7518 |
rslt = shmdt(shmaddr); |
|
7519 |
if (rslt != -1) { |
|
7520 |
RETURN (true); |
|
7521 |
} |
|
7522 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
7523 |
RETURN (false); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7524 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7525 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7526 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7527 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7528 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7529 |
"Modified: 22.4.1996 / 13:15:03 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7530 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7531 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7532 |
shmGet:key size:size flags:flags |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7533 |
"low level entry to shmget()-system call. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7534 |
This is not for public use and not supported with all operatingSystems. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7535 |
- use the provided wrapper class SharedExternalBytes instead." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7536 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7537 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7538 |
#ifdef WANT_SHM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7539 |
if (__bothSmallInteger(key, size) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7540 |
&& __isSmallInteger(flags)) { |
6050 | 7541 |
int rslt; |
7542 |
||
7543 |
rslt = shmget(__intVal(key), __intVal(size), __intVal(flags)); |
|
7544 |
if (rslt != -1) { |
|
7545 |
RETURN (__MKSMALLINT(rslt)); |
|
7546 |
} |
|
7547 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
7548 |
RETURN (nil); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7549 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7550 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7551 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7552 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7553 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7554 |
"Modified: 22.4.1996 / 13:14:46 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7555 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7556 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7557 |
!UnixOperatingSystem class methodsFor:'time and date'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7558 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7559 |
computeDatePartsOf:osTime for:aBlock |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7560 |
"compute year, month and day from the OS time, osTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7561 |
and evaluate the argument, a 3-arg block with these. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7562 |
Conversion is to localtime including any daylight saving adjustments." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7563 |
|
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7564 |
|year month day osSeconds i| |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7565 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7566 |
osSeconds := osTime // 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7567 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7568 |
struct tm* tmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7569 |
INT t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7570 |
TIME_T tt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7571 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7572 |
t = __longIntVal(osSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7573 |
tt = (TIME_T)t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7574 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7575 |
tmPtr = localtime(&tt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7576 |
year = __MKSMALLINT(tmPtr->tm_year + 1900); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7577 |
month = __MKSMALLINT(tmPtr->tm_mon + 1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7578 |
day = __MKSMALLINT(tmPtr->tm_mday); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7579 |
%}. |
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7580 |
year isNil ifTrue:[ |
6050 | 7581 |
i := self computeTimeAndDateFrom:osTime. |
7582 |
year := i at:1. |
|
7583 |
month := i at:2. |
|
7584 |
day := i at:3. |
|
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7585 |
]. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7586 |
aBlock value:year value:month value:day |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7587 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7588 |
" |
3795 | 7589 |
OperatingSystem computeDatePartsOf:0 for:[:y :m :d | |
6050 | 7590 |
y printCR. m printCR. d printCR |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7591 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7592 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7593 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7594 |
|
4380 | 7595 |
computeOSTimeFromUTCYear:y month:m day:d hour:h minute:min second:s millisecond:millis |
7596 |
"return the OS-dependent time for the given time and day. |
|
7597 |
The arguments are assumed to be in UTC Time" |
|
7598 |
||
7599 |
|osSeconds| |
|
7600 |
||
7601 |
%{ |
|
7602 |
struct tm tm; |
|
7603 |
TIME_T t; |
|
7604 |
||
7605 |
if (__bothSmallInteger(y, m) |
|
7606 |
&& __bothSmallInteger(d, h) |
|
7607 |
&& __bothSmallInteger(min, s)) { |
|
6050 | 7608 |
tm.tm_hour = __intVal(h); |
7609 |
tm.tm_min = __intVal(min); |
|
7610 |
tm.tm_sec = __intVal(s); |
|
7611 |
||
7612 |
tm.tm_year = __intVal(y) - 1900; |
|
7613 |
tm.tm_mon = __intVal(m) - 1; |
|
7614 |
tm.tm_mday = __intVal(d); |
|
7615 |
tm.tm_isdst = -1; |
|
7616 |
||
7617 |
t = mktime(&tm); |
|
7618 |
osSeconds = __MKUINT((INT)t+TIMEZONE(&tm)); |
|
4380 | 7619 |
} |
7620 |
%}. |
|
7621 |
osSeconds notNil ifTrue:[ |
|
6050 | 7622 |
^ osSeconds * 1000 + millis |
4380 | 7623 |
]. |
7624 |
^ self primitiveFailed |
|
7625 |
||
7626 |
" |
|
5639
2e750f87b419
Fix UTC Time handling when daylight saving time applies.
Stefan Vogel <sv@exept.de>
parents:
5625
diff
changeset
|
7627 |
OperatingSystem computeOSTimeFromUTCYear:1970 month:1 day:1 hour:0 minute:0 second:0 millisecond:0 |
4380 | 7628 |
OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0 |
5639
2e750f87b419
Fix UTC Time handling when daylight saving time applies.
Stefan Vogel <sv@exept.de>
parents:
5625
diff
changeset
|
7629 |
OperatingSystem computeOSTimeFromUTCYear:2000 month:7 day:1 hour:0 minute:0 second:0 millisecond:0 |
2e750f87b419
Fix UTC Time handling when daylight saving time applies.
Stefan Vogel <sv@exept.de>
parents:
5625
diff
changeset
|
7630 |
OperatingSystem computeOSTimeFromYear:2000 month:7 day:1 hour:0 minute:0 seconds:0 millis:0 |
2e750f87b419
Fix UTC Time handling when daylight saving time applies.
Stefan Vogel <sv@exept.de>
parents:
5625
diff
changeset
|
7631 |
" |
4380 | 7632 |
! |
7633 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7634 |
computeOSTimeFromYear:y month:m day:d hour:h minute:min seconds:s millis:millis |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7635 |
"return the OS-dependent time for the given time and day. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7636 |
The arguments are assumed to be in localtime including |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7637 |
any daylight saving adjustings." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7638 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7639 |
|osSeconds| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7640 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7641 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7642 |
struct tm tm; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7643 |
TIME_T t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7644 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7645 |
if (__bothSmallInteger(y, m) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7646 |
&& __bothSmallInteger(d, h) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7647 |
&& __bothSmallInteger(min, s)) { |
6050 | 7648 |
tm.tm_hour = __intVal(h); |
7649 |
tm.tm_min = __intVal(min); |
|
7650 |
tm.tm_sec = __intVal(s); |
|
7651 |
||
7652 |
tm.tm_year = __intVal(y) - 1900; |
|
7653 |
tm.tm_mon = __intVal(m) - 1; |
|
7654 |
tm.tm_mday = __intVal(d); |
|
7655 |
tm.tm_isdst = -1; |
|
7656 |
||
7657 |
t = mktime(&tm); |
|
7658 |
osSeconds = __MKUINT((INT)t); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7659 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7660 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7661 |
osSeconds notNil ifTrue:[ |
6050 | 7662 |
^ osSeconds * 1000 + millis |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7663 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7664 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7665 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7666 |
" |
3795 | 7667 |
OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0 |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7668 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7669 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7670 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7671 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7672 |
computeTimeAndDateFrom:osTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7673 |
"given an OS-dependent time in osTime, return an Array |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7674 |
containing (full-) year, month, day, hour, minute and seconds, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7675 |
offset to UTC, daylight savings time flag, milliseconds, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7676 |
dayInYear (1..) and dayInWeek (1..). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7677 |
Conversion is to localtime including any daylight saving adjustments." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7678 |
|
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7679 |
|millis osSeconds ret| |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7680 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7681 |
millis := osTime \\ 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7682 |
osSeconds := osTime // 1000. |
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7683 |
ret := self fillTimeAndDateFromSeconds:osSeconds into:(Array new:11). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7684 |
ret at:9 put:millis. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7685 |
^ ret |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7686 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7687 |
" |
3795 | 7688 |
OperatingSystem computeTimeAndDateFrom:0 |
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7689 |
OperatingSystem computeTimeAndDateFrom:1011 |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7690 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7691 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7692 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7693 |
computeTimePartsOf:osTime for:aBlock |
5854 | 7694 |
"compute hours, minutes, seconds and milliseconds from the local osTime |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7695 |
and evaluate the argument, a 4-arg block with these. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7696 |
Conversion is to localtime including any daylight saving adjustments." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7697 |
|
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7698 |
|hours minutes seconds millis osSeconds i| |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7699 |
|
5854 | 7700 |
i := self computeTimeAndDateFrom:osTime. |
7701 |
hours := i at:4. |
|
7702 |
minutes := i at:5. |
|
7703 |
seconds := i at:6. |
|
7704 |
millis := i at:9. |
|
7705 |
||
7706 |
"/ osSeconds := osTime // 1000. |
|
7707 |
"/ millis := osTime \\ 1000. |
|
7708 |
"/%{ |
|
7709 |
"/ struct tm *tmPtr; |
|
7710 |
"/ INT t; |
|
7711 |
"/ TIME_T tt; |
|
7712 |
"/ |
|
7713 |
"/ t = __longIntVal(osSeconds); |
|
7714 |
"/ tt = (TIME_T)t; |
|
7715 |
"/ |
|
7716 |
"/ tmPtr = localtime(&tt); |
|
7717 |
"/ hours = __MKSMALLINT(tmPtr->tm_hour); |
|
7718 |
"/ minutes = __MKSMALLINT(tmPtr->tm_min); |
|
7719 |
"/ seconds = __MKSMALLINT(tmPtr->tm_sec); |
|
7720 |
"/%}. |
|
7721 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7722 |
aBlock value:hours value:minutes value:seconds value:millis |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7723 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7724 |
" |
3795 | 7725 |
OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli | |
6050 | 7726 |
Transcript show:h; space; show:m; space; show:s; space; showCR:milli. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7727 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7728 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7729 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7730 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7731 |
computeUTCTimeAndDateFrom:osTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7732 |
"given an OS-dependent time in osTime, return an Array |
5854 | 7733 |
containing: |
6050 | 7734 |
(full-) year, |
7735 |
month, (1..) |
|
7736 |
day, (1..) |
|
7737 |
hour, (0..23) |
|
7738 |
minute (0..59) |
|
7739 |
seconds, (0..59) |
|
7740 |
offset to UTC, (seconds) |
|
7741 |
daylight savings time flag, |
|
7742 |
milliseconds, (0..999) |
|
7743 |
dayInYear (1..) |
|
7744 |
dayInWeek (1..). |
|
5854 | 7745 |
Conversion is to utc." |
7746 |
||
7747 |
|millis osSeconds ret| |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7748 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7749 |
millis := osTime \\ 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7750 |
osSeconds := osTime // 1000. |
5854 | 7751 |
ret := self fillTimeAndDateFromUTCSeconds:osSeconds into:(Array new:11). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7752 |
ret at:9 put:millis. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7753 |
^ ret |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7754 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7755 |
" |
5854 | 7756 |
OperatingSystem computeUTCTimeAndDateFrom:0 |
7757 |
OperatingSystem computeUTCTimeAndDateFrom:1011 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7758 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7759 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7760 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7761 |
computeUTCTimePartsOf:osTime for:aBlock |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7762 |
"compute hours, minutes, seconds and milliseconds from the osTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7763 |
and evaluate the argument, a 4-arg block with these. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7764 |
Conversion is to UTC." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7765 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7766 |
|hours minutes seconds millis osSeconds| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7767 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7768 |
osSeconds := osTime // 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7769 |
millis := osTime \\ 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7770 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7771 |
struct tm *tmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7772 |
long t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7773 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7774 |
t = __longIntVal(osSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7775 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7776 |
tmPtr = gmtime(&t); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7777 |
hours = __MKSMALLINT(tmPtr->tm_hour); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7778 |
minutes = __MKSMALLINT(tmPtr->tm_min); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7779 |
seconds = __MKSMALLINT(tmPtr->tm_sec); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7780 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7781 |
aBlock value:hours value:minutes value:seconds value:millis |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7782 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7783 |
" |
3795 | 7784 |
OperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli | |
6050 | 7785 |
h printCR. m printCR. s printCR. milli printCR |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7786 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7787 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7788 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7789 |
|
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7790 |
fillTimeAndDateFromSeconds:osSeconds into:timeArray |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7791 |
"fill the array with os-time components. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7792 |
An internal helper" |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7793 |
|
5854 | 7794 |
^ self fillTimeAndDateFromSeconds:osSeconds isLocal:true into:timeArray |
7795 |
! |
|
7796 |
||
7797 |
fillTimeAndDateFromSeconds:osSeconds isLocal:isLocalTime into:timeArray |
|
7798 |
"fill the array with os-time components. |
|
7799 |
An internal helper" |
|
7800 |
||
5855 | 7801 |
|low hi year month day hours minutes seconds utcOffset |
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7802 |
dst yDay wDay | |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7803 |
|
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7804 |
%{ |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7805 |
struct tm *tmPtr; |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7806 |
INT t; |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7807 |
TIME_T tt; |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7808 |
|
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7809 |
t = __longIntVal(osSeconds); |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7810 |
tt = (TIME_T)t; |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7811 |
|
5854 | 7812 |
if (isLocalTime == true) { |
6050 | 7813 |
tmPtr = localtime(&tt); |
5854 | 7814 |
} else { |
6050 | 7815 |
tmPtr = gmtime(&tt); |
5854 | 7816 |
} |
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7817 |
hours = __MKSMALLINT(tmPtr->tm_hour); |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7818 |
minutes = __MKSMALLINT(tmPtr->tm_min); |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7819 |
seconds = __MKSMALLINT(tmPtr->tm_sec); |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7820 |
|
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7821 |
year = __MKSMALLINT(tmPtr->tm_year + 1900); |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7822 |
month = __MKSMALLINT(tmPtr->tm_mon + 1); |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7823 |
day = __MKSMALLINT(tmPtr->tm_mday); |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7824 |
|
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7825 |
yDay = __MKSMALLINT(tmPtr->tm_yday+1); |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7826 |
wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday); |
5656
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
7827 |
utcOffset = __MKSMALLINT(TIMEZONE(tmPtr)); |
dbc52ea02716
Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents:
5649
diff
changeset
|
7828 |
dst = (tmPtr->tm_isdst == 0 ? false : true); |
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7829 |
%}. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7830 |
"I would love to have SELF-like inline objects ..." |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7831 |
timeArray at:1 put:year. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7832 |
timeArray at:2 put:month. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7833 |
timeArray at:3 put:day. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7834 |
timeArray at:4 put:hours. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7835 |
timeArray at:5 put:minutes. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7836 |
timeArray at:6 put:seconds. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7837 |
timeArray at:7 put:utcOffset. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7838 |
timeArray at:8 put:dst. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7839 |
timeArray at:9 put:nil. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7840 |
timeArray at:10 put:yDay. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7841 |
timeArray at:11 put:wDay. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7842 |
^ timeArray |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7843 |
|
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7844 |
" |
5855 | 7845 |
OperatingSystem fillTimeAndDateFromSeconds:0 isLocal:false into:(Array new:11) |
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7846 |
" |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7847 |
! |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7848 |
|
5854 | 7849 |
fillTimeAndDateFromUTCSeconds:osSeconds into:timeArray |
7850 |
"fill the array with os-time components. |
|
7851 |
An internal helper" |
|
7852 |
||
7853 |
^ self fillTimeAndDateFromSeconds:osSeconds isLocal:false into:timeArray |
|
7854 |
||
7855 |
" |
|
7856 |
OperatingSystem fillTimeAndDateFromUTCSeconds:0 into:(Array new:11) |
|
7857 |
" |
|
7858 |
! |
|
7859 |
||
3692
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7860 |
getMicrosecondTime |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7861 |
"This returns the microsecond timers value - if available. |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7862 |
On some machines, times with this precision may not be available, |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7863 |
on those, the returned value may be rounded towards some internal |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7864 |
clock resolution value." |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7865 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7866 |
|seconds millis micros| |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7867 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7868 |
%{ |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7869 |
long _seconds = 0; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7870 |
long _millis = 0; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7871 |
long _micros = 0; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7872 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7873 |
#if !defined(HAS_GETTIMEOFDAY) |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7874 |
# if defined(HAS_FTIME) |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7875 |
struct timeb timebuffer; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7876 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7877 |
ftime(&timebuffer); |
6050 | 7878 |
_seconds = timebuffer.time; |
3692
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7879 |
_millis = timebuffer.millitm; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7880 |
# define HAVE_TIME |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7881 |
# endif |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7882 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7883 |
# ifndef HAVE_TIME |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7884 |
# if defined(SYSV) && defined(HZ) |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7885 |
/* |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7886 |
* sys5 time - in ticks |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7887 |
*/ |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7888 |
long ticks; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7889 |
struct tms tb; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7890 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7891 |
ticks = times(&tb); |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7892 |
_seconds = ticks / HZ; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7893 |
ticks -= (_seconds * HZ); |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7894 |
_millis = ticks * 1000 / HZ; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7895 |
# define HAVE_TIME |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7896 |
# endif /* old SYSV stuff */ |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7897 |
# endif |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7898 |
#endif |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7899 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7900 |
#ifndef HAVE_TIME |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7901 |
/* assume HAS_GETTIMEOFDAY |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7902 |
* - will result in a linkage error |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7903 |
* if not fixed. |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7904 |
*/ |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7905 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7906 |
/* |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7907 |
* bsd time |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7908 |
*/ |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7909 |
struct timeval tb; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7910 |
/* struct timezone tzb; */ |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7911 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7912 |
gettimeofday(&tb, NULL /* &tzb */); |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7913 |
_seconds = tb.tv_sec; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7914 |
_micros = tb.tv_usec; |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7915 |
if (_micros >= (1000*1000)) { |
6050 | 7916 |
printf("oops\n"); |
3692
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7917 |
} |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7918 |
#endif |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7919 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7920 |
#undef HAVE_TIME |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7921 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7922 |
seconds = __MKINT(_seconds); |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7923 |
millis = __MKINT(_millis); |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7924 |
micros = __MKINT(_micros); |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7925 |
%}. |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7926 |
^ (((seconds * 1000) + millis) * 1000) + micros |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7927 |
|
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7928 |
" |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7929 |
Transcript showCR:(OperatingSystem getMicrosecondTime). |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7930 |
Transcript showCR:(OperatingSystem getMicrosecondTime). |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7931 |
" |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7932 |
! |
0f0377cca3d6
added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents:
3691
diff
changeset
|
7933 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7934 |
getMillisecondTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7935 |
"This returns the millisecond timers value. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7936 |
The range is limited to 0..1fffffff (i.e. the SmallInteger range) to avoid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7937 |
LargeInteger arithmetic when doing timeouts and delays. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7938 |
Since this value is wrapping around in regular intervals, this can only be used for |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7939 |
short relative time deltas. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7940 |
Use the millisecondTimeXXX:-methods to compare and add time deltas - these know about the wrap. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7941 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7942 |
BAD DESIGN: |
6050 | 7943 |
This should be changed to return some instance of RelativeTime, |
7944 |
and these computations moved there. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7945 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7946 |
Dont use this method in application code since it is an internal (private) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7947 |
interface. For compatibility with ST-80, use Time millisecondClockValue. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7948 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7949 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7950 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7951 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7952 |
long t = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7953 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7954 |
#if !defined(HAS_GETTIMEOFDAY) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7955 |
# if defined(HAS_FTIME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7956 |
struct timeb timebuffer; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7957 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7958 |
ftime(&timebuffer); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7959 |
t = (timebuffer.time * 1000) + timebuffer.millitm; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7960 |
# define HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7961 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7962 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7963 |
# ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7964 |
# if defined(SYSV) && defined(HZ) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7965 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7966 |
* sys5 time |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7967 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7968 |
long ticks; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7969 |
struct tms tb; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7970 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7971 |
ticks = times(&tb); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7972 |
t = (ticks * 1000) / HZ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7973 |
# define HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7974 |
# endif /* old SYSV stuff */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7975 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7976 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7977 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7978 |
#ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7979 |
/* assume HAS_GETTIMEOFDAY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7980 |
* - will result in a linkage error |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7981 |
* if not fixed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7982 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7983 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7984 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7985 |
* bsd time |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7986 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7987 |
struct timeval tb; |
6050 | 7988 |
/* struct timezone tzb; */ |
7989 |
||
7990 |
gettimeofday(&tb, NULL /* &tzb */); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7991 |
t = tb.tv_sec*1000 + tb.tv_usec/1000; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7992 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7993 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7994 |
#undef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7995 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7996 |
RETURN ( __MKSMALLINT(t & 0x1FFFFFFF) ); |
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7997 |
%}. |
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
7998 |
self primitiveFailed |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7999 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8000 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8001 |
getOSTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8002 |
"This returns the OS time. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8003 |
The base of the returned value is not consistent across |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8004 |
different OS's - some return the number of millis since jan, 1st 1970; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8005 |
others since 1900. The Time classes are prepared for this, and |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8006 |
converts as appropriate (by using my fromOSTime: conversion methods). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8007 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8008 |
Dont use this method in application code since it is an internal (private) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8009 |
interface. For compatibility with ST-80, use Time>>millisecondClockValue. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8010 |
or use instances of Time, Date or AbsoluteTime to work with. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8011 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8012 |
|
5488 | 8013 |
|time seconds millis| |
8014 |
||
8015 |
time := self primGetOSTime. |
|
8016 |
time isArray ifTrue:[ |
|
6050 | 8017 |
seconds := time at:1. |
8018 |
millis := time at:2. |
|
8019 |
time := (seconds * 1000) + millis |
|
5488 | 8020 |
]. |
8021 |
^ time |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8022 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8023 |
" |
3795 | 8024 |
OperatingSystem getOSTime printCR. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8025 |
Delay waitForSeconds:0.2. |
3795 | 8026 |
OperatingSystem getOSTime printCR. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8027 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8028 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8029 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8030 |
millisecondDelay:millis |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8031 |
"delay execution for millis milliseconds or until the next event |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8032 |
arrives. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8033 |
All lower priority threads will also sleep for the duration, |
5233 | 8034 |
interrupts (and therefore, higher prio processes) are still handled. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8035 |
Better use a Delay, to only delay the calling thread. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8036 |
(however, a delay cannot be used in the event handler or scheduler)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8037 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8038 |
|now then delta| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8039 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8040 |
now := UnixOperatingSystem getMillisecondTime. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8041 |
then := UnixOperatingSystem millisecondTimeAdd:now and:millis. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8042 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8043 |
[UnixOperatingSystem millisecondTime:then isAfter:now] whileTrue:[ |
6050 | 8044 |
delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now. |
8045 |
self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta. |
|
8046 |
now := UnixOperatingSystem getMillisecondTime. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8047 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8048 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8049 |
" |
3795 | 8050 |
OperatingSystem millisecondDelay:2000 |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8051 |
" |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8052 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8053 |
"Modified: / 5.6.1998 / 18:42:17 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8054 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8055 |
|
5488 | 8056 |
primGetOSTime |
8057 |
"This returns the OS time. |
|
8058 |
The base of the returned value is not consistent across |
|
8059 |
different OS's - some return the number of millis since jan, 1st 1970; |
|
8060 |
others since 1900. The Time classes are prepared for this, and |
|
8061 |
converts as appropriate (by using my fromOSTime: conversion methods). |
|
8062 |
||
8063 |
Dont use this method in application code since it is an internal (private) |
|
8064 |
interface. For compatibility with ST-80, use Time>>millisecondClockValue. |
|
8065 |
or use instances of Time, Date or AbsoluteTime to work with. |
|
8066 |
" |
|
8067 |
||
8068 |
|seconds millis| |
|
8069 |
||
8070 |
%{ |
|
8071 |
||
8072 |
long t; |
|
8073 |
long _secs, _millis; |
|
8074 |
||
8075 |
#if !defined(HAS_GETTIMEOFDAY) |
|
8076 |
# if defined(HAS_FTIME) |
|
8077 |
{ |
|
6050 | 8078 |
struct timeb timebuffer; |
8079 |
||
8080 |
ftime(&timebuffer); |
|
8081 |
_secs = timebuffer.time; |
|
8082 |
_millis = timebuffer.millitm; |
|
5488 | 8083 |
} |
8084 |
# define HAVE_TIME |
|
8085 |
# endif /* HAS_FTIME */ |
|
8086 |
||
8087 |
# ifndef HAVE_TIME |
|
8088 |
# if defined(SYSV) && defined(HZ) |
|
8089 |
{ |
|
6050 | 8090 |
/* |
8091 |
* sys5 time; we have to fake the information |
|
8092 |
* the returned value is inexact. |
|
8093 |
*/ |
|
8094 |
long ticks; |
|
8095 |
struct tms tb; |
|
8096 |
||
8097 |
_secs = time(0); /* seconds since 1970 ... */ |
|
8098 |
||
8099 |
ticks = times(&tb); |
|
8100 |
t = (ticks * 1000) / HZ; |
|
8101 |
t = t % 1000; |
|
8102 |
_millis = __MKSMALLINT(t); |
|
5488 | 8103 |
} |
8104 |
# define HAVE_TIME |
|
8105 |
# endif /* OLD SYSV stuff */ |
|
8106 |
# endif |
|
8107 |
#endif /* no HAS_GETTIMEOFDAY */ |
|
8108 |
||
8109 |
#ifndef HAVE_TIME |
|
8110 |
/* |
|
8111 |
* use HAS_GETTIMEOFDAY even if HAS_GETTIMEOFDAY is undefined here. |
|
8112 |
* Will result in a linkage error if not fixed and neither ftime() nor time() is used. |
|
8113 |
*/ |
|
8114 |
||
8115 |
{ |
|
6050 | 8116 |
/* |
8117 |
* bsd time |
|
8118 |
*/ |
|
8119 |
struct timeval tb; |
|
8120 |
/* struct timezone tzb; */ |
|
8121 |
||
8122 |
gettimeofday(&tb, NULL /* &tzb */); |
|
8123 |
||
8124 |
_secs = tb.tv_sec; |
|
8125 |
_millis = tb.tv_usec / 1000; |
|
5488 | 8126 |
} |
8127 |
#endif |
|
8128 |
||
8129 |
/* |
|
8130 |
* mhmh long-long stuff seems not to work correctly |
|
8131 |
* on all machines (sparc) |
|
8132 |
* being conservative here ... |
|
8133 |
*/ |
|
8134 |
||
8135 |
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(i386) && defined(LINUX) |
|
8136 |
# define HAS_LONGLONG |
|
8137 |
#endif |
|
8138 |
||
8139 |
#ifdef alpha64 |
|
8140 |
{ |
|
6050 | 8141 |
unsigned INT _lsecs, _lmillis, rslt; |
8142 |
||
8143 |
_lsecs = (INT)_secs; |
|
8144 |
_lmillis = (INT)_millis; |
|
8145 |
rslt = _lsecs * 1000 + _lmillis; |
|
8146 |
RETURN (__MKUINT(rslt)); |
|
5488 | 8147 |
} |
8148 |
#else |
|
8149 |
# ifdef HAS_LONGLONG |
|
8150 |
{ |
|
6050 | 8151 |
unsigned long long _lsecs, _lmillis, rslt; |
8152 |
unsigned low, hi; |
|
8153 |
||
8154 |
_lsecs = (long long)_secs; |
|
8155 |
_lmillis = (long long)_millis; |
|
8156 |
rslt = _lsecs * 1000 + _lmillis; |
|
8157 |
low = rslt & 0xFFFFFFFF; |
|
8158 |
hi = rslt >> 32; |
|
8159 |
RETURN (__MKLARGEINT64(1, low, hi)); |
|
5488 | 8160 |
} |
8161 |
# else |
|
8162 |
seconds = __MKUINT(_secs); |
|
8163 |
millis = __MKUINT(_millis); |
|
8164 |
RETURN (__ARRAY_WITH2(seconds, millis)); |
|
8165 |
# endif /* long long */ |
|
8166 |
#endif /* alpha64 */ |
|
8167 |
%}. |
|
8168 |
||
8169 |
" |
|
8170 |
OperatingSystem primGetOSTime printCR. |
|
8171 |
Delay waitForSeconds:0.2. |
|
8172 |
OperatingSystem primGetOSTime printCR. |
|
8173 |
" |
|
8174 |
! |
|
8175 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8176 |
sleep:numberOfSeconds |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8177 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8178 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8179 |
"cease ANY action for some time. This suspends the whole smalltalk |
5233 | 8180 |
(unix-) process for some time if running threadless; |
8181 |
if running with threads (which is the default), this will |
|
5438
00e3c22156c3
added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents:
5407
diff
changeset
|
8182 |
only block until the next clock tick and return with the next |
5233 | 8183 |
timer interrupt. |
3795 | 8184 |
Use either OperatingSystem>>millisecondDelay: (which makes all |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8185 |
threads sleep, but handles interrupts) or use a Delay (which makes |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8186 |
only the calling thread sleep)." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8187 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8188 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8189 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8190 |
if (__isSmallInteger(numberOfSeconds)) { |
6050 | 8191 |
sleep(__intVal(numberOfSeconds)); |
8192 |
RETURN ( self ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8193 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8194 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8195 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8196 |
argument not integer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8197 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8198 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8199 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8200 |
" |
3795 | 8201 |
OperatingSystem sleep:2 |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8202 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8203 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8204 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8205 |
!UnixOperatingSystem class methodsFor:'users & groups'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8206 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8207 |
getEffectiveGroupID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8208 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8209 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8210 |
"return the current users (thats you) effective numeric group id. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8211 |
This is only different from getGroupID, if you have ST/X running |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8212 |
as a setuid program (of which you should think about twice)." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8213 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8214 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8215 |
int uid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8216 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8217 |
uid = getegid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8218 |
RETURN ( __MKSMALLINT(uid) ); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8219 |
%} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8220 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8221 |
" |
3795 | 8222 |
OperatingSystem getEffectiveGroupID |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8223 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8224 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8225 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8226 |
getEffectiveUserID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8227 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8228 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8229 |
"return the current users (thats you) effective numeric user id. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8230 |
This is only different from getUserID, if you have ST/X running |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8231 |
as a setuid program (of which you should think about twice)." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8232 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8233 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8234 |
int uid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8235 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8236 |
uid = geteuid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8237 |
RETURN ( __MKSMALLINT(uid) ); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8238 |
%} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8239 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8240 |
" |
3795 | 8241 |
OperatingSystem getEffectiveUserID |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8242 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8243 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8244 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8245 |
getFullUserNameFromID:userID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8246 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8247 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8248 |
"return a string with the users full name - if available. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8249 |
If not, return the login name as a fallBack." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8250 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8251 |
|info gecos| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8252 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8253 |
info := self userInfoOf:userID. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8254 |
(info notNil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8255 |
and:[info includesKey:#gecos]) ifTrue:[ |
6050 | 8256 |
gecos := info at:#gecos. |
8257 |
(gecos includes:$,) ifTrue:[ |
|
8258 |
^ gecos copyTo:(gecos indexOf:$,) - 1 |
|
8259 |
]. |
|
8260 |
^ gecos |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8261 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8262 |
^ self getUserNameFromID:userID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8263 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8264 |
" |
3795 | 8265 |
OperatingSystem getFullUserNameFromID:0 |
8266 |
OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID) |
|
8267 |
||
8268 |
OperatingSystem getUserNameFromID:(OperatingSystem getUserID) |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8269 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8270 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8271 |
"Modified: 15.7.1996 / 12:44:21 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8272 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8273 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8274 |
getGroupID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8275 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8276 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8277 |
"return the current users (thats you) numeric group id" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8278 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8279 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8280 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8281 |
int uid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8282 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8283 |
uid = getgid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8284 |
RETURN ( __MKSMALLINT(uid) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8285 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8286 |
^ 1 "just a dummy for systems which do not have userIDs" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8287 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8288 |
" |
3795 | 8289 |
OperatingSystem getGroupID |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8290 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8291 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8292 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8293 |
getGroupNameFromID:aNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8294 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8295 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8296 |
"return the group-name-string for a given numeric group-id" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8297 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8298 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8299 |
struct group *g; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8300 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8301 |
if (__isSmallInteger(aNumber)) { |
6050 | 8302 |
g = getgrgid(__intVal(aNumber)); |
8303 |
if (g) { |
|
8304 |
RETURN ( __MKSTRING(g->gr_name) ); |
|
8305 |
} |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8306 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8307 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8308 |
^ '???' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8309 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8310 |
" |
3795 | 8311 |
OperatingSystem getGroupNameFromID:0 |
8312 |
OperatingSystem getGroupNameFromID:10 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8313 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8314 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8315 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8316 |
getHomeDirectory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8317 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8318 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8319 |
"return the name of the users home directory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8320 |
(i.e. yours)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8321 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8322 |
^ UnixOperatingSystem getEnvironment:'HOME' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8323 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8324 |
" |
3795 | 8325 |
OperatingSystem getHomeDirectory |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8326 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8327 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8328 |
"Modified: 24.1.1997 / 11:32:13 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8329 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8330 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8331 |
getLoginName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8332 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8333 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8334 |
"return a string with the users login name (thats yours)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8335 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8336 |
%{ /* NOCONTEXT */ |
3970 | 8337 |
static char cachedName[128]; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8338 |
static firstCall = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8339 |
extern char *getenv(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8340 |
extern char *getlogin(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8341 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8342 |
char *name = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8343 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8344 |
if (firstCall) { |
6050 | 8345 |
name = getlogin(); |
8346 |
if (! name || (name[0] == 0)) { |
|
8347 |
name = getenv("LOGNAME"); |
|
8348 |
} |
|
8349 |
if (name && (strlen(name) < sizeof(cachedName))) { |
|
8350 |
strcpy(cachedName, name); |
|
8351 |
firstCall = 0; |
|
8352 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8353 |
} else { |
6050 | 8354 |
name = cachedName; |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8355 |
} |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8356 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8357 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8358 |
* try a few common environment variables ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8359 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8360 |
if (! name || (name[0] == 0) ) { |
6050 | 8361 |
name = getenv("LOGIN"); |
8362 |
if (! name || (name[0] == 0) ) { |
|
8363 |
name = getenv("LOGNAME"); |
|
8364 |
if (! name || (name[0] == 0) ) { |
|
8365 |
name = getenv("USER"); |
|
8366 |
} |
|
8367 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8368 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8369 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8370 |
* nope - I really font know who you are. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8371 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8372 |
if (! name || (name[0] == 0) ) { |
6050 | 8373 |
name = "you"; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8374 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8375 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8376 |
RETURN ( __MKSTRING(name) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8377 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8378 |
" |
3795 | 8379 |
OperatingSystem getLoginName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8380 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8381 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8382 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8383 |
getUserID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8384 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8385 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8386 |
"return the current users (thats you) numeric user id" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8387 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8388 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8389 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8390 |
int uid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8391 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8392 |
uid = getuid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8393 |
RETURN ( __MKSMALLINT(uid) ); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8394 |
%} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8395 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8396 |
" |
3795 | 8397 |
OperatingSystem getUserID |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8398 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8399 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8400 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8401 |
getUserNameFromID:aNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8402 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8403 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8404 |
"return the user-name-string for a given numeric user-id. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8405 |
This is the login name, not the fullName." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8406 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8407 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8408 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8409 |
# ifndef NO_PWD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8410 |
struct passwd *p; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8411 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8412 |
if (__isSmallInteger(aNumber)) { |
6050 | 8413 |
p = getpwuid(__intVal(aNumber)); |
8414 |
if (p) { |
|
8415 |
RETURN ( __MKSTRING(p->pw_name) ); |
|
8416 |
} |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
8417 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8418 |
#endif /* unix-like */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8419 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8420 |
aNumber == self getUserID ifTrue:[ |
6050 | 8421 |
^ self getLoginName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8422 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8423 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8424 |
^ '? (' , aNumber printString , ')' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8425 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8426 |
" |
3795 | 8427 |
OperatingSystem getUserNameFromID:0 |
8428 |
OperatingSystem getUserNameFromID:100 |
|
8429 |
OperatingSystem getUserNameFromID:9991 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8430 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8431 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8432 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8433 |
userInfoOf:aNameOrID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8434 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8435 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8436 |
"return a dictionary filled with userinfo. The argument can be either |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8437 |
a string with the users name or its numeric id. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8438 |
Notice, that not all systems provide (all of) this info; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8439 |
DOS systems return nothing; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8440 |
non-SYSV4 systems have no age/comment. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8441 |
Portable applications may want to check the systemType and NOT depend |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8442 |
on all keys to be present in the returned dictionary. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8443 |
Another notice: on some systems (SYSV4), the gecos field includes multiple |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8444 |
entries (i.e. not just the name), separated by commas. You may want to |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8445 |
extract any substring, up to the first comma to get the real life name." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8446 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8447 |
|info name passw uid gid age comment |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8448 |
gecos dir shell| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8449 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8450 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8451 |
# ifndef NO_PWD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8452 |
struct passwd *buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8453 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8454 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8455 |
if (__isString(aNameOrID)) { |
6050 | 8456 |
buf = getpwnam(__stringVal(aNameOrID)); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8457 |
} else if (__isSmallInteger(aNameOrID)) { |
6050 | 8458 |
buf = getpwuid(__intVal(aNameOrID)); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8459 |
} else { |
6050 | 8460 |
buf = (struct passwd *)0; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8461 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8462 |
if (buf) { |
6050 | 8463 |
name = __MKSTRING(buf->pw_name); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8464 |
# ifndef NO_PWD_PASSWD |
6050 | 8465 |
passw = __MKSTRING(buf->pw_passwd); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8466 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8467 |
# ifdef SYSV4 |
6050 | 8468 |
age = __MKSTRING(buf->pw_age); |
8469 |
comment = __MKSTRING(buf->pw_comment); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8470 |
# endif |
6050 | 8471 |
dir = __MKSTRING(buf->pw_dir); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8472 |
# ifndef NO_PWD_GECOS |
6050 | 8473 |
gecos = __MKSTRING(buf->pw_gecos); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8474 |
# endif |
6050 | 8475 |
shell = __MKSTRING(buf->pw_shell); |
8476 |
||
8477 |
uid = __MKSMALLINT(buf->pw_uid); |
|
8478 |
gid = __MKSMALLINT(buf->pw_gid); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8479 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8480 |
# endif /* has PWD */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8481 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8482 |
info := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8483 |
name isNil ifTrue:[ |
6050 | 8484 |
aNameOrID == self getUserID ifTrue:[ |
8485 |
name := self getLoginName |
|
8486 |
]. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8487 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8488 |
name notNil ifTrue:[ |
6050 | 8489 |
info at:#name put:name. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8490 |
] ifFalse:[ |
6050 | 8491 |
info at:#name put:'unknown' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8492 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8493 |
passw notNil ifTrue:[info at:#passwd put:passw]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8494 |
age notNil ifTrue:[info at:#age put:age]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8495 |
comment notNil ifTrue:[info at:#comment put:comment]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8496 |
gecos notNil ifTrue:[info at:#gecos put:gecos]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8497 |
shell notNil ifTrue:[info at:#shell put:shell]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8498 |
dir isNil ifTrue:[ |
6050 | 8499 |
aNameOrID == self getUserID ifTrue:[ |
8500 |
dir := self getHomeDirectory |
|
8501 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8502 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8503 |
dir notNil ifTrue:[info at:#dir put:dir]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8504 |
uid notNil ifTrue:[info at:#uid put:uid]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8505 |
gid notNil ifTrue:[info at:#gid put:gid]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8506 |
^ info |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8507 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8508 |
" |
3795 | 8509 |
OperatingSystem userInfoOf:'root' |
8510 |
OperatingSystem userInfoOf:1 |
|
8511 |
OperatingSystem userInfoOf:'claus' |
|
8512 |
OperatingSystem userInfoOf:'fooBar' |
|
8513 |
OperatingSystem userInfoOf:(OperatingSystem getUserID) |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8514 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8515 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8516 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8517 |
!UnixOperatingSystem class methodsFor:'waiting for events'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8518 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8519 |
blockingChildProcessWait |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8520 |
"return true, if childProcessWait: blocks, if no children are ready. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8521 |
On those systems, we must be somewhat careful when looking out for |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8522 |
a subprocesses status (to avoid blocking)." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8523 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8524 |
%{ /*NOCONTEXT*/ |
3780 | 8525 |
#if defined(HAS_WAITPID) || defined(HAS_WAIT3) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8526 |
RETURN(false); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8527 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8528 |
RETURN(true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8529 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8530 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8531 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8532 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8533 |
childProcessWait:blocking pid:pidToWait |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8534 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8535 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8536 |
"get status changes from child processes. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8537 |
Return an OSProcessStatus or nil, if no process has terminated. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8538 |
If blocking is true, we wait until a process changed state, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8539 |
otherwise we return immediately. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8540 |
Note that win32 needs to know the HANDLE of the process on which |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8541 |
it waits. In case of an error, THIS ALWAYS WAITS and then times out." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8542 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8543 |
|pid status code core| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8544 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8545 |
int p; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8546 |
|
3930 | 8547 |
#if defined(HAS_WAITPID) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8548 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8549 |
int s; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8550 |
# define __WAIT waitpid(-1, &s, blocking == true ? WUNTRACED : WNOHANG|WUNTRACED) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8551 |
|
3930 | 8552 |
#else |
8553 |
# if defined(HAS_WAIT3) |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8554 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8555 |
union wait s; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8556 |
# define __WAIT wait3(&s, blocking == true ? WUNTRACED : WNOHANG|WUNTRACED, 0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8557 |
|
3930 | 8558 |
# else /* neither waitpid, nor wait3; use wait, which is blocking */ |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8559 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8560 |
int s; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8561 |
# define __WAIT wait(&s) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8562 |
# define __BLOCKING_WAIT__ 1 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8563 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8564 |
if (blocking != true) { |
6050 | 8565 |
/* |
8566 |
* We do not support nonBlocking waits, so signal an error |
|
8567 |
* Sorry about the goto, but with all these ifdefs ... |
|
8568 |
*/ |
|
8569 |
goto done; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8570 |
} |
3930 | 8571 |
# endif /*!HAS_WAIT3*/ |
8572 |
#endif /*!HAS_WAITPID*/ |
|
8573 |
||
8574 |
#if !defined(WIFEXITED) |
|
8575 |
# define WIFEXITED(stat) (((int)((stat)&0377))==0) |
|
8576 |
# define WIFSIGNALED(stat) (((int)((stat)&0377))>0&&((int)(((stat)>>8)&0377))==0) |
|
8577 |
# define WIFSTOPPED(stat) (((int)((stat)&0377))==0177&&((int)(((stat)>>8)&0377))!=0) |
|
8578 |
||
8579 |
# define WEXITSTATUS(stat) ((int)(((stat)>>8)&0377)) |
|
8580 |
# define WTERMSIG(stat) (((int)((stat)&0377))&0177) |
|
8581 |
# define WSTOPSIG(stat) ((int)(((stat)>>8)&0377)) |
|
8582 |
#endif /*!WIFEXITED*/ |
|
8583 |
||
8584 |
#if !defined(WCOREDUMP) |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8585 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8586 |
* some systems lack that definition, although the field is there ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8587 |
*/ |
3930 | 8588 |
# if defined(HAS_WAIT3) |
8589 |
# define WCOREDUMP(status) (((union __wait*)&(status))->__w_coredump) |
|
8590 |
# else |
|
8591 |
# define WCOREDUMP(status) ((int)(((status)>>8)&0200)) |
|
8592 |
# endif |
|
8593 |
#endif /*!WCOREDUMP*/ |
|
8594 |
||
8595 |
#if __BLOCKING_WAIT__ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8596 |
__BEGIN_INTERRUPTABLE__ |
3930 | 8597 |
#endif |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8598 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8599 |
do { |
6050 | 8600 |
p = __WAIT; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8601 |
} while (p == -1 && errno == EINTR); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8602 |
|
3930 | 8603 |
#if __BLOCKING_WAIT__ |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8604 |
__END_INTERRUPTABLE__ |
3930 | 8605 |
# undef __BLOCKING_WAIT__ |
8606 |
#endif |
|
8607 |
||
8608 |
#undef __WAIT |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8609 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8610 |
if (p == 0) |
6050 | 8611 |
RETURN(nil) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8612 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8613 |
if (p == -1) { |
6050 | 8614 |
if (errno == ECHILD) |
8615 |
RETURN(nil); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8616 |
} else { |
6050 | 8617 |
pid = __MKSMALLINT(p); |
8618 |
if (WIFEXITED(s)) { |
|
8619 |
status = @symbol(exit); |
|
8620 |
code = __MKSMALLINT(WEXITSTATUS(s)); |
|
8621 |
core = WCOREDUMP(s) ? true : false; |
|
8622 |
} else if (WIFSIGNALED(s)) { |
|
8623 |
status = @symbol(signal); |
|
8624 |
code = __MKSMALLINT(WTERMSIG(s)); |
|
8625 |
} else if (WIFSTOPPED(s)) { |
|
8626 |
status = @symbol(stop); |
|
8627 |
code = __MKSMALLINT(WSTOPSIG(s)); |
|
8628 |
} |
|
3930 | 8629 |
#if defined(WIFCONTINUED) |
6050 | 8630 |
else if (WIFCONTINUED(s)) { |
8631 |
status = @symbol(continue); |
|
8632 |
} |
|
3930 | 8633 |
#endif |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8634 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8635 |
done: ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8636 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8637 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8638 |
(status isNil or:[pid isNil]) ifTrue:[ |
6050 | 8639 |
^ self primitiveFailed |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8640 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8641 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8642 |
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8643 |
"/ show:' code: '; show:code; show:' core:'; showCR:core. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8644 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8645 |
^ OSProcessStatus pid:pid status:status code:code core:core |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8646 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8647 |
" |
3795 | 8648 |
OperatingSystem childProcessWait:false |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8649 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8650 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8651 |
"Created: 5.1.1996 / 16:39:14 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8652 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8653 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8654 |
numAvailableForReadOn:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8655 |
"return the number of bytes available for reading, without blocking." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8656 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8657 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8658 |
#ifdef NOTDEF /* does not work ... */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8659 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8660 |
* if available, try FIONREAD first, which is usually done faster. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8661 |
*/ |
3780 | 8662 |
# if defined(FIONREAD) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8663 |
{ |
6050 | 8664 |
int n; |
8665 |
||
8666 |
if (__isSmallInteger(fd)) { |
|
8667 |
if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) { |
|
8668 |
RETURN (__MKINT(n)); |
|
8669 |
} |
|
8670 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8671 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8672 |
# endif /* FIONREAD */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8673 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8674 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8675 |
^ (self readCheck:fd) ifTrue:[1] ifFalse:[0] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8676 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8677 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8678 |
readCheck:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8679 |
"return true, if data is available on a filedescriptor |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8680 |
(i.e. read is possible without blocking). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8681 |
This depends on a working select or FIONREAD to be provided by the OS." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8682 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8683 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8684 |
#ifdef NOTDEF /* does not work ... */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8685 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8686 |
* if available, try FIONREAD first, which is usually done faster. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8687 |
*/ |
3780 | 8688 |
# if defined(FIONREAD) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8689 |
{ |
6050 | 8690 |
int n; |
8691 |
||
8692 |
if (__isSmallInteger(fd)) { |
|
8693 |
if (n = ioctl(__intVal(fd), FIONREAD)) { |
|
8694 |
printf("FIONREAD returns %d\n", n); |
|
8695 |
} |
|
8696 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8697 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8698 |
# endif /* FIONREAD */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8699 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8700 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8701 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8702 |
^ super readCheck:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8703 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8704 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8705 |
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8706 |
"wait for any fd in readFdArray (an Array of integers) to become ready for |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8707 |
reading, writeFdArray to become ready for writing, or exceptFdArray to |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8708 |
arrive exceptional data (i.e. out-of-band data). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8709 |
Timeout after t milliseconds or, if the timeout time is 0, immediately.. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8710 |
Empty fd-sets will always wait. Zero time can be used to poll file- |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8711 |
descriptors (i.e. to check if I/O possible without blocking). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8712 |
Return first ready fd if I/O ok, nil if timed-out or interrupted." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8713 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8714 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8715 |
fd_set rset, wset, eset; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8716 |
struct timeval wt, et; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8717 |
int f, maxF, i, lX, bX; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8718 |
INT t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8719 |
OBJ fd, retFd; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8720 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8721 |
int count; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8722 |
int numFds = 0; |
3801
b4b3d6a6e48f
oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents:
3795
diff
changeset
|
8723 |
#ifndef __isArrayLike |
b4b3d6a6e48f
oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents:
3795
diff
changeset
|
8724 |
# define __isArrayLike __isArray |
b4b3d6a6e48f
oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents:
3795
diff
changeset
|
8725 |
#endif |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8726 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8727 |
if (__isSmallInteger(millis)) { |
6050 | 8728 |
FD_ZERO(&rset); |
8729 |
FD_ZERO(&wset); |
|
8730 |
FD_ZERO(&eset); |
|
8731 |
||
8732 |
maxF = -1; |
|
8733 |
if (__isNonNilObject(readFdArray)) { |
|
8734 |
if (! __isArrayLike(readFdArray)) { |
|
8735 |
goto fail; |
|
8736 |
} |
|
8737 |
count = __arraySize(readFdArray); |
|
8738 |
||
8739 |
for (i=0; i<count;i++) { |
|
8740 |
fd = __ArrayInstPtr(readFdArray)->a_element[i]; |
|
8741 |
if (fd != nil) { |
|
8742 |
if (! __isSmallInteger(fd)) { |
|
8743 |
if (@global(InfoPrinting) == true) { |
|
8744 |
fprintf(stderr, "[OS] warning: funny read-fd (0x%x) given to select\n", fd); |
|
8745 |
} |
|
8746 |
} else { |
|
8747 |
f = __intVal(fd); |
|
8748 |
if ((unsigned)f < FD_SETSIZE) { |
|
8749 |
FD_SET(f, &rset); |
|
8750 |
if (f > maxF) maxF = f; |
|
8751 |
numFds++; |
|
8752 |
} else { |
|
8753 |
if (@global(InfoPrinting) == true) { |
|
8754 |
fprintf(stderr, "[OS] warning: huge read-fd (0x%x) given to select\n", fd); |
|
8755 |
} |
|
8756 |
} |
|
8757 |
} |
|
8758 |
} |
|
8759 |
} |
|
8760 |
} |
|
8761 |
||
8762 |
if (__isNonNilObject(writeFdArray)) { |
|
8763 |
if (! __isArrayLike(writeFdArray)) { |
|
8764 |
goto fail; |
|
8765 |
} |
|
8766 |
count = __arraySize(writeFdArray); |
|
8767 |
for (i=0; i<count;i++) { |
|
8768 |
fd = __ArrayInstPtr(writeFdArray)->a_element[i]; |
|
8769 |
if (fd != nil) { |
|
8770 |
if (! __isSmallInteger(fd)) { |
|
8771 |
if (@global(InfoPrinting) == true) { |
|
8772 |
fprintf(stderr, "[OS] warning: funny write-fd (0x%x) given to select\n", fd); |
|
8773 |
} |
|
8774 |
} else { |
|
8775 |
f = __intVal(fd); |
|
8776 |
if ((unsigned)f < FD_SETSIZE) { |
|
8777 |
FD_SET(f, &wset); |
|
8778 |
if (f > maxF) maxF = f; |
|
8779 |
numFds++; |
|
8780 |
} else { |
|
8781 |
if (@global(InfoPrinting) == true) { |
|
8782 |
fprintf(stderr, "[OS] warning: huge write-fd (0x%x) given to select\n", fd); |
|
8783 |
} |
|
8784 |
} |
|
8785 |
} |
|
8786 |
} |
|
8787 |
} |
|
8788 |
} |
|
8789 |
||
8790 |
if (__isNonNilObject(exceptFdArray)) { |
|
8791 |
if (! __isArrayLike(exceptFdArray)) { |
|
8792 |
goto fail; |
|
8793 |
} |
|
8794 |
count = __arraySize(exceptFdArray); |
|
8795 |
for (i=0; i<count;i++) { |
|
8796 |
fd = __ArrayInstPtr(exceptFdArray)->a_element[i]; |
|
8797 |
if (fd != nil) { |
|
8798 |
if (! __isSmallInteger(fd)) { |
|
8799 |
if (@global(InfoPrinting) == true) { |
|
8800 |
fprintf(stderr, "[OS] warning: funny except-fd (0x%x) given to select\n", fd); |
|
8801 |
} |
|
8802 |
} else { |
|
8803 |
f = __intVal(fd); |
|
8804 |
if ((unsigned)f < FD_SETSIZE) { |
|
8805 |
FD_SET(f, &eset); |
|
8806 |
if (f > maxF) maxF = f; |
|
8807 |
numFds++; |
|
8808 |
} else { |
|
8809 |
if (@global(InfoPrinting) == true) { |
|
8810 |
fprintf(stderr, "[OS] warning: huge except-fd (0x%x) given to select\n", fd); |
|
8811 |
} |
|
8812 |
} |
|
8813 |
} |
|
8814 |
} |
|
8815 |
} |
|
8816 |
} |
|
8817 |
||
8818 |
t = __intVal(millis); |
|
8819 |
if (t) { |
|
8820 |
wt.tv_sec = t / 1000; |
|
8821 |
wt.tv_usec = (t % 1000) * 1000; |
|
8822 |
} else { |
|
8823 |
wt.tv_sec = wt.tv_usec = 0; |
|
8824 |
} |
|
8825 |
||
8826 |
/* |
|
8827 |
* make certain, that interrupt gets us out of the select |
|
8828 |
* However, we must then care for moved objects. |
|
8829 |
*/ |
|
8830 |
__BEGIN_INTERRUPTABLE__ |
|
8831 |
errno = 0; |
|
8832 |
||
8833 |
if (t == 0) { |
|
8834 |
/* |
|
8835 |
* if there is no timeout time, we can stay here interruptable. |
|
8836 |
*/ |
|
8837 |
do { |
|
8838 |
ret = select(maxF+1, &rset, &wset, &eset, &wt); |
|
8839 |
} while ((ret < 0) && (errno == EINTR)); |
|
8840 |
} else { |
|
8841 |
do { |
|
8842 |
ret = select(maxF+1, &rset, &wset, &eset, &wt); |
|
8843 |
/* |
|
8844 |
* for now: dont loop; if we did, we had to adjust the vt-timeval; |
|
8845 |
* could otherwise stay in this loop forever ... |
|
8846 |
* Premature ret (before the time expired) must be handled by the caller. |
|
8847 |
* A good solution is to update the wt-timeval and redo the select. |
|
8848 |
*/ |
|
8849 |
} while (0 /* (ret < 0) && (errno == EINTR) */ ); |
|
8850 |
} |
|
8851 |
__END_INTERRUPTABLE__ |
|
8852 |
||
8853 |
if (ret > 0) { |
|
8854 |
for (i=0; i <= maxF; i++) { |
|
8855 |
if (FD_ISSET(i, &rset) |
|
8856 |
|| FD_ISSET(i, &wset) |
|
8857 |
|| FD_ISSET(i, &eset)) { |
|
8858 |
RETURN ( __MKSMALLINT(i) ); |
|
8859 |
} |
|
8860 |
} |
|
8861 |
} else { |
|
8862 |
if (ret < 0) { |
|
8863 |
if (errno == EINTR) { |
|
8864 |
errno = 0; |
|
8865 |
@global(LastErrorNumber) = nil; |
|
8866 |
} else { |
|
8867 |
if (@global(InfoPrinting) == true) { |
|
8868 |
fprintf(stderr, "OS [info]: select errno = %d\n", errno); |
|
8869 |
} |
|
8870 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
8871 |
} |
|
8872 |
} else { |
|
8873 |
@global(LastErrorNumber) = nil; |
|
8874 |
} |
|
8875 |
} |
|
8876 |
||
8877 |
/* |
|
8878 |
* Return nil (means time expired or interrupted) |
|
8879 |
*/ |
|
8880 |
RETURN ( nil ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8881 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8882 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8883 |
fail: ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8884 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8885 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8886 |
timeout argument not integer, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8887 |
or any fd-array nonNil and not an array |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8888 |
or not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8889 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8890 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8891 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8892 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8893 |
setBlocking:aBoolean on:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8894 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8895 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8896 |
"set/clear the blocking attribute - if set (which is the default) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8897 |
a read on the fileDescriptor will block until data is available. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8898 |
If cleared, a read operation will immediately return with a value of |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8899 |
nil." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8900 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8901 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8902 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8903 |
int ret, flags; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8904 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8905 |
#if defined(F_GETFL) && defined(F_SETFL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8906 |
# if defined(FNDELAY) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8907 |
if (__isSmallInteger(fd)) { |
6050 | 8908 |
int f = __intVal(fd); |
8909 |
||
8910 |
flags = fcntl(f, F_GETFL, 0); |
|
8911 |
if (aBoolean == true) { |
|
8912 |
ret = fcntl(f, F_SETFL, flags & ~FNDELAY); |
|
8913 |
} else { |
|
8914 |
ret = fcntl(f, F_SETFL, flags | FNDELAY); |
|
8915 |
} |
|
8916 |
if (ret >= 0) ret = flags; |
|
8917 |
RETURN ( __MKSMALLINT(ret) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8918 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8919 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8920 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8921 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8922 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8923 |
fd argument not integer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8924 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8925 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8926 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8927 |
|
6301 | 8928 |
!UnixOperatingSystem::FileDescriptorHandle class methodsFor:'change & update'! |
8929 |
||
8930 |
update:aspect with:argument from:anObject |
|
8931 |
"one of our registered handles has been collected" |
|
8932 |
||
8933 |
aspect == #ElementExpired ifTrue:[ |
|
8934 |
OpenFiles keysAndValuesDo:[:fd :handle | |
|
8935 |
handle == 0 ifTrue:[ |
|
8936 |
"Have to close the file descriptor" |
|
8937 |
||
8938 |
OperatingSystem closeFd:fd. |
|
8939 |
OpenFiles at:fd put:nil. |
|
8940 |
]. |
|
8941 |
]. |
|
8942 |
]. |
|
8943 |
||
8944 |
"Created: 30.9.1997 / 12:57:35 / stefan" |
|
8945 |
! ! |
|
8946 |
||
8947 |
!UnixOperatingSystem::FileDescriptorHandle class methodsFor:'initialization'! |
|
8948 |
||
8949 |
initialize |
|
8950 |
OpenFiles := WeakArray new:10. |
|
8951 |
OpenFiles addDependent:self. |
|
8952 |
||
8953 |
"self initialize" |
|
8954 |
||
8955 |
"Created: 26.9.1997 / 17:15:50 / stefan" |
|
8956 |
"Modified: 30.9.1997 / 12:40:55 / stefan" |
|
8957 |
! ! |
|
8958 |
||
8959 |
!UnixOperatingSystem::FileDescriptorHandle class methodsFor:'instance creation'! |
|
8960 |
||
8961 |
for:aFileDescriptor |
|
8962 |
"create an instance of myself for a given fileDescriptor" |
|
8963 |
||
8964 |
^ self new for:aFileDescriptor. |
|
8965 |
||
8966 |
"Created: 30.9.1997 / 14:00:00 / stefan" |
|
8967 |
! ! |
|
8968 |
||
8969 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'error handling'! |
|
8970 |
||
8971 |
error:anError |
|
8972 |
"got an error with anInteger as error number" |
|
8973 |
||
8974 |
anError isInteger ifTrue:[ |
|
8975 |
^ UnixOperatingSystem errorHolderForNumber:anError |
|
8976 |
]. |
|
8977 |
self primitiveFailed:anError. |
|
8978 |
! ! |
|
8979 |
||
8980 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'file access'! |
|
8981 |
||
8982 |
close |
|
8983 |
"close the descriptor" |
|
8984 |
||
8985 |
|desc| |
|
8986 |
||
8987 |
desc := fd. |
|
8988 |
self invalidate. |
|
8989 |
||
8990 |
^ OperatingSystem closeFd:desc. |
|
8991 |
||
8992 |
"Modified: 30.9.1997 / 13:06:55 / stefan" |
|
8993 |
! ! |
|
8994 |
||
8995 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'initialization'! |
|
8996 |
||
8997 |
for:aFileDescriptor |
|
8998 |
"create file for a handle" |
|
8999 |
||
9000 |
|oldHandle| |
|
9001 |
||
9002 |
fd := aFileDescriptor. |
|
9003 |
oldHandle := OpenFiles at:aFileDescriptor. |
|
9004 |
(oldHandle notNil and:[oldHandle ~~ self]) ifTrue:[ |
|
9005 |
oldHandle invalidate. |
|
9006 |
]. |
|
9007 |
self register. |
|
9008 |
||
9009 |
"Created: 26.9.1997 / 17:14:40 / stefan" |
|
9010 |
"Modified: 30.9.1997 / 12:41:43 / stefan" |
|
9011 |
! ! |
|
9012 |
||
9013 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'input/output'! |
|
9014 |
||
9015 |
readBytes:count into:aByteBuffer startingAt:firstIndex |
|
9016 |
"read count bytes into a byte-buffer; |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9017 |
Return the number of bytes read. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9018 |
The read is non-blocking. If the operation would block |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9019 |
either an incomplete count or nil will be returned. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9020 |
|
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9021 |
An exception is raised on any other error" |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9022 |
|
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9023 |
|error| |
6301 | 9024 |
|
9025 |
%{ |
|
9026 |
unsigned char *extPtr; |
|
9027 |
int nRead = -1; |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9028 |
INT fd; |
6301 | 9029 |
INT cnt, offs; |
9030 |
int nInstBytes, objSize; |
|
9031 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9032 |
if (! __isSmallInteger(__INST(fd))) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9033 |
error = @symbol(errorNotOpen); |
6301 | 9034 |
goto bad; |
9035 |
} |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9036 |
if (! __bothSmallInteger(count, firstIndex)) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9037 |
error = @symbol(badArgument); |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9038 |
goto bad; |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9039 |
} |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9040 |
fd = __smallIntegerVal(__INST(fd)); |
6301 | 9041 |
cnt = __smallIntegerVal(count); |
9042 |
offs = __smallIntegerVal(firstIndex) - 1; |
|
9043 |
||
9044 |
if (fd < 0) { |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9045 |
error = @symbol(internalError); |
6301 | 9046 |
goto bad; |
9047 |
} |
|
9048 |
if (__isExternalBytes(aByteBuffer)) { |
|
9049 |
OBJ sz; |
|
9050 |
||
9051 |
nInstBytes = 0; |
|
9052 |
extPtr = (char *)(__externalBytesAddress(aByteBuffer)); |
|
9053 |
sz = __externalBytesSize(aByteBuffer); |
|
9054 |
if (__isSmallInteger(sz)) { |
|
9055 |
objSize = __smallIntegerVal(sz); |
|
9056 |
} else { |
|
9057 |
objSize = -1; /* unknown */ |
|
9058 |
} |
|
9059 |
} else { |
|
9060 |
OBJ oClass; |
|
9061 |
int nInstVars; |
|
9062 |
||
9063 |
oClass = __Class(aByteBuffer); |
|
9064 |
switch (__smallIntegerVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) { |
|
9065 |
case BYTEARRAY: |
|
9066 |
case WORDARRAY: |
|
9067 |
case LONGARRAY: |
|
9068 |
case SWORDARRAY: |
|
9069 |
case SLONGARRAY: |
|
9070 |
case FLOATARRAY: |
|
9071 |
case DOUBLEARRAY: |
|
9072 |
break; |
|
9073 |
default: |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9074 |
error = @symbol(badArgument1); |
6301 | 9075 |
goto bad; |
9076 |
} |
|
9077 |
extPtr = (char *)0; |
|
9078 |
nInstVars = __smallIntegerVal(__ClassInstPtr(oClass)->c_ninstvars); |
|
9079 |
nInstBytes = __OBJS2BYTES__(nInstVars); |
|
9080 |
objSize = __Size(aByteBuffer) - OHDR_SIZE - nInstBytes; |
|
9081 |
} |
|
9082 |
if ((offs >= 0) |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9083 |
&& (cnt >= 0) |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9084 |
&& ((objSize == -1) || (objSize >= (cnt + offs)))) { |
6301 | 9085 |
nRead = 0; |
9086 |
||
9087 |
do { |
|
9088 |
int n; |
|
9089 |
||
9090 |
if (extPtr) { |
|
9091 |
n = read(fd, extPtr+offs, cnt); |
|
9092 |
} else { |
|
9093 |
char *bp; |
|
9094 |
||
9095 |
/* |
|
9096 |
* on interrupt, anObject may be moved to another location. |
|
9097 |
* So we recompute the byte-address here. |
|
9098 |
*/ |
|
9099 |
bp = __ByteArrayInstPtr(aByteBuffer)->ba_element + nInstBytes; |
|
9100 |
||
9101 |
n = read(fd, bp + offs, cnt); |
|
9102 |
} |
|
9103 |
if (n > 0) { |
|
9104 |
cnt -= n; |
|
9105 |
offs += n; |
|
9106 |
nRead += n; |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9107 |
} else if (n == 0) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9108 |
break; |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9109 |
} else if (n < 0) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9110 |
if (0 |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9111 |
#ifdef EWOULDBLOCK |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9112 |
|| errno == EWOULDBLOCK |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9113 |
#endif |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9114 |
#ifdef EAGAIN |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9115 |
|| errno == EAGAIN |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9116 |
#endif |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9117 |
) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9118 |
RETURN(nil); |
6301 | 9119 |
} |
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9120 |
if (errno != EINTR) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9121 |
error = __mkSmallInteger(errno); |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9122 |
goto bad; |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9123 |
} |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9124 |
__HANDLE_INTERRUPTS__; |
6301 | 9125 |
} |
9126 |
} while (cnt > 0); |
|
9127 |
||
9128 |
RETURN (__mkSmallInteger(nRead)); |
|
9129 |
} |
|
9130 |
bad: ; |
|
9131 |
%}. |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9132 |
^ self error:error. |
6301 | 9133 |
|
9134 |
" |
|
9135 |
|h buff n| |
|
9136 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9137 |
h := OperatingSystem openFileForRead:'/etc/hosts'. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9138 |
buff := ByteArray new:1000. buff inspect. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9139 |
n := h readBytes:1000 into:buff startingAt:1. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9140 |
Transcript show:n; space; showCR:buff asString. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9141 |
" |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9142 |
|
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9143 |
" |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9144 |
|h buff n| |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9145 |
|
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9146 |
h := OperatingSystem openFileForRead:'/dev/cua0'. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9147 |
buff := ByteArray new:1000. buff inspect. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9148 |
n := h readBytes:1000 into:buff startingAt:1. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9149 |
Transcript show:n printString; space; showCR:buff asString. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9150 |
" |
6301 | 9151 |
! |
9152 |
||
9153 |
writeBytes:count from:aByteBuffer startingAt:firstIndex |
|
9154 |
"write count bytes from a byte-buffer; |
|
9155 |
Return the number of bytes written (negative on error)" |
|
9156 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9157 |
|error| |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9158 |
|
6301 | 9159 |
%{ |
9160 |
unsigned char *extPtr; |
|
9161 |
int nWritten = -1; |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9162 |
INT fd; |
6301 | 9163 |
INT cnt, offs; |
9164 |
int nInstBytes, objSize; |
|
9165 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9166 |
if (! __isSmallInteger(__INST(fd))) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9167 |
error = @symbol(errorNotOpen); |
6301 | 9168 |
goto bad; |
9169 |
} |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9170 |
if (! __bothSmallInteger(count, firstIndex)) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9171 |
error = @symbol(badArgument); |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9172 |
goto bad; |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9173 |
} |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9174 |
fd = __smallIntegerVal(__INST(fd)); |
6301 | 9175 |
cnt = __smallIntegerVal(count); |
9176 |
offs = __smallIntegerVal(firstIndex) - 1; |
|
9177 |
||
9178 |
if (fd < 0) { |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9179 |
error = @symbol(internalError); |
6301 | 9180 |
goto bad; |
9181 |
} |
|
9182 |
if (__isExternalBytes(aByteBuffer)) { |
|
9183 |
OBJ sz; |
|
9184 |
||
9185 |
nInstBytes = 0; |
|
9186 |
extPtr = (char *)(__externalBytesAddress(aByteBuffer)); |
|
9187 |
sz = __externalBytesSize(aByteBuffer); |
|
9188 |
if (__isSmallInteger(sz)) { |
|
9189 |
objSize = __smallIntegerVal(sz); |
|
9190 |
} else { |
|
9191 |
objSize = -1; /* unknown */ |
|
9192 |
} |
|
9193 |
} else { |
|
9194 |
OBJ oClass; |
|
9195 |
int nInstVars; |
|
9196 |
||
9197 |
oClass = __Class(aByteBuffer); |
|
9198 |
switch (__smallIntegerVal(__ClassInstPtr(oClass)->c_flags) & ARRAYMASK) { |
|
9199 |
case BYTEARRAY: |
|
9200 |
case WORDARRAY: |
|
9201 |
case LONGARRAY: |
|
9202 |
case SWORDARRAY: |
|
9203 |
case SLONGARRAY: |
|
9204 |
case FLOATARRAY: |
|
9205 |
case DOUBLEARRAY: |
|
9206 |
break; |
|
9207 |
default: |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9208 |
error = @symbol(badArgument1); |
6301 | 9209 |
goto bad; |
9210 |
} |
|
9211 |
extPtr = (char *)0; |
|
9212 |
nInstVars = __smallIntegerVal(__ClassInstPtr(oClass)->c_ninstvars); |
|
9213 |
nInstBytes = __OBJS2BYTES__(nInstVars); |
|
9214 |
objSize = __Size(aByteBuffer) - OHDR_SIZE - nInstBytes; |
|
9215 |
} |
|
9216 |
if ((offs >= 0) |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9217 |
&& (cnt >= 0) |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9218 |
&& ((objSize == -1) || (objSize >= (cnt + offs)))) { |
6301 | 9219 |
nWritten = 0; |
9220 |
||
9221 |
do { |
|
9222 |
int n; |
|
9223 |
||
9224 |
if (extPtr) { |
|
9225 |
n = write(fd, extPtr+offs, cnt); |
|
9226 |
} else { |
|
9227 |
char *bp; |
|
9228 |
||
9229 |
/* |
|
9230 |
* on interrupt, anObject may be moved to another location. |
|
9231 |
* So we recompute the byte-address here. |
|
9232 |
*/ |
|
9233 |
bp = __ByteArrayInstPtr(aByteBuffer)->ba_element + nInstBytes; |
|
9234 |
||
9235 |
n = write(fd, bp + offs, cnt); |
|
9236 |
} |
|
9237 |
if (n > 0) { |
|
9238 |
cnt -= n; |
|
9239 |
offs += n; |
|
9240 |
nWritten += n; |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9241 |
} else if (n == 0) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9242 |
break; |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9243 |
} else if (n < 0) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9244 |
if (0 |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9245 |
#ifdef EWOULDBLOCK |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9246 |
|| errno == EWOULDBLOCK |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9247 |
#endif |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9248 |
#ifdef EAGAIN |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9249 |
|| errno == EAGAIN |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9250 |
#endif |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9251 |
) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9252 |
RETURN(nil); |
6301 | 9253 |
} |
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9254 |
if (errno != EINTR) { |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9255 |
error = __mkSmallInteger(errno); |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9256 |
goto bad; |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9257 |
} |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9258 |
__HANDLE_INTERRUPTS__; |
6301 | 9259 |
} |
9260 |
} while (cnt > 0); |
|
9261 |
||
9262 |
RETURN (__mkSmallInteger(nWritten)); |
|
9263 |
} |
|
9264 |
bad: ; |
|
9265 |
%}. |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9266 |
^ self error:error |
6301 | 9267 |
|
9268 |
" |
|
9269 |
|h buff n| |
|
9270 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9271 |
h := OperatingSystem createFileForReadWrite:'/tmp/xx'. |
6301 | 9272 |
buff := '12345678901234567890'. |
9273 |
n := h writeBytes:10 from:buff startingAt:1. |
|
9274 |
" |
|
9275 |
||
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9276 |
" |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9277 |
|h buff n| |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9278 |
|
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9279 |
h := OperatingSystem createFileForReadWrite:'/dev/cua0'. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9280 |
buff := '12345678901234567890'. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9281 |
n := h writeBytes:10 from:buff startingAt:1. |
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9282 |
" |
6301 | 9283 |
! ! |
9284 |
||
9285 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'misc functions'! |
|
9286 |
||
9287 |
readCheck |
|
9288 |
"return true, if data is available on a filedescriptor |
|
9289 |
(i.e. read is possible without blocking). |
|
9290 |
This depends on a working select or FIONREAD to be provided by the OS." |
|
9291 |
||
9292 |
%{ |
|
9293 |
/* |
|
9294 |
* if available, try FIONREAD first, which is usually done faster. |
|
9295 |
*/ |
|
9296 |
# ifdef FIONREAD |
|
9297 |
{ |
|
9298 |
int n; |
|
9299 |
||
9300 |
if (__isSmallInteger(__INST(fd))) { |
|
9301 |
if (n = ioctl(__intVal(__INST(fd)), FIONREAD)) { |
|
9302 |
printf("FIONREAD returns %d\n", n); |
|
9303 |
} |
|
9304 |
} |
|
9305 |
} |
|
9306 |
# endif /* FIONREAD */ |
|
9307 |
||
9308 |
# ifdef __VMS__ |
|
9309 |
# ifdef DOES_NOT_WORK_YET |
|
9310 |
{ |
|
9311 |
/* |
|
9312 |
* do a sys$qio .. |
|
9313 |
* fd here is suposed to be a channel nr. |
|
9314 |
*/ |
|
9315 |
struct IOSB iosb; |
|
9316 |
int status; |
|
9317 |
int channel; |
|
9318 |
struct typahdask sensebuf; |
|
9319 |
||
9320 |
if (__isSmallInteger(fd)) { |
|
9321 |
channel = __intVal(fd); |
|
9322 |
status = SYS$QIO(0, /* efn */ |
|
9323 |
channel, |
|
9324 |
IO$_SENSEMODE | IO$M_TYPEAHDCNT, |
|
9325 |
&iosb, |
|
9326 |
0, /* ast */ |
|
9327 |
0, /* ast arg */ |
|
9328 |
&sensebuf, /* data */ |
|
9329 |
sizeof(sensebuf), /* data size */ |
|
9330 |
0, 0, 0, 0); |
|
9331 |
if (status != SS$_NORMAL) { |
|
9332 |
fprintf(stderr, "OS [info]: SYS$QIO failed on %d\n", channel); |
|
9333 |
} else { |
|
9334 |
fprintf(stderr, "sys$QIO -> %d\n", sensebuf.typcnt); |
|
9335 |
} |
|
9336 |
} |
|
9337 |
} |
|
9338 |
# endif |
|
9339 |
# endif /* __VMS__ */ |
|
9340 |
%}. |
|
9341 |
||
9342 |
OperatingSystem supportsSelect ifFalse:[ |
|
9343 |
"/ mhmh - what should we do then ? |
|
9344 |
"/ For now, return true as if data was present, |
|
9345 |
"/ and let the thread fall into the read. |
|
9346 |
"/ It will then (hopefully) be desceduled there and |
|
9347 |
"/ effectively polling for input. |
|
9348 |
||
9349 |
^ true |
|
9350 |
]. |
|
9351 |
||
9352 |
(OperatingSystem selectOnAnyReadable:(Array with:fd) |
|
9353 |
writable:nil |
|
9354 |
exception:nil |
|
9355 |
withTimeOut:0) == fd |
|
9356 |
ifTrue:[^ true]. |
|
9357 |
^ false |
|
9358 |
! |
|
9359 |
||
9360 |
selectWithTimeOut:millis |
|
9361 |
"wait for aFileDesriptor to become ready; timeout after t milliseconds. |
|
9362 |
Return true, if i/o ok, false if timed-out or interrupted. |
|
9363 |
With 0 as timeout argument, this can be used to check for availability |
|
9364 |
of read-data. |
|
9365 |
Experimental." |
|
9366 |
||
9367 |
^ OperatingSystem selectOnAnyReadable:(Array with:fd) |
|
9368 |
writable:(Array with:fd) |
|
9369 |
exception:nil |
|
9370 |
withTimeOut:millis |
|
9371 |
||
9372 |
"Created: 1.10.1997 / 08:51:11 / stefan" |
|
9373 |
! |
|
9374 |
||
9375 |
setBlocking:aBoolean |
|
9376 |
"{ Pragma: +optSpace }" |
|
9377 |
||
9378 |
"set/clear the blocking attribute - if set (which is the default) |
|
9379 |
a read on the fileDescriptor will block until data is available. |
|
9380 |
If cleared, a read operation will immediately return with a value of |
|
9381 |
nil if no data is available." |
|
9382 |
||
9383 |
|err| |
|
9384 |
%{ |
|
9385 |
int ret, flags; |
|
9386 |
||
9387 |
#if defined(F_GETFL) && defined(F_SETFL) |
|
9388 |
# if defined(O_NDELAY) |
|
9389 |
# define DELAY O_NDELAY |
|
9390 |
# else |
|
9391 |
# if defined(FNDELAY) |
|
9392 |
# define DELAY FNDELAY |
|
9393 |
# endif |
|
9394 |
# endif |
|
9395 |
# if defined(DELAY) |
|
9396 |
if (__isSmallInteger(__INST(fd))) { |
|
9397 |
int f = __intVal(__INST(fd)); |
|
9398 |
||
9399 |
flags = fcntl(f, F_GETFL, 0); |
|
9400 |
if (aBoolean == true) { |
|
9401 |
ret = fcntl(f, F_SETFL, flags & ~DELAY); |
|
9402 |
} else { |
|
9403 |
ret = fcntl(f, F_SETFL, flags | DELAY); |
|
9404 |
} |
|
9405 |
if (ret >= 0) { |
|
9406 |
RETURN(__MKSMALLINT(flags)); |
|
9407 |
} else { |
|
9408 |
err = __MKSMALLINT(errno); |
|
9409 |
} |
|
9410 |
} |
|
9411 |
# undef DELAY |
|
9412 |
# endif /* DELAY */ |
|
9413 |
#endif |
|
9414 |
%}. |
|
9415 |
err notNil ifTrue:[ |
|
9416 |
self error:err |
|
9417 |
]. |
|
9418 |
" |
|
9419 |
fd argument not integer |
|
9420 |
" |
|
9421 |
^ self primitiveFailed |
|
9422 |
||
9423 |
||
9424 |
! |
|
9425 |
||
9426 |
writeCheck |
|
9427 |
"return true, if filedescriptor can be written without blocking" |
|
9428 |
||
9429 |
OperatingSystem supportsSelect ifFalse:[ |
|
9430 |
"/ mhmh - what should we do then ? |
|
9431 |
"/ For now, return true as if data was present, |
|
9432 |
"/ and let the thread fall into the write. |
|
9433 |
"/ It will then (hopefully) be desceduled there and |
|
9434 |
"/ effectively polling for output. |
|
9435 |
^ true |
|
9436 |
]. |
|
9437 |
||
9438 |
(OperatingSystem selectOnAnyReadable:nil |
|
9439 |
writable:(Array with:fd) |
|
9440 |
exception:nil |
|
9441 |
withTimeOut:0) == fd |
|
9442 |
ifTrue:[^ true]. |
|
9443 |
^ false |
|
9444 |
||
9445 |
"Created: 1.10.1997 / 08:49:24 / stefan" |
|
9446 |
! ! |
|
9447 |
||
9448 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'private accessing'! |
|
9449 |
||
9450 |
setFileDescriptor:anInteger |
|
9451 |
||
9452 |
%{ |
|
9453 |
if (__isSmallInteger(anInteger)) { |
|
9454 |
__externalAddressVal(self) = (OBJ)(__smallIntegerVal(anInteger)); |
|
9455 |
} |
|
9456 |
%} |
|
9457 |
||
9458 |
||
9459 |
! ! |
|
9460 |
||
9461 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'queries'! |
|
9462 |
||
9463 |
isValid |
|
9464 |
"answer true, if the handle is valid, i.e. connected to |
|
9465 |
a file or some other OS object" |
|
9466 |
||
9467 |
^ fd notNil |
|
9468 |
! ! |
|
9469 |
||
9470 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'registering'! |
|
9471 |
||
9472 |
register |
|
9473 |
"register myself as an open file" |
|
9474 |
||
9475 |
|sz old| |
|
9476 |
||
9477 |
sz := OpenFiles size. |
|
9478 |
fd > sz ifTrue:[ |
|
9479 |
"grow for more descriptors" |
|
9480 |
old := OpenFiles. |
|
9481 |
OpenFiles := WeakArray new:(sz * 2). |
|
9482 |
old removeDependent:(self class). |
|
9483 |
OpenFiles addDependent:(self class). |
|
9484 |
old keysAndValuesDo:[:index :elem| |
|
9485 |
"be careful to not overwrite new entries in OpenFiles" |
|
9486 |
elem notNil ifTrue:[ |
|
9487 |
OpenFiles at:index put:elem. |
|
9488 |
]. |
|
9489 |
]. |
|
9490 |
]. |
|
9491 |
OpenFiles at:fd put:self. |
|
9492 |
||
9493 |
"Created: 30.9.1997 / 12:51:48 / stefan" |
|
9494 |
"Modified: 30.9.1997 / 12:58:37 / stefan" |
|
9495 |
! ! |
|
9496 |
||
9497 |
!UnixOperatingSystem::FileDescriptorHandle methodsFor:'releasing'! |
|
9498 |
||
9499 |
invalidate |
|
9500 |
"a file handle has become invalid" |
|
9501 |
||
9502 |
OpenFiles at:fd put:nil. |
|
9503 |
fd := nil. |
|
9504 |
||
9505 |
"Created: 30.9.1997 / 12:37:26 / stefan" |
|
9506 |
"Modified: 30.9.1997 / 12:42:16 / stefan" |
|
9507 |
! ! |
|
9508 |
||
9509 |
!UnixOperatingSystem::FilePointerHandle class methodsFor:'documentation'! |
|
9510 |
||
9511 |
version |
|
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9512 |
^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.104 2001-12-11 20:21:45 stefan Exp $' |
6301 | 9513 |
! ! |
9514 |
||
9515 |
!UnixOperatingSystem::FilePointerHandle methodsFor:'release'! |
|
9516 |
||
9517 |
closeFile |
|
9518 |
"close the underlying file" |
|
9519 |
||
9520 |
%{ |
|
9521 |
FILE *f = (FILE *)(__externalAddressVal(self)); |
|
9522 |
||
9523 |
if (f) { |
|
9524 |
__externalAddressVal(self) = NULL; |
|
9525 |
fclose(f); |
|
9526 |
} |
|
9527 |
%} |
|
9528 |
||
9529 |
! ! |
|
9530 |
||
5854 | 9531 |
!UnixOperatingSystem::FileStatusInfo class methodsFor:'instance creation'! |
9532 |
||
9533 |
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP |
|
9534 |
^ self basicNew |
|
6050 | 9535 |
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP |
5854 | 9536 |
! ! |
9537 |
||
9538 |
!UnixOperatingSystem::FileStatusInfo methodsFor:'accessing'! |
|
9539 |
||
9540 |
accessed |
|
9541 |
"return accessed" |
|
9542 |
||
9543 |
^ accessed |
|
9544 |
! |
|
9545 |
||
9546 |
alternativeName |
|
9547 |
"return the files other name (DOS name on windows). |
|
9548 |
Nil if there is no other name" |
|
9549 |
||
9550 |
^ nil |
|
9551 |
! |
|
9552 |
||
9553 |
fixedHeaderSize |
|
9554 |
"return the fixedHeaderSize (VMS only; nil everywhere else)" |
|
9555 |
||
9556 |
^ nil |
|
9557 |
! |
|
9558 |
||
9559 |
gid |
|
9560 |
"return gid" |
|
9561 |
||
9562 |
^ gid |
|
9563 |
! |
|
9564 |
||
9565 |
id |
|
9566 |
"return id" |
|
9567 |
||
9568 |
^ id |
|
9569 |
! |
|
9570 |
||
9571 |
mode |
|
9572 |
"return mode" |
|
9573 |
||
9574 |
^ mode |
|
9575 |
! |
|
9576 |
||
9577 |
modified |
|
9578 |
"return modified" |
|
9579 |
||
9580 |
^ modified |
|
9581 |
! |
|
9582 |
||
9583 |
path |
|
9584 |
"for symbolic links only: return the path where the symbolic link points to" |
|
9585 |
||
9586 |
^ path |
|
9587 |
||
9588 |
! |
|
9589 |
||
9590 |
recordAttributes |
|
9591 |
"return the recordAttributes (VMS only; nil everywhere else)" |
|
9592 |
||
9593 |
^ nil |
|
9594 |
! |
|
9595 |
||
9596 |
recordFormat |
|
9597 |
"return the recordFormat (VMS only; nil everywhere else)" |
|
9598 |
||
9599 |
^ nil |
|
9600 |
! |
|
9601 |
||
9602 |
recordFormatNumeric |
|
9603 |
"return the recordFormat as numeric (VMS only; nil everywhere else)" |
|
9604 |
||
9605 |
^ nil |
|
9606 |
! |
|
9607 |
||
9608 |
recordSize |
|
9609 |
"return the recordSize (VMS only; nil everywhere else)" |
|
9610 |
||
9611 |
^ nil |
|
9612 |
! |
|
9613 |
||
9614 |
size |
|
9615 |
"return size" |
|
9616 |
||
9617 |
^ size |
|
9618 |
! |
|
9619 |
||
9620 |
statusChanged |
|
9621 |
"return statusChanged" |
|
9622 |
||
9623 |
^ statusChanged |
|
9624 |
! |
|
9625 |
||
9626 |
type |
|
9627 |
"return type" |
|
9628 |
||
9629 |
^ type |
|
9630 |
! |
|
9631 |
||
9632 |
uid |
|
9633 |
"return uid" |
|
9634 |
||
9635 |
^ uid |
|
9636 |
! ! |
|
9637 |
||
9638 |
!UnixOperatingSystem::FileStatusInfo methodsFor:'backward compatibility'! |
|
9639 |
||
9640 |
at:key |
|
9641 |
"backward compatibility access: in previous releases, IdentityDictionaries |
|
9642 |
were used to hold my information. Allow access via key messages. |
|
9643 |
This method will vanish - use the proper access protocol." |
|
9644 |
||
9645 |
^ self perform:key |
|
9646 |
! ! |
|
9647 |
||
9648 |
!UnixOperatingSystem::FileStatusInfo methodsFor:'private accessing'! |
|
9649 |
||
9650 |
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP |
|
9651 |
type := t. |
|
9652 |
mode := m. |
|
9653 |
uid := u. |
|
9654 |
gid := g. |
|
9655 |
size := s. |
|
9656 |
id := i. |
|
9657 |
accessed := aT. |
|
9658 |
modified := mT. |
|
9659 |
statusChanged := sT. |
|
9660 |
path := lP. |
|
9661 |
! ! |
|
9662 |
||
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9663 |
!UnixOperatingSystem::OSProcessStatus class methodsFor:'documentation'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9664 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9665 |
documentation |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9666 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9667 |
This is an auxillary class, that holds information about status changes of |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9668 |
operating system processes (these are no smalltalk processes!!). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9669 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9670 |
[Instance variables:] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9671 |
|
6050 | 9672 |
pid <Integer> OS-Process identifier |
9673 |
||
9674 |
status <Symbol> either #exit #signal #stop #continue |
|
9675 |
||
9676 |
code <Integer> either exitcode or signalnumber |
|
9677 |
||
9678 |
core <Boolean> true if core has been dumped |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9679 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9680 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9681 |
[author:] |
6050 | 9682 |
Stefan Vogel |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9683 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9684 |
[see also:] |
6050 | 9685 |
OperatingSystem |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9686 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9687 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9688 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9689 |
!UnixOperatingSystem::OSProcessStatus class methodsFor:'instance creation'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9690 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9691 |
pid:pid status:status code:code core:core |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9692 |
"private interface for UnixOperatingSystem" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9693 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9694 |
^ self new pid:pid status:status code:code core:core |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9695 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9696 |
"Created: 28.12.1995 / 14:16:14 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9697 |
"Modified: 30.4.1996 / 18:25:00 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9698 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9699 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9700 |
processCreationFailure |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9701 |
"private interface for UnixOperatingSystem" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9702 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9703 |
^ self new pid:-1 status:#failure code:-1 core:false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9704 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9705 |
"Created: 28.12.1995 / 14:35:29 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9706 |
"Modified: 30.4.1996 / 18:25:05 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9707 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9708 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9709 |
!UnixOperatingSystem::OSProcessStatus methodsFor:'accessing'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9710 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9711 |
code |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9712 |
"return the exitcode / signalNumber" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9713 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9714 |
^ code |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9715 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9716 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9717 |
"Modified: 30.4.1996 / 18:26:23 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9718 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9719 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9720 |
core |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9721 |
"return true if core has been dumped, false otherwise" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9722 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9723 |
^ core == true |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9724 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9725 |
"Modified: 28.12.1995 / 14:14:38 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9726 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9727 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9728 |
pid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9729 |
"return the pid" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9730 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9731 |
^ pid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9732 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9733 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9734 |
"Modified: 30.4.1996 / 18:26:30 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9735 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9736 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9737 |
status |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9738 |
"return status as a Symbol; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9739 |
one of #exit #signal #stop #continue" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9740 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9741 |
^ status |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9742 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9743 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9744 |
"Modified: 30.4.1996 / 18:26:54 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9745 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9746 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9747 |
!UnixOperatingSystem::OSProcessStatus methodsFor:'initialization'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9748 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9749 |
pid:newPid status:newStatus code:newCode core:newCore |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9750 |
pid := newPid. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9751 |
status := newStatus. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9752 |
code := newCode. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9753 |
core := newCore. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9754 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9755 |
"Created: 28.12.1995 / 14:18:22 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9756 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9757 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9758 |
!UnixOperatingSystem::OSProcessStatus methodsFor:'private-OS interface'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9759 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9760 |
code:something |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9761 |
"set the exitCode" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9762 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9763 |
code := something. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9764 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9765 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9766 |
"Modified: 30.4.1996 / 18:25:18 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9767 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9768 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9769 |
core:something |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9770 |
"set core" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9771 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9772 |
core := something. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9773 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9774 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9775 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9776 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9777 |
pid:something |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9778 |
"set pid" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9779 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9780 |
pid := something. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9781 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9782 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9783 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9784 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9785 |
status:something |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9786 |
"set status" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9787 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9788 |
status := something. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9789 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9790 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9791 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9792 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9793 |
!UnixOperatingSystem::OSProcessStatus methodsFor:'queries'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9794 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9795 |
couldNotExecute |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9796 |
"return true when a command could not be executed" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9797 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9798 |
^ status == #exit and:[code = 127]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9799 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9800 |
"Created: 28.12.1995 / 15:43:17 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9801 |
"Modified: 30.4.1996 / 18:27:03 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9802 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9803 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9804 |
stillAlive |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9805 |
"true if process is still alive" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9806 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9807 |
^ status == #stop or:[status == #continue] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9808 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9809 |
"Created: 28.12.1995 / 14:27:26 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9810 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9811 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9812 |
success |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9813 |
"true if process terminated successfully" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9814 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9815 |
^ status == #exit and:[code = 0] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9816 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9817 |
"Created: 28.12.1995 / 14:13:05 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9818 |
"Modified: 28.12.1995 / 14:13:41 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9819 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9820 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9821 |
!UnixOperatingSystem class methodsFor:'documentation'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9822 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9823 |
version |
6306
0e4cc1ce9245
More FileDescriptorHandle stuff
Stefan Vogel <sv@exept.de>
parents:
6301
diff
changeset
|
9824 |
^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.104 2001-12-11 20:21:45 stefan Exp $' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9825 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
9826 |
UnixOperatingSystem initialize! |