author | Claus Gittinger <cg@exept.de> |
Thu, 11 Jun 1998 22:48:35 +0200 | |
changeset 3556 | 03e4132de6da |
parent 3555 | 211885c31b61 |
child 3558 | 5a6c4b491b95 |
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 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3 |
All Rights Reserved |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
13 |
AbstractOperatingSystem subclass:#UnixOperatingSystem |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
14 |
instanceVariableNames:'' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
15 |
classVariableNames:'HostName DomainName SlowFork CurrentDirectory' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
16 |
poolDictionaries:'' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
17 |
category:'OS-Unix' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
18 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
19 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
20 |
Object subclass:#FileStatusInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
21 |
instanceVariableNames:'type mode uid gid size id accessed modified statusChanged path |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
22 |
alternativeName recordFormatNumeric recordFormat recordAttributes |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
23 |
fixedHeaderSize recordSize' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
24 |
classVariableNames:'' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
25 |
poolDictionaries:'' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
26 |
privateIn:UnixOperatingSystem |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
27 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
28 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
29 |
Object subclass:#OSProcessStatus |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
30 |
instanceVariableNames:'pid status code core' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
31 |
classVariableNames:'' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
32 |
poolDictionaries:'' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
33 |
privateIn:UnixOperatingSystem |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
34 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
35 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
36 |
!UnixOperatingSystem primitiveDefinitions! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
37 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
38 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
39 |
#define UNIX_LIKE /* assumption: a real operatingSystem */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
40 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
41 |
#if defined(MSWINDOWS) || defined(OS2) || defined(MSDOS) || defined(WIN32) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
42 |
# ifndef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
43 |
# define MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
44 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
45 |
# undef UNIX_LIKE /* oops - we were too optimistic - no OS */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
46 |
# ifdef i386 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
47 |
# ifndef _X86_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
48 |
# define _X86_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
49 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
50 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
51 |
#endif /* any MS-non-OS */ |
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(transputer) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
54 |
# undef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
55 |
# undef UNIX_LIKE /* oops - we were too optimistic - no OS */ |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
58 |
#if defined(_AIX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
59 |
# ifndef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
60 |
# define WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
61 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
62 |
# ifndef WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
63 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
64 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
65 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
66 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
67 |
#ifdef LINUX |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
68 |
/* use inline string macros */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
69 |
# define __STRINGDEFS__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
70 |
# include <linuxIntern.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
71 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
72 |
# ifndef WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
73 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
74 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
75 |
# define WANT_SHM |
3544
a654f7ac3a6e
solaris has no setenv / unsetenv
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
76 |
# define HAS_SETENV |
a654f7ac3a6e
solaris has no setenv / unsetenv
Claus Gittinger <cg@exept.de>
parents:
3543
diff
changeset
|
77 |
# define HAS_UNSETENV |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
78 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
79 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
80 |
#ifdef IRIX5 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
81 |
# define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
82 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
83 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
84 |
#ifdef ultrix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
85 |
# define WANT_SYSTEM |
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 hpux |
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 solaris |
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 |
#if defined(SYSV4) && defined(i386) /* e.g. unixware */ |
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 __VMS__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
101 |
# undef __new |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
102 |
# undef HAS_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
103 |
# undef HAS_WAIT3 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
104 |
# undef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
105 |
# undef HAS_USLEEP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
106 |
# define NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
107 |
# define NO_SETITIMER |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
108 |
# define NO_GRP_H |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
109 |
# define HAS_REMOVE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
110 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
111 |
# ifdef __openVMS__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
112 |
# ifndef _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
113 |
# include <unistd.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
114 |
# define _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
115 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
116 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
117 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
118 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
119 |
* req'd for additional fileInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
120 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
121 |
# include <rms.h> /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
122 |
# include <fabdef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
123 |
|
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 |
* req'd for subprocess support |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
126 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
127 |
# include <iodef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
128 |
# include <ssdef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
129 |
# include <syidef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
130 |
# include <clidef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
131 |
# include <stsdef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
132 |
# include <dvidef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
133 |
# include <nam.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
134 |
# include <descrip.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
135 |
# include <lib$routines.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
136 |
# include <starlet.h> |
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 |
# define xxxUSE_SLOW_ALARM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
139 |
# define USE_AST_TIMER |
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 |
/* VMS variable length string */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
142 |
struct Vstring { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
143 |
short length; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
144 |
char body[NAM$C_MAXRSS+1]; |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
147 |
/* VMS typeahead-ask struct */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
148 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
149 |
struct typahdask { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
150 |
short typcnt; /* chars in buffer */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
151 |
char firstChar; /* first character */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
152 |
char reserve1; /* secret */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
153 |
long reserve2; /* secret */ |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
156 |
/* VMS I/O status block */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
157 |
struct IOSB { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
158 |
short status, count; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
159 |
long devinfo; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
160 |
}; |
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 |
/* VMS Item List 3 structure */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
163 |
struct itm$list3 { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
164 |
short buflen; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
165 |
short itemcode; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
166 |
void *buffer; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
167 |
size_t *retlen; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
168 |
}; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
169 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
170 |
/* ST/X maintained per-process information */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
171 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
172 |
struct procInfo { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
173 |
long returnStatus; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
174 |
long pid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
175 |
char eventFlag; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
176 |
char finished; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
177 |
struct procInfo *nextProc; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
178 |
}; |
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 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
181 |
* move this to alphaIntern.h ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
182 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
183 |
# if __VMS_VER < 70000000 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
184 |
# define NO_PWD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
185 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
186 |
# define NO_PWD_PASSWD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
187 |
# define NO_PWD_GECOS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
188 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
189 |
#endif /* __VMS__ */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
190 |
|
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 |
* notice: although many systems' include files |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
193 |
* already block against multiple inclusion, some |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
194 |
* do not. Therefore, this is done here again. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
195 |
* (it does not hurt) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
196 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
197 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
198 |
#ifdef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
199 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
200 |
# ifndef NO_SYS_PARAM_H |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
201 |
# include <sys/param.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
202 |
# define _SYS_PARAM_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
203 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
204 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
205 |
# include <errno.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
206 |
# define _ERRNO_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
207 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
208 |
# include <sys/stat.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
209 |
# define _SYS_STAT_H_INCLUDED_ |
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 |
#endif /* WANT_REALPATH */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
212 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
213 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
214 |
#ifdef WANT_SHM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
215 |
extern int shmctl(), shmget(), shmdt(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
216 |
extern char * shmat(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
217 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
218 |
# include <sys/types.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
219 |
# define _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
220 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
221 |
# include <sys/ipc.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
222 |
# define _SYS_IPC_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
223 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
224 |
# include <sys/shm.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
225 |
# define _SYS_SHM_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
226 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
227 |
#endif /* WANT_SHM */ |
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 |
#ifdef IRIX5 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
230 |
# include <sys/syssgi.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
231 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
232 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
233 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
234 |
#ifdef transputer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
235 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
236 |
# define unlink(f) ((remove(f) == 0) ? 0 : -1) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
237 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
238 |
#else /* not transputer */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
239 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
240 |
# ifndef _SIGNAL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
241 |
# include <signal.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
242 |
# define _SIGNAL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
243 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
244 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
245 |
# ifdef SYSV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
246 |
# ifndef _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
247 |
# include <sys/types.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
248 |
# define _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
249 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
250 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
251 |
# ifndef _SYS_PARAM_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
252 |
# ifndef NO_SYS_PARAM_H |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
253 |
# include <sys/param.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
254 |
# define _SYS_PARAM_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
255 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
256 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
257 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
258 |
# ifndef _SYS_TIMES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
259 |
# include <sys/times.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
260 |
# define _SYS_TIMES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
261 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
262 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
263 |
# ifndef _SYS_FILE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
264 |
# include <sys/file.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
265 |
# define _SYS_FILE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
266 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
267 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
268 |
# if ! defined(sco3_2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
269 |
# ifndef _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
270 |
# include <unistd.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
271 |
# define _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
272 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
273 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
274 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
275 |
# if defined(isc3_2) || defined(sco3_2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
276 |
# ifndef _SYS_TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
277 |
# include <sys/time.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
278 |
# define _SYS_TIME_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 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
281 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
282 |
# if !defined(isc3_2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
283 |
# if defined(PCS) && defined(mips) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
284 |
# include "/usr/include/bsd/sys/time.h" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
285 |
# include "/usr/include/sys/time.h" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
286 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
287 |
# ifndef _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
288 |
# include <time.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
289 |
# define _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
290 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
291 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
292 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
293 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
294 |
# if defined(isc3_2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
295 |
# include <sys/bsdtypes.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
296 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
297 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
298 |
# else /* not SYSV */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
299 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
300 |
# ifdef MSDOS_LIKE |
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 |
# ifndef _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
303 |
# include <sys/types.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
304 |
# define _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
305 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
306 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
307 |
# ifndef _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
308 |
# include <time.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
309 |
# define _TIME_H_INCLUDED_ |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
312 |
# ifndef _SYS_TIMEB_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
313 |
# include <sys/timeb.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
314 |
# define _SYS_TIMEB_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
315 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
316 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
317 |
# else /* not MSDOS_like */ |
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 _SYS_TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
320 |
# include <sys/time.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
321 |
# define _SYS_TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
322 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
323 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
324 |
# ifndef _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
325 |
# include <sys/types.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
326 |
# define _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
327 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
328 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
329 |
# endif /* not MSDOS */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
330 |
# endif /* not SYSV */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
331 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
332 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
333 |
# ifdef aix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
334 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
335 |
# ifndef _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
336 |
# include <time.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
337 |
# define _TIME_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
338 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
339 |
# ifndef _SYS_SELECT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
340 |
# include <sys/select.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
341 |
# define _SYS_SELECT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
342 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
343 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
344 |
# endif /* aix */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
345 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
346 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
347 |
# ifndef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
348 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
349 |
# ifndef _PWD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
350 |
# include <pwd.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
351 |
# define _PWD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
352 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
353 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
354 |
# ifndef NO_GRP_H |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
355 |
# ifndef _GRP_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
356 |
# include <grp.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
357 |
# define _GRP_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
358 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
359 |
# endif |
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 |
# endif /* not MSDOS */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
362 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
363 |
# ifndef _SYS_STAT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
364 |
# include <sys/stat.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
365 |
# define _SYS_STAT_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
366 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
367 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
368 |
# ifndef _SYS_FILE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
369 |
# ifndef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
370 |
# include <sys/file.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
371 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
372 |
# define _SYS_FILE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
373 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
374 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
375 |
# ifndef _ERRNO_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
376 |
# include <errno.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
377 |
# define _ERRNO_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
378 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
379 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
380 |
# ifndef _STDIO_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
381 |
# include <stdio.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
382 |
# define _STDIO_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
383 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
384 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
385 |
# ifndef _FCNTL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
386 |
# include <fcntl.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
387 |
# define _FCNTL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
388 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
389 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
390 |
# ifndef _IOCTL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
391 |
# ifndef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
392 |
# include <sys/ioctl.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
393 |
# define _IOCTL_H_INCLUDED_ |
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 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
396 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
397 |
# ifdef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
398 |
/*# define PROCESSDEBUGWIN32*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
399 |
# define xxUSE_TimerProc |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
400 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
401 |
# undef INT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
402 |
# undef Array |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
403 |
# undef Number |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
404 |
# undef Method |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
405 |
# undef Point |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
406 |
# undef Rectangle |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
407 |
# undef Block |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
408 |
# undef String |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
409 |
# undef Message |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
410 |
# undef Object |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
411 |
# undef Context |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
412 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
413 |
/* # include <windows.h> /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
414 |
# include <stdarg.h> /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
415 |
# include <windef.h> /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
416 |
# include <winbase.h> /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
417 |
# include <wingdi.h> /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
418 |
# include <winuser.h> /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
419 |
# include <winsock.h> /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
420 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
421 |
# ifdef __DEF_Array |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
422 |
# define Array __DEF_Array |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
423 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
424 |
# ifdef __DEF_Number |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
425 |
# define Number __DEF_Number |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
426 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
427 |
# ifdef __DEF_Method |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
428 |
# define Method __DEF_Method |
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 |
# ifdef __DEF_Point |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
431 |
# define Point __DEF_Point |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
432 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
433 |
# ifdef __DEF_Block |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
434 |
# define Block __DEF_Block |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
435 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
436 |
# ifdef __DEF_String |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
437 |
# define String __DEF_String |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
438 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
439 |
# ifdef __DEF_Message |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
440 |
# define Message __DEF_Message |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
441 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
442 |
# ifdef __DEF_Object |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
443 |
# define Object __DEF_Object |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
444 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
445 |
# ifdef __DEF_Context |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
446 |
# define Context __DEF_Context |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
447 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
448 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
449 |
# define INT int |
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 |
# define stat _stat |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
452 |
# define WIN32_ERR(x) ((x) | 0x01000000) /* tag GetLastError codes */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
453 |
/* as opposed to Posix errors */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
454 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
455 |
typedef int (*intf)(int); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
456 |
BOOL __signalUserInterruptWIN32(DWORD sig); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
457 |
# endif /* WIN32 */ |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
460 |
# if defined(LINUX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
461 |
# define HAS_LOCALECONV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
462 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
463 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
464 |
# if defined (HAS_LOCALECONV) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
465 |
# ifndef _LOCALE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
466 |
# include <locale.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
467 |
# define _LOCALE_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
468 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
469 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
470 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
471 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
472 |
* posix systems should define these ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
473 |
* but on some (older) systems, they are not. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
474 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
475 |
# ifndef S_IXUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
476 |
# ifdef S_IEXEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
477 |
# define S_IXUSR S_IEXEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
478 |
# define S_IXGRP (S_IEXEC>>3) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
479 |
# define S_IXOTH (S_IEXEC>>6) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
480 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
481 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
482 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
483 |
# ifndef S_IXUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
484 |
# define S_IXUSR 0100 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
485 |
# define S_IXGRP 0010 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
486 |
# define S_IXOTH 0001 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
487 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
488 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
489 |
# ifndef S_IRUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
490 |
# define S_IRUSR 0400 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
491 |
# define S_IRGRP 0040 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
492 |
# define S_IROTH 0004 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
493 |
# endif |
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 |
# ifndef S_IWUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
496 |
# define S_IWUSR 0200 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
497 |
# define S_IWGRP 0020 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
498 |
# define S_IWOTH 0002 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
499 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
500 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
501 |
# ifndef MAXPATHLEN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
502 |
# ifndef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
503 |
# ifndef NO_SYS_PARAM_H |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
504 |
# include <sys/param.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
505 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
506 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
507 |
# ifndef MAXPATHLEN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
508 |
# ifdef FILENAME_MAX /* i.e. MSDOS_LIKE */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
509 |
# define MAXPATHLEN FILENAME_MAX |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
510 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
511 |
# ifdef MAX_PATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
512 |
# define MAXPATHLEN MAX_PATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
513 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
514 |
# define MAXPATHLEN 1024 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
515 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
516 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
517 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
518 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
519 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
520 |
# if defined(HAS_UNAME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
521 |
# include <sys/utsname.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
522 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
523 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
524 |
# if defined(SYSV4) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
525 |
# include <stropts.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
526 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
527 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
528 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
529 |
* NeXT has no pid_t |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
530 |
* and no sigemptyset |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
531 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
532 |
# ifdef NEXT3 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
533 |
typedef int pid_t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
534 |
# define sigemptyset(set) ((*(set) = 0L), 0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
535 |
# define HAS_GETDOMAINNAME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
536 |
# define NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
537 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
538 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
539 |
# ifdef sunos |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
540 |
# undef NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
541 |
# undef HAS_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
542 |
# define HAS_WAIT3 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
543 |
# define HAS_SIGACTION |
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 |
# ifdef _AIX |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
547 |
# undef HAS_WAIT3 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
548 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
549 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
550 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
551 |
* some (BSD ?) have no timezone global, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
552 |
* but provide the info in struct timezone. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
553 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
554 |
# if defined(ultrix) || defined(sunos) || defined(NEXT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
555 |
# define HAS_NO_TIMEZONE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
556 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
557 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
558 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
559 |
* 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
|
560 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
561 |
# ifndef SA_RESTART |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
562 |
# define SA_RESTART 0 |
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 |
# ifndef SA_SIGINFO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
565 |
# define SA_SIGINFO 0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
566 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
567 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
568 |
# if defined(HAS_WAITPID) || defined(HAS_WAIT3) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
569 |
# include <sys/wait.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
570 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
571 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
572 |
# if defined(HAS_SYSINFO) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
573 |
# include <sys/systeminfo.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
574 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
575 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
576 |
#endif /* not transputer */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
577 |
|
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 |
* 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
|
580 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
581 |
#ifndef errno |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
582 |
extern errno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
583 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
584 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
585 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
586 |
* some (old ?) systems do not define this ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
587 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
588 |
#if !defined(R_OK) && !defined(_AIX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
589 |
# define R_OK 4 /* Test for Read permission */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
590 |
# define W_OK 2 /* Test for Write permission */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
591 |
# define X_OK 1 /* Test for eXecute permission */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
592 |
# 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
|
593 |
#endif |
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 |
#ifdef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
596 |
# define SIGHANDLER_ARG int |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
597 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
598 |
# define SIGHANDLER_ARG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
599 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
600 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
601 |
#ifdef sunos |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
602 |
# define NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
603 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
604 |
#ifdef NEXT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
605 |
# define NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
606 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
607 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
608 |
#ifdef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
609 |
#define _HANDLEVal(o) (HANDLE)(__externalAddressVal(o)) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
610 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
611 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
612 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
613 |
* 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
|
614 |
* explicit add of those we know to have ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
615 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
616 |
#ifdef __osf__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
617 |
# define TIME_T time_t |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
618 |
# define OFF_T off_t |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
619 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
620 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
621 |
#ifndef TIME_T |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
622 |
# define TIME_T long |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
623 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
624 |
#ifndef OFF_T |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
625 |
# define OFF_T long |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
626 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
627 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
628 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
629 |
* where is the timezone info ? |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
630 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
631 |
#if defined(HAS_NO_TIMEZONE) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
632 |
# if defined(HAS_NO_TM_GMTOFF) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
633 |
# define TIMEZONE(tmPtr) 0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
634 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
635 |
# define TIMEZONE(tmPtr) ((tmPtr)->tm_gmtoff) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
636 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
637 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
638 |
# ifdef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
639 |
# define TIMEZONE(tmPtr) 0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
640 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
641 |
# define TIMEZONE(tmPtr) timezone |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
642 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
643 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
644 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
645 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
646 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
647 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
648 |
!UnixOperatingSystem primitiveVariables! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
649 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
650 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
651 |
#ifdef __VMS__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
652 |
static struct procInfo *procInfoHead = (struct procInfo *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
653 |
static struct procInfo *procInfoFree = (struct procInfo *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
654 |
static unsigned char procEventFlag = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
655 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
656 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
657 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
658 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
659 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
660 |
!UnixOperatingSystem primitiveFunctions! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
661 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
662 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
663 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
664 |
* 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
|
665 |
* 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
|
666 |
* (LINUX is one of them) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
667 |
* 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
|
668 |
* UnixOperatingSystem>>executeCommand, you ought to define WANT_SYSTEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
669 |
* 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
|
670 |
* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
671 |
* 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
|
672 |
* 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
|
673 |
* (i.e. it is RT safe) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
674 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
675 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
676 |
#if defined(WANT_SYSTEM) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
677 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
678 |
/* # define DPRINTF(x) printf x */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
679 |
# define DPRINTF(x) /* nothing */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
680 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
681 |
# ifndef _STDDEF_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
682 |
# include <stddef.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
683 |
# define _STDDEF_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
684 |
# endif |
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 |
# ifndef _STDLIB_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
687 |
# include <stdlib.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
688 |
# define _STDLIB_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
689 |
# endif |
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 |
# ifndef _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
692 |
# include <unistd.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
693 |
# define _UNISTD_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
694 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
695 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
696 |
# ifndef _SYS_WAIT_H_INCLUDED |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
697 |
# include <sys/wait.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
698 |
# define _SYS_WAIT_H_INCLUDED |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
699 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
700 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
701 |
# ifndef _SIGNAL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
702 |
# include <signal.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
703 |
# define _SIGNAL_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
704 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
705 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
706 |
# ifndef _SYS_TYPES_H_INCLUDED_ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
707 |
# include <sys/types.h> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
708 |
# define _SYS_TYPES_H_INCLUDED_ |
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 |
# 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
|
712 |
# define __environ environ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
713 |
# if !defined(LINUX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
714 |
# define __sigemptyset sigemptyset |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
715 |
# define __sigaction sigaction |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
716 |
# define __sigaddset sigaddset |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
717 |
# define __sigprocmask sigprocmask |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
718 |
# define __execve execve |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
719 |
# define __wait wait |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
720 |
# define __waitpid waitpid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
721 |
# if defined(HAS_VFORK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
722 |
# define FORK vfork |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
723 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
724 |
# define FORK fork |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
725 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
726 |
# endif /* ! LINUX */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
727 |
extern char **environ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
728 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
729 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
730 |
# 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
|
731 |
# define SHELL_NAME "sh" /* Name to give it. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
732 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
733 |
# ifndef FORK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
734 |
# define FORK __fork |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
735 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
736 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
737 |
# ifndef CONST |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
738 |
# ifdef __GNUC__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
739 |
# define CONST const |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
740 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
741 |
# define CONST /* nothing */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
742 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
743 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
744 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
745 |
static int |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
746 |
mySystem(line) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
747 |
register CONST char *line; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
748 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
749 |
int status, save; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
750 |
pid_t pid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
751 |
struct sigaction sa, intr, quit; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
752 |
sigset_t block, omask; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
753 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
754 |
if (line == NULL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
755 |
return -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
756 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
757 |
sa.sa_handler = SIG_IGN; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
758 |
sa.sa_flags = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
759 |
__sigemptyset (&sa.sa_mask); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
760 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
761 |
if (__sigaction (SIGINT, &sa, &intr) < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
762 |
DPRINTF(("1: errno=%d\n", errno)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
763 |
return -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
764 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
765 |
if (__sigaction (SIGQUIT, &sa, &quit) < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
766 |
save = errno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
767 |
(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
768 |
errno = save; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
769 |
DPRINTF(("2: errno=%d\n", errno)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
770 |
return -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
771 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
772 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
773 |
__sigemptyset (&block); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
774 |
__sigaddset (&block, SIGCHLD); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
775 |
save = errno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
776 |
if (__sigprocmask(SIG_BLOCK, &block, &omask) < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
777 |
if (errno == ENOSYS) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
778 |
errno = save; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
779 |
else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
780 |
save = errno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
781 |
(void) __sigaction(SIGINT, &intr, (struct sigaction *) NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
782 |
(void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
783 |
errno = save; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
784 |
DPRINTF(("3: errno=%d\n", errno)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
785 |
return -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
786 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
787 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
788 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
789 |
pid = FORK (); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
790 |
if (pid == (pid_t) 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
791 |
/* Child side. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
792 |
CONST char *new_argv[4]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
793 |
new_argv[0] = SHELL_NAME; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
794 |
new_argv[1] = "-c"; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
795 |
new_argv[2] = line; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
796 |
new_argv[3] = NULL; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
797 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
798 |
/* Restore the signals. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
799 |
(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
800 |
(void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
801 |
(void) __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
802 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
803 |
/* Exec the shell. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
804 |
(void) __execve (SHELL_PATH, (char *CONST *) new_argv, __environ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
805 |
_exit (127); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
806 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
807 |
if (pid < (pid_t) 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
808 |
/* The fork failed. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
809 |
DPRINTF(("4: errno=%d\n", errno)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
810 |
status = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
811 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
812 |
/* Parent side. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
813 |
#ifdef NO_WAITPID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
814 |
pid_t child; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
815 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
816 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
817 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
818 |
child = __wait (&status); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
819 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
820 |
if (child < 0 && errno != EINTR) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
821 |
DPRINTF(("5: errno=%d\n", errno)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
822 |
status = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
823 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
824 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
825 |
} while (child != pid); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
826 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
827 |
pid_t child; |
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 |
/* claus: the original did not care for EINTR here ... */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
830 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
831 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
832 |
child = __waitpid (pid, &status, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
833 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
834 |
} while ((child != pid) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
835 |
if (child != pid) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
836 |
DPRINTF(("6: errno=%d\n", errno)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
837 |
status = -1; |
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 |
#endif /* NO_WAITPID */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
840 |
} |
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 |
save = errno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
843 |
if ((__sigaction (SIGINT, &intr, (struct sigaction *) NULL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
844 |
| __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
845 |
| __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL)) != 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
846 |
if (errno == ENOSYS) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
847 |
errno = save; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
848 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
849 |
status = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
850 |
DPRINTF(("7: errno=%d\n", errno)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
851 |
} |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
854 |
return status; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
855 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
856 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
857 |
# define __wait wait |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
858 |
#endif /* WANT_SYSTEM */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
859 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
860 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
861 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
862 |
* some systems do not have realpath(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
863 |
* the alternative of reading from a 'pwp'-pipe |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
864 |
* 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
|
865 |
* 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
|
866 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
867 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
868 |
#if defined(HAS_REALPATH) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
869 |
# undef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
870 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
871 |
#if !defined(HAS_GETWD) && !defined(HAS_GETCWD) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
872 |
# undef WANT_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
873 |
#endif |
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 |
#if defined(WANT_REALPATH) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
876 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
877 |
# ifndef NULL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
878 |
# define NULL (char *)0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
879 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
880 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
881 |
# define MAX_READLINKS 32 |
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 |
# ifndef MAXPATHLEN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
884 |
# define MAXPATHLEN 1024 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
885 |
# endif |
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 |
static |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
888 |
char *realpath(path, resolved_path) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
889 |
char *path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
890 |
char resolved_path []; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
891 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
892 |
char copy_path[MAXPATHLEN]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
893 |
char link_path[MAXPATHLEN]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
894 |
char *new_path = resolved_path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
895 |
char *max_path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
896 |
int readlinks = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
897 |
int n; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
898 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
899 |
/* Make a copy of the source path since we may need to modify it. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
900 |
strcpy(copy_path, path); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
901 |
path = copy_path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
902 |
max_path = copy_path + MAXPATHLEN - 2; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
903 |
/* If it's a relative pathname use getwd for starters. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
904 |
if (*path != '/') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
905 |
#ifdef HAS_GETCWD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
906 |
new_path = getcwd(new_path, MAXPATHLEN - 1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
907 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
908 |
new_path = getwd(new_path); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
909 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
910 |
if (new_path == NULL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
911 |
return(NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
912 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
913 |
new_path += strlen(new_path); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
914 |
if (new_path[-1] != '/') |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
915 |
*new_path++ = '/'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
916 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
917 |
else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
918 |
*new_path++ = '/'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
919 |
path++; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
920 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
921 |
/* Expand each slash-separated pathname component. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
922 |
while (*path != '\0') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
923 |
/* Ignore stray "/". */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
924 |
if (*path == '/') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
925 |
path++; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
926 |
continue; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
927 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
928 |
if (*path == '.') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
929 |
/* Ignore ".". */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
930 |
if (path[1] == '\0' || path[1] == '/') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
931 |
path++; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
932 |
continue; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
933 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
934 |
if (path[1] == '.') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
935 |
if (path[2] == '\0' || path[2] == '/') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
936 |
path += 2; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
937 |
/* Ignore ".." at root. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
938 |
if (new_path == resolved_path + 1) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
939 |
continue; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
940 |
/* Handle ".." by backing up. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
941 |
while ((--new_path)[-1] != '/') |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
942 |
; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
943 |
continue; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
944 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
945 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
946 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
947 |
/* Safely copy the next pathname component. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
948 |
while (*path != '\0' && *path != '/') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
949 |
if (path > max_path) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
950 |
errno = ENAMETOOLONG; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
951 |
return NULL; |
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 |
*new_path++ = *path++; |
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 |
#ifdef S_IFLNK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
956 |
/* Protect against infinite loops. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
957 |
if (readlinks++ > MAX_READLINKS) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
958 |
errno = ELOOP; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
959 |
return NULL; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
960 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
961 |
/* See if latest pathname component is a symlink. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
962 |
*new_path = '\0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
963 |
n = readlink(resolved_path, link_path, MAXPATHLEN - 1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
964 |
if (n < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
965 |
/* EINVAL means the file exists but isn't a symlink. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
966 |
if (errno != EINVAL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
967 |
return NULL; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
968 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
969 |
else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
970 |
/* Note: readlink doesn't add the null byte. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
971 |
link_path[n] = '\0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
972 |
if (*link_path == '/') |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
973 |
/* Start over for an absolute symlink. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
974 |
new_path = resolved_path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
975 |
else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
976 |
/* Otherwise back up over this component. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
977 |
while (*(--new_path) != '/') |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
978 |
; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
979 |
/* Safe sex check. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
980 |
if (strlen(path) + n >= MAXPATHLEN) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
981 |
errno = ENAMETOOLONG; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
982 |
return NULL; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
983 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
984 |
/* Insert symlink contents into path. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
985 |
strcat(link_path, path); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
986 |
strcpy(copy_path, link_path); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
987 |
path = copy_path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
988 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
989 |
#endif /* S_IFLNK */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
990 |
*new_path++ = '/'; |
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 |
/* Delete trailing slash but don't whomp a lone slash. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
993 |
if (new_path != resolved_path + 1 && new_path[-1] == '/') |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
994 |
new_path--; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
995 |
/* Make sure it's null terminated. */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
996 |
*new_path = '\0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
997 |
return resolved_path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
998 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
999 |
# define HAS_REALPATH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1000 |
#endif /* WANT_REALPATH && not HAS_REALPATH */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1001 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1002 |
#ifdef __VMS__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1003 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1004 |
/* #define TRACE_STAT_CALLS /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1005 |
/* #define TRACE_ACCESS_CALLS /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1006 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1007 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1008 |
* a stat which retries with appended '.DIR' in case of |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1009 |
* failure. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1010 |
* This allows to stat a directory. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1011 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1012 |
int |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1013 |
__vms_stat__(path, buffP) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1014 |
char *path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1015 |
struct stat *buffP; |
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 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1018 |
int retry = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1019 |
char t[MAXPATHLEN+1+5+2]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1020 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1021 |
# ifdef TRACE_STAT_CALLS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1022 |
printf("===> stat('%s')\n", path); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1023 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1024 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1025 |
ret = stat(path, buffP); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1026 |
} while ((ret < 0) && (errno == EINTR)); |
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 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1029 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1030 |
* try with appended ';0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1031 |
* but only, if it has no version |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1032 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1033 |
if (strchr(path, ';') == NULL) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1034 |
strncpy(t, path, MAXPATHLEN); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1035 |
t[MAXPATHLEN] = '\0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1036 |
strcat(t, ";0"); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1037 |
# ifdef TRACE_STAT_CALLS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1038 |
printf("===> stat('%s') - retry\n", t); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1039 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1040 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1041 |
ret = stat(t, buffP); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1042 |
} while ((ret < 0) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1043 |
if (ret >= 0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1044 |
return ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1045 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1046 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1047 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1048 |
* try with appended '.DIR'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1049 |
* but only, if it has no extension. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1050 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1051 |
if (strchr(path, '.') == NULL) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1052 |
strncpy(t, path, MAXPATHLEN); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1053 |
t[MAXPATHLEN] = '\0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1054 |
strcat(t, ".DIR;0"); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1055 |
retry = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1056 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1057 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1058 |
* try with appended 'DIR'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1059 |
* but only, if it ends with '.'. |
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 |
if (path[strlen(path)-1] == '.') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1062 |
strncpy(t, path, MAXPATHLEN); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1063 |
t[MAXPATHLEN] = '\0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1064 |
strcat(t, "DIR;0"); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1065 |
retry = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1066 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1067 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1068 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1069 |
if (retry) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1070 |
# ifdef TRACE_STAT_CALLS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1071 |
printf("===> stat('%s') - retry\n", t); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1072 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1073 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1074 |
ret = stat(t, buffP); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1075 |
} while ((ret < 0) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1076 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1077 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1078 |
return ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1079 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1080 |
# define stat(__path__, __buffP__) __vms_stat__(__path__, __buffP__) |
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 |
* same for access |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1084 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1085 |
int |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1086 |
__vms_access__(path, mode) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1087 |
char *path; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1088 |
int mode; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1089 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1090 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1091 |
int retry = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1092 |
char t[MAXPATHLEN+1+5]; |
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 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1095 |
ret = access(path, mode); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1096 |
} while ((ret < 0) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1097 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1098 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1099 |
* try with appended '.DIR'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1100 |
* but only, if it has no extension. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1101 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1102 |
if (strchr(path, '.') == NULL) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1103 |
strncpy(t, path, MAXPATHLEN); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1104 |
t[MAXPATHLEN] = '\0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1105 |
strcat(t, ".DIR"); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1106 |
retry = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1107 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1108 |
if (path[strlen(path)-1] == '.') { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1109 |
strncpy(t, path, MAXPATHLEN); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1110 |
t[MAXPATHLEN] = '\0'; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1111 |
strcat(t, "DIR"); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1112 |
retry = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1113 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1114 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1115 |
if (retry) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1116 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1117 |
ret = access(t, mode); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1118 |
} while ((ret < 0) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1119 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1120 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1121 |
return ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1122 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1123 |
# define access(__path__, __mode__) __vms_access__(__path__, __mode__) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1124 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1125 |
/* #define WAITDEBUG /* */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1126 |
/* #define PROCESSDEBUG /* */ |
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 |
void |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1129 |
__vms_ASTChildWithInfo(pInfo) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1130 |
struct procInfo *pInfo; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1131 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1132 |
#ifdef WAITDEBUG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1133 |
printf("__vms_ASTChildWithInfo pI=%x\n", pInfo); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1134 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1135 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1136 |
pInfo->finished = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1137 |
__vmsASTChild(); /* this signals an ST/X interrupt */ |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1140 |
int |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1141 |
__vms_waitPid(pidToWait, pStatus, pPid) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1142 |
int pidToWait; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1143 |
long *pStatus, *pPid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1144 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1145 |
extern struct procInfo *procInfoHead, *procInfoFree; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1146 |
struct procInfo *pInfo, *prevInfo; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1147 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1148 |
prevInfo = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1149 |
#ifdef WAITDEBUG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1150 |
printf("__vms_waitPid ...\r\n", pInfo); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1151 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1152 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1153 |
for (pInfo = procInfoHead; pInfo; pInfo = pInfo->nextProc) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1154 |
#ifdef WAITDEBUG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1155 |
printf("__vms_waitPid pI=%x\r\n", pInfo); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1156 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1157 |
if (pInfo->finished) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1158 |
#ifdef WAITDEBUG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1159 |
printf(" finished\n"); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1160 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1161 |
if ((pidToWait == -1) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1162 |
|| (pInfo->pid == pidToWait)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1163 |
#ifdef WAITDEBUG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1164 |
printf(" pid is %d\n", pInfo->pid); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1165 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1166 |
if ((pInfo->returnStatus & STS$M_SUCCESS) != STS$M_SUCCESS) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1167 |
*pStatus = pInfo->returnStatus; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1168 |
else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1169 |
*pStatus = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1170 |
#ifdef WAITDEBUG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1171 |
printf(" status is %d (returning %d)\n", pInfo->returnStatus, *pStatus); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1172 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1173 |
*pPid = pInfo->pid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1174 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1175 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1176 |
* link this infoBlock back to the freeList |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1177 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1178 |
if (prevInfo) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1179 |
prevInfo->nextProc = pInfo->nextProc; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1180 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1181 |
procInfoHead = pInfo->nextProc; |
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 |
pInfo->nextProc = procInfoFree; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1184 |
procInfoFree = pInfo; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1185 |
return 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1186 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1187 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1188 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1189 |
#ifdef WAITDEBUG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1190 |
printf("no child\r\n"); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1191 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1192 |
return 0; |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1195 |
#endif /* __VMS__ */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1196 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1197 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1198 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1199 |
!UnixOperatingSystem class methodsFor:'documentation'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1200 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1201 |
copyright |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1202 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1203 |
COPYRIGHT (c) 1988 by Claus Gittinger |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1204 |
All Rights Reserved |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1205 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1206 |
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
|
1207 |
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
|
1208 |
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
|
1209 |
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
|
1210 |
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
|
1211 |
hereby transferred. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1212 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1213 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1214 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1215 |
documentation |
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 |
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
|
1218 |
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
|
1219 |
things available here in your applications |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1220 |
- 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
|
1221 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1222 |
(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
|
1223 |
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
|
1224 |
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
|
1225 |
You decide - portability vs. functionality) |
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 |
[Class variables:] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1228 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1229 |
HostName <String> remembered hostname |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1230 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1231 |
DomainName <String> remembered domainname |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1232 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1233 |
SlowFork <Boolean> if set, fork and popen are avoided; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1234 |
(more or less obsolete now) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1235 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1236 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1237 |
CurrentDirectory <String> remembered currentDirectories path |
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 |
[author:] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1240 |
Claus Gittinger |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1241 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1242 |
[see also:] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1243 |
OSProcessStatus |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1244 |
Filename Date Time |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1245 |
ExternalStream FileStream PipeStream Socket |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1246 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1247 |
! |
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 |
examples |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1250 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1251 |
various queries |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1252 |
[exBegin] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1253 |
Transcript |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1254 |
showCR:'hello ' , (UnixOperatingSystem getLoginName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1255 |
[exEnd] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1256 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1257 |
[exBegin] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1258 |
UnixOperatingSystem isUNIXlike ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1259 |
Transcript showCR:'this is some UNIX-like OS' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1260 |
] ifFalse:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1261 |
Transcript showCR:'this OS is not UNIX-like' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1262 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1263 |
[exEnd] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1264 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1265 |
[exBegin] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1266 |
Transcript |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1267 |
showCR:'this machine is called ' , UnixOperatingSystem getHostName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1268 |
[exEnd] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1269 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1270 |
[exBegin] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1271 |
Transcript |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1272 |
showCR:('this machine is in the ' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1273 |
, UnixOperatingSystem getDomainName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1274 |
, ' domain') |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1275 |
[exEnd] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1276 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1277 |
[exBegin] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1278 |
Transcript |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1279 |
showCR:('this machine''s CPU is a ' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1280 |
, UnixOperatingSystem getCPUType |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1281 |
) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1282 |
[exEnd] |
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 |
[exBegin] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1285 |
Transcript showCR:'executing ls command ...'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1286 |
UnixOperatingSystem executeCommand:'ls'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1287 |
Transcript showCR:'... done.'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1288 |
[exEnd] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1289 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1290 |
locking a file |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1291 |
(should be executed on two running smalltalks - not in two threads): |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1292 |
[exBegin] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1293 |
|f| |
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 |
f := 'testFile' asFilename readWriteStream. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1296 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1297 |
10 timesRepeat:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1298 |
'about to lock ...' printCR. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1299 |
[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1300 |
UnixOperatingSystem |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1301 |
lockFD:(f fileDescriptor) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1302 |
shared:false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1303 |
blocking:false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1304 |
] whileFalse:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1305 |
'process ' print. UnixOperatingSystem getProcessId print. ' is waiting' printCR. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1306 |
Delay waitForSeconds:1 |
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 |
'LOCKED ...' printCR. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1309 |
Delay waitForSeconds:10. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1310 |
'unlock ...' printCR. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1311 |
(UnixOperatingSystem |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1312 |
unlockFD:(f fileDescriptor)) printCR. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1313 |
Delay waitForSeconds:3. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1314 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1315 |
[exBegin] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1316 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1317 |
! ! |
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 |
!UnixOperatingSystem class methodsFor:'initialization'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1320 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1321 |
initialize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1322 |
"initialize the class" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1323 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1324 |
ObjectMemory addDependent:self. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1325 |
HostName := nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1326 |
DomainName := nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1327 |
LastErrorNumber := nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1328 |
PipeFailed := false. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1329 |
SlowFork := false. |
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 |
"Modified: 13.9.1997 / 10:47:32 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1332 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1333 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1334 |
update:something with:aParameter from:changedObject |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1335 |
"catch image restart and flush some cached data" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1336 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1337 |
something == #earlyRestart ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1338 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1339 |
flush cached data |
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 |
HostName := nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1342 |
DomainName := nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1343 |
LastErrorNumber := nil. |
3540 | 1344 |
PipeFailed := false. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1345 |
SlowFork := false. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1346 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1347 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1348 |
"Modified: 22.4.1996 / 13:10:43 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1349 |
"Created: 15.6.1996 / 15:22:37 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1350 |
"Modified: 7.1.1997 / 19:36:11 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1351 |
! ! |
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 |
!UnixOperatingSystem class methodsFor:'OS signal constants'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1354 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1355 |
sigABRT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1356 |
"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
|
1357 |
(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
|
1358 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1359 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1360 |
#ifdef SIGABRT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1361 |
RETURN ( __MKSMALLINT(SIGABRT) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1362 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1363 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1364 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1365 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1366 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1367 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1368 |
sigALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1369 |
"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
|
1370 |
(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
|
1371 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1372 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1373 |
#ifdef SIGALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1374 |
RETURN ( __MKSMALLINT(SIGALRM) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1375 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1376 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1377 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1378 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1379 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1380 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1381 |
sigBREAK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1382 |
"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
|
1383 |
This is an MSDOS specific signal" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1384 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1385 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1386 |
#ifdef SIGBREAK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1387 |
RETURN ( __MKSMALLINT(SIGBREAK) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1388 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1389 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1390 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1391 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1392 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1393 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1394 |
sigBUS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1395 |
"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
|
1396 |
(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
|
1397 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1398 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1399 |
#ifdef SIGBUS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1400 |
RETURN ( __MKSMALLINT(SIGBUS) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1401 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1402 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1403 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1404 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1405 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1406 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1407 |
sigCHLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1408 |
"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
|
1409 |
(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
|
1410 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1411 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1412 |
#if defined(SIGCHLD) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1413 |
RETURN ( __MKSMALLINT(SIGCHLD) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1414 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1415 |
# if defined(SIGCLD) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1416 |
RETURN ( __MKSMALLINT(SIGCLD) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1417 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1418 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1419 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1420 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1421 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1422 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1423 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1424 |
sigCONT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1425 |
"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
|
1426 |
(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
|
1427 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1428 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1429 |
#if defined(SIGCONT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1430 |
RETURN ( __MKSMALLINT(SIGCONT) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1431 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1432 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1433 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1434 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1435 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1436 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1437 |
sigDANGER |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1438 |
"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
|
1439 |
(seems to be an AIX special)" |
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 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1442 |
#if defined(SIGDANGER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1443 |
RETURN ( __MKSMALLINT(SIGDANGER) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1444 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1445 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1446 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1447 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1448 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1449 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1450 |
sigEMT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1451 |
"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
|
1452 |
(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
|
1453 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1454 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1455 |
#ifdef SIGEMT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1456 |
RETURN ( __MKSMALLINT(SIGEMT) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1457 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1458 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1459 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1460 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1461 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1462 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1463 |
sigFP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1464 |
"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
|
1465 |
(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
|
1466 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1467 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1468 |
#ifdef SIGFPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1469 |
RETURN ( __MKSMALLINT(SIGFPE) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1470 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1471 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1472 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1473 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1474 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1475 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1476 |
sigGRANT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1477 |
"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
|
1478 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1479 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1480 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1481 |
#if defined(SIGGRANT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1482 |
RETURN ( __MKSMALLINT(SIGGRANT) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1483 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1484 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1485 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1486 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1487 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1488 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1489 |
sigHUP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1490 |
"return the signal number for SIGHUP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1491 |
(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
|
1492 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1493 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1494 |
#ifdef SIGHUP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1495 |
RETURN ( __MKSMALLINT(SIGHUP) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1496 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1497 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1498 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1499 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1500 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1501 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1502 |
sigILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1503 |
"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
|
1504 |
(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
|
1505 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1506 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1507 |
#ifdef SIGILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1508 |
RETURN ( __MKSMALLINT(SIGILL) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1509 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1510 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1511 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1512 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1513 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1514 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1515 |
sigINT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1516 |
"return the signal number for SIGINT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1517 |
(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
|
1518 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1519 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1520 |
#ifdef SIGINT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1521 |
RETURN ( __MKSMALLINT(SIGINT) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1522 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1523 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1524 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1525 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1526 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1527 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1528 |
sigIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1529 |
"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
|
1530 |
(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
|
1531 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1532 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1533 |
#if defined(SIGIO) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1534 |
RETURN ( __MKSMALLINT(SIGIO) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1535 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1536 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1537 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1538 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1539 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1540 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1541 |
sigIOT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1542 |
"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
|
1543 |
(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
|
1544 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1545 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1546 |
#ifdef SIGIOT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1547 |
RETURN ( __MKSMALLINT(SIGIOT) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1548 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1549 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1550 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1551 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1552 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1553 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1554 |
sigKILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1555 |
"return the signal number for SIGKILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1556 |
(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
|
1557 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1558 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1559 |
#ifdef SIGKILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1560 |
RETURN ( __MKSMALLINT(SIGKILL) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1561 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1562 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1563 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1564 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1565 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1566 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1567 |
sigLOST |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1568 |
"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
|
1569 |
(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
|
1570 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1571 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1572 |
#if defined(SIGLOST) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1573 |
RETURN ( __MKSMALLINT(SIGLOST) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1574 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1575 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1576 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1577 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1578 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1579 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1580 |
sigMIGRATE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1581 |
"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
|
1582 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1583 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1584 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1585 |
#if defined(SIGMIGRATE) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1586 |
RETURN ( __MKSMALLINT(SIGMIGRATE) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1587 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1588 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1589 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1590 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1591 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1592 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1593 |
sigMSG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1594 |
"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
|
1595 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1596 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1597 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1598 |
#if defined(SIGMSG) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1599 |
RETURN ( __MKSMALLINT(SIGMSG) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1600 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1601 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1602 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1603 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1604 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1605 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1606 |
sigPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1607 |
"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
|
1608 |
(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
|
1609 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1610 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1611 |
#ifdef SIGPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1612 |
RETURN ( __MKSMALLINT(SIGPIPE) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1613 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1614 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1615 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1616 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1617 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1618 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1619 |
sigPOLL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1620 |
"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
|
1621 |
(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
|
1622 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1623 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1624 |
#if defined(SIGPOLL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1625 |
RETURN ( __MKSMALLINT(SIGPOLL) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1626 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1627 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1628 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1629 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1630 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1631 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1632 |
sigPRE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1633 |
"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
|
1634 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1635 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1636 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1637 |
#if defined(SIGPRE) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1638 |
RETURN ( __MKSMALLINT(SIGPRE) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1639 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1640 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1641 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1642 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1643 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1644 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1645 |
sigPROF |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1646 |
"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
|
1647 |
(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
|
1648 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1649 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1650 |
#if defined(SIGPROF) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1651 |
RETURN ( __MKSMALLINT(SIGPROF) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1652 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1653 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1654 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1655 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1656 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1657 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1658 |
sigPWR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1659 |
"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
|
1660 |
(not available on all systems)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1661 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1662 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1663 |
#if defined(SIGPWR) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1664 |
RETURN ( __MKSMALLINT(SIGPWR) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1665 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1666 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1667 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1668 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1669 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1670 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1671 |
sigQUIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1672 |
"return the signal number for SIGQUIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1673 |
(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
|
1674 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1675 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1676 |
#ifdef SIGQUIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1677 |
RETURN ( __MKSMALLINT(SIGQUIT) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1678 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1679 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1680 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1681 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1682 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1683 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1684 |
sigRETRACT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1685 |
"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
|
1686 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1687 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1688 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1689 |
#if defined(SIGRETRACT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1690 |
RETURN ( __MKSMALLINT(SIGRETRACT) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1691 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1692 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1693 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1694 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1695 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1696 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1697 |
sigSAK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1698 |
"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
|
1699 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1700 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1701 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1702 |
#if defined(SIGSAK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1703 |
RETURN ( __MKSMALLINT(SIGSAK) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1704 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1705 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1706 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1707 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1708 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1709 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1710 |
sigSEGV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1711 |
"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
|
1712 |
(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
|
1713 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1714 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1715 |
#ifdef SIGSEGV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1716 |
RETURN ( __MKSMALLINT(SIGSEGV) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1717 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1718 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1719 |
#endif |
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 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1722 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1723 |
sigSOUND |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1724 |
"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
|
1725 |
(seems to be an AIX special)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1726 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1727 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1728 |
#if defined(SIGSOUND) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1729 |
RETURN ( __MKSMALLINT(SIGSOUND) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1730 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1731 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1732 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1733 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1734 |
! |
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 |
sigSTOP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1737 |
"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
|
1738 |
(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
|
1739 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1740 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1741 |
#if defined(SIGSTOP) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1742 |
RETURN ( __MKSMALLINT(SIGSTOP) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1743 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1744 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1745 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1746 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1747 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1748 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1749 |
sigSYS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1750 |
"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
|
1751 |
(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
|
1752 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1753 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1754 |
#ifdef SIGSYS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1755 |
RETURN ( __MKSMALLINT(SIGSYS) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1756 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1757 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1758 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1759 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1760 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1761 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1762 |
sigTERM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1763 |
"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
|
1764 |
(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
|
1765 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1766 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1767 |
#ifdef SIGTERM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1768 |
RETURN ( __MKSMALLINT(SIGTERM) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1769 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1770 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1771 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1772 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1773 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1774 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1775 |
sigTRAP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1776 |
"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
|
1777 |
(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
|
1778 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1779 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1780 |
#ifdef SIGTRAP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1781 |
RETURN ( __MKSMALLINT(SIGTRAP) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1782 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1783 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1784 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1785 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1786 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1787 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1788 |
sigTSTP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1789 |
"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
|
1790 |
(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
|
1791 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1792 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1793 |
#if defined(SIGTSTP) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1794 |
RETURN ( __MKSMALLINT(SIGTSTP) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1795 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1796 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1797 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1798 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1799 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1800 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1801 |
sigTTIN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1802 |
"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
|
1803 |
(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
|
1804 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1805 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1806 |
#if defined(SIGTTIN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1807 |
RETURN ( __MKSMALLINT(SIGTTIN) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1808 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1809 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1810 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1811 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1812 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1813 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1814 |
sigTTOU |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1815 |
"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
|
1816 |
(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
|
1817 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1818 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1819 |
#if defined(SIGTTOU) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1820 |
RETURN ( __MKSMALLINT(SIGTTOU) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1821 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1822 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1823 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1824 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1825 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1826 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1827 |
sigURG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1828 |
"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
|
1829 |
(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
|
1830 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1831 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1832 |
#if defined(SIGURG) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1833 |
RETURN ( __MKSMALLINT(SIGURG) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1834 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1835 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1836 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1837 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1838 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1839 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1840 |
sigUSR1 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1841 |
"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
|
1842 |
(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
|
1843 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1844 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1845 |
#if defined(SIGUSR1) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1846 |
RETURN ( __MKSMALLINT(SIGUSR1) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1847 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1848 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1849 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1850 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1851 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1852 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1853 |
sigUSR2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1854 |
"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
|
1855 |
(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
|
1856 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1857 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1858 |
#if defined(SIGUSR2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1859 |
RETURN ( __MKSMALLINT(SIGUSR2) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1860 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1861 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1862 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1863 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1864 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1865 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1866 |
sigVTALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1867 |
"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
|
1868 |
(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
|
1869 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1870 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1871 |
#if defined(SIGVTALRM) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1872 |
RETURN ( __MKSMALLINT(SIGVTALRM) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1873 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1874 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1875 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1876 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1877 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1878 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1879 |
sigWINCH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1880 |
"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
|
1881 |
(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
|
1882 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1883 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1884 |
#if defined(SIGWINCH) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1885 |
RETURN ( __MKSMALLINT(SIGWINCH) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1886 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1887 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1888 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1889 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1890 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1891 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1892 |
sigXCPU |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1893 |
"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
|
1894 |
(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
|
1895 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1896 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1897 |
#if defined(SIGXCPU) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1898 |
RETURN ( __MKSMALLINT(SIGXCPU) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1899 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1900 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1901 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1902 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1903 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1904 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1905 |
sigXFSZ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1906 |
"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
|
1907 |
(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
|
1908 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1909 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1910 |
#if defined(SIGXFSZ) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1911 |
RETURN ( __MKSMALLINT(SIGXFSZ) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1912 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1913 |
RETURN ( __MKSMALLINT(0) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1914 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1915 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1916 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1917 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1918 |
!UnixOperatingSystem class methodsFor:'error messages'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1919 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1920 |
currentErrorNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1921 |
"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
|
1922 |
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
|
1923 |
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
|
1924 |
request to the OS. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1925 |
Use lastErrorNumber - currentErrorNumber is invalidated by |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1926 |
many, many internal calls." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1927 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1928 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1929 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1930 |
RETURN ( __MKSMALLINT(errno) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1931 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1932 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1933 |
UnixOperatingSystem currentErrorNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1934 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1935 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1936 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1937 |
errorNumberFor:aSymbol |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1938 |
"given a symbolic error, return the numeric; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1939 |
(i.e. errorNumberFor:#EBADF returns EBADF's value). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1940 |
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
|
1941 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1942 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1943 |
OBJ sym = aSymbol; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1944 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1945 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1946 |
* POSIX errnos - these should be defined |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1947 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1948 |
#ifdef EPERM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1949 |
if (sym == @symbol(EPERM)) { |
3540 | 1950 |
RETURN ( __MKSMALLINT(EPERM) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1951 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1952 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1953 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1954 |
#ifdef ENOENT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1955 |
if (sym == @symbol(ENOENT)) { |
3540 | 1956 |
RETURN ( __MKSMALLINT(ENOENT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1957 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1958 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1959 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1960 |
#ifdef ESRCH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1961 |
if (sym == @symbol(ESRCH)) { |
3540 | 1962 |
RETURN ( __MKSMALLINT(ESRCH) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1963 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1964 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1965 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1966 |
#ifdef EINTR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1967 |
if (sym == @symbol(EINTR)) { |
3540 | 1968 |
RETURN ( __MKSMALLINT(EINTR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1969 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1970 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1971 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1972 |
#ifdef EIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1973 |
if (sym == @symbol(EIO)) { |
3540 | 1974 |
RETURN ( __MKSMALLINT(EIO) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1975 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1976 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1977 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1978 |
#ifdef ENXIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1979 |
if (sym == @symbol(ENXIO)) { |
3540 | 1980 |
RETURN ( __MKSMALLINT(ENXIO) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1981 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1982 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1983 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1984 |
#ifdef E2BIG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1985 |
if (sym == @symbol(E2BIG)) { |
3540 | 1986 |
RETURN ( __MKSMALLINT(E2BIG) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1987 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1988 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1989 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1990 |
#ifdef ENOEXEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1991 |
if (sym == @symbol(ENOEXEC)) { |
3540 | 1992 |
RETURN ( __MKSMALLINT(ENOEXEC) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1993 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1994 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1995 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1996 |
#ifdef EBADF |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1997 |
if (sym == @symbol(EBADF)) { |
3540 | 1998 |
RETURN ( __MKSMALLINT(EBADF) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
1999 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2000 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2001 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2002 |
#ifdef ECHILD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2003 |
if (sym == @symbol(ECHILD)) { |
3540 | 2004 |
RETURN ( __MKSMALLINT(ECHILD) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2005 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2006 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2007 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2008 |
#if defined(EAGAIN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2009 |
if (sym == @symbol(EAGAIN)) { |
3540 | 2010 |
RETURN ( __MKSMALLINT(EAGAIN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2011 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2012 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2013 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2014 |
#ifdef ENOMEM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2015 |
if (sym == @symbol(ENOMEM)) { |
3540 | 2016 |
RETURN ( __MKSMALLINT(ENOMEM) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2017 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2018 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2019 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2020 |
#ifdef EACCES |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2021 |
if (sym == @symbol(EACCES)) { |
3540 | 2022 |
RETURN ( __MKSMALLINT(EACCES) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2023 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2024 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2025 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2026 |
#ifdef EFAULT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2027 |
if (sym == @symbol(EFAULT)) { |
3540 | 2028 |
RETURN ( __MKSMALLINT(EFAULT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2029 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2030 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2031 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2032 |
#ifdef EBUSY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2033 |
if (sym == @symbol(EBUSY)) { |
3540 | 2034 |
RETURN ( __MKSMALLINT(EBUSY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2035 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2036 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2037 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2038 |
#ifdef EXDEV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2039 |
if (sym == @symbol(EXDEV)) { |
3540 | 2040 |
RETURN ( __MKSMALLINT(EXDEV) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2041 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2042 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2043 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2044 |
#ifdef ENODEV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2045 |
if (sym == @symbol(ENODEV)) { |
3540 | 2046 |
RETURN ( __MKSMALLINT(ENODEV) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2047 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2048 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2049 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2050 |
#ifdef ENOTDIR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2051 |
if (sym == @symbol(ENOTDIR)) { |
3540 | 2052 |
RETURN ( __MKSMALLINT(ENOTDIR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2053 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2054 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2055 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2056 |
#ifdef EISDIR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2057 |
if (sym == @symbol(EISDIR)) { |
3540 | 2058 |
RETURN ( __MKSMALLINT(EISDIR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2059 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2060 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2061 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2062 |
#ifdef EINVAL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2063 |
if (sym == @symbol(EINVAL)) { |
3540 | 2064 |
RETURN ( __MKSMALLINT(EINVAL) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2065 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2066 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2067 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2068 |
#ifdef ENFILE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2069 |
if (sym == @symbol(ENFILE)) { |
3540 | 2070 |
RETURN ( __MKSMALLINT(ENFILE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2071 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2072 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2073 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2074 |
#ifdef EMFILE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2075 |
if (sym == @symbol(EMFILE)) { |
3540 | 2076 |
RETURN ( __MKSMALLINT(EMFILE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2077 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2078 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2079 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2080 |
#ifdef ENOTTY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2081 |
if (sym == @symbol(ENOTTY)) { |
3540 | 2082 |
RETURN ( __MKSMALLINT(ENOTTY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2083 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2084 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2085 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2086 |
#ifdef EFBIG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2087 |
if (sym == @symbol(EFBIG)) { |
3540 | 2088 |
RETURN ( __MKSMALLINT(EFBIG) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2089 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2090 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2091 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2092 |
#ifdef ENOSPC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2093 |
if (sym == @symbol(ENOSPC)) { |
3540 | 2094 |
RETURN ( __MKSMALLINT(ENOSPC) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2095 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2096 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2097 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2098 |
#ifdef ESPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2099 |
if (sym == @symbol(ESPIPE)) { |
3540 | 2100 |
RETURN ( __MKSMALLINT(ESPIPE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2101 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2102 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2103 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2104 |
#ifdef EROFS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2105 |
if (sym == @symbol(EROFS)) { |
3540 | 2106 |
RETURN ( __MKSMALLINT(EROFS) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2107 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2108 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2109 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2110 |
#ifdef EMLINK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2111 |
if (sym == @symbol(EMLINK)) { |
3540 | 2112 |
RETURN ( __MKSMALLINT(EMLINK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2113 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2114 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2115 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2116 |
#ifdef EPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2117 |
if (sym == @symbol(EPIPE)) { |
3540 | 2118 |
RETURN ( __MKSMALLINT(EPIPE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2119 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2120 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2121 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2122 |
#ifdef EDOM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2123 |
if (sym == @symbol(EDOM)) { |
3540 | 2124 |
RETURN ( __MKSMALLINT(EDOM) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2125 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2126 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2127 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2128 |
#ifdef ERANGE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2129 |
if (sym == @symbol(ERANGE)) { |
3540 | 2130 |
RETURN ( __MKSMALLINT(ERANGE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2131 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2132 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2133 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2134 |
#ifdef EDEADLK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2135 |
if (sym == @symbol(EDEADLK)) { |
3540 | 2136 |
RETURN ( __MKSMALLINT(EDEADLK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2137 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2138 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2139 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2140 |
#ifdef ENAMETOOLONG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2141 |
if (sym == @symbol(ENAMETOOLONG)) { |
3540 | 2142 |
RETURN ( __MKSMALLINT(ENAMETOOLONG) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2143 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2144 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2145 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2146 |
#ifdef ENOLCK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2147 |
if (sym == @symbol(ENOLCK)) { |
3540 | 2148 |
RETURN ( __MKSMALLINT(ENOLCK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2149 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2150 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2151 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2152 |
#ifdef ENOSYS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2153 |
if (sym == @symbol(ENOSYS)) { |
3540 | 2154 |
RETURN ( __MKSMALLINT(ENOSYS) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2155 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2156 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2157 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2158 |
#ifdef ENOTEMPTY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2159 |
if (sym == @symbol(ENOTEMPTY)) { |
3540 | 2160 |
RETURN ( __MKSMALLINT(ENOTEMPTY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2161 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2162 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2163 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2164 |
#ifdef EEXIST |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2165 |
if (sym == @symbol(EEXIST)) { |
3540 | 2166 |
RETURN ( __MKSMALLINT(EEXIST) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2167 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2168 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2169 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2170 |
#ifdef EILSEQ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2171 |
if (sym == @symbol(EILSEQ)) { |
3540 | 2172 |
RETURN ( __MKSMALLINT(EILSEQ) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2173 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2174 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2175 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2176 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2177 |
* XPG3 errnos - defined on most systems |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2178 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2179 |
#ifdef ENOTBLK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2180 |
if (sym == @symbol(ENOTBLK)) { |
3540 | 2181 |
RETURN ( __MKSMALLINT(ENOTBLK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2182 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2183 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2184 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2185 |
#ifdef ETXTBSY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2186 |
if (sym == @symbol(ETXTBSY)) { |
3540 | 2187 |
RETURN ( __MKSMALLINT(ETXTBSY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2188 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2189 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2190 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2191 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2192 |
* some others |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2193 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2194 |
#ifdef EWOULDBLOCK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2195 |
if (sym == @symbol(EWOULDBLOCK)) { |
3540 | 2196 |
RETURN ( __MKSMALLINT(EWOULDBLOCK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2197 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2198 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2199 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2200 |
#ifdef ENOMSG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2201 |
if (sym == @symbol(ENOMSG)) { |
3540 | 2202 |
RETURN ( __MKSMALLINT(ENOMSG) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2203 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2204 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2205 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2206 |
#ifdef ELOOP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2207 |
if (sym == @symbol(ELOOP)) { |
3540 | 2208 |
RETURN ( __MKSMALLINT(ELOOP) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2209 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2210 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2211 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2212 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2213 |
* some stream errors |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2214 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2215 |
#ifdef ETIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2216 |
if (sym == @symbol(ETIME)) { |
3540 | 2217 |
RETURN ( __MKSMALLINT(ETIME) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2218 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2219 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2220 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2221 |
#ifdef ENOSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2222 |
if (sym == @symbol(ENOSR)) { |
3540 | 2223 |
RETURN ( __MKSMALLINT(ENOSR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2224 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2225 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2226 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2227 |
#ifdef ENOSTR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2228 |
if (sym == @symbol(ENOSTR)) { |
3540 | 2229 |
RETURN ( __MKSMALLINT(ENOSTR) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2230 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2231 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2232 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2233 |
#ifdef ECOMM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2234 |
if (sym == @symbol(ECOMM)) { |
3540 | 2235 |
RETURN ( __MKSMALLINT(ECOMM) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2236 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2237 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2238 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2239 |
#ifdef EPROTO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2240 |
if (sym == @symbol(EPROTO)) { |
3540 | 2241 |
RETURN ( __MKSMALLINT(EPROTO) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2242 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2243 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2244 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2245 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2246 |
* nfs errors |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2247 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2248 |
#ifdef ESTALE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2249 |
if (sym == @symbol(ESTALE)) { |
3540 | 2250 |
RETURN ( __MKSMALLINT(ESTALE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2251 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2252 |
#endif |
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 |
#ifdef EREMOTE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2255 |
if (sym == @symbol(EREMOTE)) { |
3540 | 2256 |
RETURN ( __MKSMALLINT(EREMOTE) ); |
3496
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 |
#endif |
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 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2261 |
* some networking errors |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2262 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2263 |
#ifdef EINPROGRESS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2264 |
if (sym == @symbol(EINPROGRESS)) { |
3540 | 2265 |
RETURN ( __MKSMALLINT(EINPROGRESS) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2266 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2267 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2268 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2269 |
#ifdef EALREADY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2270 |
if (sym == @symbol(EALREADY)) { |
3540 | 2271 |
RETURN ( __MKSMALLINT(EALREADY) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2272 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2273 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2274 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2275 |
#ifdef ENOTSOCK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2276 |
if (sym == @symbol(ENOTSOCK)) { |
3540 | 2277 |
RETURN ( __MKSMALLINT(ENOTSOCK) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2278 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2279 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2280 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2281 |
#ifdef EDESTADDRREQ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2282 |
if (sym == @symbol(EDESTADDRREQ)) { |
3540 | 2283 |
RETURN ( __MKSMALLINT(EDESTADDRREQ) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2284 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2285 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2286 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2287 |
#ifdef EMSGSIZE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2288 |
if (sym == @symbol(EMSGSIZE)) { |
3540 | 2289 |
RETURN ( __MKSMALLINT(EMSGSIZE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2290 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2291 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2292 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2293 |
#ifdef EPROTOTYPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2294 |
if (sym == @symbol(EPROTOTYPE)) { |
3540 | 2295 |
RETURN ( __MKSMALLINT(EPROTOTYPE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2296 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2297 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2298 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2299 |
#ifdef ENOPROTOOPT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2300 |
if (sym == @symbol(ENOPROTOOPT)) { |
3540 | 2301 |
RETURN ( __MKSMALLINT(ENOPROTOOPT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2302 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2303 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2304 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2305 |
#ifdef EPROTONOSUPPORT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2306 |
if (sym == @symbol(EPROTONOSUPPORT)) { |
3540 | 2307 |
RETURN ( __MKSMALLINT(EPROTONOSUPPORT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2308 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2309 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2310 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2311 |
#ifdef ESOCKTNOSUPPORT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2312 |
if (sym == @symbol(ESOCKTNOSUPPORT)) { |
3540 | 2313 |
RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2314 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2315 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2316 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2317 |
#ifdef EOPNOTSUPP |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2318 |
if (sym == @symbol(EOPNOTSUPP)) { |
3540 | 2319 |
RETURN ( __MKSMALLINT(EOPNOTSUPP) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2320 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2321 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2322 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2323 |
#ifdef EPFNOSUPPORT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2324 |
if (sym == @symbol(EPFNOSUPPORT)) { |
3540 | 2325 |
RETURN ( __MKSMALLINT(EPFNOSUPPORT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2326 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2327 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2328 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2329 |
#ifdef EAFNOSUPPORT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2330 |
if (sym == @symbol(EAFNOSUPPORT)) { |
3540 | 2331 |
RETURN ( __MKSMALLINT(EAFNOSUPPORT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2332 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2333 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2334 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2335 |
#ifdef EADDRINUSE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2336 |
if (sym == @symbol(EADDRINUSE)) { |
3540 | 2337 |
RETURN ( __MKSMALLINT(EADDRINUSE) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2338 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2339 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2340 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2341 |
#ifdef EADDRNOTAVAIL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2342 |
if (sym == @symbol(EADDRNOTAVAIL)) { |
3540 | 2343 |
RETURN ( __MKSMALLINT(EADDRNOTAVAIL) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2344 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2345 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2346 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2347 |
#ifdef ETIMEDOUT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2348 |
if (sym == @symbol(ETIMEDOUT)) { |
3540 | 2349 |
RETURN ( __MKSMALLINT(ETIMEDOUT) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2350 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2351 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2352 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2353 |
#ifdef ECONNREFUSED |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2354 |
if (sym == @symbol(ECONNREFUSED)) { |
3540 | 2355 |
RETURN ( __MKSMALLINT(ECONNREFUSED) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2356 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2357 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2358 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2359 |
#ifdef ENETDOWN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2360 |
if (sym == @symbol(ENETDOWN)) { |
3540 | 2361 |
RETURN ( __MKSMALLINT(ENETDOWN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2362 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2363 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2364 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2365 |
#ifdef ENETUNREACH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2366 |
if (sym == @symbol(ENETUNREACH)) { |
3540 | 2367 |
RETURN ( __MKSMALLINT(ENETUNREACH) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2368 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2369 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2370 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2371 |
#ifdef ENETRESET |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2372 |
if (sym == @symbol(ENETRESET)) { |
3540 | 2373 |
RETURN ( __MKSMALLINT(ENETRESET) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2374 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2375 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2376 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2377 |
#ifdef ECONNABORTED |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2378 |
if (sym == @symbol(ECONNABORTED)) { |
3540 | 2379 |
RETURN ( __MKSMALLINT(ECONNABORTED) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2380 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2381 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2382 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2383 |
#ifdef ECONNRESET |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2384 |
if (sym == @symbol(ECONNRESET)) { |
3540 | 2385 |
RETURN ( __MKSMALLINT(ECONNRESET) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2386 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2387 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2388 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2389 |
#ifdef EISCONN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2390 |
if (sym == @symbol(EISCONN)) { |
3540 | 2391 |
RETURN ( __MKSMALLINT(EISCONN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2392 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2393 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2394 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2395 |
#ifdef ENOTCONN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2396 |
if (sym == @symbol(ENOTCONN)) { |
3540 | 2397 |
RETURN ( __MKSMALLINT(ENOTCONN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2398 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2399 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2400 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2401 |
#ifdef ESHUTDOWN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2402 |
if (sym == @symbol(ESHUTDOWN)) { |
3540 | 2403 |
RETURN ( __MKSMALLINT(ESHUTDOWN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2404 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2405 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2406 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2407 |
#ifdef EHOSTDOWN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2408 |
if (sym == @symbol(EHOSTDOWN)) { |
3540 | 2409 |
RETURN ( __MKSMALLINT(EHOSTDOWN) ); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2410 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2411 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2412 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2413 |
#ifdef EHOSTUNREACH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2414 |
if (sym == @symbol(EHOSTUNREACH)) { |
3540 | 2415 |
RETURN ( __MKSMALLINT(EHOSTUNREACH) ); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2416 |
} |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2417 |
#endif |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2418 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2419 |
^ -1 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2420 |
! |
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 |
errorSymbolAndTextForNumber:errNr |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2423 |
"return an array consisting of symbol & message string from a unix errorNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2424 |
(as returned by a system call). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2425 |
The returned message is in english (as found in /usr/include/errno.h) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2426 |
and should be replaced by a resource lookup before being presented to the user." |
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 |
|sym text| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2429 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2430 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2431 |
/* claus: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2432 |
* I made this primitive code, since errnos are not |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2433 |
* standard across unixes |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2434 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2435 |
char *msg = "unknown error"; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2436 |
char buffer[128]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2437 |
OBJ eno = errNr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2438 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2439 |
if (__isSmallInteger(eno)) { |
3540 | 2440 |
switch (__intVal(eno)) { |
2441 |
/* |
|
2442 |
* POSIX errnos - these should be defined |
|
2443 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2444 |
#ifdef EPERM |
3540 | 2445 |
case EPERM: |
2446 |
msg = "Operation not permitted"; |
|
2447 |
sym = @symbol(EPERM); |
|
2448 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2449 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2450 |
#ifdef ENOENT |
3540 | 2451 |
case ENOENT: |
2452 |
msg = "No such file or directory"; |
|
2453 |
sym = @symbol(ENOENT); |
|
2454 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2455 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2456 |
#ifdef ESRCH |
3540 | 2457 |
case ESRCH: |
2458 |
msg = "No such process"; |
|
2459 |
sym = @symbol(ESRCH); |
|
2460 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2461 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2462 |
#ifdef EINTR |
3540 | 2463 |
case EINTR: |
2464 |
msg = "Interrupted system call"; |
|
2465 |
sym = @symbol(EINTR); |
|
2466 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2467 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2468 |
#ifdef EIO |
3540 | 2469 |
case EIO: |
2470 |
msg = "I/O error"; |
|
2471 |
sym = @symbol(EIO); |
|
2472 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2473 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2474 |
#ifdef ENXIO |
3540 | 2475 |
case ENXIO: |
2476 |
msg = "No such device or address"; |
|
2477 |
sym = @symbol(ENXIO); |
|
2478 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2479 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2480 |
#ifdef E2BIG |
3540 | 2481 |
case E2BIG: |
2482 |
msg = "Arg list too long"; |
|
2483 |
sym = @symbol(E2BIG); |
|
2484 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2485 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2486 |
#ifdef ENOEXEC |
3540 | 2487 |
case ENOEXEC: |
2488 |
msg = "Exec format error"; |
|
2489 |
sym = @symbol(ENOEXEC); |
|
2490 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2491 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2492 |
#ifdef EBADF |
3540 | 2493 |
case EBADF: |
2494 |
msg = "Bad file number"; |
|
2495 |
sym = @symbol(EBADF); |
|
2496 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2497 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2498 |
#ifdef ECHILD |
3540 | 2499 |
case ECHILD: |
2500 |
msg = "No child processes"; |
|
2501 |
sym = @symbol(ECHILD); |
|
2502 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2503 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2504 |
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN) |
3540 | 2505 |
case EAGAIN: |
2506 |
msg = "Try again"; |
|
2507 |
sym = @symbol(EAGAIN); |
|
2508 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2509 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2510 |
#ifdef ENOMEM |
3540 | 2511 |
case ENOMEM: |
2512 |
msg = "Out of memory"; |
|
2513 |
sym = @symbol(ENOMEM); |
|
2514 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2515 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2516 |
#ifdef EACCES |
3540 | 2517 |
case EACCES: |
2518 |
msg = "Permission denied"; |
|
2519 |
sym = @symbol(EACCES); |
|
2520 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2521 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2522 |
#ifdef EFAULT |
3540 | 2523 |
case EFAULT: |
2524 |
msg = "Bad address"; |
|
2525 |
sym = @symbol(EFAULT); |
|
2526 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2527 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2528 |
#ifdef EBUSY |
3540 | 2529 |
case EBUSY: |
2530 |
msg = "Device or resource busy"; |
|
2531 |
sym = @symbol(EBUSY); |
|
2532 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2533 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2534 |
#ifdef EEXIST |
3540 | 2535 |
case EEXIST: |
2536 |
msg = "File exists"; |
|
2537 |
sym = @symbol(EEXIST); |
|
2538 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2539 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2540 |
#ifdef EXDEV |
3540 | 2541 |
case EXDEV: |
2542 |
msg = "Cross-device link"; |
|
2543 |
sym = @symbol(EXDEV); |
|
2544 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2545 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2546 |
#ifdef ENODEV |
3540 | 2547 |
case ENODEV: |
2548 |
msg = "No such device"; |
|
2549 |
sym = @symbol(ENODEV); |
|
2550 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2551 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2552 |
#ifdef ENOTDIR |
3540 | 2553 |
case ENOTDIR: |
2554 |
msg = "Not a directory"; |
|
2555 |
sym = @symbol(ENOTDIR); |
|
2556 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2557 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2558 |
#ifdef EISDIR |
3540 | 2559 |
case EISDIR: |
2560 |
msg = "Is a directory"; |
|
2561 |
sym = @symbol(EISDIR); |
|
2562 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2563 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2564 |
#ifdef EINVAL |
3540 | 2565 |
case EINVAL: |
2566 |
msg = "Invalid argument"; |
|
2567 |
sym = @symbol(EINVAL); |
|
2568 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2569 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2570 |
#ifdef ENFILE |
3540 | 2571 |
case ENFILE: |
2572 |
msg = "File table overflow"; |
|
2573 |
sym = @symbol(ENFILE); |
|
2574 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2575 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2576 |
#ifdef EMFILE |
3540 | 2577 |
case EMFILE: |
2578 |
msg = "Too many open files"; |
|
2579 |
sym = @symbol(EMFILE); |
|
2580 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2581 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2582 |
#ifdef ENOTTY |
3540 | 2583 |
case ENOTTY: |
2584 |
msg = "Not a typewriter"; |
|
2585 |
sym = @symbol(ENOTTY); |
|
2586 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2587 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2588 |
#ifdef EFBIG |
3540 | 2589 |
case EFBIG: |
2590 |
msg = "File too large"; |
|
2591 |
sym = @symbol(EFBIG); |
|
2592 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2593 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2594 |
#ifdef ENOSPC |
3540 | 2595 |
case ENOSPC: |
2596 |
msg = "No space left on device"; |
|
2597 |
sym = @symbol(ENOSPC); |
|
2598 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2599 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2600 |
#ifdef ESPIPE |
3540 | 2601 |
case ESPIPE: |
2602 |
msg = "Illegal seek"; |
|
2603 |
sym = @symbol(ESPIPE); |
|
2604 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2605 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2606 |
#ifdef EROFS |
3540 | 2607 |
case EROFS: |
2608 |
msg = "Read-only file system"; |
|
2609 |
sym = @symbol(EROFS); |
|
2610 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2611 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2612 |
#ifdef EMLINK |
3540 | 2613 |
case EMLINK: |
2614 |
msg = "Too many links"; |
|
2615 |
sym = @symbol(EMLINK); |
|
2616 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2617 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2618 |
#ifdef EPIPE |
3540 | 2619 |
case EPIPE: |
2620 |
msg = "Broken pipe"; |
|
2621 |
sym = @symbol(EPIPE); |
|
2622 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2623 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2624 |
#ifdef EDOM |
3540 | 2625 |
case EDOM: |
2626 |
msg = "Math argument out of domain"; |
|
2627 |
sym = @symbol(EDOM); |
|
2628 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2629 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2630 |
#ifdef ERANGE |
3540 | 2631 |
case ERANGE: |
2632 |
msg = "Math result not representable"; |
|
2633 |
sym = @symbol(ERANGE); |
|
2634 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2635 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2636 |
#ifdef EDEADLK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2637 |
# if EDEADLK != EWOULDBLOCK |
3540 | 2638 |
case EDEADLK: |
2639 |
msg = "Resource deadlock would occur"; |
|
2640 |
sym = @symbol(EDEADLK); |
|
2641 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2642 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2643 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2644 |
#ifdef ENAMETOOLONG |
3540 | 2645 |
case ENAMETOOLONG: |
2646 |
msg = "File name too long"; |
|
2647 |
sym = @symbol(ENAMETOOLONG); |
|
2648 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2649 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2650 |
#ifdef ENOLCK |
3540 | 2651 |
case ENOLCK: |
2652 |
msg = "No record locks available"; |
|
2653 |
sym = @symbol(ENOLCK); |
|
2654 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2655 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2656 |
#ifdef ENOSYS |
3540 | 2657 |
case ENOSYS: |
2658 |
msg = "Function not implemented"; |
|
2659 |
sym = @symbol(ENOSYS); |
|
2660 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2661 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2662 |
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST) |
3540 | 2663 |
case ENOTEMPTY: |
2664 |
msg = "Directory not empty"; |
|
2665 |
sym = @symbol(ENOTEMPTY); |
|
2666 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2667 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2668 |
#ifdef EILSEQ |
3540 | 2669 |
case EILSEQ: |
2670 |
msg = "Illegal byte sequence"; |
|
2671 |
sym = @symbol(EILSEQ); |
|
2672 |
break; |
|
2673 |
#endif |
|
2674 |
/* |
|
2675 |
* XPG3 errnos - defined on most systems |
|
2676 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2677 |
#ifdef ENOTBLK |
3540 | 2678 |
case ENOTBLK: |
2679 |
msg = "Block device required"; |
|
2680 |
sym = @symbol(ENOTBLK); |
|
2681 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2682 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2683 |
#ifdef ETXTBSY |
3540 | 2684 |
case ETXTBSY: |
2685 |
msg = "Text file busy"; |
|
2686 |
sym = @symbol(ETXTBSY); |
|
2687 |
break; |
|
2688 |
#endif |
|
2689 |
/* |
|
2690 |
* some others |
|
2691 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2692 |
#ifdef EWOULDBLOCK |
3540 | 2693 |
case EWOULDBLOCK: |
2694 |
msg = "Operation would block"; |
|
2695 |
sym = @symbol(EWOULDBLOCK); |
|
2696 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2697 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2698 |
#ifdef ENOMSG |
3540 | 2699 |
case ENOMSG: |
2700 |
msg = "No message of desired type"; |
|
2701 |
sym = @symbol(ENOMSG); |
|
2702 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2703 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2704 |
#ifdef ELOOP |
3540 | 2705 |
case ELOOP: |
2706 |
msg = "Too many levels of symbolic links"; |
|
2707 |
sym = @symbol(ELOOP); |
|
2708 |
break; |
|
2709 |
#endif |
|
2710 |
||
2711 |
/* |
|
2712 |
* some stream errors |
|
2713 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2714 |
#ifdef ETIME |
3540 | 2715 |
case ETIME: |
2716 |
msg = "Timer expired"; |
|
2717 |
sym = @symbol(ETIME); |
|
2718 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2719 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2720 |
#ifdef ENOSR |
3540 | 2721 |
case ENOSR: |
2722 |
msg = "Out of streams resources"; |
|
2723 |
sym = @symbol(ENOSR); |
|
2724 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2725 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2726 |
#ifdef ENOSTR |
3540 | 2727 |
case ENOSTR: |
2728 |
msg = "Device not a stream"; |
|
2729 |
sym = @symbol(ENOSTR); |
|
2730 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2731 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2732 |
#ifdef ECOMM |
3540 | 2733 |
case ECOMM: |
2734 |
msg = "Communication error on send"; |
|
2735 |
sym = @symbol(ECOMM); |
|
2736 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2737 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2738 |
#ifdef EPROTO |
3540 | 2739 |
case EPROTO: |
2740 |
msg = "Protocol error"; |
|
2741 |
sym = @symbol(EPROTO); |
|
2742 |
break; |
|
2743 |
#endif |
|
2744 |
/* |
|
2745 |
* nfs errors |
|
2746 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2747 |
#ifdef ESTALE |
3540 | 2748 |
case ESTALE: |
2749 |
msg = "Stale NFS file handle"; |
|
2750 |
sym = @symbol(ESTALE); |
|
2751 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2752 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2753 |
#ifdef EREMOTE |
3540 | 2754 |
case EREMOTE: |
2755 |
msg = "Too many levels of remote in path"; |
|
2756 |
sym = @symbol(EREMOTE); |
|
2757 |
break; |
|
2758 |
#endif |
|
2759 |
/* |
|
2760 |
* some networking errors |
|
2761 |
*/ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2762 |
#ifdef EINPROGRESS |
3540 | 2763 |
case EINPROGRESS: |
2764 |
msg = "Operation now in progress"; |
|
2765 |
sym = @symbol(EINPROGRESS); |
|
2766 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2767 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2768 |
#ifdef EALREADY |
3540 | 2769 |
case EALREADY: |
2770 |
msg = "Operation already in progress"; |
|
2771 |
sym = @symbol(EALREADY); |
|
2772 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2773 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2774 |
#ifdef ENOTSOCK |
3540 | 2775 |
case ENOTSOCK: |
2776 |
msg = "Socket operation on non-socket"; |
|
2777 |
sym = @symbol(ENOTSOCK); |
|
2778 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2779 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2780 |
#ifdef EDESTADDRREQ |
3540 | 2781 |
case EDESTADDRREQ: |
2782 |
msg = "Destination address required"; |
|
2783 |
sym = @symbol(EDESTADDRREQ); |
|
2784 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2785 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2786 |
#ifdef EMSGSIZE |
3540 | 2787 |
case EMSGSIZE: |
2788 |
msg = "Message too long"; |
|
2789 |
sym = @symbol(EMSGSIZE); |
|
2790 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2791 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2792 |
#ifdef EPROTOTYPE |
3540 | 2793 |
case EPROTOTYPE: |
2794 |
msg = "Protocol wrong type for socket"; |
|
2795 |
sym = @symbol(EPROTOTYPE); |
|
2796 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2797 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2798 |
#ifdef ENOPROTOOPT |
3540 | 2799 |
case ENOPROTOOPT: |
2800 |
msg = "Protocol not available"; |
|
2801 |
sym = @symbol(ENOPROTOOPT); |
|
2802 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2803 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2804 |
#ifdef EPROTONOSUPPORT |
3540 | 2805 |
case EPROTONOSUPPORT: |
2806 |
msg = "Protocol not supported"; |
|
2807 |
sym = @symbol(EPROTONOSUPPORT); |
|
2808 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2809 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2810 |
#ifdef ESOCKTNOSUPPORT |
3540 | 2811 |
case ESOCKTNOSUPPORT: |
2812 |
msg = "Socket type not supported"; |
|
2813 |
sym = @symbol(ESOCKTNOSUPPORT); |
|
2814 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2815 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2816 |
#ifdef EOPNOTSUPP |
3540 | 2817 |
case EOPNOTSUPP: |
2818 |
msg = "Operation not supported on socket"; |
|
2819 |
sym = @symbol(EOPNOTSUPP); |
|
2820 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2821 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2822 |
#ifdef EPFNOSUPPORT |
3540 | 2823 |
case EPFNOSUPPORT: |
2824 |
msg = "Protocol family not supported"; |
|
2825 |
sym = @symbol(EPFNOSUPPORT); |
|
2826 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2827 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2828 |
#ifdef EAFNOSUPPORT |
3540 | 2829 |
case EAFNOSUPPORT: |
2830 |
msg = "Address family not supported by protocol family"; |
|
2831 |
sym = @symbol(EAFNOSUPPORT); |
|
2832 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2833 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2834 |
#ifdef EADDRINUSE |
3540 | 2835 |
case EADDRINUSE: |
2836 |
msg = "Address already in use"; |
|
2837 |
sym = @symbol(EADDRINUSE); |
|
2838 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2839 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2840 |
#ifdef EADDRNOTAVAIL |
3540 | 2841 |
case EADDRNOTAVAIL: |
2842 |
msg = "Can\'t assign requested address"; |
|
2843 |
sym = @symbol(EADDRNOTAVAIL); |
|
2844 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2845 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2846 |
#ifdef ETIMEDOUT |
3540 | 2847 |
case ETIMEDOUT: |
2848 |
msg = "Connection timed out"; |
|
2849 |
sym = @symbol(ETIMEDOUT); |
|
2850 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2851 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2852 |
#ifdef ECONNREFUSED |
3540 | 2853 |
case ECONNREFUSED: |
2854 |
msg = "Connection refused"; |
|
2855 |
sym = @symbol(ECONNREFUSED); |
|
2856 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2857 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2858 |
#ifdef ENETDOWN |
3540 | 2859 |
case ENETDOWN: |
2860 |
msg = "Network is down"; |
|
2861 |
sym = @symbol(ENETDOWN); |
|
2862 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2863 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2864 |
#ifdef ENETUNREACH |
3540 | 2865 |
case ENETUNREACH: |
2866 |
msg = "Network is unreachable"; |
|
2867 |
sym = @symbol(ENETUNREACH); |
|
2868 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2869 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2870 |
#ifdef ENETRESET |
3540 | 2871 |
case ENETRESET: |
2872 |
msg = "Network dropped conn due to reset"; |
|
2873 |
sym = @symbol(ENETRESET); |
|
2874 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2875 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2876 |
#ifdef ECONNABORTED |
3540 | 2877 |
case ECONNABORTED: |
2878 |
msg = "Software caused connection abort"; |
|
2879 |
sym = @symbol(ECONNABORTED); |
|
2880 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2881 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2882 |
#ifdef ECONNRESET |
3540 | 2883 |
case ECONNRESET: |
2884 |
msg = "Connection reset by peer"; |
|
2885 |
sym = @symbol(ECONNRESET); |
|
2886 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2887 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2888 |
#ifdef EISCONN |
3540 | 2889 |
case EISCONN: |
2890 |
msg = "Socket is already connected"; |
|
2891 |
sym = @symbol(EISCONN); |
|
2892 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2893 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2894 |
#ifdef ENOTCONN |
3540 | 2895 |
case ENOTCONN: |
2896 |
msg = "Socket is not connected"; |
|
2897 |
sym = @symbol(ENOTCONN); |
|
2898 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2899 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2900 |
#ifdef ESHUTDOWN |
3540 | 2901 |
case ESHUTDOWN: |
2902 |
msg = "Can't send after socket shutdown"; |
|
2903 |
sym = @symbol(ESHUTDOWN); |
|
2904 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2905 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2906 |
#ifdef EHOSTDOWN |
3540 | 2907 |
case EHOSTDOWN: |
2908 |
msg = "Host is down"; |
|
2909 |
sym = @symbol(EHOSTDOWN); |
|
2910 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2911 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2912 |
#ifdef EHOSTUNREACH |
3540 | 2913 |
case EHOSTUNREACH: |
2914 |
msg = "No route to host"; |
|
2915 |
sym = @symbol(EHOSTUNREACH); |
|
2916 |
break; |
|
2917 |
#endif |
|
2918 |
||
2919 |
default: |
|
2920 |
{ |
|
2921 |
__BEGIN_PROTECT_REGISTERS__ |
|
2922 |
sprintf(buffer, "ErrorNr: %d", __intVal(eno)); |
|
2923 |
__END_PROTECT_REGISTERS__ |
|
2924 |
} |
|
2925 |
msg = buffer; |
|
2926 |
sym = @symbol(ERROR_OTHER); |
|
2927 |
break; |
|
2928 |
} |
|
2929 |
text = __MKSTRING(msg); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2930 |
} else { |
3540 | 2931 |
text = nil; |
2932 |
sym = nil; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2933 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2934 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2935 |
^ Array with:sym with:text |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2936 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2937 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2938 |
UnixOperatingSystem errorSymbolAndTextForNumber:4 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2939 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2940 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2941 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2942 |
!UnixOperatingSystem class methodsFor:'executing OS commands'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2943 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2944 |
commandAndArgsForOSCommand:aCommandString |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2945 |
"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
|
2946 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2947 |
|shell args| |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2948 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2949 |
"/ |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2950 |
"/ '/bin/sh -c <command>' |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2951 |
"/ |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2952 |
shell := '/bin/sh'. |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2953 |
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
|
2954 |
^ Array with:shell with:args |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2955 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
2956 |
"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
|
2957 |
"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
|
2958 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2959 |
|
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2960 |
exec:aCommandPath withArguments:argArray environment:env fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2961 |
"Internal lowLevel entry for combined fork & exec; |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2962 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2963 |
If fork is false (chain a command): |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2964 |
execute the OS command specified by the argument, aCommandPath, with |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2965 |
arguments in argArray (no arguments, if nil). |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2966 |
If successful, this method does not return and smalltalk is gone. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2967 |
If not successful, it does return. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2968 |
Normal use is with forkForCommand. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2969 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2970 |
If fork is true (subprocess command execution): |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2971 |
fork a child to do the above. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2972 |
The process id of the child process is returned; nil if the fork failed. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2973 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2974 |
fdArray contains the filedescriptors, to be used for the child (if fork is true). |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2975 |
fdArray[1] = 15 -> use fd 15 as stdin. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2976 |
If an element of the array is set to nil, the corresponding filedescriptor |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2977 |
will be closed for the child. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2978 |
fdArray[0] == StdIn for child |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2979 |
fdArray[1] == StdOut for child |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2980 |
fdArray[2] == StdErr for child |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2981 |
on VMS, these must be channels as returned by createMailBox. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2982 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2983 |
closeFdArray contains descriptors that will be closed in the subprocess. |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2984 |
closeDescriptors are ignored in the WIN32 & VMS versions. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2985 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2986 |
If newPgrp is true, the subprocess will be established in a new process group. |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2987 |
The processgroup will be equal to id. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2988 |
newPgrp is not used on WIN32 and VMS systems. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2989 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2990 |
env specifies environment variables which are passed differently from |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2991 |
the current environment. If non-nil, it must be a dictionary providing |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2992 |
key-value pairs for changed/added environment variables. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2993 |
To pass a variable as empty (i.e. unset), pass a nil value. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2994 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
2995 |
Notice: this used to be two separate ST-methods; however, in order to use |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2996 |
vfork on some machines, it had to be merged into one, to avoid write |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2997 |
accesses to ST/X memory from the vforked-child. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2998 |
The code below only does read accesses." |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
2999 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3000 |
|envPairs| |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3001 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3002 |
env notNil ifTrue:[ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3003 |
envPairs := OrderedCollection new. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3004 |
env keysAndValuesDo:[:key :val | |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3005 |
envPairs add:key; add:val |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3006 |
]. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3007 |
envPairs := envPairs asArray. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3008 |
]. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3009 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3010 |
%{ /* STACK: 16000 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3011 |
char **argv; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3012 |
int nargs, i, id; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3013 |
OBJ arg; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3014 |
/* extern char *malloc(); */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3015 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3016 |
if (__isString(aCommandPath) && |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3017 |
((argArray == nil) || __isArray(argArray)) && |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3018 |
((fdArray == nil) || __isArray(fdArray)) && |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3019 |
((closeFdArray == nil) || __isArray(closeFdArray)) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3020 |
) { |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3021 |
nargs = argArray == nil ? 0 : __arraySize(argArray); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3022 |
argv = (char **) malloc(sizeof(char *) * (nargs + 1)); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3023 |
if (argv) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3024 |
for (i=0; i < nargs; i++) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3025 |
arg = __ArrayInstPtr(argArray)->a_element[i]; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3026 |
if (__isString(arg)) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3027 |
argv[i] = (char *) __stringVal(arg); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3028 |
} else { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3029 |
argv[i] = ""; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3030 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3031 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3032 |
argv[i] = NULL; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3033 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3034 |
if (doFork == true) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3035 |
/* |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3036 |
* fork a subprocess. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3037 |
*/ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3038 |
int nfd, nclose; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3039 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3040 |
nfd = fdArray == nil ? 0 : __arraySize(fdArray); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3041 |
nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3042 |
#ifdef HAS_VFORK |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3043 |
id = vfork(); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3044 |
#else |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3045 |
id = fork(); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3046 |
#endif |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3047 |
if (id == 0) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3048 |
/* |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3049 |
** In child. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3050 |
** first: dup filedescriptors |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3051 |
*/ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3052 |
for (i = 0; i < nfd; i++) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3053 |
OBJ fd; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3054 |
int rslt; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3055 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3056 |
fd = __ArrayInstPtr(fdArray)->a_element[i]; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3057 |
if (__isSmallInteger(fd) && (__intVal(fd) != i)) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3058 |
do { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3059 |
rslt = dup2(__intVal(fd), i); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3060 |
} while ((rslt < 0) && (errno == EINTR)); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3061 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3062 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3063 |
/* |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3064 |
** second: close unused filedescriptors |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3065 |
*/ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3066 |
for (i = 0; i < nfd; i++) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3067 |
if (__ArrayInstPtr(fdArray)->a_element[i] == nil) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3068 |
close(i); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3069 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3070 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3071 |
/* |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3072 |
** third: close filedescriptors |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3073 |
*/ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3074 |
for (i = 0; i < nclose; i++) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3075 |
OBJ fd; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3076 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3077 |
fd = __ArrayInstPtr(closeFdArray)->a_element[i]; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3078 |
if (__isSmallInteger(fd)) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3079 |
close(__intVal(fd)); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3080 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3081 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3082 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3083 |
if ((envPairs != nil) && __isArray(envPairs)) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3084 |
for (i=0; (i+1)<__arraySize(envPairs); i+=2) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3085 |
OBJ t; |
3549 | 3086 |
char *var, *val, *e; |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3087 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3088 |
t = __ArrayInstPtr(envPairs)->a_element[i]; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3089 |
if (__isString(t) || __isSymbol(t)) { |
3549 | 3090 |
var = (char *)__stringVal(t); |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3091 |
t = __ArrayInstPtr(envPairs)->a_element[i+1]; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3092 |
if (__isString(t) || __isSymbol(t)) { |
3549 | 3093 |
val = (char *)__stringVal(t); |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3094 |
} else { |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3095 |
val = NULL; |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3096 |
} |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3097 |
#if defined(HAS_SETENV) && defined(HAS_UNSETENV) |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3098 |
if (val != NULL) { |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3099 |
setenv(var, val, 1); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3100 |
} else { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3101 |
unsetenv(var); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3102 |
} |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3103 |
#else /* use putenv */ |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3104 |
if (val != NULL) { |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3105 |
e = (char *)malloc(strlen(var) + 1 + strlen(val) + 1); |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3106 |
strcpy(e, var); |
3548 | 3107 |
strcat(e, "="); |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3108 |
strcat(e, val); |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3109 |
} else { |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3110 |
e = (char *)malloc(strlen(var) + 1 + 1); |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3111 |
strcpy(e, var); |
3548 | 3112 |
strcat(e, "="); |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3113 |
} |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3114 |
putenv(e); |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3115 |
#endif /* HAS_SETENV && HAS_UNSETENV */ |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3116 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3117 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3118 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3119 |
|
3555
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3120 |
setsid(); |
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3121 |
#if defined(TIOCSCTTY) |
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3122 |
ioctl(0, TIOCSCTTY, 0) ; |
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3123 |
#endif |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3124 |
if (newPgrp == true) { |
3555
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3125 |
#if defined(TIOCSPGRP) |
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3126 |
int pgrp = getpid(); |
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3127 |
|
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3128 |
ioctl(0, TIOCSPGRP, (char *)&pgrp); |
211885c31b61
correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents:
3550
diff
changeset
|
3129 |
#endif |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3130 |
#if defined(_POSIX_JOB_CONTROL) |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3131 |
(void) setpgid(0, 0); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3132 |
#else |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3133 |
# if defined(BSD) || defined(LINUX) |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3134 |
(void) setpgrp(0); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3135 |
# endif |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3136 |
#endif |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3137 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3138 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3139 |
execv(__stringVal(aCommandPath), argv); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3140 |
/* should not be reached */ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3141 |
_exit(127); /* POSIX 2 compatible exit value */ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3142 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3143 |
/* |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3144 |
** In parent: succes or failure |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3145 |
*/ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3146 |
free(argv); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3147 |
if (id == -1) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3148 |
RETURN (nil); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3149 |
} else { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3150 |
RETURN (__MKSMALLINT(id)); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3151 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3152 |
} else { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3153 |
/* |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3154 |
* no subprocess (i.e. transfer to another program) |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3155 |
*/ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3156 |
if ((envPairs != nil) && __isArray(envPairs)) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3157 |
for (i=0; (i+1)<__arraySize(envPairs); i+=2) { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3158 |
OBJ t; |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3159 |
char *var, *val, *e; |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3160 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3161 |
t = __ArrayInstPtr(envPairs)->a_element[i]; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3162 |
if (__isString(t) || __isSymbol(t)) { |
3549 | 3163 |
var = (char *)__stringVal(t); |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3164 |
t = __ArrayInstPtr(envPairs)->a_element[i+1]; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3165 |
if (__isString(t) || __isSymbol(t)) { |
3549 | 3166 |
val = (char *)__stringVal(t); |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3167 |
} else { |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3168 |
val = NULL; |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3169 |
} |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3170 |
#if defined(HAS_SETENV) && defined(HAS_UNSETENV) |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3171 |
if (val != NULL) { |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3172 |
setenv(var, val, 1); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3173 |
} else { |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3174 |
unsetenv(var); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3175 |
} |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3176 |
#else /* use putenv */ |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3177 |
if (val != NULL) { |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3178 |
e = (char *)malloc(strlen(var) + 1 + strlen(val) + 1); |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3179 |
strcpy(e, var); |
3548 | 3180 |
strcat(e, "="); |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3181 |
strcat(e, val); |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3182 |
} else { |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3183 |
e = (char *)malloc(strlen(var) + 1 + 1); |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3184 |
strcpy(e, var); |
3548 | 3185 |
strcat(e, "="); |
3547
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3186 |
} |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3187 |
putenv(e); |
68930ab54ee5
alternaitev environment pasing using putenv (solaris)
Claus Gittinger <cg@exept.de>
parents:
3544
diff
changeset
|
3188 |
#endif /* HAS_SETENV && HAS_UNSETENV */ |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3189 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3190 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3191 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3192 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3193 |
execv(__stringVal(aCommandPath), argv); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3194 |
/* |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3195 |
* should not be reached |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3196 |
* (well, it is, if you pass a wrong command-path) |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3197 |
*/ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3198 |
free(argv); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3199 |
RETURN ( nil ); |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3200 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3201 |
} |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3202 |
} |
3496
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 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3205 |
path-argument not string |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3206 |
or argArray not an array/nil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3207 |
or malloc failed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3208 |
or not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3209 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3210 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3211 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3212 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3213 |
|id| |
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 |
id := UnixOperatingSystem fork. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3216 |
id == 0 ifTrue:[ |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3217 |
'I am the child'. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3218 |
UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp'). |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3219 |
'not reached'. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3220 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3221 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3222 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3223 |
|id| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3224 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3225 |
id := UnixOperatingSystem fork. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3226 |
id == 0 ifTrue:[ |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3227 |
'I am the child'. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3228 |
UnixOperatingSystem |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3229 |
exec:'/bin/sh' |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3230 |
withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2'). |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3231 |
'not reached'. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3232 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3233 |
id printNL. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3234 |
(Delay forSeconds:3.5) wait. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3235 |
'killing ...' printNL. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3236 |
UnixOperatingSystem sendSignal:(UnixOperatingSystem sigTERM) to:id. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3237 |
UnixOperatingSystem sendSignal:(UnixOperatingSystem sigKILL) to:id |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3238 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3239 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3240 |
|
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3241 |
exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3242 |
"Internal lowLevel entry for combined fork & exec; |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3243 |
If fork is false (chain a command): |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3244 |
execute the OS command specified by the argument, aCommandPath, with |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3245 |
arguments in argArray (no arguments, if nil). |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3246 |
If successful, this method does not return and smalltalk is gone. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3247 |
If not successful, it does return. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3248 |
Normal use is with forkForCommand. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3249 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3250 |
If fork is true (subprocess command execution): |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3251 |
fork a child to do the above. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3252 |
The process id of the child process is returned; nil if the fork failed. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3253 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3254 |
fdArray contains the filedescriptors, to be used for the child (if fork is true). |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3255 |
fdArray[1] = 15 -> use fd 15 as stdin. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3256 |
If an element of the array is set to nil, the corresponding filedescriptor |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3257 |
will be closed for the child. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3258 |
fdArray[0] == StdIn for child |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3259 |
fdArray[1] == StdOut for child |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3260 |
fdArray[2] == StdErr for child |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3261 |
on VMS, these must be channels as returned by createMailBox. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3262 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3263 |
closeFdArray contains descriptors that will be closed in the subprocess. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3264 |
closeDescriptors are ignored in the WIN32 & VMS versions. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3265 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3266 |
NOTE that in WIN32 the fds are HANDLES!! |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3267 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3268 |
If newPgrp is true, the subprocess will be established in a new process group. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3269 |
The processgroup will be equal to id. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3270 |
newPgrp is not used on WIN32 and VMS systems. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3271 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3272 |
Notice: this used to be two separate ST-methods; however, in order to use |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3273 |
vfork on some machines, it had to be merged into one, to avoid write |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3274 |
accesses to ST/X memory from the vforked-child. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3275 |
The code below only does read accesses." |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3276 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3277 |
^ self |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3278 |
exec:aCommandPath |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3279 |
withArguments:argArray |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3280 |
environment:nil |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3281 |
fileDescriptors:fdArray |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3282 |
closeDescriptors:closeFdArray |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3283 |
fork:doFork |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3284 |
newPgrp:newPgrp |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3285 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3286 |
" |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3287 |
|id| |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3288 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3289 |
id := UnixOperatingSystem fork. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3290 |
id == 0 ifTrue:[ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3291 |
'I am the child'. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3292 |
UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp'). |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3293 |
'not reached'. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3294 |
] |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3295 |
" |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3296 |
" |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3297 |
|id| |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3298 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3299 |
id := UnixOperatingSystem fork. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3300 |
id == 0 ifTrue:[ |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3301 |
'I am the child'. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3302 |
UnixOperatingSystem |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3303 |
exec:'/bin/sh' |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3304 |
withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2'). |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3305 |
'not reached'. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3306 |
]. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3307 |
id printNL. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3308 |
(Delay forSeconds:3.5) wait. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3309 |
'killing ...' printNL. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3310 |
UnixOperatingSystem sendSignal:(UnixOperatingSystem sigTERM) to:id. |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3311 |
UnixOperatingSystem sendSignal:(UnixOperatingSystem sigKILL) to:id |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3312 |
" |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3313 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3314 |
"Modified: / 10.6.1998 / 16:09:59 / cg" |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3315 |
! |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3316 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3317 |
exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory |
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3318 |
"Internal lowLevel entry for combined fork & exec for WIN32. |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3319 |
Not needed with Unix" |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3320 |
|
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3321 |
^ self |
3543
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3322 |
exec:aCommandPath |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3323 |
withArguments:argArray |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3324 |
environment:nil |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3325 |
fileDescriptors:fdArray |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3326 |
closeDescriptors:closeFdArray |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3327 |
fork:doFork |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3328 |
newPgrp:newPgrp |
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3329 |
|
acd4a449d96b
allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents:
3542
diff
changeset
|
3330 |
"Modified: / 10.6.1998 / 16:10:29 / cg" |
3496
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3333 |
executeCommand:aCommandString inDirectory:aDirectory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3334 |
"much like #executeCommand:, but changes the current directory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3335 |
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
|
3336 |
hardwiring any 'cd ..' command strings into your applictions." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3337 |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3338 |
| cmd ret | |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3339 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3340 |
"/ unix - prepend a 'cd' to the command |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3341 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3342 |
cmd := 'cd ' , aDirectory asFilename pathName, '; ' , aCommandString. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3343 |
^ self executeCommand:cmd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3344 |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3345 |
"Modified: / 20.1.1998 / 17:03:03 / md" |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3346 |
"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
|
3347 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3348 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3349 |
fork |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3350 |
"fork a new (HEAVY-weight) unix process. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3351 |
Not supported with MSDOS & VMS systems. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3352 |
Dont confuse this with Block>>fork, which creates |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3353 |
lightweight smalltalk processes. This method will return |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3354 |
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
|
3355 |
unix-process-id) to the parent (original) process. |
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 |
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
|
3358 |
#startProcess: and #executCommand: for higher level interfaces." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3359 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3360 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3361 |
int pid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3362 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3363 |
pid = fork(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3364 |
RETURN ( __MKUINT(pid) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3365 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3366 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3367 |
"/ not supported by OS |
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 |
^ UnsupportedOperationSignal raise |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3371 |
|
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 |
|id| |
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 |
id := UnixOperatingSystem fork. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3376 |
id == 0 ifTrue:[ |
3540 | 3377 |
'I am the child process' printCR. |
3378 |
UnixOperatingSystem exit |
|
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 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3382 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3383 |
getStatusOfProcess:aProcessId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3384 |
"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
|
3385 |
This is required to avoid zombie processes." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3386 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3387 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3388 |
int status; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3389 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3390 |
if (__isSmallInteger(aProcessId)) { |
3540 | 3391 |
pid_t pid = (pid_t)(__intVal(aProcessId)); |
3392 |
{ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3393 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3394 |
# ifdef NO_WAITPID |
3540 | 3395 |
pid_t child; |
3396 |
||
3397 |
do { |
|
3398 |
__BEGIN_INTERRUPTABLE__ |
|
3399 |
child = __wait (&status); |
|
3400 |
__END_INTERRUPTABLE__ |
|
3401 |
if (child < 0 && errno != EINTR) { |
|
3402 |
fprintf(stderr, "OS: child-wait errno=%d\n", errno); |
|
3403 |
status = -1; |
|
3404 |
break; |
|
3405 |
} |
|
3406 |
} while (child != pid); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3407 |
# else |
3540 | 3408 |
pid_t child; |
3409 |
||
3410 |
/* claus: the original did not care for EINTR here ... */ |
|
3411 |
do { |
|
3412 |
__BEGIN_INTERRUPTABLE__ |
|
3413 |
child = __waitpid (pid, &status, 0); |
|
3414 |
__END_INTERRUPTABLE__ |
|
3415 |
} while ((child != pid) && (errno == EINTR)); |
|
3416 |
if (child != pid) { |
|
3417 |
fprintf(stderr, "OS: child-waitpid errno=%d\n", errno); |
|
3418 |
status = -1; |
|
3419 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3420 |
# endif /* NO_WAITPID */ |
3540 | 3421 |
} |
3422 |
RETURN ( __MKSMALLINT(status)); |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3423 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3424 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3425 |
self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3426 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3427 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3428 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3429 |
pathOfCommand:aCommand |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3430 |
"find where aCommand's executable file is; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3431 |
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
|
3432 |
return nil." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3433 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3434 |
|path f fExt| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3435 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3436 |
aCommand asFilename isAbsolute ifTrue:[ |
3540 | 3437 |
^ aCommand |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3438 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3439 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3440 |
path := self getEnvironment:'PATH'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3441 |
path notNil ifTrue:[ |
3540 | 3442 |
(path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path | |
3443 |
path isEmpty ifTrue:[ |
|
3444 |
f := aCommand asFilename |
|
3445 |
] ifFalse:[ |
|
3446 |
f := path asFilename construct:aCommand. |
|
3447 |
]. |
|
3448 |
self executableFileExtensions do:[:ext | |
|
3449 |
ext notEmpty ifTrue:[ |
|
3450 |
fExt := (f pathName , ext) asFilename. |
|
3451 |
] ifFalse:[ |
|
3452 |
fExt := f. |
|
3453 |
]. |
|
3454 |
fExt isExecutable ifTrue:[ |
|
3455 |
^ fExt pathName |
|
3456 |
]. |
|
3457 |
]. |
|
3458 |
]. |
|
3496
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 |
^ nil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3461 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3462 |
"unix: |
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 |
UnixOperatingSystem pathOfCommand:'fooBar' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3465 |
UnixOperatingSystem pathOfCommand:'ls' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3466 |
UnixOperatingSystem pathOfCommand:'cvs' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3467 |
UnixOperatingSystem pathOfCommand:'stx' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3468 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3469 |
"windows: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3470 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3471 |
UnixOperatingSystem pathOfCommand:'windbg' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3472 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3473 |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3474 |
"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
|
3475 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3476 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3477 |
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3478 |
"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
|
3479 |
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
|
3480 |
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
|
3481 |
'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
|
3482 |
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
|
3483 |
each may be nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3484 |
Return the processId if successful, nil otherwise. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3485 |
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
|
3486 |
or #killProcess: to stop it." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3487 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3488 |
|in out err shellAndArgs| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3489 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3490 |
anExternalInStream notNil ifTrue:[ |
3540 | 3491 |
in := anExternalInStream fileDescriptor. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3492 |
] ifFalse:[ |
3540 | 3493 |
in := '/dev/null' asFilename readStream fileDescriptor |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3494 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3495 |
anExternalOutStream notNil ifTrue:[ |
3540 | 3496 |
out := anExternalOutStream fileDescriptor. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3497 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3498 |
anExternalErrStream notNil ifTrue:[ |
3540 | 3499 |
err := anExternalErrStream fileDescriptor. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3500 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3501 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3502 |
shellAndArgs := self commandAndArgsForOSCommand:aCommandString. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3503 |
^ self |
3540 | 3504 |
exec:(shellAndArgs at:1) |
3505 |
withArguments:(shellAndArgs at:2) |
|
3506 |
fileDescriptors:(Array with:in with:out with:err) |
|
3507 |
closeDescriptors:nil |
|
3508 |
fork:true |
|
3509 |
newPgrp:false. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3510 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3511 |
"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
|
3512 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3513 |
UnixOperatingSystem executeCommand:'ls -l > out'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3514 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3515 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3516 |
"non-blocking (lower prio threads continue): |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3517 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3518 |
|in out err pid sema| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3519 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3520 |
in := 'out' asFilename readStream. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3521 |
out := 'out2' asFilename writeStream. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3522 |
err := 'err' asFilename writeStream. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3523 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3524 |
sema := Semaphore new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3525 |
pid := UnixOperatingSystem startProcess:'sleep 10; grep drw' inputFrom:in outputTo:out errorTo:err. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3526 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3527 |
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
|
3528 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3529 |
pid notNil ifTrue:[ |
3540 | 3530 |
Processor monitorPid:pid action:[:OSstatus | sema signal ]. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3531 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3532 |
in close. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3533 |
out close. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3534 |
err close. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3535 |
sema wait. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3536 |
Transcript showCR:'finished' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3537 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3538 |
|
3515
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3539 |
"Created: / 29.2.1996 / 12:31:29 / cg" |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3540 |
"Modified: / 21.3.1997 / 10:04:35 / dq" |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3541 |
"Modified: / 15.7.1997 / 16:03:51 / stefan" |
e7ff23b98a83
removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents:
3512
diff
changeset
|
3542 |
"Modified: / 5.6.1998 / 19:03:51 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3543 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3544 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3545 |
!UnixOperatingSystem class methodsFor:'file access'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3546 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3547 |
closeFd:anInteger |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3548 |
"low level close of a filedescriptor" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3549 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3550 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3551 |
if (__isSmallInteger(anInteger)) { |
3540 | 3552 |
close(__intVal(anInteger)); |
3553 |
RETURN(self); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3554 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3555 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3556 |
^ self primitiveFailed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3557 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3558 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3559 |
createDirectory:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3560 |
"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
|
3561 |
path, or relative to the current directory. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3562 |
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
|
3563 |
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
|
3564 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3565 |
"/ if it already exists this is ok |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3566 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3567 |
(self isDirectory:aPathName) ifTrue:[^ true]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3568 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3569 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3570 |
if (__isString(aPathName)) { |
3540 | 3571 |
int ret; |
3572 |
||
3573 |
ret = mkdir(__stringVal(aPathName), 0755); |
|
3574 |
if (ret < 0) { |
|
3575 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3576 |
RETURN (false); |
|
3577 |
} |
|
3578 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3579 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3580 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3581 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3582 |
"/ self isUNIXlike ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3583 |
"/ ^ self executeCommand:('mkdir 2>/dev/null ', newPathName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3584 |
"/ ]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3585 |
"/ ^ self executeCommand:('mkdir ', newPathName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3586 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3587 |
self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3588 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3589 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3590 |
UnixOperatingSystem createDirectory:'foo' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3591 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3592 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3593 |
"Modified: 20.12.1995 / 11:24:13 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3594 |
"Modified: 29.6.1996 / 14:06:54 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3595 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3596 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3597 |
linkFile:oldPath to:newPath |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3598 |
"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
|
3599 |
Return true if successful, false if not." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3600 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3601 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3602 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3603 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3604 |
if (__isString(oldPath) && __isString(newPath)) { |
3540 | 3605 |
__BEGIN_INTERRUPTABLE__ |
3606 |
do { |
|
3607 |
ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath)); |
|
3608 |
} while (ret < 0 && errno == EINTR); |
|
3609 |
__END_INTERRUPTABLE__ |
|
3610 |
if (ret < 0) { |
|
3611 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3612 |
RETURN ( false ); |
|
3613 |
} |
|
3614 |
RETURN (true); |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3615 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3616 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3617 |
(oldPath isString not or:[newPath isString not]) ifTrue:[ |
3540 | 3618 |
"/ |
3619 |
"/ bad argument(s) given |
|
3620 |
"/ |
|
3621 |
^ self primitiveFailed |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3622 |
]. |
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 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3625 |
"/ this UnixOperatingSystem does not support links |
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 |
^ UnsupportedOperationSignal raise |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3628 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3629 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3630 |
UnixOperatingSystem linkFile:'foo' to:'bar' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3631 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3632 |
! |
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 |
recursiveCopyDirectory:sourcePathName to:destination |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3635 |
"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
|
3636 |
Return true if successful." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3637 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3638 |
^ 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
|
3639 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3640 |
"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
|
3641 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3642 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3643 |
recursiveRemoveDirectory:fullPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3644 |
"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
|
3645 |
Return true if successful." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3646 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3647 |
^ self executeCommand:('rm -rf ' , fullPathName) |
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 |
UnixOperatingSystem recursiveCreateDirectory:'foo/bar/baz' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3651 |
UnixOperatingSystem recursiveRemoveDirectory:'foo' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3652 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3653 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
3654 |
"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
|
3655 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3656 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3657 |
removeDirectory:fullPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3658 |
"remove the directory named 'fullPathName'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3659 |
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
|
3660 |
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
|
3661 |
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
|
3662 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3663 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3664 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3665 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3666 |
if (__isString(fullPathName)) { |
3540 | 3667 |
__BEGIN_INTERRUPTABLE__ |
3668 |
do { |
|
3669 |
ret = rmdir((char *) __stringVal(fullPathName)); |
|
3670 |
} while (ret < 0 && errno == EINTR); |
|
3671 |
__END_INTERRUPTABLE__ |
|
3672 |
if (ret < 0) { |
|
3673 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3674 |
RETURN ( false ); |
|
3675 |
} |
|
3676 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3677 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3678 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3679 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3680 |
"/ either not a string argument, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3681 |
"/ or not supported by OS |
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 |
UnixOperatingSystem createDirectory:'foo' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3687 |
UnixOperatingSystem removeDirectory:'foo' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3688 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3689 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3690 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3691 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3692 |
removeFile:fullPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3693 |
"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
|
3694 |
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
|
3695 |
|
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 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3698 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3699 |
if (__isString(fullPathName)) { |
3540 | 3700 |
__BEGIN_INTERRUPTABLE__ |
3701 |
do { |
|
3702 |
ret = unlink((char *) __stringVal(fullPathName)); |
|
3703 |
} while (ret < 0 && errno == EINTR); |
|
3704 |
__END_INTERRUPTABLE__ |
|
3705 |
if (ret < 0) { |
|
3706 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3707 |
RETURN ( false ); |
|
3708 |
} |
|
3709 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3710 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3711 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3712 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3713 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3714 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3715 |
renameFile:oldPath to:newPath |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3716 |
"rename the file 'oldPath' to 'newPath'. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3717 |
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
|
3718 |
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
|
3719 |
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
|
3720 |
any invalid names. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3721 |
Returns true if successful, false if not" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3722 |
|
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 |
int ret, eno; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3725 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3726 |
if (__isString(oldPath) && __isString(newPath)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3727 |
#if defined(HAS_RENAME) |
3540 | 3728 |
__BEGIN_INTERRUPTABLE__ |
3729 |
do { |
|
3730 |
ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath)); |
|
3731 |
} while (ret < 0 && errno == EINTR); |
|
3732 |
__END_INTERRUPTABLE__ |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3733 |
#else |
3540 | 3734 |
ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath)); |
3735 |
if (ret >= 0) { |
|
3736 |
ret = unlink((char *) __stringVal(oldPath)); |
|
3737 |
if (ret < 0) { |
|
3738 |
eno = errno; |
|
3739 |
unlink((char *) __stringVal(newPath)); |
|
3740 |
errno = eno; |
|
3741 |
} |
|
3742 |
} |
|
3743 |
#endif |
|
3744 |
if (ret < 0) { |
|
3745 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
3746 |
RETURN ( false ); |
|
3747 |
} |
|
3748 |
RETURN (true); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3749 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3750 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3751 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3752 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3753 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3754 |
UnixOperatingSystem renameFile:'foo' to:'bar' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3755 |
" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3758 |
truncateFile:aPathName to:newSize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3759 |
"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
|
3760 |
This may not be supported on all architectures. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3761 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3762 |
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
|
3763 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3764 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3765 |
#ifdef HAS_TRUNCATE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3766 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3767 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3768 |
if (__isString(aPathName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3769 |
&& __isSmallInteger(newSize)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3770 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3771 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3772 |
ret = truncate((char *) __stringVal(aPathName), __intVal(newSize)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3773 |
} while (ret < 0 && errno == EINTR); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3774 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3775 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3776 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3777 |
RETURN ( false ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3778 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3779 |
RETURN (true); |
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 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3782 |
# ifdef HAS_FTRUNCATE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3783 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3784 |
int fd; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3785 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3786 |
if (__isString(aPathName) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3787 |
&& __isSmallInteger(newSize)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3788 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3789 |
fd = open((char *) __stringVal(aPathName), 2); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3790 |
} while (fd < 0 && errno == EINTR); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3791 |
if (fd < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3792 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3793 |
RETURN ( false ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3794 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3795 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3796 |
ret = ftruncate(fd, __intVal(newSize)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3797 |
close(fd); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3798 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3799 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3800 |
RETURN ( false ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3801 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3802 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3803 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3804 |
# endif /* using FTRUNCATE */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3805 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3806 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3807 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3808 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3809 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3810 |
!UnixOperatingSystem class methodsFor:'file access rights'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3811 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3812 |
accessMaskFor:aSymbol |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3813 |
"return the access bits mask for numbers as returned by |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3814 |
UnixOperatingSystem>>accessModeOf: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3815 |
and expected by UnixOperatingSystem>>changeAccessModeOf:to:. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3816 |
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
|
3817 |
(never hardcode 8rxxx into your code)." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3818 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3819 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3820 |
# ifndef S_IRUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3821 |
/* posix systems should define these ... */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3822 |
# define S_IRUSR 0400 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3823 |
# define S_IWUSR 0200 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3824 |
# define S_IXUSR 0100 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3825 |
# define S_IRGRP 0040 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3826 |
# define S_IWGRP 0020 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3827 |
# define S_IXGRP 0010 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3828 |
# define S_IROTH 0004 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3829 |
# define S_IWOTH 0002 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3830 |
# define S_IXOTH 0001 |
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 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3833 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3834 |
if (aSymbol == @symbol(readUser)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3835 |
RETURN ( __MKSMALLINT(S_IRUSR) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3836 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3837 |
if (aSymbol == @symbol(writeUser)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3838 |
RETURN ( __MKSMALLINT(S_IWUSR) ); |
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 |
if (aSymbol == @symbol(executeUser)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3841 |
RETURN ( __MKSMALLINT(S_IXUSR) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3842 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3843 |
if (aSymbol == @symbol(readGroup)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3844 |
RETURN ( __MKSMALLINT(S_IRGRP) ); |
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 |
if (aSymbol == @symbol(writeGroup)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3847 |
RETURN ( __MKSMALLINT(S_IWGRP) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3848 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3849 |
if (aSymbol == @symbol(executeGroup)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3850 |
RETURN ( __MKSMALLINT(S_IXGRP) ); |
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 |
if (aSymbol == @symbol(readOthers)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3853 |
RETURN ( __MKSMALLINT(S_IROTH) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3854 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3855 |
if (aSymbol == @symbol(writeOthers)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3856 |
RETURN ( __MKSMALLINT(S_IWOTH) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3857 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3858 |
if (aSymbol == @symbol(executeOthers)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3859 |
RETURN ( __MKSMALLINT(S_IXOTH) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3860 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3861 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3862 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3863 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3864 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3865 |
UnixOperatingSystem accessMaskFor:#readUser |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3866 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3867 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3868 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3869 |
accessModeOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3870 |
"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
|
3871 |
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
|
3872 |
Notice that the returned number is OS dependent - use the |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3873 |
modeMasks as returned by UnixOperatingSystem>>accessMaskFor:" |
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 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3876 |
this could have been implemented as: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3877 |
(self infoOf:aPathName) at:#mode |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3878 |
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
|
3879 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3880 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3881 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3882 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3883 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3884 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3885 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3886 |
# ifdef TRACE_STAT_CALLS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3887 |
printf("stat on '%s' for accessMode\n", __stringVal(aPathName)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3888 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3889 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3890 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3891 |
ret = stat((char *) __stringVal(aPathName), &buf); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3892 |
} while ((ret < 0) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3893 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3894 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3895 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3896 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3897 |
RETURN ( nil ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3898 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3899 |
RETURN ( __MKSMALLINT(buf.st_mode & 0777) ); |
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 accessModeOf:'/') printStringRadix:8 |
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 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3908 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3909 |
changeAccessModeOf:aPathName to:modeBits |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3910 |
"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
|
3911 |
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
|
3912 |
independent. Return true if changed, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3913 |
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
|
3914 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3915 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3916 |
int ret; |
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 |
if (__isString(aPathName) && __isSmallInteger(modeBits)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3919 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3920 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3921 |
ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3922 |
} while (ret < 0 && errno == EINTR); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3923 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3924 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3925 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3926 |
RETURN ( false ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3927 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3928 |
RETURN ( true ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3929 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3930 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3931 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3932 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3933 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3934 |
!UnixOperatingSystem class methodsFor:'file locking'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3935 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3936 |
lockFD:aFileDescriptor shared:isSharedReadLock blocking:blockIfLocked |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3937 |
"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
|
3938 |
(such as returned by ExternalStream>>fileDescriptor). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3939 |
On some systems, only advisory locks are available - |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3940 |
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
|
3941 |
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
|
3942 |
(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
|
3943 |
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
|
3944 |
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
|
3945 |
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
|
3946 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3947 |
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
|
3948 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3949 |
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
|
3950 |
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
|
3951 |
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
|
3952 |
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
|
3953 |
argument." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3954 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3955 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3956 |
if (__isSmallInteger(aFileDescriptor)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3957 |
int fd = __intVal(aFileDescriptor); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3958 |
int lockArg; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3959 |
|
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 |
* claus: sigh - each one has a different interface ... |
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(F_SETLK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3964 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3965 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3966 |
* new fcntl(SETLK) interface; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3967 |
* available on SYSV4 and Linux |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3968 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3969 |
struct flock flock; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3970 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3971 |
if (isSharedReadLock == true) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3972 |
flock.l_type = F_RDLCK; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3973 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3974 |
flock.l_type = F_WRLCK; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3975 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3976 |
flock.l_whence = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3977 |
flock.l_start = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3978 |
flock.l_len = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3979 |
lockArg = F_SETLK; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3980 |
# if defined(F_SETLKW) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3981 |
if (blockIfLocked == true) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3982 |
lockArg = F_SETLKW; |
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 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3985 |
if (fcntl(fd, lockArg, &flock) != -1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3986 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3987 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3988 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3989 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3990 |
#else /* no F_SETLK available */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3991 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3992 |
# if defined(LOCK_EX) && defined(LOCK_UN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3993 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3994 |
* BSD 4.3 advisory locks |
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 |
lockArg = LOCK_EX; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3997 |
# if defined(LOCK_SH) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3998 |
if (isSharedReadLock == true) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
3999 |
lockArg = LOCK_SH |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4000 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4001 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4002 |
# if defined(LOCK_NB) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4003 |
if (blockIfLocked == false) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4004 |
lockArg |= LOCK_NB; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4005 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4006 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4007 |
if (flock(fd, lockArg) != -1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4008 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4009 |
} |
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 |
# else /* no flock available */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4012 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4013 |
# if defined(F_LOCK) && defined(F_UNLOCK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4014 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4015 |
* SYSV3 advisory locks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4016 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4017 |
if (lockf(fd, F_LOCK, 0) != -1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4018 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4019 |
} |
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 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4025 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4026 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4027 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4028 |
supportsFileLinks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4029 |
"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
|
4030 |
Typically, only unix returns true here." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4031 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4032 |
^ true |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4033 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4034 |
"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
|
4035 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4036 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4037 |
supportsFileLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4038 |
"return true, if the OS supports file locking" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4039 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4040 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4041 |
#if defined(F_SETLK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4042 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4043 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4044 |
# if defined(LOCK_EX) && defined(LOCK_UN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4045 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4046 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4047 |
# if defined(F_LOCK) && defined(F_UNLOCK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4048 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4049 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4050 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4051 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4052 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4053 |
^ false |
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 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4056 |
UnixOperatingSystem supportsFileLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4057 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4058 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4059 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4060 |
supportsNonBlockingFileLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4061 |
"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
|
4062 |
(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
|
4063 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4064 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4065 |
#if defined(F_SETLK) && defined(F_SETLKW) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4066 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4067 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4068 |
# 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
|
4069 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4070 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4071 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4072 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4073 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4074 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4075 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4076 |
UnixOperatingSystem supportsNonBlockingFileLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4077 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4078 |
! |
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 |
supportsSharedLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4081 |
"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
|
4082 |
file locking." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4083 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4084 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4085 |
#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
|
4086 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4087 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4088 |
# 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
|
4089 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4090 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4091 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4092 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4093 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4094 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4095 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4096 |
UnixOperatingSystem supportsNonBlockingFileLocks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4097 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4098 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4099 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4100 |
supportsSymbolicLinks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4101 |
"return true, if the OS supports symbolic links on files/directories. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4102 |
Typically, only Unix returns true here" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4103 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4104 |
^ true |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4105 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4106 |
"Modified: / 5.6.1998 / 18:35:11 / cg" |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4107 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4108 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4109 |
unlockFD:aFileDescriptor |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4110 |
"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
|
4111 |
which was previously aquired by #lockFD:. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4112 |
Return false, if the unlock failed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4113 |
(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
|
4114 |
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
|
4115 |
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
|
4116 |
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
|
4117 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4118 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4119 |
if (__isSmallInteger(aFileDescriptor)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4120 |
int fd = __intVal(aFileDescriptor); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4121 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4122 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4123 |
* claus: sigh - each one has a different interface ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4124 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4125 |
#if defined(F_SETLK) |
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 |
* new fcntl(SETLK) interface; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4129 |
* available on SYSV4 and Linux |
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 |
struct flock flock; |
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 |
flock.l_type = F_UNLCK; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4134 |
flock.l_whence = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4135 |
flock.l_start = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4136 |
flock.l_len = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4137 |
if (fcntl(fd, F_SETLK, &flock) != -1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4138 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4139 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4140 |
} |
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 |
#else /* no F_SETLK available */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4143 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4144 |
# if defined(LOCK_EX) && defined(LOCK_UN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4145 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4146 |
* BSD 4.3 advisory locks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4147 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4148 |
if (flock(fd, LOCK_UN) != -1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4149 |
RETURN (true); |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4152 |
# else /* no flock available */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4153 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4154 |
# if defined(F_LOCK) && defined(F_UNLOCK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4155 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4156 |
* SYSV3 advisory locks |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4157 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4158 |
if (lockf(fd, F_UNLOCK, 0) != -1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4159 |
RETURN (true); |
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 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4162 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4163 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4164 |
} |
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 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4167 |
! ! |
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 |
!UnixOperatingSystem class methodsFor:'file queries'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4170 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4171 |
caseSensitiveFilenames |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4172 |
"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
|
4173 |
On MSDOS, this will return false; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4174 |
on a real OS, we return true." |
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 |
^ true |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4177 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4178 |
"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
|
4179 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4180 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4181 |
compressPath:pathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4182 |
"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
|
4183 |
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
|
4184 |
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
|
4185 |
if realPath and popen failed." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4186 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4187 |
|names n "{ Class: SmallInteger }" | |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4188 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4189 |
names := pathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4190 |
asCollectionOfSubstringsSeparatedBy:self fileSeparator. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4191 |
names := names asOrderedCollection. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4192 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4193 |
cut off initial double-slashes |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4194 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4195 |
[names startsWith:#('' '')] whileTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4196 |
names removeFirst. |
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 |
cut off double-slashes at end |
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 |
[names endsWith:#('')] whileTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4202 |
names removeLast. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4203 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4204 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4205 |
cut off current-dir at beginning |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4206 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4207 |
n := names size. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4208 |
[(n >= 2) and:[names startsWith:#('.')]] whileTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4209 |
names removeFirst. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4210 |
n := n - 1. |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4213 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4214 |
cut off parent-dirs at end |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4215 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4216 |
[(n > 2) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4217 |
and:[(names endsWith:#('..')) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4218 |
and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4219 |
names removeLast; removeLast. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4220 |
n := n - 2. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4221 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4222 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4223 |
^ names asStringWith:self fileSeparator |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4224 |
from:1 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4225 |
to:n |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4226 |
compressTabs:false final:nil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4227 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4228 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4229 |
UnixOperatingSystem compressPath:'./..' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4230 |
UnixOperatingSystem compressPath:'/foo/bar/baz/..' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4231 |
UnixOperatingSystem compressPath:'foo/bar/baz/..' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4232 |
UnixOperatingSystem compressPath:'foo/bar/baz/../' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4233 |
UnixOperatingSystem compressPath:'foo/bar/baz/..///' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4234 |
UnixOperatingSystem compressPath:'///foo/bar/baz/..///' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4235 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4236 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4237 |
"Modified: 1.11.1996 / 20:13:48 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4238 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4239 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4240 |
fileSeparator |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4241 |
"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
|
4242 |
This character differs for MSDOS and other systems, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4243 |
(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
|
4244 |
preparation for the future)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4245 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4246 |
^ $/ |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4247 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4248 |
"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
|
4249 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4250 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4251 |
getDriveList |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4252 |
"return a list of volumes in the system. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4253 |
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
|
4254 |
- 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
|
4255 |
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
|
4256 |
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
|
4257 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4258 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4259 |
"/ default: retrurn array filled with |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4260 |
"/ root, home and current directories. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4261 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4262 |
^ Array |
3540 | 4263 |
with:'/' |
4264 |
with:(self getHomeDirectory) |
|
4265 |
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
|
4266 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4267 |
"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
|
4268 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4269 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4270 |
infoOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4271 |
"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
|
4272 |
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
|
4273 |
the returned object) is: |
3540 | 4274 |
type - a symbol giving the files type |
4275 |
mode - numeric access mode |
|
4276 |
uid - owners user id |
|
4277 |
gid - owners group id |
|
4278 |
size - files size |
|
4279 |
id - files number (i.e. inode number) |
|
4280 |
accessed - last access time (as Timestamp) |
|
4281 |
modified - last modification time (as Timestamp) |
|
4282 |
statusChanged - last status change time (as Timestamp) |
|
4283 |
alternativeName - (windows only: the MSDOS name of the file) |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4284 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4285 |
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
|
4286 |
all of the information. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4287 |
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
|
4288 |
For symbolic links (if supported by the OS), |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4289 |
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
|
4290 |
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
|
4291 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4292 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4293 |
|info type mode uid gid size id |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4294 |
atime mtime ctime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4295 |
aOStime mOStime cOStime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4296 |
aYr aMon aDay aHr aMin aSec aMS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4297 |
mYr mMon mDay mHr mMin mSec mMS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4298 |
cYr cMon cDay cHr cMin cSec cMS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4299 |
name2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4300 |
recordFormat recordAttribs fixedHeaderSize recordSize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4301 |
recordFormatNumeric| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4302 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4303 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4304 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4305 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4306 |
char nameBuffer[15]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4307 |
unsigned INT ino; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4308 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4309 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4310 |
# ifdef TRACE_STAT_CALLS |
3540 | 4311 |
printf("stat on '%s' for info\n", __stringVal(aPathName)); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4312 |
# endif |
3540 | 4313 |
__BEGIN_INTERRUPTABLE__ |
4314 |
do { |
|
4315 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4316 |
} while ((ret < 0) && (errno == EINTR)); |
|
4317 |
__END_INTERRUPTABLE__ |
|
4318 |
||
4319 |
if (ret < 0) { |
|
4320 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4321 |
RETURN ( nil ); |
|
4322 |
} |
|
4323 |
switch (buf.st_mode & S_IFMT) { |
|
4324 |
case S_IFDIR: |
|
4325 |
type = @symbol(directory); |
|
4326 |
break; |
|
4327 |
||
4328 |
case S_IFREG: |
|
4329 |
type = @symbol(regular); |
|
4330 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4331 |
# ifdef S_IFCHR |
3540 | 4332 |
case S_IFCHR: |
4333 |
type = @symbol(characterSpecial); |
|
4334 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4335 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4336 |
# ifdef S_IFBLK |
3540 | 4337 |
case S_IFBLK: |
4338 |
type = @symbol(blockSpecial); |
|
4339 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4340 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4341 |
# ifdef S_IFMPC |
3540 | 4342 |
case S_IFMPC: |
4343 |
type = @symbol(multiplexedCharacterSpecial); |
|
4344 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4345 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4346 |
# ifdef S_IFMPB |
3540 | 4347 |
case S_IFMPB: |
4348 |
type = @symbol(multiplexedBlockSpecial); |
|
4349 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4350 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4351 |
# ifdef S_IFLNK |
3540 | 4352 |
case S_IFLNK: |
4353 |
type = @symbol(symbolicLink); |
|
4354 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4355 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4356 |
# ifdef S_IFSOCK |
3540 | 4357 |
case S_IFSOCK: |
4358 |
type = @symbol(socket); |
|
4359 |
break; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4360 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4361 |
# ifdef S_IFIFO |
3540 | 4362 |
case S_IFIFO: |
4363 |
type = @symbol(fifo); |
|
4364 |
break; |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4365 |
# endif |
3540 | 4366 |
default: |
4367 |
type = @symbol(unknown); |
|
4368 |
break; |
|
4369 |
} |
|
4370 |
||
4371 |
ino = buf.st_ino; |
|
4372 |
id = __MKUINT(ino); |
|
4373 |
||
4374 |
mode = __MKSMALLINT(buf.st_mode & 0777); |
|
4375 |
uid = __MKSMALLINT(buf.st_uid); |
|
4376 |
gid = __MKSMALLINT(buf.st_gid); |
|
4377 |
size = __MKUINT(buf.st_size); |
|
4378 |
aOStime = __MKUINT(buf.st_atime); |
|
4379 |
mOStime = __MKUINT(buf.st_mtime); |
|
4380 |
cOStime = __MKUINT(buf.st_ctime); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4381 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4382 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4383 |
mode notNil ifTrue:[ |
3540 | 4384 |
aOStime notNil ifTrue:[ |
4385 |
atime := AbsoluteTime fromOSTime:(aOStime * 1000). |
|
4386 |
mtime := AbsoluteTime fromOSTime:(mOStime * 1000). |
|
4387 |
ctime := AbsoluteTime fromOSTime:(cOStime * 1000). |
|
4388 |
] ifFalse:[ |
|
4389 |
atime := AbsoluteTime day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS. |
|
4390 |
mtime := AbsoluteTime day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS. |
|
4391 |
ctime := AbsoluteTime day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS. |
|
4392 |
]. |
|
4393 |
||
4394 |
info := FileStatusInfo |
|
4395 |
type:type |
|
4396 |
mode:mode |
|
4397 |
uid:uid |
|
4398 |
gid:gid |
|
4399 |
size:size |
|
4400 |
id:id |
|
4401 |
accessed:atime |
|
4402 |
modified:mtime |
|
4403 |
statusChanged:ctime |
|
4404 |
path:nil |
|
4405 |
alternativeName:name2. |
|
4406 |
||
4407 |
recordFormat notNil ifTrue:[ |
|
4408 |
"/ additional VMS info |
|
4409 |
info |
|
4410 |
recordFormat:recordFormat |
|
4411 |
recordFormatNumeric:recordFormatNumeric |
|
4412 |
recordAttributes:recordAttribs |
|
4413 |
fixedHeaderSize:fixedHeaderSize |
|
4414 |
recordSize:recordSize |
|
4415 |
]. |
|
4416 |
^ info |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4417 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4418 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4419 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4420 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4421 |
UnixOperatingSystem infoOf:'/' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4422 |
(UnixOperatingSystem infoOf:'/') uid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4423 |
(UnixOperatingSystem infoOf:'/') accessed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4424 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4425 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4426 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4427 |
isDirectory:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4428 |
"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
|
4429 |
(i.e. exists and is a directory). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4430 |
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
|
4431 |
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
|
4432 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4433 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4434 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4435 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4436 |
if (__isString(aPathName)) { |
3540 | 4437 |
struct stat buf; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4438 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4439 |
# ifdef TRACE_STAT_CALLS |
3540 | 4440 |
printf("stat on '%s' for isDirectory\n", __stringVal(aPathName)); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4441 |
# endif |
3540 | 4442 |
__BEGIN_INTERRUPTABLE__ |
4443 |
do { |
|
4444 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4445 |
} while ((ret < 0) && (errno == EINTR)); |
|
4446 |
__END_INTERRUPTABLE__ |
|
4447 |
if (ret < 0) { |
|
4448 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4449 |
RETURN ( false ); |
|
4450 |
} |
|
4451 |
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
|
4452 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4453 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4454 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4455 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4456 |
"an alternative implementation would be: |
3540 | 4457 |
^ (self infoOf:aPathName) type == #directory |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4458 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4459 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4460 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4461 |
isExecutable:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4462 |
"return true, if the given file is executable. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4463 |
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
|
4464 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4465 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4466 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4467 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4468 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4469 |
# ifdef TRACE_ACCESS_CALLS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4470 |
printf("access on '%s' for executable\n", __stringVal(aPathName)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4471 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4472 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4473 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4474 |
ret = access(__stringVal(aPathName), X_OK); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4475 |
} while ((ret < 0) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4476 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4477 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4478 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4479 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4480 |
RETURN ( ((ret == 0) ? true : false) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4481 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4482 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4483 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4484 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4485 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4486 |
isReadable:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4487 |
"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
|
4488 |
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
|
4489 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4490 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4491 |
int ret; |
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 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4494 |
# ifdef TRACE_ACCESS_CALLS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4495 |
printf("access on '%s' for readable\n", __stringVal(aPathName)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4496 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4497 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4498 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4499 |
ret = access(__stringVal(aPathName), R_OK); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4500 |
} while ((ret < 0) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4501 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4502 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4503 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4504 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4505 |
RETURN ( ((ret == 0) ? true : false) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4506 |
} |
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 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4509 |
! |
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 |
isSymbolicLink:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4512 |
"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
|
4513 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4514 |
^ (self linkInfoOf:aPathName) notNil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4515 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4516 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4517 |
UnixOperatingSystem isSymbolicLink:'Make.proto' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4518 |
UnixOperatingSystem isSymbolicLink:'Makefile' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4519 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4520 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4521 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4522 |
isValidPath:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4523 |
"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
|
4524 |
(i.e. the file or directory exists)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4525 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4526 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4527 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4528 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4529 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4530 |
if (__isString(aPathName) || __isSymbol(aPathName) ) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4531 |
# ifdef TRACE_STAT_CALLS |
3540 | 4532 |
printf("stat on '%s' for isValidPath\n", __stringVal(aPathName)); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4533 |
# endif |
3540 | 4534 |
__BEGIN_INTERRUPTABLE__ |
4535 |
do { |
|
4536 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4537 |
} while ((ret < 0) && (errno == EINTR)); |
|
4538 |
__END_INTERRUPTABLE__ |
|
4539 |
if (ret < 0) { |
|
4540 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4541 |
RETURN (false); |
|
4542 |
} |
|
4543 |
RETURN ( ret ? false : true ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4544 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4545 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4546 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4547 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4548 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4549 |
isWritable:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4550 |
"return true, if the given file is writable. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4551 |
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
|
4552 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4553 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4554 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4555 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4556 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4557 |
# ifdef TRACE_ACCESS_CALLS |
3540 | 4558 |
printf("access on '%s' for writable\n", __stringVal(aPathName)); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4559 |
# endif |
3540 | 4560 |
__BEGIN_INTERRUPTABLE__ |
4561 |
do { |
|
4562 |
ret = access(__stringVal(aPathName), W_OK); |
|
4563 |
} while ((ret < 0) && (errno == EINTR)); |
|
4564 |
__END_INTERRUPTABLE__ |
|
4565 |
if (ret < 0) { |
|
4566 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4567 |
} |
|
4568 |
RETURN ( ((ret == 0) ? true : false) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4569 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4570 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4571 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4572 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4573 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4574 |
linkInfoOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4575 |
"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
|
4576 |
IFF aPathName is a symbolic link. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4577 |
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
|
4578 |
(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
|
4579 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4580 |
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
|
4581 |
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
|
4582 |
in case of a symbolic link." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4583 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4584 |
|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
|
4585 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4586 |
%{ /* STACK: 1200 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4587 |
#if defined(S_IFLNK) && !defined(__openVMS__) && !defined(MSDOS_LIKE) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4588 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4589 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4590 |
char pathBuffer[1024]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4591 |
unsigned INT ino; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4592 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4593 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4594 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4595 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4596 |
ret = lstat((char *) __stringVal(aPathName), &buf); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4597 |
} while ((ret < 0) && (errno == EINTR)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4598 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4599 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4600 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4601 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4602 |
RETURN ( nil ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4603 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4604 |
switch (buf.st_mode & S_IFMT) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4605 |
default: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4606 |
RETURN ( nil ); /* not a symbolic link */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4607 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4608 |
case S_IFLNK: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4609 |
type = @symbol(symbolicLink); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4610 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4611 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4612 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4613 |
ino = buf.st_ino; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4614 |
id = __MKUINT(ino); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4615 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4616 |
mode = __MKSMALLINT(buf.st_mode & 0777); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4617 |
uid = __MKSMALLINT(buf.st_uid); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4618 |
gid = __MKSMALLINT(buf.st_gid); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4619 |
size = __MKUINT(buf.st_size); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4620 |
atime = __MKUINT(buf.st_atime); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4621 |
mtime = __MKUINT(buf.st_mtime); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4622 |
ctime = __MKUINT(buf.st_ctime); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4623 |
if ((ret = readlink((char *) __stringVal(aPathName), pathBuffer, sizeof(pathBuffer))) < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4624 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4625 |
RETURN ( nil ); |
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 |
pathBuffer[ret] = '\0'; /* readlink does not 0-terminate */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4628 |
path = __MKSTRING(pathBuffer); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4629 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4630 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4631 |
RETURN ( nil ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4632 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4633 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4634 |
mode notNil ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4635 |
info := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4636 |
^ FileStatusInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4637 |
type:type |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4638 |
mode:mode |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4639 |
uid:uid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4640 |
gid:gid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4641 |
size:size |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4642 |
id:id |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4643 |
accessed:(AbsoluteTime fromOSTime:(atime * 1000)) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4644 |
modified:(AbsoluteTime fromOSTime:(mtime * 1000)) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4645 |
statusChanged:(AbsoluteTime fromOSTime:(ctime * 1000)) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4646 |
path:path |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4647 |
alternativeName:nil |
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 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4650 |
|
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 |
UnixOperatingSystem infoOf:'Make.proto' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4653 |
UnixOperatingSystem linkInfoOf:'Make.proto' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4654 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4655 |
UnixOperatingSystem infoOf:'resources/motif.style' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4656 |
UnixOperatingSystem linkInfoOf:'resources/motif.style' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4657 |
" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4660 |
parentDirectoryName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4661 |
"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
|
4662 |
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
|
4663 |
for other systems. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4664 |
(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
|
4665 |
preparation for the future)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4666 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4667 |
^ '..' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4668 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4669 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4670 |
pathNameOf:pathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4671 |
"return the pathName of the argument, aPathString, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4672 |
- 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
|
4673 |
This method needs the path to be valid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4674 |
(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
|
4675 |
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
|
4676 |
from what you expect." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4677 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4678 |
|p path command| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4679 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4680 |
"some systems have a convenient function for this ..." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4681 |
path := self primPathNameOf:pathName. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4682 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4683 |
path isNil ifTrue:[ |
3540 | 4684 |
(self isValidPath:pathName) ifFalse:[ |
4685 |
p := pathName. |
|
4686 |
[(p size > 1) |
|
4687 |
and:[p endsWith:(self fileSeparator)] |
|
4688 |
] whileTrue:[ |
|
4689 |
p := p copyWithoutLast:1. |
|
4690 |
]. |
|
4691 |
^ p |
|
4692 |
]. |
|
4693 |
||
4694 |
(SlowFork==true or:[PipeFailed==true]) ifFalse:[ |
|
4695 |
PipeStream openErrorSignal handle:[:ex | |
|
4696 |
PipeFailed := true. |
|
4697 |
'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR. |
|
4698 |
ex return. |
|
4699 |
] do:[ |
|
4700 |
"have to fall back ..." |
|
4701 |
command := 'cd ' , pathName , '; pwd'. |
|
4702 |
p := PipeStream readingFrom:command. |
|
4703 |
]. |
|
4704 |
||
4705 |
(p isNil or:[p atEnd]) ifTrue:[ |
|
4706 |
('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR. |
|
4707 |
] ifFalse:[ |
|
4708 |
path := p nextLine. |
|
4709 |
p close. |
|
4710 |
] |
|
4711 |
]. |
|
4712 |
path isNil ifTrue:[ |
|
4713 |
"/ |
|
4714 |
"/ return the original - there is nothing else can we do |
|
4715 |
"/ |
|
4716 |
path := pathName |
|
4717 |
]. |
|
4718 |
(SlowFork==true or:[ForkFailed==true]) ifTrue:[ |
|
4719 |
path := self compressPath:path |
|
4720 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4721 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4722 |
^ path. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4723 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4724 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4725 |
UnixOperatingSystem pathNameOf:'.' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4726 |
UnixOperatingSystem pathNameOf:'../smalltalk/../smalltalk' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4727 |
UnixOperatingSystem pathNameOf:'../../..' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4728 |
UnixOperatingSystem pathNameOf:'..' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4729 |
UnixOperatingSystem pathNameOf:'/tmp////' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4730 |
UnixOperatingSystem pathNameOf:'/foo/bar' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4731 |
UnixOperatingSystem pathNameOf:'/foo/bar/' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4732 |
UnixOperatingSystem pathNameOf:'/foo/bar//' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4733 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4734 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4735 |
"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
|
4736 |
"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
|
4737 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4738 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4739 |
primIdOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4740 |
"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
|
4741 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4742 |
%{ /* UNLIMITEDSTACK(WIN32) */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4743 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4744 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4745 |
unsigned INT ino; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4746 |
OBJ retVal; |
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 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4749 |
# ifdef TRACE_STAT_CALLS |
3540 | 4750 |
printf("stat on '%s' for id\n", __stringVal(aPathName)); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4751 |
# endif |
3540 | 4752 |
__BEGIN_INTERRUPTABLE__ |
4753 |
do { |
|
4754 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4755 |
} while (ret < 0 && errno == EINTR); |
|
4756 |
__END_INTERRUPTABLE__ |
|
4757 |
if (ret >= 0) { |
|
4758 |
ino = buf.st_ino; |
|
4759 |
retVal = __MKUINT(ino); |
|
4760 |
RETURN (retVal); |
|
4761 |
} |
|
4762 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4763 |
RETURN (nil); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4764 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4765 |
RETURN (nil); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4766 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4767 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4768 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4769 |
primPathNameOf:pathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4770 |
"return the pathName of the argument, aPathString, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4771 |
- 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
|
4772 |
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
|
4773 |
realPath library function. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4774 |
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
|
4775 |
from what you expect." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4776 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4777 |
|path| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4778 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4779 |
%{ /* STACK: 16000 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4780 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4781 |
if (__isString(pathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4782 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4783 |
#ifdef HAS_GETCWD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4784 |
# if defined(UNIX_LIKE) ||defined(__VMS__) || defined(MSDOS_LIKE) |
3540 | 4785 |
if (strcmp(__stringVal(pathName), ".") == 0) |
4786 |
{ |
|
4787 |
char nameBuffer[MAXPATHLEN + 1]; |
|
4788 |
||
4789 |
if (@global(CurrentDirectory) == nil) { |
|
4790 |
if (getcwd(nameBuffer, MAXPATHLEN)) { |
|
4791 |
OBJ d; |
|
4792 |
||
4793 |
@global(CurrentDirectory) = d = __MKSTRING(nameBuffer); |
|
4794 |
__GSTORE(d); |
|
4795 |
} |
|
4796 |
} |
|
4797 |
RETURN (@global(CurrentDirectory)); |
|
4798 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4799 |
# endif /* UNIX_LIKE */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4800 |
#endif /* HAS_GETCWD */ |
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 |
#ifdef HAS_REALPATH |
3540 | 4803 |
{ |
4804 |
char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1]; |
|
4805 |
||
4806 |
if (realpath(__stringVal(pathName), nameBuffer)) { |
|
4807 |
RETURN ( __MKSTRING(nameBuffer) ); |
|
4808 |
} |
|
4809 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4810 |
#endif /* ! HAS_REALPATH */ |
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 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4813 |
^ nil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4814 |
! |
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 |
timeOfLastAccess:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4817 |
"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
|
4818 |
For nonexistent files, nil is returned." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4819 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4820 |
"could be implemented as: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4821 |
(self infoOf:aPathName) accessed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4822 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4823 |
|osSeconds i| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4824 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4825 |
#if !defined(WIN32) && !defined(__VMS__) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4826 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4827 |
time_t mtime; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4828 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4829 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4830 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4831 |
# ifdef TRACE_STAT_CALLS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4832 |
printf("stat on '%s' for timeOfLastAccess\n", __stringVal(aPathName)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4833 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4834 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4835 |
do { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4836 |
ret = stat((char *) __stringVal(aPathName), &buf); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4837 |
} while (ret < 0 && errno == EINTR); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4838 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4839 |
if (ret < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4840 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4841 |
RETURN (nil); |
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 |
osSeconds = __MKUINT(buf.st_atime); |
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 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4846 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4847 |
osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4848 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4849 |
i := self infoOf:aPathName. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4850 |
i notNil ifTrue:[^ i accessed]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4851 |
^ nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4852 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4853 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4854 |
UnixOperatingSystem timeOfLastAccess:'/' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4855 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4856 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4857 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4858 |
timeOfLastChange:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4859 |
"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
|
4860 |
For nonexistent files, nil is returned." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4861 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4862 |
"could be implemented as: |
3540 | 4863 |
(self infoOf:aPathName) modified |
3496
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4866 |
|osSeconds i| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4867 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4868 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4869 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4870 |
time_t mtime; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4871 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4872 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4873 |
# ifdef TRACE_STAT_CALLS |
3540 | 4874 |
printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName)); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4875 |
# endif |
3540 | 4876 |
__BEGIN_INTERRUPTABLE__ |
4877 |
do { |
|
4878 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4879 |
} while (ret < 0 && errno == EINTR); |
|
4880 |
__END_INTERRUPTABLE__ |
|
4881 |
if (ret < 0) { |
|
4882 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4883 |
RETURN ( nil ); |
|
4884 |
} |
|
4885 |
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
|
4886 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4887 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4888 |
osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4889 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4890 |
i := self infoOf:aPathName. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4891 |
i notNil ifTrue:[^ i modified]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4892 |
^ nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4893 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4894 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4895 |
UnixOperatingSystem timeOfLastChange:'/' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4896 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4897 |
! |
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 |
typeOf:aPathName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4900 |
"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
|
4901 |
nil is returned. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4902 |
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
|
4903 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4904 |
|i| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4905 |
|
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 |
this could have been implemented as: |
3540 | 4908 |
(self infoOf:aPathName) type |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4909 |
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
|
4910 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4911 |
|
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 |
struct stat buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4914 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4915 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4916 |
if (__isString(aPathName)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4917 |
# ifdef TRACE_STAT_CALLS |
3540 | 4918 |
printf("stat on '%s' for type\n", __stringVal(aPathName)); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4919 |
# endif |
3540 | 4920 |
__BEGIN_INTERRUPTABLE__ |
4921 |
do { |
|
4922 |
ret = stat((char *) __stringVal(aPathName), &buf); |
|
4923 |
} while (ret < 0 && errno == EINTR); |
|
4924 |
__END_INTERRUPTABLE__ |
|
4925 |
if (ret < 0) { |
|
4926 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
4927 |
RETURN ( nil ); |
|
4928 |
} |
|
4929 |
switch (buf.st_mode & S_IFMT) { |
|
4930 |
case S_IFDIR: |
|
4931 |
RETURN ( @symbol(directory) ); |
|
4932 |
case S_IFREG: |
|
4933 |
RETURN ( @symbol(regular) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4934 |
# ifdef S_IFCHR |
3540 | 4935 |
case S_IFCHR: |
4936 |
RETURN ( @symbol(characterSpecial) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4937 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4938 |
# ifdef S_IFBLK |
3540 | 4939 |
case S_IFBLK: |
4940 |
RETURN ( @symbol(blockSpecial) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4941 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4942 |
# ifdef S_IFLNK |
3540 | 4943 |
case S_IFLNK: |
4944 |
RETURN ( @symbol(symbolicLink) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4945 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4946 |
# ifdef S_IFSOCK |
3540 | 4947 |
case S_IFSOCK: |
4948 |
RETURN ( @symbol(socket) ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4949 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4950 |
# ifdef S_IFIFO |
3540 | 4951 |
case S_IFIFO: |
4952 |
RETURN ( @symbol(fifo) ); |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4953 |
# endif |
3540 | 4954 |
default: |
4955 |
RETURN ( @symbol(unknown) ); |
|
4956 |
} |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4957 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4958 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4959 |
i := self infoOf:aPathName. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4960 |
i notNil ifTrue:[^ i type]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4961 |
^ nil. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4962 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4963 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4964 |
UnixOperatingSystem typeOf:'/' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4965 |
UnixOperatingSystem typeOf:'.' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4966 |
UnixOperatingSystem typeOf:'Make.proto' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4967 |
UnixOperatingSystem typeOf:'resources/motif.style' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4968 |
" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4971 |
volumeNameOf:aPathString |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4972 |
"return the volumeName of the argument, aPath |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4973 |
- thats the name of the volume where aPath is. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4974 |
Not all UnixOperatingSystems support/use volumes; on unix, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4975 |
this always returns an empty string." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4976 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4977 |
^ '' |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4978 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
4979 |
"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
|
4980 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4981 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4982 |
!UnixOperatingSystem class methodsFor:'interrupts & signals'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4983 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4984 |
defaultSignal:signalNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4985 |
"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
|
4986 |
Dont confuse Unix signals with smalltalk signals. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4987 |
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
|
4988 |
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
|
4989 |
default for SIGQUIT (^ \) is to dump core. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4990 |
Also, NOTICE that signal numbers are not portable between unix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4991 |
systems - use UnixOperatingSystem sigXXX to get the numeric value for |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4992 |
a signal." |
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 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4995 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4996 |
if (__isSmallInteger(signalNumber)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4997 |
#ifdef SIG_DFL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4998 |
signal(__intVal(signalNumber), SIG_DFL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
4999 |
RETURN (self); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5000 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5001 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5002 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5003 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5004 |
this error is triggered on non-integer argument |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5005 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5006 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5007 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5008 |
"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
|
5009 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5010 |
'if you hit ^C now, Smalltalk will exit immediately' printNewline. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5011 |
UnixOperatingSystem defaultSignal:(UnixOperatingSystem sigINT). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5012 |
1 to:1000000 do:[:i| ]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5013 |
UnixOperatingSystem enableSignal:(UnixOperatingSystem sigINT). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5014 |
'normal ^C handling again.' printNewline |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5015 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5016 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5017 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5018 |
disableIOInterruptsOn:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5019 |
"turn off IO interrupts for a filedescriptor" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5020 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5021 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5022 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5023 |
int ret, flags, f; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5024 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5025 |
#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
|
5026 |
if (__isSmallInteger(fd)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5027 |
f = __intVal(fd); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5028 |
# if defined(SYSV4) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5029 |
ret = ioctl(f, I_SETSIG, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5030 |
# else /*! SYSV4*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5031 |
flags = fcntl(f, F_GETFL, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5032 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5033 |
* if already clear, there is no need for this syscall ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5034 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5035 |
if (flags & FASYNC) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5036 |
ret = fcntl(f, F_SETFL, flags & ~FASYNC); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5037 |
if (ret >= 0) ret = flags; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5038 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5039 |
ret = flags; |
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 |
# endif /* !SYSV4 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5042 |
RETURN ( __MKSMALLINT(ret) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5043 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5044 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5045 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5046 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5047 |
this error is triggered on non-integer argument |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5048 |
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
|
5049 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5050 |
^ self primitiveFailed |
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 |
disableSignal:signalNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5054 |
"disable (Unix-) signal processing for signalNumber. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5055 |
Dont confuse Unix signals with smalltalk signals. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5056 |
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
|
5057 |
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
|
5058 |
handling. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5059 |
Also, NOTICE that signal numbers are not portable between unix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5060 |
systems - use UnixOperatingSystem sigXXX to get the numeric value for |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5061 |
a signal. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5062 |
Use only for fully debugged stand alone applications." |
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 |
%{ /* NOCONTEXT */ |
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 |
if (__isSmallInteger(signalNumber)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5067 |
int sigNo = __intVal(signalNumber); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5068 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5069 |
if (sigNo == 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5070 |
RETURN (self); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5071 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5072 |
#ifdef SIG_IGN |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5073 |
signal(sigNo, SIG_IGN); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5074 |
RETURN (self); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5075 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5076 |
} |
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 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5079 |
this error is triggered on non-integer argument |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5080 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5081 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5082 |
|
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 |
'now, ^C is totally ignored ...' printNewline. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5085 |
UnixOperatingSystem disableSignal:(UnixOperatingSystem sigINT). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5086 |
1 to:1000000 do:[:i| ]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5087 |
UnixOperatingSystem enableSignal:(UnixOperatingSystem sigINT). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5088 |
'^C handled again.' printNewline |
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 |
! |
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 |
disableTimer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5093 |
"disable timer interrupts. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5094 |
WARNING: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5095 |
the system will not operate correctly with timer interrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5096 |
disabled, because no scheduling or timeouts are possible." |
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 |
%{ /* NOCONTEXT */ |
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 |
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5101 |
struct itimerval dt; |
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 |
dt.it_interval.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5104 |
dt.it_interval.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5105 |
dt.it_value.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5106 |
dt.it_value.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5107 |
setitimer(ITIMER_REAL, &dt, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5108 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5109 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5110 |
# if defined(WIN32) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5111 |
extern void __win32ClearTimer(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5112 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5113 |
__win32ClearTimer(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5114 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5115 |
# endif /* WIN32 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5116 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5117 |
# if defined(__VMS__) && defined(USE_AST_TIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5118 |
extern void __vmsClearTimer(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5119 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5120 |
__vmsClearTimer(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5121 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5122 |
# endif /* __VMS__ */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5123 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5124 |
# if defined(USE_SLOW_ALARM) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5125 |
# if defined(SIGALRM) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5126 |
alarm(0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5127 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5128 |
# endif /* SIGALRM */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5129 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5130 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5131 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5132 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5133 |
^ false |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5136 |
enableChildSignalInterrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5137 |
"enable childSignal interrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5138 |
(SIGCHLD, if the architecture supports it). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5139 |
After enabling, these signals will send the message |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5140 |
'childSignalInterrupt' to the ChildSignalInterruptHandler object." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5141 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5142 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5143 |
#ifdef __VMS__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5144 |
extern void __vmsEnableChildInterrupts(); |
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 |
__vmsEnableChildInterrupts(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5147 |
RETURN(self); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5148 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5149 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5150 |
self enableSignal:(self sigCHLD) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5151 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5152 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5153 |
enableIOInterruptsOn:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5154 |
"turn on IO interrupts for a filedescriptor" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5155 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5156 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5157 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5158 |
int ret, flags, f; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5159 |
#ifndef __signalIoInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5160 |
extern void __signalIoInterrupt(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5161 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5162 |
static int firstCall = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5163 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5164 |
#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
|
5165 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5166 |
* SIGIO/SIGPOLL - data available for I/O |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5167 |
* (used to wake up waiting processes) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5168 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5169 |
#ifdef SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5170 |
# define THESIGNAL SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5171 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5172 |
# ifdef SIGPOLL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5173 |
# define THESIGNAL SIGPOLL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5174 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5175 |
# ifdef SIGURG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5176 |
# define THESIGNAL SIGURG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5177 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5178 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5179 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5180 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5181 |
if (__isSmallInteger(fd)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5182 |
if (firstCall) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5183 |
#ifdef HAS_SIGACTION |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5184 |
struct sigaction act; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5185 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5186 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5187 |
* Do not add SA_RESTART here. A signal can cause a |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5188 |
* thread switch, another thread can do a garbage collect |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5189 |
* and restarted system calls may write into old |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5190 |
* (collected) addresses. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5191 |
*/ |
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 |
act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5194 |
sigemptyset(&act.sa_mask); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5195 |
act.sa_handler = __signalIoInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5196 |
sigaction(THESIGNAL, &act, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5197 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5198 |
# ifdef HAS_SIGVEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5199 |
struct sigvec vec; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5200 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5201 |
vec.sv_flags = SV_INTERRUPT; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5202 |
sigemptyset(&vec.sv_mask); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5203 |
vec.sv_handler = __signalIoInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5204 |
sigvec(THESIGNAL, &vec, NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5205 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5206 |
signal(THESIGNAL, __signalIoInterrupt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5207 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5208 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5209 |
firstCall = 0; |
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 |
#undef THESIGNAL |
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 |
f = __intVal(fd); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5214 |
# if defined(SYSV4) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5215 |
ret = ioctl(f, I_SETSIG, S_INPUT | S_HIPRI | S_ERROR | S_RDNORM | S_RDBAND | S_MSG | S_HANGUP); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5216 |
# else /*! SYSV4*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5217 |
flags = fcntl(f, F_GETFL, 0); |
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 |
* if already set, there is no need for this syscall ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5220 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5221 |
if (flags & FASYNC) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5222 |
ret = flags; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5223 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5224 |
ret = fcntl(f, F_SETFL, flags | FASYNC); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5225 |
if (ret >= 0) ret = flags; |
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 |
# endif /*!SYSV4*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5228 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5229 |
#if defined(F_SETOWN) || defined(FIOSETOWN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5230 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5231 |
int pid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5232 |
int ok; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5233 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5234 |
pid = getpid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5235 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5236 |
# if defined(F_SETOWN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5237 |
ok = fcntl(f, F_SETOWN, pid); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5238 |
/* printf("F_SETOWN returns %d (%d)\n", ret, errno); */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5239 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5240 |
ok = ioctl(f, FIOSETOWN, &pid); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5241 |
/* printf("FIOSETOWN returns %d (%d)\n", ret, errno); */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5242 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5243 |
if (ok < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5244 |
ret = ok; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5245 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5246 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5247 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5248 |
RETURN ( __MKUINT(ret) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5249 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5250 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5251 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5252 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5253 |
this error is triggered on non-integer argument |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5254 |
or if the system does not support SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5255 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5256 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5257 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5258 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5259 |
enableSignal:signalNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5260 |
"enable (Unix-)signal processing for signalNumber. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5261 |
Dont confuse Unix signals with smalltalk signals. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5262 |
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
|
5263 |
(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
|
5264 |
sends #signalInterrupt:. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5265 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5266 |
NOTICE that signal numbers are not portable between unix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5267 |
systems - use UnixOperatingSystem sigXXX to get the numeric value for |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5268 |
a signal." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5269 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5270 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5271 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5272 |
#ifdef NSIG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5273 |
# define SIG_LIMIT NSIG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5274 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5275 |
# ifdef SIGUSR2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5276 |
# define SIG_LIMIT SIGUSR2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5277 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5278 |
# ifdef SIGUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5279 |
# define SIG_LIMIT SIGUSR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5280 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5281 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5282 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5283 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5284 |
#if defined(SIGPOLL) && !defined(SIGIO) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5285 |
# define SIGIO SIGPOLL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5286 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5287 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5288 |
#ifdef SIGCHLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5289 |
# define CHILD_SIGNAL SIGCHLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5290 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5291 |
# ifdef SIGCLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5292 |
# define CHILD_SIGNAL SIGCLD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5293 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5294 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5295 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5296 |
int sigNr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5297 |
#if defined(SIGINT) || defined(SIGQUIT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5298 |
# ifndef __signalUserInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5299 |
extern void __signalUserInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5300 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5301 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5302 |
#ifdef SIGFPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5303 |
# ifndef __signalFpExceptionInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5304 |
extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5305 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5306 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5307 |
#ifdef SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5308 |
# ifndef __signalIoInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5309 |
extern void __signalIoInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5310 |
# endif |
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 |
#ifdef CHILD_SIGNAL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5313 |
# ifndef __signalChildInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5314 |
extern void __signalChildInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5315 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5316 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5317 |
#ifdef SIGPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5318 |
# ifndef __signalPIPEInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5319 |
extern void __signalPIPEInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5320 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5321 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5322 |
#ifdef SIGBUS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5323 |
# ifndef __signalBUSInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5324 |
extern void __signalBUSInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5325 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5326 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5327 |
#ifdef SIGSEGV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5328 |
# ifndef __signalSEGVInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5329 |
extern void __signalSEGVInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5330 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5331 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5332 |
#if defined(SIGILL) || defined(SIGEMT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5333 |
# ifndef __signalTrapInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5334 |
extern void __signalTrapInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5335 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5336 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5337 |
#ifdef SIGALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5338 |
# ifndef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5339 |
# ifndef __signalTimerInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5340 |
extern void __signalTimerInterrupt(SIGHANDLER_ARG); |
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 |
#ifndef __signalInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5345 |
extern void __signalInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5346 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5347 |
void (*handler)(SIGHANDLER_ARG); |
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 |
if (__isSmallInteger(signalNumber) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5350 |
&& ((sigNr = __intVal(signalNumber)) >= 0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5351 |
#ifdef SIG_LIMIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5352 |
&& (sigNr <= SIG_LIMIT) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5353 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5354 |
) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5355 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5356 |
* standard signals are forced into standard handlers |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5357 |
* - all others go into general signalInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5358 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5359 |
#if defined(SIGPOLL) && defined(SIGIO) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5360 |
if (sigNr == SIGPOLL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5361 |
sigNr = SIGIO; |
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 |
switch (sigNr) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5364 |
case 0: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5365 |
/* enabling a non-supported signal */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5366 |
RETURN (self); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5367 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5368 |
#ifdef SIGBREAK |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5369 |
case SIGBREAK: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5370 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5371 |
#ifdef SIGINT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5372 |
case SIGINT: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5373 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5374 |
#ifdef SIGQUIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5375 |
case SIGQUIT: |
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 |
# ifdef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5378 |
#ifdef PROCESSDEBUGWIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5379 |
printf("ConsoleSignal %d\n",sigNr); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5380 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5381 |
SetConsoleCtrlHandler((PHANDLER_ROUTINE)__signalUserInterruptWIN32,TRUE); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5382 |
RETURN (self); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5383 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5384 |
# if defined(SIGINT) || defined(SIGQUIT) || defined(SIGBREAK) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5385 |
handler = __signalUserInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5386 |
break; |
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 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5389 |
#ifdef SIGFPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5390 |
case SIGFPE: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5391 |
handler = __signalFpExceptionInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5392 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5393 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5394 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5395 |
#ifdef SIGPIPE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5396 |
case SIGPIPE: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5397 |
handler = __signalPIPEInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5398 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5399 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5400 |
#ifdef SIGBUS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5401 |
case SIGBUS: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5402 |
handler = __signalBUSInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5403 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5404 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5405 |
#ifdef SIGSEGV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5406 |
case SIGSEGV: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5407 |
handler = __signalSEGVInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5408 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5409 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5410 |
#ifdef SIGILL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5411 |
case SIGILL: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5412 |
handler = __signalTrapInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5413 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5414 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5415 |
#ifdef SIGEMT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5416 |
case SIGEMT: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5417 |
handler = __signalTrapInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5418 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5419 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5420 |
#ifdef SIGIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5421 |
case SIGIO: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5422 |
handler = __signalIoInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5423 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5424 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5425 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5426 |
#ifdef CHILD_SIGNAL |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5427 |
case CHILD_SIGNAL: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5428 |
handler = __signalChildInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5429 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5430 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5431 |
#ifdef SIGALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5432 |
# ifndef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5433 |
case SIGALRM: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5434 |
handler = __signalTimerInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5435 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5436 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5437 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5438 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5439 |
default: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5440 |
handler = __signalInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5441 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5442 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5443 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5444 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5445 |
#ifdef HAS_SIGACTION |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5446 |
struct sigaction act; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5447 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5448 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5449 |
* Do not add SA_RESTART here. A signal can cause a |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5450 |
* thread switch, another thread can do a garbage collect |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5451 |
* and restarted system calls may write into old |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5452 |
* (collected) addresses. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5453 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5454 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5455 |
act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5456 |
sigemptyset(&act.sa_mask); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5457 |
act.sa_handler = handler; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5458 |
sigaction(sigNr, &act, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5459 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5460 |
# ifdef HAS_SIGVEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5461 |
struct sigvec vec; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5462 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5463 |
vec.sv_flags = SV_INTERRUPT; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5464 |
sigemptyset(&vec.sv_mask); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5465 |
vec.sv_handler = handler; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5466 |
sigvec(sigNr, &vec, NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5467 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5468 |
# ifdef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5469 |
#ifdef PROCESSDEBUGWIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5470 |
printf("signal %d can't change handler\n",sigNr); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5471 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5472 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5473 |
(void) signal(sigNr, handler); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5474 |
# endif |
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 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5477 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5478 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5479 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5480 |
* maybe, we should return the old enable-status |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5481 |
* as boolean here ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5482 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5483 |
RETURN (self); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5484 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5485 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5486 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5487 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5488 |
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
|
5489 |
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
|
5490 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5491 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5492 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5493 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5494 |
enableTimer:milliSeconds |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5495 |
"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
|
5496 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5497 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5498 |
int millis; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5499 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5500 |
millis = __intVal(milliSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5501 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5502 |
#ifdef SIGALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5503 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5504 |
static int firstCall = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5505 |
# ifndef __signalTimerInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5506 |
extern void __signalTimerInterrupt(SIGHANDLER_ARG); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5507 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5508 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5509 |
if (firstCall) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5510 |
# ifdef HAS_SIGACTION |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5511 |
struct sigaction act; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5512 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5513 |
act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5514 |
sigemptyset(&act.sa_mask); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5515 |
act.sa_handler = __signalTimerInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5516 |
sigaction(SIGALRM, &act, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5517 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5518 |
# ifdef HAS_SIGVEC |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5519 |
struct sigvec vec; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5520 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5521 |
vec.sv_flags = SV_INTERRUPT; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5522 |
sigemptyset(&vec.sv_mask); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5523 |
vec.sv_handler = __signalTimerInterrupt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5524 |
sigvec(SIGALRM, &vec, NULL); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5525 |
# else /* neither SIGACTION nor SIGVEC */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5526 |
signal(SIGALRM, __signalTimerInterrupt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5527 |
# endif /* stupid system */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5528 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5529 |
firstCall = 0; |
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 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5532 |
#endif /* SIGALRM */ |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5535 |
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER) |
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 |
struct itimerval dt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5538 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5539 |
dt.it_interval.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5540 |
dt.it_interval.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5541 |
dt.it_value.tv_sec = millis / 1000; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5542 |
dt.it_value.tv_usec = (millis % 1000) * 1000; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5543 |
setitimer(ITIMER_REAL, &dt, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5544 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5545 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5546 |
#else /* no ITIMER_REAL */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5547 |
# ifdef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5548 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5549 |
extern void __win32SetTimer(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5550 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5551 |
__win32SetTimer(millis); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5552 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5553 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5554 |
# endif /* WIN32 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5555 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5556 |
# if defined(__VMS__) && defined(USE_AST_TIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5557 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5558 |
extern void __vmsSetTimer(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5559 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5560 |
__vmsSetTimer(millis); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5561 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5562 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5563 |
# endif /* __VMS__ */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5564 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5565 |
# ifdef USE_SLOW_ALARM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5566 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5567 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5568 |
* last fallback - use alarm (which only gives 1 second resolution). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5569 |
* If the system does not support any of the above, you have to life |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5570 |
* with this. The consequence is that pressing CTRL-C processing and |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5571 |
* thread switching will take place much delayed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5572 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5573 |
alarm(1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5574 |
RETURN(true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5575 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5576 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5577 |
#endif /* ITIMER_REAL */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5578 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5579 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5580 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5581 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5582 |
killProcess:processId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5583 |
"kill a unix process. |
3541
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5584 |
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
|
5585 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5586 |
WARNING: in order to avoid zombie processes (on unix), |
3541
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5587 |
you may have to fetch the processes exitstatus with |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5588 |
UnixOperatingSystem>>getStatusOfProcess:aProcessId." |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5589 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5590 |
self sendSignal:(self sigKILL) to:processId. |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5591 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5592 |
"Modified: / 10.6.1998 / 11:59:12 / cg" |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5593 |
! |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5594 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5595 |
killProcessGroup:processGroupId |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5596 |
"kill a unix process group. |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5597 |
The process has a no chance to do some cleanup. |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5598 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5599 |
WARNING: in order to avoid zombie processes (on unix), |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5600 |
you may have to fetch the processes exitstatus with |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5601 |
UnixOperatingSystem>>getStatusOfProcess:aProcessId." |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5602 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5603 |
self sendSignal:(self sigKILL) to:(processGroupId negated). |
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5604 |
|
7391c94f47b3
added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents:
3540
diff
changeset
|
5605 |
"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
|
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 |
primTerminateProcess:pid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5609 |
"terminate a WIN32 process. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5610 |
The TerminateProcess function is used to unconditionally cause |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5611 |
a process to exit. Use it only in extreme circumstances. The state of |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5612 |
global data maintained by dynamic-link libraries (DLLs) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5613 |
may be compromised if TerminateProcess is used." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5614 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5615 |
%{ /* UNLIMITEDSTACK (WIN95 only)*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5616 |
#ifdef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5617 |
if (__isExternalAddress(pid) ) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5618 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5619 |
if (_HANDLEVal(pid) != 0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5620 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5621 |
#ifdef PROCESSDEBUGWIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5622 |
printf("Terminate ProcessHandle %x\n",_HANDLEVal(pid)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5623 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5624 |
TerminateProcess(_HANDLEVal(pid),-1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5625 |
CloseHandle(_HANDLEVal(pid)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5626 |
_HANDLEVal(pid) = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5627 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5628 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5629 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5630 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5631 |
%} |
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), |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5641 |
you may have to fetch the processes exitstatus with |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5642 |
UnixOperatingSystem>>getStatusOfProcess:aProcessId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5643 |
if the signal terminates that process." |
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 |
#ifndef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5647 |
if (__bothSmallInteger(signalNumber, processId)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5648 |
if (kill(__intVal(processId), __intVal(signalNumber)) < 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5649 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5650 |
RETURN ( false ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5651 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5652 |
RETURN ( true ); |
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 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5655 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5656 |
"/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5657 |
"/ either invalid argument (non-integers) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5658 |
"/ or not supported by OS |
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 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5661 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5662 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5663 |
startSpyTimer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5664 |
"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
|
5665 |
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
|
5666 |
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
|
5667 |
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
|
5668 |
(which is of course less correct). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5669 |
OBSOLETE: the new messageTally runs as a high prio process, not using |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5670 |
spy interrupts." |
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 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5673 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5674 |
#ifndef __spyInterrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5675 |
extern void __spyInterrupt(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5676 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5677 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5678 |
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5679 |
struct itimerval dt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5680 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5681 |
# ifdef SIGVTALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5682 |
signal(SIGVTALRM, __spyInterrupt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5683 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5684 |
# ifdef SIGALRM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5685 |
signal(SIGALRM, __spyInterrupt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5686 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5687 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5688 |
* mhmh - system has neither SIGBTALRM nor SIGALRM ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5689 |
* what should we do here ? |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5690 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5691 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5692 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5693 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5694 |
dt.it_interval.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5695 |
dt.it_interval.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5696 |
dt.it_value.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5697 |
dt.it_value.tv_usec = 1000; /* 1000 Hz */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5698 |
setitimer(ITIMER_VIRTUAL, &dt, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5699 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5700 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5701 |
#endif /* ITIMER_VIRTUAL */ |
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 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5704 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5705 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5706 |
stopSpyTimer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5707 |
"stop spy timing - disable spy timer. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5708 |
OBSOLETE: the new messageTally runs as a high prio process, not using |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5709 |
spy interrupts." |
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 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5712 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5713 |
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5714 |
struct itimerval dt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5715 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5716 |
dt.it_interval.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5717 |
dt.it_interval.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5718 |
dt.it_value.tv_sec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5719 |
dt.it_value.tv_usec = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5720 |
setitimer(ITIMER_VIRTUAL, &dt, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5721 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5722 |
#endif /* ITIMER_VIRTUAL */ |
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 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5725 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5726 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5727 |
terminateProcess:processId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5728 |
"terminate a unix process. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5729 |
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
|
5730 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5731 |
WARNING: in order to avoid zombie processes (on unix), |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5732 |
you may have to fetch the processes exitstatus with |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5733 |
UnixOperatingSystem>>getStatusOfProcess:aProcessId." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5734 |
|
3540 | 5735 |
self sendSignal:(self sigTERM) to:processId. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5736 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5737 |
"Modified: / 28.12.1995 / 15:05:37 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5738 |
"Modified: / 27.1.1998 / 20:05:47 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5739 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5740 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5741 |
terminateProcessGroup:processGroupId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5742 |
"terminate a unix process group. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5743 |
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
|
5744 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5745 |
WARNING: in order to avoid zombie processes (on unix), |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5746 |
you may have to fetch the processes exitstatus with |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5747 |
UnixOperatingSystem>>getStatusOfProcess:aProcessId." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5748 |
|
3540 | 5749 |
self sendSignal:(self sigTERM) to:(processGroupId negated). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5750 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5751 |
"Modified: / 28.12.1995 / 15:05:37 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5752 |
"Created: / 23.4.1996 / 16:40:34 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5753 |
"Modified: / 27.1.1998 / 20:05:59 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5754 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5755 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5756 |
!UnixOperatingSystem class methodsFor:'ipc support - UNIX'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5757 |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5758 |
makePTYPair |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5759 |
"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
|
5760 |
nil on failure. |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5761 |
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
|
5762 |
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
|
5763 |
|
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5764 |
|fdS fdM| |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5765 |
|
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5766 |
%{ |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5767 |
/* |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5768 |
* Find a pseudo tty to use and open both sides. |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5769 |
* _fdM receives the master file descriptor while _fdS |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5770 |
* 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
|
5771 |
* needed in daemons such as rlogind and telnetd. |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5772 |
*/ |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5773 |
|
3536 | 5774 |
#ifdef IRIX5 |
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5775 |
int _fdM, _fdS; |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5776 |
char *line; |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5777 |
|
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5778 |
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
|
5779 |
if ((line != 0) && (_fdM >= 0)) { |
3540 | 5780 |
_fdS = open(line, O_RDWR); |
5781 |
if (_fdS < 0) { |
|
5782 |
(void)close(_fdM); |
|
5783 |
_fdS = _fdM = -1; |
|
5784 |
} |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5785 |
} else { |
3540 | 5786 |
_fdM -1; |
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5787 |
} |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5788 |
if ((_fdM >= 0) && (_fdS >= 0)) { |
3540 | 5789 |
fdM = __MKSMALLINT(_fdM); |
5790 |
fdS = __MKSMALLINT(_fdS); |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5791 |
} |
3542 | 5792 |
# define NO_PTY_TEMPL |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5793 |
#endif /* IRIX5 */ |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5794 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5795 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5796 |
#ifdef LINUX |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5797 |
# define PTY_TEMPL "/dev/ptyXX" |
3550 | 5798 |
# define PTY_1_CHARS "pqrstuabcdevwxyz" |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5799 |
# define PTY_2_CHARS "0123456789abcdef" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5800 |
#endif /* LINUX */ |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5801 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5802 |
#ifdef solaris |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5803 |
# define PTY_TEMPL "/dev/ptyXX" |
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" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5810 |
# define PTY_1_CHARS "pqr" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5811 |
# define PTY_2_CHARS "0123456789abcdef" |
3539 | 5812 |
#endif /* aix */ |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5813 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5814 |
#ifdef next3 |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5815 |
# define PTY_TEMPL "/dev/ptyXX" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5816 |
# define PTY_1_CHARS "pqr" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5817 |
# define PTY_2_CHARS "0123456789abcdef" |
3539 | 5818 |
#endif /* next3 */ |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5819 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5820 |
#ifdef hpux |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5821 |
# define PTY_TEMPL "/dev/ptyXX" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5822 |
# define PTY_1_CHARS "pqrs" |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5823 |
# define PTY_2_CHARS "0123456789abcdef" |
3539 | 5824 |
#endif /* hpux */ |
5825 |
||
5826 |
#if defined(BSD) |
|
5827 |
# define PTY_TEMPL "/dev/ptyXX" |
|
5828 |
# define PTY_1_CHARS "p" |
|
5829 |
# define PTY_2_CHARS "0123456789abcdefghijklmnopqrstuv" |
|
5830 |
#endif /* BSD */ |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5831 |
|
3542 | 5832 |
#ifdef NO_PTY_TEMPL |
5833 |
# undef PTY_TEMPL |
|
5834 |
#endif |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5835 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5836 |
#ifdef PTY_TEMPL |
3542 | 5837 |
# include <grp.h> |
5838 |
||
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5839 |
static char line[] = PTY_TEMPL; |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5840 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5841 |
register const char *cp1, *cp2; |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5842 |
int _fdM = -1, _fdS = -1, ttygid; |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5843 |
struct group *gr; |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5844 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5845 |
if ((gr = getgrnam("tty")) != NULL) |
3540 | 5846 |
ttygid = gr->gr_gid; |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5847 |
else |
3540 | 5848 |
ttygid = -1; |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5849 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5850 |
for (cp1 = PTY_1_CHARS; *cp1; cp1++) { |
3540 | 5851 |
line[sizeof(line)-1-2] = * cp1; |
5852 |
||
5853 |
for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) { |
|
5854 |
line[5] = 'p'; |
|
5855 |
line[sizeof(line)-1-1] = *cp2; |
|
5856 |
||
5857 |
if ((_fdM = open(line, O_RDWR, 0)) == -1) { |
|
5858 |
if (errno == ENOENT) { |
|
5859 |
_fdM = _fdS = -1; |
|
5860 |
goto getOutOfHere; /* out of ptys */ |
|
5861 |
} |
|
5862 |
} else { |
|
5863 |
line[5] = 't'; |
|
5864 |
(void) chown( line, getuid(), ttygid ); |
|
5865 |
(void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP ); |
|
5866 |
||
5867 |
if( (_fdS = open(line, O_RDWR, 0)) != -1 ) { |
|
5868 |
goto getOutOfHere; |
|
5869 |
} |
|
5870 |
(void) close( _fdM ); |
|
5871 |
} |
|
5872 |
} |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5873 |
} |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5874 |
getOutOfHere: ; |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5875 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5876 |
if ((_fdM >= 0) && (_fdS >= 0)) { |
3540 | 5877 |
fdM = __MKSMALLINT(_fdM); |
5878 |
fdS = __MKSMALLINT(_fdS); |
|
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5879 |
} |
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5880 |
|
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5881 |
#endif /* PTY_TEMPL */ |
3542 | 5882 |
#undef NO_PTY_TEMPL |
5883 |
||
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5884 |
%}. |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5885 |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5886 |
fdM notNil ifTrue:[ |
3540 | 5887 |
^ Array with:fdM with:fdS. |
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5888 |
]. |
3538
fcedde036bc3
added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents:
3536
diff
changeset
|
5889 |
|
3534
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5890 |
^ nil |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5891 |
! |
126b23939933
added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents:
3518
diff
changeset
|
5892 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5893 |
makePipe |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5894 |
"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
|
5895 |
nil on failure. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5896 |
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
|
5897 |
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
|
5898 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5899 |
|fd1 fd2| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5900 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5901 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5902 |
int fds[2]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5903 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5904 |
if (pipe(fds) < 0) { |
3540 | 5905 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
5906 |
RETURN ( nil ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5907 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5908 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5909 |
fd1 = __MKSMALLINT(fds[0]); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5910 |
fd2 = __MKSMALLINT(fds[1]); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5911 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5912 |
fd1 notNil ifTrue:[ |
3540 | 5913 |
^ Array with:fd1 with:fd2. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5914 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5915 |
^ nil |
3556
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5916 |
! |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5917 |
|
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5918 |
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
|
5919 |
"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
|
5920 |
%{ |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5921 |
#ifdef TIOCSWINSZ |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5922 |
struct winsize wsize; |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5923 |
|
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5924 |
if (__isSmallInteger(fd) |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5925 |
&& __isSmallInteger(w) |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5926 |
&& __isSmallInteger(h)) { |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5927 |
wsize.ws_row = (unsigned short)__intVal(h); |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5928 |
wsize.ws_col = (unsigned short)__intVal(w); |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5929 |
if (ioctl(__intVal(fd), TIOCSWINSZ, (char *)&wsize) >= 0) { |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5930 |
RETURN (true); |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5931 |
} |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5932 |
} |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5933 |
#endif |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5934 |
%}. |
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
5935 |
^ false |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5936 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5937 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5938 |
!UnixOperatingSystem class methodsFor:'misc'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5939 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5940 |
closePid:pid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5941 |
"free pid resource" |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5942 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5943 |
^ true. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5944 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5945 |
"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
|
5946 |
"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
|
5947 |
"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
|
5948 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5949 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5950 |
slowFork:aBoolean |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5951 |
"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
|
5952 |
Only used internally on SYSV3 systems" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5953 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5954 |
SlowFork := aBoolean |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5955 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5956 |
"Modified: 22.4.1996 / 13:13:09 / cg" |
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:'os queries'! |
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 |
executableFileExtensions |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5962 |
"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
|
5963 |
Only req'd for msdos like systems ..." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5964 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5965 |
^ #('') |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5966 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
5967 |
"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
|
5968 |
"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
|
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 |
getDomainName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5972 |
"return the domain this host is in. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5973 |
Notice: |
3540 | 5974 |
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
|
5975 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5976 |
|name idx hostName| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5977 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5978 |
DomainName notNil ifTrue:[ |
3540 | 5979 |
^ DomainName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5980 |
]. |
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 |
%{ /* STACK: 2048 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5983 |
#if defined(HAS_GETDOMAINNAME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5984 |
char buffer[128]; |
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 |
if (getdomainname(buffer, sizeof(buffer)) == 0) { |
3540 | 5987 |
name = __MKSTRING(buffer); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5988 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5989 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5990 |
# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5991 |
struct utsname ubuff; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5992 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5993 |
if (uname(&ubuff) >= 0) { |
3540 | 5994 |
name = __MKSTRING(ubuff.domainname); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5995 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5996 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5997 |
# if defined(HAS_SYSINFO) && defined(SI_SRPC_DOMAIN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5998 |
char buffer[256]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
5999 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6000 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6001 |
if ((ret = sysinfo(SI_SRPC_DOMAIN, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) { |
3540 | 6002 |
name = __MKSTRING(buffer); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6003 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6004 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6005 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6006 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6007 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6008 |
name isNil ifTrue:[ |
3540 | 6009 |
name := self getEnvironment:'DOMAIN'. |
6010 |
name isNil ifTrue:[ |
|
6011 |
UnixOperatingSystem isUNIXlike ifTrue:[ |
|
6012 |
name := self getCommandOutputFrom:'domainname' |
|
6013 |
] |
|
6014 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6015 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6016 |
name isNil ifTrue:[ |
3540 | 6017 |
"/ sometimes, we can extract the domainName from the hostName ... |
6018 |
hostName := self getHostName. |
|
6019 |
hostName notNil ifTrue:[ |
|
6020 |
idx := hostName indexOf:$.. |
|
6021 |
idx ~~ 0 ifTrue:[ |
|
6022 |
name := hostName copyFrom:idx+1. |
|
6023 |
] |
|
6024 |
]. |
|
6025 |
name isNil ifTrue:[ |
|
6026 |
'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR. |
|
6027 |
name := 'unknown'. |
|
6028 |
] |
|
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 |
DomainName := name. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6031 |
^ name |
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 |
UnixOperatingSystem getDomainName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6035 |
" |
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 |
"Modified: 26.4.1996 / 10:04:54 / stefan" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6040 |
getEnvironment:aStringOrSymbol |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6041 |
"get an environment string" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6042 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6043 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6044 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6045 |
char *env; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6046 |
extern char *getenv(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6047 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6048 |
if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) { |
3540 | 6049 |
env = getenv(__stringVal(aStringOrSymbol)); |
6050 |
if (env) { |
|
6051 |
RETURN ( __MKSTRING(env) ); |
|
6052 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6053 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6054 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6055 |
. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6056 |
^ nil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6057 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6058 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6059 |
UnixOperatingSystem getEnvironment:'LANG' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6060 |
UnixOperatingSystem getEnvironment:'LOGIN' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6061 |
UnixOperatingSystem getEnvironment:'HOME' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6062 |
UnixOperatingSystem getEnvironment:'NNTPSERVER' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6063 |
UnixOperatingSystem getEnvironment:'MAIL' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6064 |
UnixOperatingSystem getEnvironment:'PATH' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6065 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6066 |
! |
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 |
getHostName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6069 |
"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
|
6070 |
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
|
6071 |
Notice: |
3540 | 6072 |
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
|
6073 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6074 |
|name idx| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6075 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6076 |
HostName notNil ifTrue:[ |
3540 | 6077 |
^ HostName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6078 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6079 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6080 |
%{ /* STACK: 2048 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6081 |
#if defined(HAS_GETHOSTNAME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6082 |
char buffer[256]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6083 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6084 |
if (gethostname(buffer, sizeof(buffer)) == 0) { |
3540 | 6085 |
name = __MKSTRING(buffer); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6086 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6087 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6088 |
# if defined(HAS_UNAME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6089 |
struct utsname ubuff; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6090 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6091 |
if (uname(&ubuff) >= 0) { |
3540 | 6092 |
name = __MKSTRING(ubuff.nodename); |
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 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6095 |
# if defined(HAS_SYSINFO) && defined(SI_HOSTNAME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6096 |
char buffer[256]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6097 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6098 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6099 |
if ((ret = sysinfo(SI_HOSTNAME, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) { |
3540 | 6100 |
name = __MKSTRING(buffer); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
6101 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6102 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6103 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6104 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6105 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6106 |
name isNil ifTrue:[ |
3540 | 6107 |
name := self getEnvironment:'HOST'. |
6108 |
name isNil ifTrue:[ |
|
6109 |
UnixOperatingSystem isUNIXlike ifTrue:[ |
|
6110 |
name := self getCommandOutputFrom:'hostname' |
|
6111 |
] |
|
6112 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6113 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6114 |
name isNil ifTrue:[ |
3540 | 6115 |
'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR. |
6116 |
name := 'unknown'. |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6117 |
] ifFalse:[ |
3540 | 6118 |
"/ on some systems, the hostname already contains the domain. |
6119 |
"/ decompose it here. |
|
6120 |
idx := name indexOf:$.. |
|
6121 |
idx ~~ 0 ifTrue:[ |
|
6122 |
DomainName := name copyFrom:(idx+1). |
|
6123 |
name := name copyTo:(idx-1). |
|
6124 |
] |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6125 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6126 |
HostName := name. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6127 |
^ name |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6128 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6129 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6130 |
UnixOperatingSystem getHostName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6131 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6132 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6133 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6134 |
getLocaleInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6135 |
"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
|
6136 |
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
|
6137 |
Possible fields are: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6138 |
decimalPoint <String> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6139 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6140 |
thousandsSep <String> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6141 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6142 |
internationalCurrencySymbol <String> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6143 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6144 |
currencySymbol <String> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6145 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6146 |
monetaryDecimalPoint <String> |
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 |
monetaryThousandsSeparator <String> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6149 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6150 |
positiveSign <String> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6151 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6152 |
negativeSign <String> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6153 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6154 |
internationalFractionalDigits <Integer> |
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 |
fractionalDigits <Integer> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6157 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6158 |
positiveSignPrecedesCurrencySymbol <Boolean> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6159 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6160 |
negativeSignPrecedesCurrencySymbol <Boolean> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6161 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6162 |
positiveSignSeparatedBySpaceFromCurrencySymbol <Boolean> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6163 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6164 |
negativeSignSeparatedBySpaceFromCurrencySymbol <Boolean> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6165 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6166 |
positiveSignPosition <Symbol> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6167 |
one of: #parenthesesAround, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6168 |
#signPrecedes, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6169 |
#signSuceeds, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6170 |
#signPrecedesCurrencySymbol, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6171 |
#signSuceedsCurrencySymbol |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6172 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6173 |
negativeSignPosition <like above> |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6174 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6175 |
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
|
6176 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6177 |
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
|
6178 |
it should be used by applications as required. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6179 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6180 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6181 |
|info val| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6182 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6183 |
LocaleInfo notNil ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6184 |
"/ return the internal info; useful on systems which do not |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6185 |
"/ support this. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6186 |
^ LocaleInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6187 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6188 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6189 |
info := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6190 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6191 |
char *decimalPoint; /* something like "." (US) or "," (german) */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6192 |
char *thousandsSep; /* something like "," (US) or "." (german) */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6193 |
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
|
6194 |
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
|
6195 |
char *monDecimalPoint; /* money: decimal point */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6196 |
char *monThousandsSep; /* money: thousands sep */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6197 |
char *positiveSign; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6198 |
char *negativeSign; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6199 |
int intFractDigits; /* money: international digits after decPoint */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6200 |
int fractDigits; /* money: local digits after decPoint */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6201 |
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
|
6202 |
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
|
6203 |
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
|
6204 |
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
|
6205 |
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
|
6206 |
int csNegSignPosition; /* 1: sign precedes the value & currency symbol */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6207 |
/* 2: sign succeeds the value & currency symbol */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6208 |
/* 3: sign immediately precedes the currency symbol */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6209 |
/* 4: sign immediately suceeds the currency symbol */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6210 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6211 |
#if defined(HAS_LOCALECONV) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6212 |
struct lconv *conf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6213 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6214 |
conf = localeconv(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6215 |
if (conf) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6216 |
decimalPoint = conf->decimal_point; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6217 |
thousandsSep = conf->thousands_sep; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6218 |
intCurrencySymbol = conf->int_curr_symbol; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6219 |
currencySymbol = conf->currency_symbol; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6220 |
monDecimalPoint = conf->mon_decimal_point; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6221 |
monThousandsSep = conf->mon_thousands_sep; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6222 |
positiveSign = conf->positive_sign; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6223 |
negativeSign = conf->negative_sign; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6224 |
intFractDigits = conf->int_frac_digits; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6225 |
fractDigits = conf->frac_digits; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6226 |
csPosPrecedes = conf->p_cs_precedes; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6227 |
csNegPrecedes = conf->n_cs_precedes; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6228 |
csPosSepBySpace = conf->p_sep_by_space; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6229 |
csNegSepBySpace = conf->n_sep_by_space; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6230 |
csPosSignPosition = conf->p_sign_posn; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6231 |
csNegSignPosition = conf->n_sign_posn; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6232 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6233 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6234 |
decimalPoint = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6235 |
thousandsSep = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6236 |
intCurrencySymbol = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6237 |
currencySymbol = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6238 |
monDecimalPoint = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6239 |
monThousandsSep = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6240 |
positiveSign = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6241 |
negativeSign =(char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6242 |
intFractDigits = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6243 |
fractDigits = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6244 |
csPosPrecedes = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6245 |
csNegPrecedes = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6246 |
csPosSepBySpace = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6247 |
csNegSepBySpace = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6248 |
csPosSignPosition = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6249 |
csNegSignPosition = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6250 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6251 |
if (decimalPoint) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6252 |
val = __MKSTRING(decimalPoint); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6253 |
__AT_PUT_(info, @symbol(decimalPoint), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6254 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6255 |
if (thousandsSep) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6256 |
val = __MKSTRING(thousandsSep); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6257 |
__AT_PUT_(info, @symbol(thousandsSeparator), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6258 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6259 |
if (intCurrencySymbol) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6260 |
val = __MKSTRING(intCurrencySymbol); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6261 |
__AT_PUT_(info, @symbol(internationCurrencySymbol), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6262 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6263 |
if (currencySymbol) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6264 |
val = __MKSTRING(currencySymbol); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6265 |
__AT_PUT_(info, @symbol(currencySymbol), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6266 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6267 |
if (monDecimalPoint) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6268 |
val = __MKSTRING(monDecimalPoint); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6269 |
__AT_PUT_(info, @symbol(monetaryDecimalPoint), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6270 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6271 |
if (monThousandsSep) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6272 |
val = __MKSTRING(monThousandsSep); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6273 |
__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6274 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6275 |
if (positiveSign) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6276 |
val = __MKSTRING(positiveSign); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6277 |
__AT_PUT_(info, @symbol(positiveSign), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6278 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6279 |
if (negativeSign) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6280 |
val = __MKSTRING(negativeSign); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6281 |
__AT_PUT_(info, @symbol(negativeSign), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6282 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6283 |
if (intFractDigits >= 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6284 |
__AT_PUT_(info, @symbol(internationalFractionalDigits), __MKSMALLINT(intFractDigits)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6285 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6286 |
if (fractDigits >= 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6287 |
__AT_PUT_(info, @symbol(fractionalDigits), __MKSMALLINT(fractDigits)); |
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 |
if (csPosPrecedes >= 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6290 |
if (csPosPrecedes == 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6291 |
val = false; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6292 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6293 |
val = true; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6294 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6295 |
__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6296 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6297 |
if (csNegPrecedes >= 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6298 |
if (csNegPrecedes == 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6299 |
val = false; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6300 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6301 |
val = true; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6302 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6303 |
__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6304 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6305 |
if (csPosSepBySpace >= 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6306 |
if (csPosSepBySpace == 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6307 |
val = false; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6308 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6309 |
val = true; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6310 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6311 |
__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val); |
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 (csNegSepBySpace >= 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6314 |
if (csNegSepBySpace == 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6315 |
val = false; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6316 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6317 |
val = true; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6318 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6319 |
__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6320 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6321 |
switch (csPosSignPosition) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6322 |
case 0: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6323 |
val = @symbol(parenthesesAround); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6324 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6325 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6326 |
case 1: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6327 |
val = @symbol(signPrecedes); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6328 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6329 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6330 |
case 2: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6331 |
val = @symbol(signSuceeds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6332 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6333 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6334 |
case 3: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6335 |
val = @symbol(signPrecedesCurrencySymbol); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6336 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6337 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6338 |
case 4: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6339 |
val = @symbol(signSuceedsCurrencySymbol); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6340 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6341 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6342 |
default: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6343 |
val = nil; |
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 |
if (val != nil) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6346 |
__AT_PUT_(info, @symbol(positiveSignPosition), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6347 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6348 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6349 |
switch (csNegSignPosition) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6350 |
case 0: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6351 |
val = @symbol(parenthesesAround); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6352 |
break; |
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 |
case 1: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6355 |
val = @symbol(signPrecedes); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6356 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6357 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6358 |
case 2: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6359 |
val = @symbol(signSuceeds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6360 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6361 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6362 |
case 3: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6363 |
val = @symbol(signPrecedesCurrencySymbol); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6364 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6365 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6366 |
case 4: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6367 |
val = @symbol(signSuceedsCurrencySymbol); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6368 |
break; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6369 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6370 |
default: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6371 |
val = nil; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6372 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6373 |
if (val != nil) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6374 |
__AT_PUT_(info, @symbol(negativeSignPosition), val); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6375 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6376 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6377 |
^ info |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6378 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6379 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6380 |
UnixOperatingSystem getLocaleInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6381 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6382 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6383 |
"Created: 23.12.1995 / 14:19:20 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6384 |
! |
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 |
getProcessId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6387 |
"return the (unix-)processId" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6388 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6389 |
%{ /* NOCONTEXT */ |
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 |
int pid = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6392 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6393 |
pid = getpid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6394 |
RETURN ( __MKSMALLINT(pid) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6395 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6396 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6397 |
UnixOperatingSystem getProcessId |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6398 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6399 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6400 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6401 |
getSystemID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6402 |
"if supported by the OS, return the systemID; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6403 |
a unique per machine identification. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6404 |
WARNING: |
3540 | 6405 |
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
|
6406 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6407 |
%{ /* NO_CONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6408 |
#if defined(IRIX5) && !defined(HAS_GETHOSTID) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6409 |
char idBuffer[MAXSYSIDSIZE]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6410 |
int retVal; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6411 |
OBJ arr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6412 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6413 |
if ((retVal = syssgi(SGI_SYSID, idBuffer)) == 0) { |
3540 | 6414 |
arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE); |
6415 |
bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE); |
|
6416 |
RETURN (arr); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6417 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6418 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6419 |
#if defined(HAS_GETHOSTID) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6420 |
int runningId; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6421 |
OBJ arr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6422 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6423 |
runningId = gethostid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6424 |
arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6425 |
*(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6426 |
RETURN (arr); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6427 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6428 |
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6429 |
{ |
3540 | 6430 |
char buffer[128]; |
6431 |
||
6432 |
buffer[0] = 0; |
|
6433 |
if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) { |
|
6434 |
buffer[127] = 0; |
|
6435 |
if (strlen(buffer) > 0) { |
|
6436 |
RETURN(__MKSTRING(buffer)); |
|
6437 |
} |
|
6438 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6439 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6440 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6441 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6442 |
^ 'unknown' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6443 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6444 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6445 |
UnixOperatingSystem getSystemID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6446 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6447 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6448 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6449 |
getSystemInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6450 |
"return info on the system weare running on. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6451 |
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
|
6452 |
otherwise, some simulated info is returned. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6453 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6454 |
WARNING: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6455 |
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
|
6456 |
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
|
6457 |
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
|
6458 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6459 |
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
|
6460 |
information. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6461 |
(in case of system/version specific OS errors, conditional workarounds and patches |
3540 | 6462 |
may be based upon this info). |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6463 |
Your application should NOT depend upon this in any way. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6464 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6465 |
The returned info may (or may not) contain: |
3540 | 6466 |
#system -> some operating system identification (irix, Linux, nt, win32s ...) |
6467 |
#version -> OS version (some os version identification) |
|
6468 |
#release -> OS release (3.5, 1.2.1 ...) |
|
6469 |
#node -> some host identification (hostname) |
|
6470 |
#domain -> domain name (hosts domain) |
|
6471 |
#machine -> type of machine (i586, mips ...) |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6472 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6473 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6474 |
|sys node rel ver mach dom mtyp brel info arch| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6475 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6476 |
%{ /* STACK: 4096 */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6477 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6478 |
#if defined(HAS_UNAME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6479 |
struct utsname ubuff; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6480 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6481 |
if (uname(&ubuff) >= 0) { |
3540 | 6482 |
sys = __MKSTRING(ubuff.sysname); |
6483 |
node = __MKSTRING(ubuff.nodename); |
|
6484 |
rel = __MKSTRING(ubuff.release); |
|
6485 |
ver = __MKSTRING(ubuff.version); |
|
6486 |
mach = __MKSTRING(ubuff.machine); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6487 |
# ifdef HAS_UTS_DOMAINNAME |
3540 | 6488 |
dom = __MKSTRING(ubuff.domainname); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6489 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6490 |
# if defined(HAS_GETDOMAINNAME) |
3540 | 6491 |
{ |
6492 |
char buffer[128]; |
|
6493 |
||
6494 |
if (getdomainname(buffer, sizeof(buffer)) == 0) { |
|
6495 |
dom = __MKSTRING(buffer); |
|
6496 |
} |
|
6497 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6498 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6499 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6500 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6501 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6502 |
# if defined(HAS_SYSINFO) && defined(SI_ARCHITECTURE) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6503 |
{ |
3540 | 6504 |
char buffer[128]; |
6505 |
||
6506 |
if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) { |
|
6507 |
arch = __MKSTRING(buffer); |
|
6508 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6509 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6510 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6511 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6512 |
#else /* no uname */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6513 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6514 |
#endif /* no uname */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6515 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6516 |
sys isNil ifTrue:[ |
3540 | 6517 |
sys := self getSystemType. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6518 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6519 |
node isNil ifTrue:[ |
3540 | 6520 |
node := self getHostName. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6521 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6522 |
dom isNil ifTrue:[ |
3540 | 6523 |
dom := self getDomainName. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6524 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6525 |
mach isNil ifTrue:[ |
3540 | 6526 |
mach := self getCPUType. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6527 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6528 |
arch isNil ifTrue:[ |
3540 | 6529 |
arch := 'unknown'. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6530 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6531 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6532 |
info := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6533 |
info at:#system put:sys. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6534 |
info at:#node put:node. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6535 |
rel notNil ifTrue:[info at:#release put:rel]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6536 |
ver notNil ifTrue:[info at:#version put:ver]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6537 |
mach notNil ifTrue:[info at:#machine put:mach]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6538 |
arch notNil ifTrue:[info at:#architecture put:arch]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6539 |
dom notNil ifTrue:[info at:#domain put:dom]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6540 |
info at:#osType put:(self getOSType). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6541 |
^ info |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6542 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6543 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6544 |
UnixOperatingSystem getSystemInfo |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6545 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6546 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6547 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6548 |
getSystemType |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6549 |
"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
|
6550 |
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
|
6551 |
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
|
6552 |
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
|
6553 |
here ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6554 |
(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
|
6555 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6556 |
|sys| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6557 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6558 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6559 |
# ifdef NEXT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6560 |
# define SYS_STRING "next" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6561 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6562 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6563 |
# ifdef IRIS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6564 |
# define SYS_STRING "iris" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6565 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6566 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6567 |
# ifdef SYS_STRING |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6568 |
sys = __MKSTRING(SYS_STRING); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6569 |
# undef SYS_STRING |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6570 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6571 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6572 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6573 |
sys isNil ifTrue:[ |
3540 | 6574 |
^ self getOSType |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6575 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6576 |
^ sys |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6577 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6578 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6579 |
UnixOperatingSystem getSystemType |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6580 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6581 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6582 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6583 |
isBSDlike |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6584 |
"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
|
6585 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6586 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6587 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6588 |
#if defined(BSD) || defined(MACH) || defined(SYSV4) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6589 |
RETURN ( true ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6590 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6591 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6592 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6593 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6594 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6595 |
isUNIXlike |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6596 |
"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
|
6597 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6598 |
^ true |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
6599 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
6600 |
"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
|
6601 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6602 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6603 |
maxFileNameLength |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6604 |
"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
|
6605 |
CAVEAT: |
3540 | 6606 |
Actually, the following is somewhat wrong - some systems |
6607 |
support different sizes, depending on the volume. |
|
6608 |
We return a somewhat conservative number here. |
|
6609 |
Another entry, to query for volume specific max |
|
6610 |
will be added in the future." |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6611 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6612 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6613 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6614 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6615 |
* TODO: newer systems provide a query function for this ... use it |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6616 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6617 |
# if defined(BSD) || defined(SYSV4) || defined(LONGFILENAMES) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6618 |
RETURN ( __MKSMALLINT(255) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6619 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6620 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6621 |
# ifdef realIX |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6622 |
RETURN ( __MKSMALLINT(127) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6623 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6624 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6625 |
# ifdef SYSV |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6626 |
RETURN ( __MKSMALLINT(14) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6627 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6628 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6629 |
"unix default" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6630 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6631 |
^ 14 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6632 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6633 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6634 |
maxPathLength |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6635 |
"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
|
6636 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6637 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6638 |
RETURN ( __MKSMALLINT(MAXPATHLEN) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6639 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6640 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6641 |
UnixOperatingSystem maxPathLength |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6642 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6643 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6644 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6645 |
pathSeparator |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6646 |
"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
|
6647 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6648 |
^ $: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6649 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
6650 |
"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
|
6651 |
"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
|
6652 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6653 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6654 |
platformName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6655 |
"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
|
6656 |
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
|
6657 |
#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
|
6658 |
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
|
6659 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6660 |
^ #unix |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6661 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6662 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6663 |
UnixOperatingSystem platformName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6664 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6665 |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
6666 |
"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
|
6667 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6668 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6669 |
setLocaleInfo:anInfoDictionary |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6670 |
"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
|
6671 |
(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
|
6672 |
See description of fields in #getLocaleInfo. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6673 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6674 |
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
|
6675 |
it should be used by applications as required." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6676 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6677 |
LocaleInfo := anInfoDictionary |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6678 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6679 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6680 |
|d| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6681 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6682 |
d := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6683 |
d at:#decimalPoint put:'.' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6684 |
d at:#thousandsSeparator put:',' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6685 |
d at:#currencySymbol put:'USD' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6686 |
d at:#monetaryDecimalPoint put:'.' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6687 |
d at:#monetaryThousandsSeparator put:'.' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6688 |
d at:#fractionalDigits put:2 . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6689 |
d at:#positiveSign put:'+' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6690 |
d at:#negativeSign put:'-' . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6691 |
d at:#positiveSignPrecedesCurrencySymbol put:true . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6692 |
d at:#negativeSignPrecedesCurrencySymbol put:false . |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6693 |
UnixOperatingSystem setLocaleInfo:d |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6694 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6695 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6696 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6697 |
supportsChildInterrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6698 |
"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
|
6699 |
through interrupts (i.e. SIGCHILD)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6700 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6701 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6702 |
#if defined(SIGCHLD) || defined(SIGCLD) || defined(__VMS__) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6703 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6704 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6705 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6706 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6707 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6708 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6709 |
UnixOperatingSystem supportsChildInterrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6710 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6711 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6712 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6713 |
supportsIOInterrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6714 |
"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
|
6715 |
(i.e. SIGPOLL/SIGIO). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6716 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6717 |
Currently, this mechanism does not work on all |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6718 |
systems ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6719 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6720 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6721 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6722 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6723 |
/* positive defines here |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6724 |
* - irix5.2 does not work |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6725 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6726 |
#if defined(LINUX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6727 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6728 |
# if defined(SIGIO) || defined(SIGPOLL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6729 |
# 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
|
6730 |
# if defined(F_SETOWN) || defined(FIOSETOWN) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6731 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6732 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6733 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6734 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6735 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6736 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6737 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6738 |
#endif /* machines where it works */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6739 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6740 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6741 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6742 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6743 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6744 |
UnixOperatingSystem supportsIOInterrupts |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6745 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6746 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6747 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6748 |
supportsNonBlockingIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6749 |
"return true, if the OS supports nonblocking IO." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6750 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6751 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6752 |
#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
|
6753 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6754 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6755 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6756 |
^ false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6757 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6758 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6759 |
UnixOperatingSystem supportsNonBlockingIO |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6760 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6761 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6762 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6763 |
supportsSelect |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6764 |
"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
|
6765 |
filedescriptors via select. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6766 |
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
|
6767 |
intervals for I/O becoming ready." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6768 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6769 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6770 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6771 |
#if defined(sco) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6772 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6773 |
* 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
|
6774 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6775 |
RETURN(false); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6776 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6777 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6778 |
^ true |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6779 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6780 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6781 |
UnixOperatingSystem supportsSelect |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6782 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6783 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6784 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6785 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6786 |
!UnixOperatingSystem class methodsFor:'shared memory access'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6787 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6788 |
shmAttach:id address:addr flags:flags |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6789 |
"low level entry to shmat()-system call. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6790 |
Not supported on all operatingSystems" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6791 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6792 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6793 |
#ifdef WANT_SHM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6794 |
void *address, *shmaddr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6795 |
int shmflg, shmid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6796 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6797 |
if (__isSmallInteger(addr) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6798 |
&& __bothSmallInteger(flags, id)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6799 |
shmaddr = (void *) __intVal(addr); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6800 |
shmflg = __intVal(flags); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6801 |
shmid = __intVal(id); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6802 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6803 |
address = shmat(shmid, shmaddr, shmflg); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6804 |
if (address != (void *)-1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6805 |
RETURN (__MKEXTERNALBYTES(addr)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6806 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6807 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6808 |
RETURN (nil); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6809 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6810 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6811 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6812 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6813 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6814 |
"Modified: 22.4.1996 / 13:15:12 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6815 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6816 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6817 |
shmDetach:addr |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6818 |
"low level entry to shmdt()-system call. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6819 |
Not supported on all operatingSystems" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6820 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6821 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6822 |
#ifdef WANT_SHM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6823 |
void *shmaddr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6824 |
int rslt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6825 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6826 |
if (__isSmallInteger(addr)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6827 |
shmaddr = (void *) __intVal(addr); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6828 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6829 |
rslt = shmdt(shmaddr); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6830 |
if (rslt != -1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6831 |
RETURN (true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6832 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6833 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6834 |
RETURN (false); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6835 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6836 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6837 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6838 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6839 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6840 |
"Modified: 22.4.1996 / 13:15:03 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6841 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6842 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6843 |
shmGet:key size:size flags:flags |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6844 |
"low level entry to shmget()-system call. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6845 |
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
|
6846 |
- use the provided wrapper class SharedExternalBytes instead." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6847 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6848 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6849 |
#ifdef WANT_SHM |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6850 |
if (__bothSmallInteger(key, size) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6851 |
&& __isSmallInteger(flags)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6852 |
int rslt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6853 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6854 |
rslt = shmget(__intVal(key), __intVal(size), __intVal(flags)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6855 |
if (rslt != -1) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6856 |
RETURN (__MKSMALLINT(rslt)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6857 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6858 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6859 |
RETURN (nil); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6860 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6861 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6862 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6863 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6864 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6865 |
"Modified: 22.4.1996 / 13:14:46 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6866 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6867 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6868 |
!UnixOperatingSystem class methodsFor:'time and date'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6869 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6870 |
computeDatePartsOf:osTime for:aBlock |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6871 |
"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
|
6872 |
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
|
6873 |
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
|
6874 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6875 |
|year month day osSeconds| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6876 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6877 |
osSeconds := osTime // 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6878 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6879 |
struct tm* tmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6880 |
INT t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6881 |
TIME_T tt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6882 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6883 |
t = __longIntVal(osSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6884 |
tt = (TIME_T)t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6885 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6886 |
tmPtr = localtime(&tt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6887 |
year = __MKSMALLINT(tmPtr->tm_year + 1900); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6888 |
month = __MKSMALLINT(tmPtr->tm_mon + 1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6889 |
day = __MKSMALLINT(tmPtr->tm_mday); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6890 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6891 |
aBlock value:year value:month value:day |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6892 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6893 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6894 |
UnixOperatingSystem computeDatePartsOf:0 for:[:y :m :d | |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6895 |
y printCR. m printCR. d printCR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6896 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6897 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6898 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6899 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6900 |
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
|
6901 |
"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
|
6902 |
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
|
6903 |
any daylight saving adjustings." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6904 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6905 |
|osSeconds| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6906 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6907 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6908 |
struct tm tm; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6909 |
TIME_T t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6910 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6911 |
if (__bothSmallInteger(y, m) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6912 |
&& __bothSmallInteger(d, h) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6913 |
&& __bothSmallInteger(min, s)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6914 |
tm.tm_hour = __intVal(h); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6915 |
tm.tm_min = __intVal(min); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6916 |
tm.tm_sec = __intVal(s); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6917 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6918 |
tm.tm_year = __intVal(y) - 1900; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6919 |
tm.tm_mon = __intVal(m) - 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6920 |
tm.tm_mday = __intVal(d); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6921 |
tm.tm_isdst = -1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6922 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6923 |
t = mktime(&tm); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6924 |
osSeconds = __MKUINT((INT)t); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6925 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6926 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6927 |
osSeconds notNil ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6928 |
^ osSeconds * 1000 + millis |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6929 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6930 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6931 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6932 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6933 |
UnixOperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6934 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6935 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6936 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6937 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6938 |
computeTimeAndDateFrom:osTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6939 |
"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
|
6940 |
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
|
6941 |
offset to UTC, daylight savings time flag, milliseconds, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6942 |
dayInYear (1..) and dayInWeek (1..). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6943 |
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
|
6944 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6945 |
|low hi year month day hours minutes seconds millis utcOffset |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6946 |
dst yDay wDay osSeconds ret| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6947 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6948 |
millis := osTime \\ 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6949 |
osSeconds := osTime // 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6950 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6951 |
struct tm *tmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6952 |
struct tm *gmTmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6953 |
INT t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6954 |
TIME_T tt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6955 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6956 |
t = __longIntVal(osSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6957 |
tt = (TIME_T)t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6958 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6959 |
tmPtr = localtime(&tt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6960 |
hours = __MKSMALLINT(tmPtr->tm_hour); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6961 |
minutes = __MKSMALLINT(tmPtr->tm_min); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6962 |
seconds = __MKSMALLINT(tmPtr->tm_sec); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6963 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6964 |
year = __MKSMALLINT(tmPtr->tm_year + 1900); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6965 |
month = __MKSMALLINT(tmPtr->tm_mon + 1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6966 |
day = __MKSMALLINT(tmPtr->tm_mday); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6967 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6968 |
yDay = __MKSMALLINT(tmPtr->tm_yday+1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6969 |
wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6970 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6971 |
if (tmPtr->tm_isdst == 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6972 |
dst = false; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6973 |
utcOffset = __MKINT(TIMEZONE(tmPtr)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6974 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6975 |
dst = true; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6976 |
#ifdef HAS_ALTZONE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6977 |
utcOffset = __MKINT(altzone); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6978 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6979 |
utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6980 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6981 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6982 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6983 |
"I would love to have SELF-like inline objects ..." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6984 |
ret := Array new:11. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6985 |
ret at:1 put:year. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6986 |
ret at:2 put:month. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6987 |
ret at:3 put:day. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6988 |
ret at:4 put:hours. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6989 |
ret at:5 put:minutes. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6990 |
ret at:6 put:seconds. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6991 |
ret at:7 put:utcOffset. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6992 |
ret at:8 put:dst. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6993 |
ret at:9 put:millis. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6994 |
ret at:10 put:yDay. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6995 |
ret at:11 put:wDay. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6996 |
^ ret |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6997 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6998 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
6999 |
UnixOperatingSystem computeTimeAndDateFrom:0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7000 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7001 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7002 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7003 |
computeTimePartsOf:osTime for:aBlock |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7004 |
"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
|
7005 |
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
|
7006 |
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
|
7007 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7008 |
|hours minutes seconds millis osSeconds| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7009 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7010 |
osSeconds := osTime // 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7011 |
millis := osTime \\ 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7012 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7013 |
struct tm *tmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7014 |
INT t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7015 |
TIME_T tt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7016 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7017 |
t = __longIntVal(osSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7018 |
tt = (TIME_T)t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7019 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7020 |
tmPtr = localtime(&tt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7021 |
hours = __MKSMALLINT(tmPtr->tm_hour); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7022 |
minutes = __MKSMALLINT(tmPtr->tm_min); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7023 |
seconds = __MKSMALLINT(tmPtr->tm_sec); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7024 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7025 |
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
|
7026 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7027 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7028 |
UnixOperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli | |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7029 |
h printCR. m printCR. s printCR. millis printCR |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7030 |
] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7031 |
" |
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 |
computeUTCTimeAndDateFrom:osTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7035 |
"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
|
7036 |
containing year, month, day, hour, minute and seconds, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7037 |
offset to UTC, daylight savings time flag, milliseconds, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7038 |
dayInYear (1..) and dayInWeek (1..). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7039 |
Conversion is to UTC." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7040 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7041 |
|low hi year month day hours minutes seconds millis utcOffset |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7042 |
dst yDay wDay osSeconds ret| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7043 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7044 |
millis := osTime \\ 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7045 |
osSeconds := osTime // 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7046 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7047 |
struct tm *tmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7048 |
struct tm *gmTmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7049 |
long t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7050 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7051 |
t = __longIntVal(osSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7052 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7053 |
tmPtr = gmtime(&t); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7054 |
hours = __MKSMALLINT(tmPtr->tm_hour); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7055 |
minutes = __MKSMALLINT(tmPtr->tm_min); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7056 |
seconds = __MKSMALLINT(tmPtr->tm_sec); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7057 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7058 |
year = __MKSMALLINT(tmPtr->tm_year + 1900); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7059 |
month = __MKSMALLINT(tmPtr->tm_mon + 1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7060 |
day = __MKSMALLINT(tmPtr->tm_mday); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7061 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7062 |
yDay = __MKSMALLINT(tmPtr->tm_yday + 1); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7063 |
wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7064 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7065 |
if (tmPtr->tm_isdst == 0) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7066 |
dst = false; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7067 |
utcOffset = __MKINT(TIMEZONE(tmPtr)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7068 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7069 |
dst = true; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7070 |
#ifdef HAS_ALTZONE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7071 |
utcOffset = __MKINT(altzone); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7072 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7073 |
utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7074 |
#endif |
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 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7077 |
"I would love to have SELF-like inline objects ..." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7078 |
ret := Array new:11. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7079 |
ret at:1 put:year. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7080 |
ret at:2 put:month. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7081 |
ret at:3 put:day. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7082 |
ret at:4 put:hours. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7083 |
ret at:5 put:minutes. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7084 |
ret at:6 put:seconds. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7085 |
ret at:7 put:utcOffset. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7086 |
ret at:8 put:dst. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7087 |
ret at:9 put:millis. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7088 |
ret at:10 put:yDay. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7089 |
ret at:11 put:wDay. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7090 |
^ ret |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7091 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7092 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7093 |
UnixOperatingSystem computeUTCTimeAndDateFrom:0 |
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 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7096 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7097 |
computeUTCTimePartsOf:osTime for:aBlock |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7098 |
"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
|
7099 |
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
|
7100 |
Conversion is to UTC." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7101 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7102 |
|hours minutes seconds millis osSeconds| |
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 |
osSeconds := osTime // 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7105 |
millis := osTime \\ 1000. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7106 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7107 |
struct tm *tmPtr; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7108 |
long t; |
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 |
t = __longIntVal(osSeconds); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7111 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7112 |
tmPtr = gmtime(&t); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7113 |
hours = __MKSMALLINT(tmPtr->tm_hour); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7114 |
minutes = __MKSMALLINT(tmPtr->tm_min); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7115 |
seconds = __MKSMALLINT(tmPtr->tm_sec); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7116 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7117 |
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
|
7118 |
|
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 |
UnixOperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli | |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7121 |
h printCR. m printCR. s printCR. milli printCR |
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 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7124 |
! |
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 |
getMillisecondTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7127 |
"This returns the millisecond timers value. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7128 |
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
|
7129 |
LargeInteger arithmetic when doing timeouts and delays. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7130 |
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
|
7131 |
short relative time deltas. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7132 |
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
|
7133 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7134 |
BAD DESIGN: |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7135 |
This should be changed to return some instance of RelativeTime, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7136 |
and these computations moved there. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7137 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7138 |
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
|
7139 |
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
|
7140 |
" |
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 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7143 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7144 |
long t = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7145 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7146 |
#if !defined(HAS_GETTIMEOFDAY) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7147 |
# if defined(HAS_FTIME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7148 |
struct timeb timebuffer; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7149 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7150 |
ftime(&timebuffer); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7151 |
t = (timebuffer.time * 1000) + timebuffer.millitm; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7152 |
# define HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7153 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7154 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7155 |
# ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7156 |
# if defined(SYSV) && defined(HZ) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7157 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7158 |
* sys5 time |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7159 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7160 |
long ticks; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7161 |
struct tms tb; |
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 |
ticks = times(&tb); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7164 |
t = (ticks * 1000) / HZ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7165 |
# define HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7166 |
# endif /* old SYSV stuff */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7167 |
# endif |
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 |
# ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7170 |
# ifdef WIN32 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7171 |
t = GetTickCount(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7172 |
# define HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7173 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7174 |
# endif |
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 |
# ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7177 |
# ifdef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7178 |
struct _timeb timebuffer; |
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 |
_ftime(&timebuffer); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7181 |
t = (timebuffer.time * 1000) + timebuffer.millitm; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7182 |
# define HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7183 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7184 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7185 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7186 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7187 |
#ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7188 |
/* assume HAS_GETTIMEOFDAY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7189 |
* - will result in a linkage error |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7190 |
* if not fixed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7191 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7192 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7193 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7194 |
* bsd time |
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 |
struct timeval tb; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7197 |
struct timezone tzb; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7198 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7199 |
gettimeofday(&tb, &tzb); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7200 |
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
|
7201 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7202 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7203 |
#undef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7204 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7205 |
RETURN ( __MKSMALLINT(t & 0x1FFFFFFF) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7206 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7207 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7208 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7209 |
getOSTime |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7210 |
"This returns the OS time. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7211 |
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
|
7212 |
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
|
7213 |
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
|
7214 |
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
|
7215 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7216 |
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
|
7217 |
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
|
7218 |
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
|
7219 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7220 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7221 |
|seconds millis| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7222 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7223 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7224 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7225 |
long t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7226 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7227 |
#if !defined(HAS_GETTIMEOFDAY) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7228 |
# if defined(HAS_FTIME) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7229 |
struct timeb timebuffer; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7230 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7231 |
ftime(&timebuffer); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7232 |
seconds = __MKUINT(timebuffer.time); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7233 |
millis = __MKUINT(timebuffer.millitm); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7234 |
# define HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7235 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7236 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7237 |
# ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7238 |
# if defined(SYSV) && defined(HZ) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7239 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7240 |
* sys5 time; we have to fake the information |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7241 |
* the returned value is inexact. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7242 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7243 |
int now; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7244 |
long ticks; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7245 |
struct tms tb; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7246 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7247 |
now = time(0); /* seconds since 1970 ... */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7248 |
seconds = __MKUINT(now); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7249 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7250 |
ticks = times(&tb); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7251 |
t = (ticks * 1000) / HZ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7252 |
t = t % 1000; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7253 |
millis = __MKSMALLINT(t); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7254 |
# endif /* OLD SYSV stuff */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7255 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7256 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7257 |
# ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7258 |
# ifdef MSDOS_LIKE |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7259 |
struct _timeb timebuffer; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7260 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7261 |
_ftime(&timebuffer); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7262 |
seconds = __MKUINT(timebuffer.time); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7263 |
millis = __MKUINT(timebuffer.millitm); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7264 |
# define HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7265 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7266 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7267 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7268 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7269 |
#ifndef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7270 |
/* assume HAS_GETTIMEOFDAY |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7271 |
* - will result in a linkage error |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7272 |
* if not fixed. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7273 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7274 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7275 |
* bsd time |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7276 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7277 |
struct timeval tb; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7278 |
struct timezone tzb; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7279 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7280 |
gettimeofday(&tb, &tzb); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7281 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7282 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7283 |
* mhmh long-long stuff seems not to work correctly |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7284 |
* on all machines (sparc) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7285 |
* being conservative here ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7286 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7287 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7288 |
# if defined(__GNUC__) && (__GNUC__ >= 2) && defined(i386) && defined(LINUX) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7289 |
# define HAS_LONGLONG |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7290 |
# endif |
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 |
# ifdef HAS_LONGLONG |
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 |
unsigned long long _secs, _millis, rslt; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7295 |
unsigned low, hi; |
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 |
_secs = tb.tv_sec; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7298 |
_millis = tb.tv_usec / 1000; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7299 |
rslt = _secs * 1000 + _millis; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7300 |
low = rslt & 0xFFFFFFFF; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7301 |
hi = rslt >> 32; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7302 |
RETURN (__MKLARGEINT64(1, low, hi)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7303 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7304 |
# endif /* long long */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7305 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7306 |
# ifdef alpha64 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7307 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7308 |
unsigned INT _secs, _millis, rslt; |
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 |
_secs = (INT) tb.tv_sec; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7311 |
_millis = (INT) tb.tv_usec / 1000; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7312 |
rslt = _secs * 1000 + _millis; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7313 |
RETURN (__MKUINT(rslt)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7314 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7315 |
# endif /* alpha */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7316 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7317 |
seconds = __MKUINT(tb.tv_sec); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7318 |
millis = __MKUINT(tb.tv_usec / 1000); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7319 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7320 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7321 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7322 |
#undef HAVE_TIME |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7323 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7324 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7325 |
^ (seconds * 1000) + millis |
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 |
UnixOperatingSystem getOSTime printCR. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7329 |
Delay waitForSeconds:0.2. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7330 |
UnixOperatingSystem getOSTime printCR. |
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 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7333 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7334 |
millisecondDelay:millis |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7335 |
"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
|
7336 |
arrives. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7337 |
All lower priority threads will also sleep for the duration, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7338 |
interrupts (and therefore, higher prio processes) are |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7339 |
still handled. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7340 |
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
|
7341 |
(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
|
7342 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7343 |
|now then delta| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7344 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7345 |
now := UnixOperatingSystem getMillisecondTime. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7346 |
then := UnixOperatingSystem millisecondTimeAdd:now and:millis. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7347 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7348 |
[UnixOperatingSystem millisecondTime:then isAfter:now] whileTrue:[ |
3540 | 7349 |
delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now. |
7350 |
self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta. |
|
7351 |
now := UnixOperatingSystem getMillisecondTime. |
|
3496
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 |
|
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 |
UnixOperatingSystem millisecondDelay:2000 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7356 |
" |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7357 |
|
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7358 |
"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
|
7359 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7360 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7361 |
sleep:numberOfSeconds |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7362 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7363 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7364 |
"cease ANY action for some time. This suspends the whole smalltalk |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7365 |
(unix-) process for some time. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7366 |
Not really useful since not even low-prio processes and interrupt |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7367 |
handling will run during the sleep. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7368 |
Use either UnixOperatingSystem>>millisecondDelay: (which makes all |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7369 |
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
|
7370 |
only the calling thread sleep)." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7371 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7372 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7373 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7374 |
if (__isSmallInteger(numberOfSeconds)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7375 |
sleep(__intVal(numberOfSeconds)); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7376 |
RETURN ( self ); |
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 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7379 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7380 |
argument not integer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7381 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7382 |
^ self primitiveFailed |
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 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7385 |
UnixOperatingSystem sleep:2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7386 |
" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7389 |
!UnixOperatingSystem class methodsFor:'users & groups'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7390 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7391 |
getEffectiveGroupID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7392 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7393 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7394 |
"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
|
7395 |
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
|
7396 |
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
|
7397 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7398 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7399 |
int uid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7400 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7401 |
uid = getegid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7402 |
RETURN ( __MKSMALLINT(uid) ); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7403 |
%} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7404 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7405 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7406 |
UnixOperatingSystem getEffectiveGroupID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7407 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7408 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7409 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7410 |
getEffectiveUserID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7411 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7412 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7413 |
"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
|
7414 |
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
|
7415 |
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
|
7416 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7417 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7418 |
int uid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7419 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7420 |
uid = geteuid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7421 |
RETURN ( __MKSMALLINT(uid) ); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7422 |
%} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7423 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7424 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7425 |
UnixOperatingSystem getEffectiveUserID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7426 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7427 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7428 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7429 |
getFullUserNameFromID:userID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7430 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7431 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7432 |
"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
|
7433 |
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
|
7434 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7435 |
|info gecos| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7436 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7437 |
info := self userInfoOf:userID. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7438 |
(info notNil |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7439 |
and:[info includesKey:#gecos]) ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7440 |
gecos := info at:#gecos. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7441 |
(gecos includes:$,) ifTrue:[ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7442 |
^ gecos copyTo:(gecos indexOf:$,) - 1 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7443 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7444 |
^ gecos |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7445 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7446 |
^ self getUserNameFromID:userID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7447 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7448 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7449 |
UnixOperatingSystem getFullUserNameFromID:0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7450 |
UnixOperatingSystem getFullUserNameFromID:(UnixOperatingSystem getUserID) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7451 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7452 |
UnixOperatingSystem getUserNameFromID:(UnixOperatingSystem getUserID) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7453 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7454 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7455 |
"Modified: 15.7.1996 / 12:44:21 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7456 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7457 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7458 |
getGroupID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7459 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7460 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7461 |
"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
|
7462 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7463 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7464 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7465 |
int uid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7466 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7467 |
uid = getgid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7468 |
RETURN ( __MKSMALLINT(uid) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7469 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7470 |
^ 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
|
7471 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7472 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7473 |
UnixOperatingSystem getGroupID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7474 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7475 |
! |
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 |
getGroupNameFromID:aNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7478 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7479 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7480 |
"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
|
7481 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7482 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7483 |
struct group *g; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7484 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7485 |
if (__isSmallInteger(aNumber)) { |
3540 | 7486 |
g = getgrgid(__intVal(aNumber)); |
7487 |
if (g) { |
|
7488 |
RETURN ( __MKSTRING(g->gr_name) ); |
|
7489 |
} |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7490 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7491 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7492 |
^ '???' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7493 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7494 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7495 |
UnixOperatingSystem getGroupNameFromID:0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7496 |
UnixOperatingSystem getGroupNameFromID:10 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7497 |
" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7500 |
getHomeDirectory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7501 |
"{ Pragma: +optSpace }" |
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 |
"return the name of the users home directory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7504 |
(i.e. yours)" |
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 |
^ UnixOperatingSystem getEnvironment:'HOME' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7507 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7508 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7509 |
UnixOperatingSystem getHomeDirectory |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7510 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7511 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7512 |
"Modified: 24.1.1997 / 11:32:13 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7513 |
! |
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 |
getLoginName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7516 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7517 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7518 |
"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
|
7519 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7520 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7521 |
static char cachedName[64]; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7522 |
static firstCall = 1; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7523 |
extern char *getenv(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7524 |
extern char *getlogin(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7525 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7526 |
char *name = (char *)0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7527 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7528 |
if (firstCall) { |
3540 | 7529 |
name = getlogin(); |
7530 |
if (! name || (name[0] == 0)) { |
|
7531 |
name = getenv("LOGNAME"); |
|
7532 |
} |
|
7533 |
if (name && (strlen(name) < sizeof(cachedName))) { |
|
7534 |
strcpy(cachedName, name); |
|
7535 |
firstCall = 0; |
|
7536 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7537 |
} else { |
3540 | 7538 |
name = cachedName; |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7539 |
} |
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7540 |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7541 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7542 |
* try a few common environment variables ... |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7543 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7544 |
if (! name || (name[0] == 0) ) { |
3540 | 7545 |
name = getenv("LOGIN"); |
7546 |
if (! name || (name[0] == 0) ) { |
|
7547 |
name = getenv("LOGNAME"); |
|
7548 |
if (! name || (name[0] == 0) ) { |
|
7549 |
name = getenv("USER"); |
|
7550 |
} |
|
7551 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7552 |
} |
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 |
* nope - I really font know who you are. |
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 |
if (! name || (name[0] == 0) ) { |
3540 | 7557 |
name = "you"; |
3496
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7560 |
RETURN ( __MKSTRING(name) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7561 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7562 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7563 |
UnixOperatingSystem getLoginName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7564 |
" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7567 |
getUserID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7568 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7569 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7570 |
"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
|
7571 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7572 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7573 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7574 |
int uid; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7575 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7576 |
uid = getuid(); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7577 |
RETURN ( __MKSMALLINT(uid) ); |
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7578 |
%} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7579 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7580 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7581 |
UnixOperatingSystem getUserID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7582 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7583 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7584 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7585 |
getUserNameFromID:aNumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7586 |
"{ Pragma: +optSpace }" |
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 |
"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
|
7589 |
This is the login name, not the fullName." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7590 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7591 |
%{ /* NOCONTEXT */ |
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 |
# ifndef NO_PWD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7594 |
struct passwd *p; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7595 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7596 |
if (__isSmallInteger(aNumber)) { |
3540 | 7597 |
p = getpwuid(__intVal(aNumber)); |
7598 |
if (p) { |
|
7599 |
RETURN ( __MKSTRING(p->pw_name) ); |
|
7600 |
} |
|
3512
5d1c5de6b9ca
removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents:
3501
diff
changeset
|
7601 |
} |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7602 |
#endif /* unix-like */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7603 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7604 |
aNumber == self getUserID ifTrue:[ |
3540 | 7605 |
^ self getLoginName |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7606 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7607 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7608 |
^ '? (' , aNumber printString , ')' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7609 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7610 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7611 |
UnixOperatingSystem getUserNameFromID:0 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7612 |
UnixOperatingSystem getUserNameFromID:100 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7613 |
UnixOperatingSystem getUserNameFromID:9991 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7614 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7615 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7616 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7617 |
userInfoOf:aNameOrID |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7618 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7619 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7620 |
"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
|
7621 |
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
|
7622 |
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
|
7623 |
DOS systems return nothing; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7624 |
non-SYSV4 systems have no age/comment. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7625 |
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
|
7626 |
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
|
7627 |
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
|
7628 |
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
|
7629 |
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
|
7630 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7631 |
|info name passw uid gid age comment |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7632 |
gecos dir shell| |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7633 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7634 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7635 |
# ifndef NO_PWD |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7636 |
struct passwd *buf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7637 |
int ret; |
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 |
if (__isString(aNameOrID)) { |
3540 | 7640 |
buf = getpwnam(__stringVal(aNameOrID)); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7641 |
} else if (__isSmallInteger(aNameOrID)) { |
3540 | 7642 |
buf = getpwuid(__intVal(aNameOrID)); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7643 |
} else { |
3540 | 7644 |
buf = (struct passwd *)0; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7645 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7646 |
if (buf) { |
3540 | 7647 |
name = __MKSTRING(buf->pw_name); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7648 |
# ifndef NO_PWD_PASSWD |
3540 | 7649 |
passw = __MKSTRING(buf->pw_passwd); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7650 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7651 |
# ifdef SYSV4 |
3540 | 7652 |
age = __MKSTRING(buf->pw_age); |
7653 |
comment = __MKSTRING(buf->pw_comment); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7654 |
# endif |
3540 | 7655 |
dir = __MKSTRING(buf->pw_dir); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7656 |
# ifndef NO_PWD_GECOS |
3540 | 7657 |
gecos = __MKSTRING(buf->pw_gecos); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7658 |
# endif |
3540 | 7659 |
shell = __MKSTRING(buf->pw_shell); |
7660 |
||
7661 |
uid = __MKSMALLINT(buf->pw_uid); |
|
7662 |
gid = __MKSMALLINT(buf->pw_gid); |
|
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 |
# endif /* has PWD */ |
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 |
info := IdentityDictionary new. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7667 |
name isNil ifTrue:[ |
3540 | 7668 |
aNameOrID == self getUserID ifTrue:[ |
7669 |
name := self getLoginName |
|
7670 |
]. |
|
3496
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 |
name notNil ifTrue:[ |
3540 | 7673 |
info at:#name put:name. |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7674 |
] ifFalse:[ |
3540 | 7675 |
info at:#name put:'unknown' |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7676 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7677 |
passw notNil ifTrue:[info at:#passwd put:passw]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7678 |
age notNil ifTrue:[info at:#age put:age]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7679 |
comment notNil ifTrue:[info at:#comment put:comment]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7680 |
gecos notNil ifTrue:[info at:#gecos put:gecos]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7681 |
shell notNil ifTrue:[info at:#shell put:shell]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7682 |
dir isNil ifTrue:[ |
3540 | 7683 |
aNameOrID == self getUserID ifTrue:[ |
7684 |
dir := self getHomeDirectory |
|
7685 |
] |
|
3496
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 |
dir notNil ifTrue:[info at:#dir put:dir]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7688 |
uid notNil ifTrue:[info at:#uid put:uid]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7689 |
gid notNil ifTrue:[info at:#gid put:gid]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7690 |
^ info |
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 |
UnixOperatingSystem userInfoOf:'root' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7694 |
UnixOperatingSystem userInfoOf:1 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7695 |
UnixOperatingSystem userInfoOf:'claus' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7696 |
UnixOperatingSystem userInfoOf:'fooBar' |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7697 |
UnixOperatingSystem userInfoOf:(UnixOperatingSystem getUserID) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7698 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7699 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7700 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7701 |
!UnixOperatingSystem class methodsFor:'waiting for events'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7702 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7703 |
blockingChildProcessWait |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7704 |
"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
|
7705 |
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
|
7706 |
a subprocesses status (to avoid blocking)." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7707 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7708 |
%{ /*NOCONTEXT*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7709 |
#if defined(HAS_WAITPID) || defined(HAS_WAIT3) || defined(WIN32) || defined(__VMS__) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7710 |
RETURN(false); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7711 |
#else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7712 |
RETURN(true); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7713 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7714 |
%} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7715 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7716 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7717 |
childProcessWait:blocking pid:pidToWait |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7718 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7719 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7720 |
"get status changes from child processes. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7721 |
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
|
7722 |
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
|
7723 |
otherwise we return immediately. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7724 |
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
|
7725 |
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
|
7726 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7727 |
|pid status code core| |
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 |
#if defined(UNIX_LIKE) && !defined(__VMS__) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7730 |
int p; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7731 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7732 |
# if defined(HAS_WAITPID) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7733 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7734 |
int s; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7735 |
# 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
|
7736 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7737 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7738 |
# if defined(HAS_WAIT3) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7739 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7740 |
union wait s; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7741 |
# 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
|
7742 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7743 |
# else /* neither waitpid, nor wait3; use wait, which is blocking */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7744 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7745 |
int s; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7746 |
# define __WAIT wait(&s) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7747 |
# define __BLOCKING_WAIT__ 1 |
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 |
if (blocking != true) { |
3540 | 7750 |
/* |
7751 |
* We do not support nonBlocking waits, so signal an error |
|
7752 |
* Sorry about the goto, but with all these ifdefs ... |
|
7753 |
*/ |
|
7754 |
goto done; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7755 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7756 |
# endif /*!HAS_WAIT3*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7757 |
# endif /*!HAS_WAITPID*/ |
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 |
# if !defined(WIFEXITED) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7760 |
# define WIFEXITED(stat) (((int)((stat)&0377))==0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7761 |
# define WIFSIGNALED(stat) (((int)((stat)&0377))>0&&((int)(((stat)>>8)&0377))==0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7762 |
# define WIFSTOPPED(stat) (((int)((stat)&0377))==0177&&((int)(((stat)>>8)&0377))!=0) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7763 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7764 |
# define WEXITSTATUS(stat) ((int)(((stat)>>8)&0377)) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7765 |
# define WTERMSIG(stat) (((int)((stat)&0377))&0177) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7766 |
# define WSTOPSIG(stat) ((int)(((stat)>>8)&0377)) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7767 |
# endif /*!WIFEXITED*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7768 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7769 |
# if !defined(WCOREDUMP) |
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 |
* 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
|
7772 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7773 |
# if defined(HAS_WAIT3) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7774 |
# define WCOREDUMP(status) (((union __wait*)&(status))->__w_coredump) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7775 |
# else |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7776 |
# define WCOREDUMP(status) ((int)(((status)>>8)&0200)) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7777 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7778 |
# endif /*!WCOREDUMP*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7779 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7780 |
# if __BLOCKING_WAIT__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7781 |
__BEGIN_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7782 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7783 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7784 |
do { |
3540 | 7785 |
p = __WAIT; |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7786 |
} while (p == -1 && errno == EINTR); |
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 |
# if __BLOCKING_WAIT__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7789 |
__END_INTERRUPTABLE__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7790 |
# undef __BLOCKING_WAIT__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7791 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7792 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7793 |
# undef __WAIT |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7794 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7795 |
if (p == 0) |
3540 | 7796 |
RETURN(nil) |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7797 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7798 |
if (p == -1) { |
3540 | 7799 |
if (errno == ECHILD) |
7800 |
RETURN(nil); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7801 |
} else { |
3540 | 7802 |
pid = __MKSMALLINT(p); |
7803 |
if (WIFEXITED(s)) { |
|
7804 |
status = @symbol(exit); |
|
7805 |
code = __MKSMALLINT(WEXITSTATUS(s)); |
|
7806 |
core = WCOREDUMP(s) ? true : false; |
|
7807 |
} else if (WIFSIGNALED(s)) { |
|
7808 |
status = @symbol(signal); |
|
7809 |
code = __MKSMALLINT(WTERMSIG(s)); |
|
7810 |
} else if (WIFSTOPPED(s)) { |
|
7811 |
status = @symbol(stop); |
|
7812 |
code = __MKSMALLINT(WSTOPSIG(s)); |
|
7813 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7814 |
# if defined(WIFCONTINUED) |
3540 | 7815 |
else if (WIFCONTINUED(s)) { |
7816 |
status = @symbol(continue); |
|
7817 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7818 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7819 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7820 |
done: ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7821 |
#endif /* UNIX_LIKE */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7822 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7823 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7824 |
(status isNil or:[pid isNil]) ifTrue:[ |
3540 | 7825 |
^ self primitiveFailed |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7826 |
]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7827 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7828 |
"/ 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
|
7829 |
"/ show:' code: '; show:code; show:' core:'; showCR:core. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7830 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7831 |
^ 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
|
7832 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7833 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7834 |
UnixOperatingSystem childProcessWait:false |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7835 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7836 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7837 |
"Created: 5.1.1996 / 16:39:14 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7838 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7839 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7840 |
numAvailableForReadOn:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7841 |
"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
|
7842 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7843 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7844 |
#ifdef NOTDEF /* does not work ... */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7845 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7846 |
* 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
|
7847 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7848 |
# if defined(FIONREAD) && !defined(WIN32) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7849 |
{ |
3540 | 7850 |
int n; |
7851 |
||
7852 |
if (__isSmallInteger(fd)) { |
|
7853 |
if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) { |
|
7854 |
RETURN (__MKINT(n)); |
|
7855 |
} |
|
7856 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7857 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7858 |
# endif /* FIONREAD */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7859 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7860 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7861 |
^ (self readCheck:fd) ifTrue:[1] ifFalse:[0] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7862 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7863 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7864 |
readCheck:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7865 |
"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
|
7866 |
(i.e. read is possible without blocking). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7867 |
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
|
7868 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7869 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7870 |
#ifdef NOTDEF /* does not work ... */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7871 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7872 |
* 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
|
7873 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7874 |
# if defined(FIONREAD) && !defined(WIN32) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7875 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7876 |
int n; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7877 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7878 |
if (__isSmallInteger(fd)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7879 |
if (n = ioctl(__intVal(fd), FIONREAD)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7880 |
printf("FIONREAD returns %d\n", n); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7881 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7882 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7883 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7884 |
# endif /* FIONREAD */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7885 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7886 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7887 |
# ifdef __VMS__ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7888 |
# ifdef DOES_NOT_WORK_YET |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7889 |
{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7890 |
/* |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7891 |
* do a sys$qio .. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7892 |
* fd here is suposed to be a channel nr. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7893 |
*/ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7894 |
struct IOSB iosb; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7895 |
int status; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7896 |
int channel; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7897 |
struct typahdask sensebuf; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7898 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7899 |
if (__isSmallInteger(fd)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7900 |
channel = __intVal(fd); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7901 |
status = SYS$QIO(0, /* efn */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7902 |
channel, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7903 |
IO$_SENSEMODE | IO$M_TYPEAHDCNT, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7904 |
&iosb, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7905 |
0, /* ast */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7906 |
0, /* ast arg */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7907 |
&sensebuf, /* data */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7908 |
sizeof(sensebuf), /* data size */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7909 |
0, 0, 0, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7910 |
if (status != SS$_NORMAL) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7911 |
fprintf(stderr, "OS [info]: SYS$QIO failed on %d\n", channel); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7912 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7913 |
fprintf(stderr, "sys$QIO -> %d\n", sensebuf.typcnt); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7914 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7915 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7916 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7917 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7918 |
# endif /* __VMS__ */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7919 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7920 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7921 |
^ super readCheck:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7922 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7923 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7924 |
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7925 |
"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
|
7926 |
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
|
7927 |
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
|
7928 |
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
|
7929 |
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
|
7930 |
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
|
7931 |
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
|
7932 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7933 |
%{ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7934 |
fd_set rset, wset, eset; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7935 |
struct timeval wt, et; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7936 |
int f, maxF, i, lX, bX; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7937 |
INT t; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7938 |
OBJ fd, retFd; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7939 |
int ret; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7940 |
int count; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7941 |
int numFds = 0; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7942 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
7943 |
if (__isSmallInteger(millis)) { |
3540 | 7944 |
FD_ZERO(&rset); |
7945 |
FD_ZERO(&wset); |
|
7946 |
FD_ZERO(&eset); |
|
7947 |
||
7948 |
maxF = -1; |
|
7949 |
if (__isNonNilObject(readFdArray)) { |
|
7950 |
if (! __isArray(readFdArray)) { |
|
7951 |
goto fail; |
|
7952 |
} |
|
7953 |
count = __arraySize(readFdArray); |
|
7954 |
||
7955 |
for (i=0; i<count;i++) { |
|
7956 |
fd = __ArrayInstPtr(readFdArray)->a_element[i]; |
|
7957 |
if (fd != nil) { |
|
7958 |
f = __intVal(fd); |
|
7959 |
if ((unsigned)f < FD_SETSIZE) { |
|
7960 |
FD_SET(f, &rset); |
|
7961 |
if (f > maxF) maxF = f; |
|
7962 |
numFds++; |
|
7963 |
} |
|
7964 |
} |
|
7965 |
} |
|
7966 |
} |
|
7967 |
||
7968 |
if (__isNonNilObject(writeFdArray)) { |
|
7969 |
if (! __isArray(writeFdArray)) { |
|
7970 |
goto fail; |
|
7971 |
} |
|
7972 |
count = __arraySize(writeFdArray); |
|
7973 |
for (i=0; i<count;i++) { |
|
7974 |
fd = __ArrayInstPtr(writeFdArray)->a_element[i]; |
|
7975 |
if (fd != nil) { |
|
7976 |
f = __intVal(fd); |
|
7977 |
if ((unsigned)f < FD_SETSIZE) { |
|
7978 |
FD_SET(f, &wset); |
|
7979 |
if (f > maxF) maxF = f; |
|
7980 |
numFds++; |
|
7981 |
} |
|
7982 |
} |
|
7983 |
} |
|
7984 |
} |
|
7985 |
||
7986 |
if (__isNonNilObject(exceptFdArray)) { |
|
7987 |
if (! __isArray(exceptFdArray)) { |
|
7988 |
goto fail; |
|
7989 |
} |
|
7990 |
count = __arraySize(exceptFdArray); |
|
7991 |
for (i=0; i<count;i++) { |
|
7992 |
fd = __ArrayInstPtr(exceptFdArray)->a_element[i]; |
|
7993 |
if (fd != nil) { |
|
7994 |
f = __intVal(fd); |
|
7995 |
if ((unsigned)f < FD_SETSIZE) { |
|
7996 |
FD_SET(f, &eset); |
|
7997 |
if (f > maxF) maxF = f; |
|
7998 |
numFds++; |
|
7999 |
} |
|
8000 |
} |
|
8001 |
} |
|
8002 |
} |
|
8003 |
||
8004 |
t = __intVal(millis); |
|
8005 |
if (t) { |
|
8006 |
wt.tv_sec = t / 1000; |
|
8007 |
wt.tv_usec = (t % 1000) * 1000; |
|
8008 |
} else { |
|
8009 |
wt.tv_sec = wt.tv_usec = 0; |
|
8010 |
} |
|
8011 |
||
8012 |
/* |
|
8013 |
* make certain, that interrupt gets us out of the select |
|
8014 |
* However, we must then care for moved objects. |
|
8015 |
*/ |
|
8016 |
__BEGIN_INTERRUPTABLE__ |
|
8017 |
errno = 0; |
|
8018 |
||
8019 |
if (t == 0) { |
|
8020 |
/* |
|
8021 |
* if there is no timeout time, we can stay here interruptable. |
|
8022 |
*/ |
|
8023 |
do { |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8024 |
# ifdef WIN32 |
3540 | 8025 |
intf we; |
8026 |
||
8027 |
if (numFds == 0) { |
|
8028 |
HANDLE dummyHandle = (HANDLE)0; |
|
3496
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 |
# if 0 /* does not work under WIN95 - sigh */ |
3540 | 8031 |
if (! GetQueueStatus(QS_ALLINPUT)) { |
8032 |
MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT); |
|
8033 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8034 |
# else |
3540 | 8035 |
if (we = __getWaitInputEvent()) { |
8036 |
we(t); |
|
8037 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8038 |
# endif |
3540 | 8039 |
ret = 0; |
8040 |
} else { |
|
8041 |
ret = select(0, &rset, &wset, &eset, &wt); |
|
8042 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8043 |
# else /* a real OS */ |
3540 | 8044 |
ret = select(maxF+1, &rset, &wset, &eset, &wt); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8045 |
# endif /* to WIN or not to WIN */ |
3540 | 8046 |
} while ((ret < 0) && (errno == EINTR)); |
8047 |
} else { |
|
8048 |
do { |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8049 |
# ifdef WIN32 |
3540 | 8050 |
intf we; |
8051 |
||
8052 |
if (numFds == 0) { |
|
8053 |
HANDLE dummyHandle = (HANDLE)0; |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8054 |
# if 0 /* does not work under WIN95 - sigh */ |
3540 | 8055 |
if (! GetQueueStatus(QS_ALLINPUT)) { |
8056 |
MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT); |
|
8057 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8058 |
# else |
3540 | 8059 |
if (we = __getWaitInputEvent()) { |
8060 |
we(t); |
|
8061 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8062 |
# endif |
3540 | 8063 |
ret = 0; |
8064 |
} else { |
|
8065 |
ret = select(0, &rset, &wset, &eset, &wt); |
|
8066 |
} |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8067 |
# else /* a real OS */ |
3540 | 8068 |
ret = select(maxF+1, &rset, &wset, &eset, &wt); |
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8069 |
# endif * to WIN or not to WIN */ |
3540 | 8070 |
/* |
8071 |
* for now: dont loop; if we did, we had to adjust the vt-timeval; |
|
8072 |
* could otherwise stay in this loop forever ... |
|
8073 |
* Premature return (before the time expired) must be handled by the caller. |
|
8074 |
* A good solution is to update the wt-timeval and redo the select. |
|
8075 |
*/ |
|
8076 |
} while (0 /* (ret < 0) && (errno == EINTR) */ ); |
|
8077 |
} |
|
8078 |
__END_INTERRUPTABLE__ |
|
8079 |
||
8080 |
if (ret > 0) { |
|
8081 |
for (i=0; i <= maxF; i++) { |
|
8082 |
if (FD_ISSET(i, &rset) |
|
8083 |
|| FD_ISSET(i, &wset) |
|
8084 |
|| FD_ISSET(i, &eset)) { |
|
8085 |
RETURN ( __MKSMALLINT(i) ); |
|
8086 |
} |
|
8087 |
} |
|
8088 |
} else { |
|
8089 |
if (ret < 0) { |
|
8090 |
if (errno == EINTR) { |
|
8091 |
errno = 0; |
|
8092 |
@global(LastErrorNumber) = nil; |
|
8093 |
} else { |
|
8094 |
if (@global(InfoPrinting) == true) { |
|
8095 |
fprintf(stderr, "OS [info]: select errno = %d\n", errno); |
|
8096 |
} |
|
8097 |
@global(LastErrorNumber) = __MKSMALLINT(errno); |
|
8098 |
} |
|
8099 |
} else { |
|
8100 |
@global(LastErrorNumber) = nil; |
|
8101 |
} |
|
8102 |
} |
|
8103 |
||
8104 |
/* |
|
8105 |
* return nil (means time expired or interrupted) |
|
8106 |
*/ |
|
8107 |
RETURN ( nil ); |
|
3496
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8108 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8109 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8110 |
fail: ; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8111 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8112 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8113 |
timeout argument not integer, |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8114 |
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
|
8115 |
or not supported by OS |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8116 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8117 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8118 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8119 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8120 |
setBlocking:aBoolean on:fd |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8121 |
"{ Pragma: +optSpace }" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8122 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8123 |
"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
|
8124 |
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
|
8125 |
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
|
8126 |
nil." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8127 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8128 |
%{ /* NOCONTEXT */ |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8129 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8130 |
int ret, flags; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8131 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8132 |
#if defined(F_GETFL) && defined(F_SETFL) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8133 |
# if defined(FNDELAY) |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8134 |
if (__isSmallInteger(fd)) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8135 |
int f = __intVal(fd); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8136 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8137 |
flags = fcntl(f, F_GETFL, 0); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8138 |
if (aBoolean == true) { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8139 |
ret = fcntl(f, F_SETFL, flags & ~FNDELAY); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8140 |
} else { |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8141 |
ret = fcntl(f, F_SETFL, flags | FNDELAY); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8142 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8143 |
if (ret >= 0) ret = flags; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8144 |
RETURN ( __MKSMALLINT(ret) ); |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8145 |
} |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8146 |
# endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8147 |
#endif |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8148 |
%}. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8149 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8150 |
fd argument not integer |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8151 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8152 |
^ self primitiveFailed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8153 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8154 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8155 |
!UnixOperatingSystem::FileStatusInfo class methodsFor:'instance creation'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8156 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8157 |
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP alternativeName:name2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8158 |
^ self basicNew |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8159 |
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP alternativeName:name2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8160 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8161 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8162 |
!UnixOperatingSystem::FileStatusInfo methodsFor:'accessing'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8163 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8164 |
accessed |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8165 |
"return accessed" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8166 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8167 |
^ accessed! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8168 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8169 |
alternativeName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8170 |
"return the files other name (DOS name on windows). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8171 |
Nil if there is no other name" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8172 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8173 |
^ alternativeName |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8174 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8175 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8176 |
fixedHeaderSize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8177 |
"return the fixedHeaderSize (VMS only; nil everywhere else)" |
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 |
^ fixedHeaderSize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8180 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8181 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8182 |
gid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8183 |
"return gid" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8184 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8185 |
^ gid! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8186 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8187 |
id |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8188 |
"return id" |
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 |
^ id! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8191 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8192 |
mode |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8193 |
"return mode" |
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 |
^ mode! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8196 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8197 |
modified |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8198 |
"return modified" |
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 |
^ modified! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8201 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8202 |
path |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8203 |
"for symbolic links only: return the path where the symbolic link points to" |
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 |
^ path |
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 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8208 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8209 |
recordAttributes |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8210 |
"return the recordAttributes (VMS only; nil everywhere else)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8211 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8212 |
^ recordAttributes |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8215 |
recordFormat |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8216 |
"return the recordFormat (VMS only; nil everywhere else)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8217 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8218 |
^ recordFormat |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8219 |
! |
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 |
recordFormatNumeric |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8222 |
"return the recordFormat as numeric (VMS only; nil everywhere else)" |
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 |
^ recordFormatNumeric |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8227 |
recordSize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8228 |
"return the recordSize (VMS only; nil everywhere else)" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8229 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8230 |
^ recordSize |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8231 |
! |
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 |
size |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8234 |
"return size" |
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 |
^ size! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8237 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8238 |
statusChanged |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8239 |
"return statusChanged" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8240 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8241 |
^ statusChanged! |
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 |
type |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8244 |
"return type" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8245 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8246 |
^ type! |
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 |
uid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8249 |
"return uid" |
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 |
^ uid |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8254 |
!UnixOperatingSystem::FileStatusInfo methodsFor:'backward compatibility'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8255 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8256 |
at:key |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8257 |
"backward compatibility access: in previous releases, IdentityDictionaries |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8258 |
were used to hold my information. Allow access via key messages. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8259 |
This method will vanish - use the proper access protocol." |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8260 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8261 |
^ self perform:key |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8262 |
! ! |
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 |
!UnixOperatingSystem::FileStatusInfo methodsFor:'private accessing'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8265 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8266 |
recordFormat:rf recordFormatNumeric:nrf recordAttributes:ra fixedHeaderSize:hs recordSize:rs |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8267 |
recordFormat := rf. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8268 |
recordFormatNumeric := nrf. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8269 |
recordAttributes := ra. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8270 |
fixedHeaderSize := hs. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8271 |
recordSize := rs |
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 |
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP alternativeName:name2 |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8275 |
type := t. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8276 |
mode := m. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8277 |
uid := u. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8278 |
gid := g. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8279 |
size := s. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8280 |
id := i. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8281 |
accessed := aT. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8282 |
modified := mT. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8283 |
statusChanged := sT. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8284 |
path := lP. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8285 |
alternativeName := name2. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8286 |
! ! |
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 |
!UnixOperatingSystem::OSProcessStatus class methodsFor:'documentation'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8289 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8290 |
documentation |
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 |
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
|
8293 |
operating system processes (these are no smalltalk processes!!). |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8294 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8295 |
[Instance variables:] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8296 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8297 |
pid <Integer> OS-Process identifier |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8298 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8299 |
status <Symbol> either #exit #signal #stop #continue |
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 |
code <Integer> either exitcode or signalnumber |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8302 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8303 |
core <Boolean> true if core has been dumped |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8304 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8305 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8306 |
[author:] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8307 |
Stefan Vogel |
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 |
[see also:] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8310 |
OperatingSystem |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8311 |
" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8312 |
! ! |
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 |
!UnixOperatingSystem::OSProcessStatus class methodsFor:'instance creation'! |
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 |
pid:pid status:status code:code core:core |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8317 |
"private interface for UnixOperatingSystem" |
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 |
^ 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
|
8320 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8321 |
"Created: 28.12.1995 / 14:16:14 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8322 |
"Modified: 30.4.1996 / 18:25:00 / cg" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8325 |
processCreationFailure |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8326 |
"private interface for UnixOperatingSystem" |
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 |
^ 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
|
8329 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8330 |
"Created: 28.12.1995 / 14:35:29 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8331 |
"Modified: 30.4.1996 / 18:25:05 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8332 |
! ! |
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 |
!UnixOperatingSystem::OSProcessStatus methodsFor:'accessing'! |
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 |
code |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8337 |
"return the exitcode / signalNumber" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8338 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8339 |
^ code |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8340 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8341 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8342 |
"Modified: 30.4.1996 / 18:26:23 / cg" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8345 |
core |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8346 |
"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
|
8347 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8348 |
^ core == true |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8349 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8350 |
"Modified: 28.12.1995 / 14:14:38 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8351 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8352 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8353 |
pid |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8354 |
"return the pid" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8355 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8356 |
^ pid |
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 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8359 |
"Modified: 30.4.1996 / 18:26:30 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8360 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8361 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8362 |
status |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8363 |
"return status as a Symbol; |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8364 |
one of #exit #signal #stop #continue" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8365 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8366 |
^ status |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8367 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8368 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8369 |
"Modified: 30.4.1996 / 18:26:54 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8370 |
! ! |
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 |
!UnixOperatingSystem::OSProcessStatus methodsFor:'initialization'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8373 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8374 |
pid:newPid status:newStatus code:newCode core:newCore |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8375 |
pid := newPid. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8376 |
status := newStatus. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8377 |
code := newCode. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8378 |
core := newCore. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8379 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8380 |
"Created: 28.12.1995 / 14:18:22 / stefan" |
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 |
!UnixOperatingSystem::OSProcessStatus methodsFor:'private-OS interface'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8384 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8385 |
code:something |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8386 |
"set the exitCode" |
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 |
code := something. |
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 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8391 |
"Modified: 30.4.1996 / 18:25:18 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8392 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8393 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8394 |
core:something |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8395 |
"set core" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8396 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8397 |
core := something. |
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 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8402 |
pid:something |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8403 |
"set pid" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8404 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8405 |
pid := something. |
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 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8410 |
status:something |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8411 |
"set status" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8412 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8413 |
status := something. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8414 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8415 |
"Created: 28.12.1995 / 14:05:07 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8416 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8417 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8418 |
!UnixOperatingSystem::OSProcessStatus methodsFor:'queries'! |
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 |
couldNotExecute |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8421 |
"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
|
8422 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8423 |
^ status == #exit and:[code = 127]. |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8424 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8425 |
"Created: 28.12.1995 / 15:43:17 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8426 |
"Modified: 30.4.1996 / 18:27:03 / cg" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8427 |
! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8428 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8429 |
stillAlive |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8430 |
"true if process is still alive" |
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 |
^ status == #stop or:[status == #continue] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8433 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8434 |
"Created: 28.12.1995 / 14:27:26 / stefan" |
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 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8437 |
success |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8438 |
"true if process terminated successfully" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8439 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8440 |
^ status == #exit and:[code = 0] |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8441 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8442 |
"Created: 28.12.1995 / 14:13:05 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8443 |
"Modified: 28.12.1995 / 14:13:41 / stefan" |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8444 |
! ! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8445 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8446 |
!UnixOperatingSystem class methodsFor:'documentation'! |
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8447 |
|
85e19a68bd61
started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff
changeset
|
8448 |
version |
3556
03e4132de6da
added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents:
3555
diff
changeset
|
8449 |
^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.20 1998-06-11 20:48:35 cg Exp $' |
3496
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 |
UnixOperatingSystem initialize! |