UnixOperatingSystem.st
author Claus Gittinger <cg@exept.de>
Sun, 02 Jul 2000 14:50:18 +0200
changeset 5438 00e3c22156c3
parent 5407 d6729266a95b
child 5444 5cbb37147eeb
permissions -rw-r--r--
added fallback st-code (for rel5 migration)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
     3
              All Rights Reserved
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
    13
"{ Package: 'stx:libbasic' }"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
    14
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
AbstractOperatingSystem subclass:#UnixOperatingSystem
5035
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    16
	instanceVariableNames:''
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    17
	classVariableNames:'HostName DomainName SlowFork ForkFailed CurrentDirectory'
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    18
	poolDictionaries:''
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    19
	category:'OS-Unix'
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    20
!
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    21
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
    22
Object subclass:#FileStatusInfo
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
    23
	instanceVariableNames:'type mode uid gid size id accessed modified statusChanged path'
5035
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    24
	classVariableNames:''
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    25
	poolDictionaries:''
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    26
	privateIn:UnixOperatingSystem
3496
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
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
    29
Object subclass:#OSProcessStatus
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
    30
	instanceVariableNames:'pid status code core'
5035
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    31
	classVariableNames:''
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    32
	poolDictionaries:''
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
    33
	privateIn:UnixOperatingSystem
3496
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
#if defined(_AIX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
# ifndef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
#  define WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
# ifndef WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
#  define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
#ifdef LINUX
4882
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
    49
# define __xxUSE_GNU      /* new */
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
    50
# undef HAS_UTS_DOMAINNAME
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
    51
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
    52
# ifndef _STDIO_H_INCLUDED_
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
    53
#  include <stdio.h>
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
    54
#  define _STDIO_H_INCLUDED_
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
    55
# endif
3956
51f1a9a4d63f changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
    56
51f1a9a4d63f changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
    57
# ifndef _SYS_TYPES_H_INCLUDED_
51f1a9a4d63f changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
    58
#  include <sys/types.h>
51f1a9a4d63f changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
    59
#  define _SYS_TYPES_H_INCLUDED_
51f1a9a4d63f changes for egcs (stdio uses __new / utsname)
Claus Gittinger <cg@exept.de>
parents: 3943
diff changeset
    60
# endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
  /* use inline string macros */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
# define __STRINGDEFS__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
# include <linuxIntern.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
# ifndef WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
#  define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
# define WANT_SHM
3544
a654f7ac3a6e solaris has no setenv / unsetenv
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
    69
# define HAS_SETENV
a654f7ac3a6e solaris has no setenv / unsetenv
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
    70
# define HAS_UNSETENV
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
#ifdef IRIX5
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
#ifdef ultrix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
#ifdef hpux
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
#ifdef solaris
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
#if defined(SYSV4) && defined(i386) /* e.g. unixware */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
 * notice: although many systems' include files
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
 * already block against multiple inclusion, some
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
 * do not. Therefore, this is done here again.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
 * (it does not hurt)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
 */ 
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 WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
# ifndef NO_SYS_PARAM_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
#  include <sys/param.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
#  define _SYS_PARAM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
# include <errno.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
# define _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
# include <sys/stat.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
# define _SYS_STAT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
#endif /* WANT_REALPATH */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
extern int shmctl(), shmget(), shmdt();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
extern char * shmat();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
# include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
# define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
# include <sys/ipc.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
# define _SYS_IPC_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
# include <sys/shm.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
# define _SYS_SHM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
#endif /* WANT_SHM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
#ifdef IRIX5
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
# include <sys/syssgi.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
#ifdef transputer
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 unlink(f)      ((remove(f) == 0) ? 0 : -1)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
#else /* not transputer */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
# ifndef _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
#  include <signal.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
#  define _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
# endif
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
# ifdef SYSV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
#  ifndef _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
#   include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
#   define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
#  ifndef _SYS_PARAM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
#   ifndef NO_SYS_PARAM_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
#    include <sys/param.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
#    define _SYS_PARAM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
#  ifndef _SYS_TIMES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
#   include <sys/times.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
#   define _SYS_TIMES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
#  ifndef _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
#   include <sys/file.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
#   define _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
#  endif
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
#  if ! defined(sco3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
#   ifndef _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
#    include <unistd.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
#    define _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
#  if defined(isc3_2) || defined(sco3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
#   ifndef _SYS_TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
#    include <sys/time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
#    define _SYS_TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
#  if !defined(isc3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
#   if defined(PCS) && defined(mips)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
#    include "/usr/include/bsd/sys/time.h"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
#    include "/usr/include/sys/time.h"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
#    ifndef _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
#     include <time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
#     define _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
#    endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
#  if defined(isc3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
#   include <sys/bsdtypes.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
#  endif
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
# else /* not SYSV */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   202
#  ifndef _SYS_TIME_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   203
#   include <sys/time.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   204
#   define _SYS_TIME_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   205
#  endif
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   206
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   207
#  ifndef _SYS_TYPES_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   208
#   include <sys/types.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   209
#   define _SYS_TYPES_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   210
#  endif
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   211
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
# endif /* not SYSV */
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
# ifdef aix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
#  ifndef _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
#   include <time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
#   define _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
#  ifndef _SYS_SELECT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
#   include <sys/select.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
#   define _SYS_SELECT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
# endif /* aix */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
4882
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   228
# ifndef _STDIO_H_INCLUDED_
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   229
#  include <stdio.h>
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   230
#  define _STDIO_H_INCLUDED_
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   231
# endif
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   232
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   233
# ifndef _PWD_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   234
#  include <pwd.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   235
#  define _PWD_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   236
# endif
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   237
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   238
# ifndef NO_GRP_H
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   239
#  ifndef _GRP_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   240
#   include <grp.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   241
#   define _GRP_H_INCLUDED_
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
#  endif
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   243
# endif
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   244
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
# ifndef _SYS_STAT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
#  include <sys/stat.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
#  define _SYS_STAT_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_FILE_H_INCLUDED_
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   252
#  include <sys/file.h>
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
#  define _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
# ifndef _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
#  include <errno.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
#  define _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
# ifndef _FCNTL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
#  include <fcntl.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
#  define _FCNTL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
# ifndef _IOCTL_H_INCLUDED_
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   267
#  include <sys/ioctl.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   268
#  define _IOCTL_H_INCLUDED_
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
# if defined(LINUX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
#  define HAS_LOCALECONV
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 (HAS_LOCALECONV)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
#  ifndef _LOCALE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
#   include <locale.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
#   define _LOCALE_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
/* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
 * posix systems should define these ... 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
 * but on some (older) systems, they are not.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
# ifndef S_IXUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
#  ifdef S_IEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
#   define S_IXUSR S_IEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
#   define S_IXGRP (S_IEXEC>>3)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
#   define S_IXOTH (S_IEXEC>>6)
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
# ifndef S_IXUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
#  define S_IXUSR 0100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
#  define S_IXGRP 0010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
#  define S_IXOTH 0001
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
# endif
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
# ifndef S_IRUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
#  define S_IRUSR 0400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
#  define S_IRGRP 0040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
#  define S_IROTH 0004
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
# ifndef S_IWUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
#  define S_IWUSR 0200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
#  define S_IWGRP 0020
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
#  define S_IWOTH 0002
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 MAXPATHLEN
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   313
#  ifndef NO_SYS_PARAM_H
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   314
#   include <sys/param.h>
3496
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
#  ifndef MAXPATHLEN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
#   ifdef FILENAME_MAX  /* i.e. MSDOS_LIKE */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
#    define MAXPATHLEN FILENAME_MAX
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
#    ifdef MAX_PATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
#     define MAXPATHLEN MAX_PATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
#    else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
#     define MAXPATHLEN 1024
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
#    endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
#  endif
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
# if defined(HAS_UNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
#  include <sys/utsname.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
# endif
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
# if defined(SYSV4)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
#  include <stropts.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
4285
342a32e855b4 aix has no sys/termios.h
Claus Gittinger <cg@exept.de>
parents: 4262
diff changeset
   337
# ifndef aix
342a32e855b4 aix has no sys/termios.h
Claus Gittinger <cg@exept.de>
parents: 4262
diff changeset
   338
#  include <sys/termios.h>
342a32e855b4 aix has no sys/termios.h
Claus Gittinger <cg@exept.de>
parents: 4262
diff changeset
   339
# endif
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   340
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
 * NeXT has no pid_t
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
 * and no sigemptyset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
# ifdef NEXT3
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
   typedef int pid_t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
#  define sigemptyset(set)      ((*(set) = 0L), 0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
#  define HAS_GETDOMAINNAME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
#  define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
# ifdef sunos
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
#  undef NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
#  undef HAS_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
#  define HAS_WAIT3
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
#  define HAS_SIGACTION
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
 * some (BSD ?) have no timezone global,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
 * but provide the info in struct timezone.
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
# if defined(ultrix) || defined(sunos) || defined(NEXT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
#  define HAS_NO_TIMEZONE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
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
 * 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
   369
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
# ifndef SA_RESTART
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
#  define SA_RESTART    0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
# ifndef SA_SIGINFO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
#  define SA_SIGINFO    0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
# if defined(HAS_WAITPID) || defined(HAS_WAIT3)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
#  include <sys/wait.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
# if defined(HAS_SYSINFO)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
#  include <sys/systeminfo.h>
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
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   385
# ifdef LINUX
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   386
#  include <linux/kernel.h>
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   387
#  include <linux/sys.h>
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   388
# endif
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   389
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   390
# if defined(HAS_GETSYSINFO)
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   391
#  include <sys/sysinfo.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   392
#  include <machine/hal_sysinfo.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   393
#  include <machine/hal/cpuconf.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   394
# endif
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   395
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   396
# if defined(HAS_SYSCONF)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   397
#  ifndef _UNISTD_H_INCLUDED_
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   398
#   include <unistd.h>
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   399
#   define _UNISTD_H_INCLUDED_
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   400
#  endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   401
# endif
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   402
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
#endif /* not transputer */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
 * 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
   407
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
#ifndef errno
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
 extern errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
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
 * some (old ?) systems do not define this ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
#if !defined(R_OK) && !defined(_AIX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
# define R_OK    4       /* Test for Read permission */ 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
# define W_OK    2       /* Test for Write permission */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
# define X_OK    1       /* Test for eXecute permission */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
# 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
   420
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   422
#define SIGHANDLER_ARG
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
#ifdef sunos
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
# define NO_WAITPID
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 NEXT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
# define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
 * 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
   433
 * explicit add of those we know to have ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
#ifdef __osf__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
# define TIME_T time_t
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
# define OFF_T  off_t
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
#ifndef TIME_T
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
# define TIME_T long
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
#ifndef OFF_T
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
# define OFF_T  long
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
 * where is the timezone info ?
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
#if defined(HAS_NO_TIMEZONE)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
# if defined(HAS_NO_TM_GMTOFF)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
#  define TIMEZONE(tmPtr)       0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
#  define TIMEZONE(tmPtr)       ((tmPtr)->tm_gmtoff)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
#else
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   457
# define TIMEZONE(tmPtr)       timezone
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
3595
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   460
#ifndef CONST
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   461
# ifdef __GNUC__
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   462
#  define CONST const
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   463
# else
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   464
#  define CONST /* nothing */
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   465
# endif
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   466
#endif
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   467
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
! !
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
!UnixOperatingSystem primitiveFunctions!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
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
 * 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
   476
 * 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
   477
 * (LINUX is one of them)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
 * 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
   479
 * UnixOperatingSystem>>executeCommand, you ought to define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
 * 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
   481
 *
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
 * 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
   483
 * 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
   484
 * (i.e. it is RT safe)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
#if defined(WANT_SYSTEM)
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
/* # define DPRINTF(x)     printf x */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
# define DPRINTF(x)     /* nothing */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
# ifndef _STDDEF_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
#  include <stddef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
#  define _STDDEF_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
# ifndef _STDLIB_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
#  include <stdlib.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
#  define _STDLIB_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
# ifndef _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
#  include <unistd.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
#  define _UNISTD_H_INCLUDED_
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
# ifndef _SYS_WAIT_H_INCLUDED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
#  include <sys/wait.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
#  define _SYS_WAIT_H_INCLUDED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
# ifndef _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
#  include <signal.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
#  define _SIGNAL_H_INCLUDED_
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
# ifndef _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
#  include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
#  define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
# 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
   523
#  define       __environ       environ
4882
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   524
#  if 1 /* !defined(LINUX) */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
#   define      __sigemptyset   sigemptyset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
#   define      __sigaction     sigaction
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
#   define      __sigaddset     sigaddset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
#   define      __sigprocmask   sigprocmask
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
#   define      __execve        execve
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
#   define      __wait          wait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
#   define      __waitpid       waitpid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
#   if defined(HAS_VFORK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
#    define     FORK            vfork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
#    define     FORK            fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
#  endif /* ! LINUX */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
   extern char **environ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
4882
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   541
# define      __sigprocmask   sigprocmask
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   542
# define      __execve        execve
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   543
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
# 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
   545
# define        SHELL_NAME      "sh"            /* Name to give it.  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
# ifndef        FORK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
#  define       FORK    __fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   549
# endif
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
static int
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   552
mySystem(line)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   553
    register CONST char *line;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   555
    int status, save;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
    pid_t pid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
    struct sigaction sa, intr, quit;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
    sigset_t block, omask;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
    if (line == NULL)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   561
        return -1;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
    sa.sa_handler = SIG_IGN;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
    sa.sa_flags = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
    __sigemptyset (&sa.sa_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
    if (__sigaction (SIGINT, &sa, &intr) < 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   568
        DPRINTF(("1: errno=%d\n", errno));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   569
        return -1;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
    if (__sigaction (SIGQUIT, &sa, &quit) < 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   572
        save = errno;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   573
        (void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   574
        errno = save;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   575
        DPRINTF(("2: errno=%d\n", errno));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   576
        return -1;
3496
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
    __sigemptyset (&block);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
    __sigaddset (&block, SIGCHLD);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
    save = errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
    if (__sigprocmask(SIG_BLOCK, &block, &omask) < 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   583
        if (errno == ENOSYS)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   584
            errno = save;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   585
        else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   586
            save = errno;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   587
            (void) __sigaction(SIGINT, &intr, (struct sigaction *) NULL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   588
            (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   589
            errno = save;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   590
            DPRINTF(("3: errno=%d\n", errno));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   591
            return -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   592
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   593
    }
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
    pid = FORK ();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   596
    if (pid == (pid_t) 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   597
        /* Child side.  */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   598
        CONST char *new_argv[4];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   599
        new_argv[0] = SHELL_NAME;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   600
        new_argv[1] = "-c";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   601
        new_argv[2] = line;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   602
        new_argv[3] = NULL;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   603
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   604
        /* Restore the signals.  */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   605
        (void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   606
        (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   607
        (void) __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   608
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   609
        /* Exec the shell.  */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   610
        (void) __execve (SHELL_PATH, (char *CONST *) new_argv, __environ);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   611
        _exit (127);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
    } else {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   613
        if (pid < (pid_t) 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   614
            /* The fork failed.  */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   615
            DPRINTF(("4: errno=%d\n", errno));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   616
            status = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   617
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   618
            /* Parent side.  */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
#ifdef  NO_WAITPID
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   620
            pid_t child;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   621
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   622
            do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   623
                __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   624
                child = __wait (&status);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   625
                __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   626
                if (child < 0 && errno != EINTR) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   627
                    DPRINTF(("5: errno=%d\n", errno));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   628
                    status = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   629
                    break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   630
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   631
            } while (child != pid);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
#else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   633
            pid_t child;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   634
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   635
            /* claus: the original did not care for EINTR here ... */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   636
            do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   637
                __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   638
                child = __waitpid (pid, &status, 0);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   639
                __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   640
            } while ((child != pid) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   641
            if (child != pid) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   642
                DPRINTF(("6: errno=%d\n", errno));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   643
                status = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   644
            }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
#endif /* NO_WAITPID */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   646
        }
3496
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
    save = errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
    if ((__sigaction (SIGINT, &intr, (struct sigaction *) NULL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
     | __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
     | __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL)) != 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   652
        if (errno == ENOSYS) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   653
            errno = save;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   654
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   655
            status = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   656
            DPRINTF(("7: errno=%d\n", errno));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   657
        }
3496
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
    return status;
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
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
# define __wait wait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
#endif /* WANT_SYSTEM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
 * some systems do not have realpath();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
 * the alternative of reading from a 'pwp'-pipe
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
 * 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
   671
 * 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
   672
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
#if defined(HAS_REALPATH)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
# undef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
#if !defined(HAS_GETWD) && !defined(HAS_GETCWD)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
# undef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
#endif
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
#if defined(WANT_REALPATH)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
# ifndef NULL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
#  define NULL (char *)0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
# define MAX_READLINKS 32
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
# ifndef MAXPATHLEN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
#  define MAXPATHLEN     1024
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   692
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   693
static
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   694
char *realpath(path, resolved_path)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   695
char *path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   696
char resolved_path [];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
{
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   698
        char copy_path[MAXPATHLEN];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   699
        char link_path[MAXPATHLEN];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   700
        char *new_path = resolved_path;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   701
        char *max_path;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   702
        int readlinks = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   703
        int n;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   704
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   705
        /* Make a copy of the source path since we may need to modify it. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   706
        strcpy(copy_path, path);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   707
        path = copy_path;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   708
        max_path = copy_path + MAXPATHLEN - 2;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   709
        /* If it's a relative pathname use getwd for starters. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   710
        if (*path != '/') {
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
#ifdef HAS_GETCWD
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   712
                new_path = getcwd(new_path, MAXPATHLEN - 1);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
#else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   714
                new_path = getwd(new_path);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   715
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   716
                if (new_path == NULL) 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   717
                    return(NULL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   718
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   719
                new_path += strlen(new_path);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   720
                if (new_path[-1] != '/')
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   721
                        *new_path++ = '/';
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   722
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   723
        else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   724
                *new_path++ = '/';
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   725
                path++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   726
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   727
        /* Expand each slash-separated pathname component. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   728
        while (*path != '\0') {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   729
                /* Ignore stray "/". */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   730
                if (*path == '/') {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   731
                        path++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   732
                        continue;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   733
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   734
                if (*path == '.') {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   735
                        /* Ignore ".". */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   736
                        if (path[1] == '\0' || path[1] == '/') {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   737
                                path++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   738
                                continue;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   739
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   740
                        if (path[1] == '.') {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   741
                                if (path[2] == '\0' || path[2] == '/') {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   742
                                        path += 2;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   743
                                        /* Ignore ".." at root. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   744
                                        if (new_path == resolved_path + 1)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   745
                                                continue;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   746
                                        /* Handle ".." by backing up. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   747
                                        while ((--new_path)[-1] != '/')
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   748
                                                ;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   749
                                        continue;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   750
                                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   751
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   752
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   753
                /* Safely copy the next pathname component. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   754
                while (*path != '\0' && *path != '/') {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   755
                        if (path > max_path) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   756
                                errno = ENAMETOOLONG;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   757
                                return NULL;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   758
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   759
                        *new_path++ = *path++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   760
                }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
#ifdef S_IFLNK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   762
                /* Protect against infinite loops. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   763
                if (readlinks++ > MAX_READLINKS) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   764
                        errno = ELOOP;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   765
                        return NULL;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   766
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   767
                /* See if latest pathname component is a symlink. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   768
                *new_path = '\0';
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   769
                n = readlink(resolved_path, link_path, MAXPATHLEN - 1);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   770
                if (n < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   771
                        /* EINVAL means the file exists but isn't a symlink. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   772
                        if (errno != EINVAL)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   773
                                return NULL;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   774
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   775
                else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   776
                        /* Note: readlink doesn't add the null byte. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   777
                        link_path[n] = '\0';
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   778
                        if (*link_path == '/')
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   779
                                /* Start over for an absolute symlink. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   780
                                new_path = resolved_path;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   781
                        else
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   782
                                /* Otherwise back up over this component. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   783
                                while (*(--new_path) != '/')
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   784
                                        ;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   785
                        /* Safe sex check. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   786
                        if (strlen(path) + n >= MAXPATHLEN) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   787
                                errno = ENAMETOOLONG;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   788
                                return NULL;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   789
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   790
                        /* Insert symlink contents into path. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   791
                        strcat(link_path, path);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   792
                        strcpy(copy_path, link_path);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   793
                        path = copy_path;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   794
                }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
#endif /* S_IFLNK */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   796
                *new_path++ = '/';
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   797
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   798
        /* Delete trailing slash but don't whomp a lone slash. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   799
        if (new_path != resolved_path + 1 && new_path[-1] == '/')
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   800
                new_path--;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   801
        /* Make sure it's null terminated. */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   802
        *new_path = '\0';
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   803
        return resolved_path;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
# define HAS_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
#endif /* WANT_REALPATH && not HAS_REALPATH */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
!UnixOperatingSystem class methodsFor:'documentation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
copyright
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   814
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   815
 COPYRIGHT (c) 1988 by Claus Gittinger
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   816
              All Rights Reserved
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
 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
   819
 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
   820
 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
   821
 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
   822
 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
   823
 hereby transferred.
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
documentation
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
    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
   830
    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
   831
    things available here in your applications 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
    - 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
   833
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
    (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
   835
     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
   836
     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
   837
     You decide - portability vs. functionality)
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
    [Class variables:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   841
        HostName        <String>        remembered hostname
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   842
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   843
        DomainName      <String>        remembered domainname
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   844
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   845
        SlowFork        <Boolean>       if set, fork and popen are avoided;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   846
                                        (more or less obsolete now)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   847
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   848
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   849
        CurrentDirectory <String>       remembered currentDirectories path
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
    [author:]
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   852
        Claus Gittinger
3496
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
    [see also:]
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   855
        OSProcessStatus
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   856
        Filename Date Time
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   857
        ExternalStream FileStream PipeStream Socket
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
"
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
examples
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
  various queries
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   864
                                                                [exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
    Transcript 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   866
        showCR:'hello ' , (OperatingSystem getLoginName)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   867
                                                                [exEnd]
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   868
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   869
                                                                [exBegin]
3793
aff27e755ffd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
   870
    OperatingSystem isUNIXlike ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   871
        Transcript showCR:'this is some UNIX-like OS'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
    ] ifFalse:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   873
        Transcript showCR:'this OS is not UNIX-like'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
    ]
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   875
                                                                [exEnd]
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   876
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   877
                                                                [exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
    Transcript 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   879
        showCR:'this machine is called ' , OperatingSystem getHostName
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   880
                                                                [exEnd]
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   881
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   882
                                                                [exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
    Transcript 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   884
        showCR:('this machine is in the '
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   885
               , OperatingSystem getDomainName
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   886
               , ' domain')
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   887
                                                                [exEnd]
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   888
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   889
                                                                [exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
    Transcript 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   891
        showCR:('this machine''s CPU is a '
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   892
               , OperatingSystem getCPUType
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   893
               )
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   894
                                                                [exEnd]
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   895
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   896
                                                                [exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
    Transcript showCR:'executing ls command ...'.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
   898
    OperatingSystem executeCommand:'ls'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
    Transcript showCR:'... done.'.
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   900
                                                                [exEnd]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
  locking a file 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
  (should be executed on two running smalltalks - not in two threads):
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   904
                                                                [exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
    |f|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
    f := 'testFile' asFilename readWriteStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
    10 timesRepeat:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   910
        'about to lock ...' printCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   911
        [
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   912
          OperatingSystem 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   913
            lockFD:(f fileDescriptor)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   914
            shared:false
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   915
            blocking:false
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   916
        ] whileFalse:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   917
            'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   918
            Delay waitForSeconds:1
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   919
        ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   920
        'LOCKED ...' printCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   921
        Delay waitForSeconds:10.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   922
        'unlock ...' printCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   923
        (OperatingSystem 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   924
            unlockFD:(f fileDescriptor)) printCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   925
        Delay waitForSeconds:3.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
    ]
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   927
                                                                [exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   928
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   929
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   930
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   931
!UnixOperatingSystem class methodsFor:'initialization'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   932
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   933
initialize
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   934
    "initialize the class"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   935
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
    ObjectMemory addDependent:self.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   937
    HostName := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   938
    DomainName := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   939
    LastErrorNumber := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   940
    PipeFailed := false.
4395
53122eb3ce70 clear ForkFailed flag; made it a classVar
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
   941
    ForkFailed := false.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   942
    SlowFork := false.
3943
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   943
    CurrentDirectory := nil.
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   944
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   945
    "Modified: / 11.12.1998 / 16:35:39 / cg"
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
update:something with:aParameter from:changedObject
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
    "catch image restart and flush some cached data"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
    something == #earlyRestart ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   952
        "
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   953
         flush cached data/info
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   954
        "
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   955
        HostName := nil.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   956
        DomainName := nil.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   957
        LastErrorNumber := nil.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   958
        PipeFailed := false.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   959
        SlowFork := false.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   960
        ForkFailed := false.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
   961
        CurrentDirectory := nil.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
    ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
3943
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   964
    "Created: / 15.6.1996 / 15:22:37 / cg"
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   965
    "Modified: / 7.1.1997 / 19:36:11 / stefan"
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   966
    "Modified: / 11.12.1998 / 16:22:48 / cg"
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   967
! !
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
!UnixOperatingSystem class methodsFor:'OS signal constants'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   970
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   971
sigABRT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   972
    "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
   973
     (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
   974
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   975
    ^ self signalNamed:#SIGABRT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   976
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   977
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   978
     OperatingSystem sigABRT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   979
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   980
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   981
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
sigALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
    "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
   984
     (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
   985
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   986
    ^ self signalNamed:#SIGALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   987
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   988
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   989
     OperatingSystem sigALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   990
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   991
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   992
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   993
sigBREAK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
    "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
   995
     This is an MSDOS specific signal"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   996
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   997
    ^ self signalNamed:#SIGBREAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   998
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   999
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1000
     OperatingSystem sigBREAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1001
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
!
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
sigBUS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
    "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
  1006
     (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
  1007
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1008
    ^ self signalNamed:#SIGBUS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1009
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1010
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1011
     OperatingSystem sigBUS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1012
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1013
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1014
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1015
sigCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1016
    "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
  1017
     (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
  1018
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1019
    ^ self signalNamed:#SIGCHLD
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1020
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1021
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1022
     OperatingSystem sigCHLD
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1023
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1024
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1025
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
sigCONT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
    "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
  1028
     (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
  1029
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1030
    ^ self signalNamed:#SIGCONT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1031
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1032
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1033
     OperatingSystem sigCONT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1034
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1035
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1036
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1037
sigDANGER
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1038
    "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
  1039
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1041
    ^ self signalNamed:#SIGDANGER
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1042
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1043
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1044
     OperatingSystem sigDANGER
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1045
    "
3496
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
sigEMT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1049
    "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
  1050
     (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
  1051
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1052
    ^ self signalNamed:#SIGEMT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1053
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1054
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1055
     OperatingSystem sigEMT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1056
    "
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1059
sigFP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1060
    "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
  1061
     (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
  1062
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1063
    ^ self signalNamed:#SIGFPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1064
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1065
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1066
     OperatingSystem sigFP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1067
    "
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
sigGRANT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1071
    "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
  1072
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1073
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1074
    ^ self signalNamed:#SIGGRANT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1075
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1076
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1077
     OperatingSystem sigGRANT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1078
    "
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1081
sigHUP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1082
    "return the signal number for SIGHUP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1083
     (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
  1084
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1085
    ^ self signalNamed:#SIGHUP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1086
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1087
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1088
     OperatingSystem sigHUP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1089
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1090
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1091
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1092
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1093
sigILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1094
    "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
  1095
     (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
  1096
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1097
    ^ self signalNamed:#SIGILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1098
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1099
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1100
     OperatingSystem sigILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1101
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1102
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1103
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1104
sigINT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1105
    "return the signal number for SIGINT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1106
     (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
  1107
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1108
    ^ self signalNamed:#SIGINT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1109
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1110
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1111
     OperatingSystem sigINT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1112
    "
3496
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
sigIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1116
    "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
  1117
     (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
  1118
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1119
    ^ self signalNamed:#SIGIO
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1120
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1121
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1122
     OperatingSystem sigIO
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1123
    "
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1126
sigIOT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1127
    "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
  1128
     (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
  1129
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1130
    ^ self signalNamed:#SIGIOT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1131
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1132
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1133
     OperatingSystem sigIOT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1134
    "
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
sigKILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1138
    "return the signal number for SIGKILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1139
     (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
  1140
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1141
    ^ self signalNamed:#SIGKILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1142
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1143
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1144
     OperatingSystem sigKILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1145
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1146
!
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
sigLOST
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1149
    "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
  1150
     (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
  1151
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1152
    ^ self signalNamed:#SIGLOST
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1153
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1154
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1155
     OperatingSystem sigLOST
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1156
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1157
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1158
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1159
sigMIGRATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1160
    "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
  1161
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1162
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1163
    ^ self signalNamed:#SIGMIGRATE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1164
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1165
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1166
     OperatingSystem sigMIGRATE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1167
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1168
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1169
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1170
sigMSG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1171
    "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
  1172
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1173
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1174
    ^ self signalNamed:#SIGMSG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1175
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1176
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1177
     OperatingSystem sigMSG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1178
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1179
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1180
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1181
sigPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1182
    "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
  1183
     (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
  1184
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1185
    ^ self signalNamed:#SIGPIPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1186
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1187
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1188
     OperatingSystem sigPIPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1189
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1190
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1191
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1192
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1193
sigPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1194
    "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
  1195
     (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
  1196
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1197
    ^ self signalNamed:#SIGPOLL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1198
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1199
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1200
     OperatingSystem sigPOLL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1201
    "
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1204
sigPRE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1205
    "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
  1206
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1207
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1208
    ^ self signalNamed:#SIGPRE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1209
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1210
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1211
     OperatingSystem sigPRE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1212
    "
3496
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
sigPROF
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
    "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
  1217
     (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
  1218
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1219
    ^ self signalNamed:#SIGPROF
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1220
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1221
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1222
     OperatingSystem sigPROF
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1223
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1224
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1225
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1226
sigPWR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1227
    "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
  1228
     (not available on all systems)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1230
    ^ self signalNamed:#SIGPWR
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1231
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1232
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1233
     OperatingSystem sigPWR
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1234
    "
3496
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
sigQUIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1238
    "return the signal number for SIGQUIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1239
     (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
  1240
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1241
    ^ self signalNamed:#SIGQUIT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1242
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1243
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1244
     OperatingSystem sigQUIT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1245
    "
3496
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
sigRETRACT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1249
    "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
  1250
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1251
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1252
    ^ self signalNamed:#SIGRETRACT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1253
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1254
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1255
     OperatingSystem sigRETRACT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1256
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1257
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1260
sigSAK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
    "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
  1262
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1263
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1264
    ^ self signalNamed:#SIGSAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1265
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1266
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1267
     OperatingSystem sigSAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1268
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1269
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1272
sigSEGV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1273
    "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
  1274
     (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
  1275
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1276
    ^ self signalNamed:#SIGSEGV
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1277
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1278
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1279
     OperatingSystem sigSEGV
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1280
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1281
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1282
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1283
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1284
sigSOUND
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1285
    "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
  1286
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1288
    ^ self signalNamed:#SIGSOUND
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1289
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1290
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1291
     OperatingSystem sigSOUND
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1292
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1293
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1295
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
sigSTOP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
    "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
  1298
     (the numeric value is not the same across unix-systems)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1299
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1300
    ^ self signalNamed:#SIGSTOP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1301
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1302
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1303
     OperatingSystem sigSTOP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1304
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1305
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1306
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1307
sigSYS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1308
    "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
  1309
     (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
  1310
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1311
    ^ self signalNamed:#SIGSYS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1312
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1313
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1314
     OperatingSystem sigSYS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1315
    "
3496
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
sigTERM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1319
    "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
  1320
     (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
  1321
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1322
    ^ self signalNamed:#SIGTERM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1323
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1324
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1325
     OperatingSystem sigTERM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1326
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1327
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1328
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1329
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1330
sigTRAP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1331
    "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
  1332
     (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
  1333
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1334
    ^ self signalNamed:#SIGTRAP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1335
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1336
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1337
     OperatingSystem sigTRAP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1338
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1339
!
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
sigTSTP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1342
    "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
  1343
     (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
  1344
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1345
    ^ self signalNamed:#SIGTSTP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1346
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1347
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1348
     OperatingSystem sigTSTP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1349
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1350
!
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
sigTTIN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1353
    "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
  1354
     (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
  1355
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1356
    ^ self signalNamed:#SIGTTIN
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1357
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1358
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1359
     OperatingSystem sigTTIN
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1360
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1361
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1362
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1363
sigTTOU
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1364
    "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
  1365
     (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
  1366
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1367
    ^ self signalNamed:#SIGTTOU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1368
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1369
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1370
     OperatingSystem sigTTOU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1371
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1372
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1373
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1374
sigURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1375
    "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
  1376
     (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
  1377
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1378
    ^ self signalNamed:#SIGURG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1379
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1380
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1381
     OperatingSystem sigURG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1382
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1383
!
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
sigUSR1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1386
    "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
  1387
     (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
  1388
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1389
    ^ self signalNamed:#SIGUSR1
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1390
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1391
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1392
     OperatingSystem sigUSR1
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1393
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1394
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1395
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1396
sigUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1397
    "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
  1398
     (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
  1399
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1400
    ^ self signalNamed:#SIGUSR2
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1401
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1402
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1403
     OperatingSystem sigUSR2
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1404
    "
3496
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
sigVTALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1408
    "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
  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
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1411
    ^ self signalNamed:#SIGVTALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1412
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1413
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1414
     OperatingSystem sigVTALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1415
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1416
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
sigWINCH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1419
    "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
  1420
     (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
  1421
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1422
    ^ self signalNamed:#SIGWINCH
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1423
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1424
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1425
     OperatingSystem sigWINCH
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1426
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1427
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1428
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1429
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1430
sigXCPU
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1431
    "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
  1432
     (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
  1433
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1434
    ^ self signalNamed:#SIGXCPU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1435
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1436
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1437
     OperatingSystem sigXCPU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1438
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1439
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1441
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1442
sigXFSZ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1443
    "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
  1444
     (the numeric value is not the same across unix-systems)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1445
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1446
    ^ self signalNamed:#SIGXFSZ
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1447
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1448
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1449
     OperatingSystem sigXFSZ
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1450
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1451
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1452
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1453
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1454
signalNamed:signalName
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1455
    "return the signal number for a named signal (must be a symbol)
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1456
     Return 0 if that signal is not supported by the OS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1457
     (NOTICE: the numeric value is not the same across unix-systems, 
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1458
      therefore do not remember or hardcode those numbers in the application)"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1459
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1460
%{  /* NOCONTEXT */
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1461
#ifdef SIGABRT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1462
    if (signalName == @symbol(SIGABRT)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1463
        RETURN ( __MKSMALLINT(SIGABRT) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1464
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1465
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1466
#ifdef SIGALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1467
    if (signalName == @symbol(SIGALRM)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1468
        RETURN ( __MKSMALLINT(SIGALRM) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1469
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1470
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1471
#ifdef SIGBREAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1472
    if (signalName == @symbol(SIGBREAK)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1473
        RETURN ( __MKSMALLINT(SIGBREAK) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1474
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1475
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1476
#ifdef SIGBUS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1477
    if (signalName == @symbol(SIGBUS)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1478
        RETURN ( __MKSMALLINT(SIGBUS) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1479
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1480
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1481
#ifdef SIGCHLD
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1482
    if ((signalName == @symbol(SIGCHLD))
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1483
     || (signalName == @symbol(SIGCLD)) ) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1484
        RETURN ( __MKSMALLINT(SIGCHLD) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1485
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1486
#else
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1487
# if defined(SIGCLD)
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1488
    if ((signalName == @symbol(SIGCHLD))
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1489
     || (signalName == @symbol(SIGCLD)) ) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1490
        RETURN ( __MKSMALLINT(SIGCLD) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1491
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1492
# endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1493
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1494
#ifdef SIGCONT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1495
    if (signalName == @symbol(SIGCONT)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1496
        RETURN ( __MKSMALLINT(SIGCONT) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1497
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1498
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1499
#ifdef SIGDANGER
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1500
    if (signalName == @symbol(SIGDANGER)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1501
        RETURN ( __MKSMALLINT(SIGDANGER) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1502
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1503
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1504
#ifdef SIGEMT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1505
    if (signalName == @symbol(SIGEMT)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1506
        RETURN ( __MKSMALLINT(SIGEMT) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1507
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1508
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1509
#ifdef SIGFPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1510
    if (signalName == @symbol(SIGFPE)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1511
        RETURN ( __MKSMALLINT(SIGFPE) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1512
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1513
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1514
#ifdef SIGGRANT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1515
    if (signalName == @symbol(SIGGRANT)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1516
        RETURN ( __MKSMALLINT(SIGGRANT) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1517
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1518
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1519
#ifdef SIGHUP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1520
    if (signalName == @symbol(SIGHUP)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1521
        RETURN ( __MKSMALLINT(SIGHUP) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1522
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1523
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1524
#ifdef SIGILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1525
    if (signalName == @symbol(SIGILL)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1526
        RETURN ( __MKSMALLINT(SIGILL) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1527
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1528
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1529
#ifdef SIGINT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1530
    if (signalName == @symbol(SIGINT)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1531
        RETURN ( __MKSMALLINT(SIGINT) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1532
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1533
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1534
#ifdef SIGIO
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1535
    if (signalName == @symbol(SIGIO)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1536
        RETURN ( __MKSMALLINT(SIGIO) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1537
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1538
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1539
#ifdef SIGIOT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1540
    if (signalName == @symbol(SIGIOT)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1541
        RETURN ( __MKSMALLINT(SIGIOT) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1542
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1543
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1544
#ifdef SIGKILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1545
    if (signalName == @symbol(SIGKILL)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1546
        RETURN ( __MKSMALLINT(SIGKILL) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1547
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1548
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1549
#ifdef SIGLOST
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1550
    if (signalName == @symbol(SIGLOST)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1551
        RETURN ( __MKSMALLINT(SIGLOST) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1552
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1553
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1554
#ifdef SIGMIGRATE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1555
    if (signalName == @symbol(SIGMIGRATE)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1556
        RETURN ( __MKSMALLINT(SIGMIGRATE) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1557
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1558
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1559
#ifdef SIGMSG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1560
    if (signalName == @symbol(SIGMSG)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1561
        RETURN ( __MKSMALLINT(SIGMSG) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1562
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1563
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1564
#ifdef SIGPIPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1565
    if (signalName == @symbol(SIGPIPE)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1566
        RETURN ( __MKSMALLINT(SIGPIPE) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1567
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1568
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1569
#ifdef SIGPOLL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1570
    if (signalName == @symbol(SIGPOLL)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1571
        RETURN ( __MKSMALLINT(SIGPOLL) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1572
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1573
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1574
#ifdef SIGPRE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1575
    if (signalName == @symbol(SIGPRE)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1576
        RETURN ( __MKSMALLINT(SIGPRE) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1577
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1578
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1579
#ifdef SIGPROF
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1580
    if (signalName == @symbol(SIGPROF)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1581
        RETURN ( __MKSMALLINT(SIGPROF) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1582
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1583
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1584
#ifdef SIGPWR
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1585
    if (signalName == @symbol(SIGPWR)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1586
        RETURN ( __MKSMALLINT(SIGPWR) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1587
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1588
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1589
#ifdef SIGQUIT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1590
    if (signalName == @symbol(SIGQUIT)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1591
        RETURN ( __MKSMALLINT(SIGQUIT) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1592
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1593
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1594
#ifdef SIGRETRACT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1595
    if (signalName == @symbol(SIGRETRACT)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1596
        RETURN ( __MKSMALLINT(SIGRETRACT) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1597
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1598
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1599
#ifdef SIGSAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1600
    if (signalName == @symbol(SIGSAK)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1601
        RETURN ( __MKSMALLINT(SIGSAK) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1602
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1603
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1604
#ifdef SIGSEGV
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1605
    if (signalName == @symbol(SIGSEGV)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1606
        RETURN ( __MKSMALLINT(SIGSEGV) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1607
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1608
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1609
#ifdef SIGSOUND
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1610
    if (signalName == @symbol(SIGSOUND)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1611
        RETURN ( __MKSMALLINT(SIGSOUND) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1612
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1613
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1614
#ifdef SIGSTOP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1615
    if (signalName == @symbol(SIGSTOP)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1616
        RETURN ( __MKSMALLINT(SIGSTOP) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1617
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1618
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1619
#ifdef SIGSYS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1620
    if (signalName == @symbol(SIGSYS)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1621
        RETURN ( __MKSMALLINT(SIGSYS) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1622
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1623
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1624
#ifdef SIGTERM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1625
    if (signalName == @symbol(SIGTERM)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1626
        RETURN ( __MKSMALLINT(SIGTERM) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1627
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1628
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1629
#ifdef SIGTRAP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1630
    if (signalName == @symbol(SIGTRAP)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1631
        RETURN ( __MKSMALLINT(SIGTRAP) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1632
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1633
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1634
#ifdef SIGTSTP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1635
    if (signalName == @symbol(SIGTSTP)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1636
        RETURN ( __MKSMALLINT(SIGTSTP) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1637
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1638
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1639
#ifdef SIGTTIN
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1640
    if (signalName == @symbol(SIGTTIN)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1641
        RETURN ( __MKSMALLINT(SIGTTIN) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1642
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1643
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1644
#ifdef SIGTTOU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1645
    if (signalName == @symbol(SIGTTOU)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1646
        RETURN ( __MKSMALLINT(SIGTTOU) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1647
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1648
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1649
#ifdef SIGURG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1650
    if (signalName == @symbol(SIGURG)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1651
        RETURN ( __MKSMALLINT(SIGURG) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1652
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1653
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1654
#ifdef SIGUSR1
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1655
    if (signalName == @symbol(SIGUSR1)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1656
        RETURN ( __MKSMALLINT(SIGUSR1) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1657
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1658
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1659
#ifdef SIGUSR2
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1660
    if (signalName == @symbol(SIGUSR2)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1661
        RETURN ( __MKSMALLINT(SIGUSR2) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1662
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1663
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1664
#ifdef SIGVTALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1665
    if (signalName == @symbol(SIGVTALRM)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1666
        RETURN ( __MKSMALLINT(SIGVTALRM) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1667
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1668
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1669
#ifdef SIGWINCH
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1670
    if (signalName == @symbol(SIGWINCH)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1671
        RETURN ( __MKSMALLINT(SIGWINCH) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1672
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1673
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1674
#ifdef SIGXCPU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1675
    if (signalName == @symbol(SIGXCPU)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1676
        RETURN ( __MKSMALLINT(SIGXCPU) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1677
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1678
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1679
#ifdef SIGXFSZ
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1680
    if (signalName == @symbol(SIGXFSZ)) {
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1681
        RETURN ( __MKSMALLINT(SIGXFSZ) );
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1682
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1683
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1684
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1685
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1686
%}
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1687
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1688
     OperatingSystem signalNamed:#SIGABRT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1689
     OperatingSystem signalNamed:#SIGCHLD
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1690
     OperatingSystem signalNamed:#SIGXFSZ
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1691
     OperatingSystem signalNamed:#SIGSOUND
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1692
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1693
! !
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
!UnixOperatingSystem class methodsFor:'error messages'!
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
currentErrorNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1698
    "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
  1699
     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
  1700
     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
  1701
     request to the OS.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1702
     Use lastErrorNumber - currentErrorNumber is invalidated by
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1703
     many, many internal calls."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1704
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1705
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1706
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1707
     RETURN ( __MKSMALLINT(errno) );
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
     "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  1710
      OperatingSystem currentErrorNumber
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1711
     "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1712
!
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
errorNumberFor:aSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1715
    "given a symbolic error, return the numeric;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1716
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1717
     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
  1718
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1719
%{   /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1720
    OBJ sym = aSymbol;
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
     * POSIX errnos - these should be defined
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1724
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1725
#ifdef EPERM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
    if (sym == @symbol(EPERM)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1727
        RETURN ( __MKSMALLINT(EPERM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1728
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1729
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1730
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1731
#ifdef ENOENT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1732
    if (sym == @symbol(ENOENT)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1733
        RETURN ( __MKSMALLINT(ENOENT) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1737
#ifdef ESRCH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1738
    if (sym == @symbol(ESRCH)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1739
        RETURN ( __MKSMALLINT(ESRCH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1740
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1741
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1742
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1743
#ifdef EINTR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1744
    if (sym == @symbol(EINTR)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1745
        RETURN ( __MKSMALLINT(EINTR) );
3496
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
#endif
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
#ifdef EIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1750
    if (sym == @symbol(EIO)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1751
        RETURN ( __MKSMALLINT(EIO) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1754
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1755
#ifdef ENXIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1756
    if (sym == @symbol(ENXIO)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1757
        RETURN ( __MKSMALLINT(ENXIO) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1758
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1759
#endif
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
#ifdef E2BIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
    if (sym == @symbol(E2BIG)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1763
        RETURN ( __MKSMALLINT(E2BIG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1764
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1765
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1766
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1767
#ifdef ENOEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1768
    if (sym == @symbol(ENOEXEC)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1769
        RETURN ( __MKSMALLINT(ENOEXEC) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1770
    }
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
#ifdef EBADF
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1774
    if (sym == @symbol(EBADF)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1775
        RETURN ( __MKSMALLINT(EBADF) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1776
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1777
#endif
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
#ifdef ECHILD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1780
    if (sym == @symbol(ECHILD)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1781
        RETURN ( __MKSMALLINT(ECHILD) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1782
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1783
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1784
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1785
#if defined(EAGAIN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1786
    if (sym == @symbol(EAGAIN)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1787
        RETURN ( __MKSMALLINT(EAGAIN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1788
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1789
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1790
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1791
#ifdef ENOMEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1792
    if (sym == @symbol(ENOMEM)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1793
        RETURN ( __MKSMALLINT(ENOMEM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1794
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1795
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1796
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1797
#ifdef EACCES
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1798
    if (sym == @symbol(EACCES)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1799
        RETURN ( __MKSMALLINT(EACCES) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1802
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1803
#ifdef EFAULT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1804
    if (sym == @symbol(EFAULT)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1805
        RETURN ( __MKSMALLINT(EFAULT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1806
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1807
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1808
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1809
#ifdef EBUSY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1810
    if (sym == @symbol(EBUSY)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1811
        RETURN ( __MKSMALLINT(EBUSY) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1814
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1815
#ifdef EXDEV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1816
    if (sym == @symbol(EXDEV)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1817
        RETURN ( __MKSMALLINT(EXDEV) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1818
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1819
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1820
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1821
#ifdef ENODEV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1822
    if (sym == @symbol(ENODEV)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1823
        RETURN ( __MKSMALLINT(ENODEV) );
3496
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
#endif
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
#ifdef ENOTDIR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1828
    if (sym == @symbol(ENOTDIR)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1829
        RETURN ( __MKSMALLINT(ENOTDIR) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1832
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1833
#ifdef EISDIR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1834
    if (sym == @symbol(EISDIR)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1835
        RETURN ( __MKSMALLINT(EISDIR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1836
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1837
#endif
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
#ifdef EINVAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1840
    if (sym == @symbol(EINVAL)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1841
        RETURN ( __MKSMALLINT(EINVAL) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1842
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1843
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1844
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1845
#ifdef ENFILE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1846
    if (sym == @symbol(ENFILE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1847
        RETURN ( __MKSMALLINT(ENFILE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1848
    }
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
#ifdef EMFILE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1852
    if (sym == @symbol(EMFILE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1853
        RETURN ( __MKSMALLINT(EMFILE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1854
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1855
#endif
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
#ifdef ENOTTY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1858
    if (sym == @symbol(ENOTTY)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1859
        RETURN ( __MKSMALLINT(ENOTTY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1860
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1861
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1862
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1863
#ifdef EFBIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1864
    if (sym == @symbol(EFBIG)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1865
        RETURN ( __MKSMALLINT(EFBIG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1866
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1867
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1868
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1869
#ifdef ENOSPC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1870
    if (sym == @symbol(ENOSPC)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1871
        RETURN ( __MKSMALLINT(ENOSPC) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1872
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1873
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1874
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1875
#ifdef ESPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1876
    if (sym == @symbol(ESPIPE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1877
        RETURN ( __MKSMALLINT(ESPIPE) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1880
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1881
#ifdef EROFS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1882
    if (sym == @symbol(EROFS)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1883
        RETURN ( __MKSMALLINT(EROFS) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1884
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1885
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1886
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1887
#ifdef EMLINK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1888
    if (sym == @symbol(EMLINK)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1889
        RETURN ( __MKSMALLINT(EMLINK) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1892
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1893
#ifdef EPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1894
    if (sym == @symbol(EPIPE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1895
        RETURN ( __MKSMALLINT(EPIPE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1896
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1897
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1898
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1899
#ifdef EDOM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1900
    if (sym == @symbol(EDOM)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1901
        RETURN ( __MKSMALLINT(EDOM) );
3496
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
#endif
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
#ifdef ERANGE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1906
    if (sym == @symbol(ERANGE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1907
        RETURN ( __MKSMALLINT(ERANGE) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1910
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1911
#ifdef EDEADLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1912
    if (sym == @symbol(EDEADLK)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1913
        RETURN ( __MKSMALLINT(EDEADLK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1914
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1915
#endif
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
#ifdef ENAMETOOLONG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1918
    if (sym == @symbol(ENAMETOOLONG)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1919
        RETURN ( __MKSMALLINT(ENAMETOOLONG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1920
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1921
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1922
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1923
#ifdef ENOLCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1924
    if (sym == @symbol(ENOLCK)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1925
        RETURN ( __MKSMALLINT(ENOLCK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1926
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1927
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1928
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1929
#ifdef ENOSYS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1930
    if (sym == @symbol(ENOSYS)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1931
        RETURN ( __MKSMALLINT(ENOSYS) );
3496
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
#endif
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
#ifdef ENOTEMPTY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1936
    if (sym == @symbol(ENOTEMPTY)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1937
        RETURN ( __MKSMALLINT(ENOTEMPTY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1938
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1939
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1940
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1941
#ifdef EEXIST
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1942
    if (sym == @symbol(EEXIST)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1943
        RETURN ( __MKSMALLINT(EEXIST) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1946
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1947
#ifdef EILSEQ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1948
    if (sym == @symbol(EILSEQ)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1949
        RETURN ( __MKSMALLINT(EILSEQ) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1950
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1951
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1952
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
     * XPG3 errnos - defined on most systems
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1955
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1956
#ifdef ENOTBLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1957
    if (sym == @symbol(ENOTBLK)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1958
        RETURN ( __MKSMALLINT(ENOTBLK) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1961
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1962
#ifdef ETXTBSY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1963
    if (sym == @symbol(ETXTBSY)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1964
        RETURN ( __MKSMALLINT(ETXTBSY) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1967
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1968
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1969
     * some others
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1970
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1971
#ifdef EWOULDBLOCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1972
    if (sym == @symbol(EWOULDBLOCK)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1973
        RETURN ( __MKSMALLINT(EWOULDBLOCK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1974
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1975
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1976
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1977
#ifdef ENOMSG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1978
    if (sym == @symbol(ENOMSG)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1979
        RETURN ( __MKSMALLINT(ENOMSG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1980
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1981
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1982
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1983
#ifdef ELOOP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1984
    if (sym == @symbol(ELOOP)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1985
        RETURN ( __MKSMALLINT(ELOOP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1986
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1987
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1988
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
     * some stream errors
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1991
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1992
#ifdef ETIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1993
    if (sym == @symbol(ETIME)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  1994
        RETURN ( __MKSMALLINT(ETIME) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1997
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1998
#ifdef ENOSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1999
    if (sym == @symbol(ENOSR)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2000
        RETURN ( __MKSMALLINT(ENOSR) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2003
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2004
#ifdef ENOSTR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2005
    if (sym == @symbol(ENOSTR)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2006
        RETURN ( __MKSMALLINT(ENOSTR) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2009
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2010
#ifdef ECOMM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2011
    if (sym == @symbol(ECOMM)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2012
        RETURN ( __MKSMALLINT(ECOMM) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2015
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2016
#ifdef EPROTO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2017
    if (sym == @symbol(EPROTO)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2018
        RETURN ( __MKSMALLINT(EPROTO) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2021
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2022
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2023
     * nfs errors
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2024
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2025
#ifdef ESTALE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2026
    if (sym == @symbol(ESTALE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2027
        RETURN ( __MKSMALLINT(ESTALE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2028
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2029
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2030
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2031
#ifdef EREMOTE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2032
    if (sym == @symbol(EREMOTE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2033
        RETURN ( __MKSMALLINT(EREMOTE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2034
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2035
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2036
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
     * some networking errors
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2039
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2040
#ifdef EINPROGRESS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2041
    if (sym == @symbol(EINPROGRESS)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2042
        RETURN ( __MKSMALLINT(EINPROGRESS) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2045
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2046
#ifdef EALREADY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2047
    if (sym == @symbol(EALREADY)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2048
        RETURN ( __MKSMALLINT(EALREADY) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2051
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2052
#ifdef ENOTSOCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2053
    if (sym == @symbol(ENOTSOCK)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2054
        RETURN ( __MKSMALLINT(ENOTSOCK) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2057
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2058
#ifdef EDESTADDRREQ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2059
    if (sym == @symbol(EDESTADDRREQ)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2060
        RETURN ( __MKSMALLINT(EDESTADDRREQ) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2063
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2064
#ifdef EMSGSIZE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2065
    if (sym == @symbol(EMSGSIZE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2066
        RETURN ( __MKSMALLINT(EMSGSIZE) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2069
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2070
#ifdef EPROTOTYPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2071
    if (sym == @symbol(EPROTOTYPE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2072
        RETURN ( __MKSMALLINT(EPROTOTYPE) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2075
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2076
#ifdef ENOPROTOOPT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2077
    if (sym == @symbol(ENOPROTOOPT)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2078
        RETURN ( __MKSMALLINT(ENOPROTOOPT) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2081
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2082
#ifdef EPROTONOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2083
    if (sym == @symbol(EPROTONOSUPPORT)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2084
        RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2087
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2088
#ifdef ESOCKTNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2089
    if (sym == @symbol(ESOCKTNOSUPPORT)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2090
        RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2093
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2094
#ifdef EOPNOTSUPP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2095
    if (sym == @symbol(EOPNOTSUPP)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2096
        RETURN ( __MKSMALLINT(EOPNOTSUPP) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2099
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2100
#ifdef EPFNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2101
    if (sym == @symbol(EPFNOSUPPORT)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2102
        RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2105
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2106
#ifdef EAFNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2107
    if (sym == @symbol(EAFNOSUPPORT)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2108
        RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2111
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2112
#ifdef EADDRINUSE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2113
    if (sym == @symbol(EADDRINUSE)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2114
        RETURN ( __MKSMALLINT(EADDRINUSE) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2117
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2118
#ifdef EADDRNOTAVAIL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2119
    if (sym == @symbol(EADDRNOTAVAIL)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2120
        RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2123
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2124
#ifdef ETIMEDOUT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2125
    if (sym == @symbol(ETIMEDOUT)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2126
        RETURN ( __MKSMALLINT(ETIMEDOUT) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2129
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2130
#ifdef ECONNREFUSED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2131
    if (sym == @symbol(ECONNREFUSED)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2132
        RETURN ( __MKSMALLINT(ECONNREFUSED) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2135
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2136
#ifdef ENETDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2137
    if (sym == @symbol(ENETDOWN)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2138
        RETURN ( __MKSMALLINT(ENETDOWN) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2141
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2142
#ifdef ENETUNREACH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2143
    if (sym == @symbol(ENETUNREACH)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2144
        RETURN ( __MKSMALLINT(ENETUNREACH) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2147
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2148
#ifdef ENETRESET
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2149
    if (sym == @symbol(ENETRESET)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2150
        RETURN ( __MKSMALLINT(ENETRESET) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2153
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2154
#ifdef ECONNABORTED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2155
    if (sym == @symbol(ECONNABORTED)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2156
        RETURN ( __MKSMALLINT(ECONNABORTED) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2159
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2160
#ifdef ECONNRESET
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2161
    if (sym == @symbol(ECONNRESET)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2162
        RETURN ( __MKSMALLINT(ECONNRESET) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2165
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2166
#ifdef EISCONN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2167
    if (sym == @symbol(EISCONN)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2168
        RETURN ( __MKSMALLINT(EISCONN) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2171
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2172
#ifdef ENOTCONN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2173
    if (sym == @symbol(ENOTCONN)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2174
        RETURN ( __MKSMALLINT(ENOTCONN) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2177
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2178
#ifdef ESHUTDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2179
    if (sym == @symbol(ESHUTDOWN)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2180
        RETURN ( __MKSMALLINT(ESHUTDOWN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2181
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2182
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2183
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2184
#ifdef EHOSTDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2185
    if (sym == @symbol(EHOSTDOWN)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2186
        RETURN ( __MKSMALLINT(EHOSTDOWN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2187
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2188
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2189
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2190
#ifdef EHOSTUNREACH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2191
    if (sym == @symbol(EHOSTUNREACH)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2192
        RETURN ( __MKSMALLINT(EHOSTUNREACH) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2193
    }
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2194
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2195
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2196
    ^ -1
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2199
errorSymbolAndTextForNumber:errNr
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2200
    "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
  2201
     (as returned by a system call). 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2202
     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
  2203
     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
  2204
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2205
    |sym text|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2206
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2207
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2208
    /* claus:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2209
     * 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
  2210
     * standard across unixes
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
    char *msg = "unknown error";
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2213
    char buffer[128];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2214
    OBJ eno = errNr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2215
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2216
    if (__isSmallInteger(eno)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2217
        switch (__intVal(eno)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2218
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2219
             * POSIX errnos - these should be defined
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2220
             */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2221
#ifdef EPERM
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2222
            case EPERM:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2223
                msg = "Operation not permitted";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2224
                sym = @symbol(EPERM);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2225
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2226
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2227
#ifdef ENOENT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2228
            case ENOENT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2229
                msg = "No such file or directory";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2230
                sym = @symbol(ENOENT);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2231
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2232
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2233
#ifdef ESRCH
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2234
            case ESRCH:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2235
                msg = "No such process";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2236
                sym = @symbol(ESRCH);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2237
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2238
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2239
#ifdef EINTR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2240
            case EINTR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2241
                msg = "Interrupted system call";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2242
                sym = @symbol(EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2243
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2244
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2245
#ifdef EIO
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2246
            case EIO:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2247
                msg = "I/O error";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2248
                sym = @symbol(EIO);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2249
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2250
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2251
#ifdef ENXIO
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2252
            case ENXIO:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2253
                msg = "No such device or address";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2254
                sym = @symbol(ENXIO);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2255
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2256
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2257
#ifdef E2BIG
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2258
            case E2BIG:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2259
                msg = "Arg list too long";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2260
                sym = @symbol(E2BIG);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2261
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2262
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2263
#ifdef ENOEXEC
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2264
            case ENOEXEC:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2265
                msg = "Exec format error";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2266
                sym = @symbol(ENOEXEC);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2267
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2268
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2269
#ifdef EBADF
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2270
            case EBADF:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2271
                msg = "Bad file number";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2272
                sym = @symbol(EBADF);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2273
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2274
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2275
#ifdef ECHILD
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2276
            case ECHILD:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2277
                msg = "No child processes";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2278
                sym = @symbol(ECHILD);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2279
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2280
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2281
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2282
            case EAGAIN:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2283
                msg = "Try again";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2284
                sym = @symbol(EAGAIN);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2285
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2286
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2287
#ifdef ENOMEM
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2288
            case ENOMEM:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2289
                msg = "Out of memory";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2290
                sym = @symbol(ENOMEM);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2291
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2292
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2293
#ifdef EACCES
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2294
            case EACCES:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2295
                msg = "Permission denied";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2296
                sym = @symbol(EACCES);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2297
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2298
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2299
#ifdef EFAULT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2300
            case EFAULT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2301
                msg = "Bad address";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2302
                sym = @symbol(EFAULT);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2303
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2304
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2305
#ifdef EBUSY
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2306
            case EBUSY:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2307
                msg = "Device or resource busy";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2308
                sym = @symbol(EBUSY);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2309
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2310
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2311
#ifdef EEXIST
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2312
            case EEXIST:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2313
                msg = "File exists";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2314
                sym = @symbol(EEXIST);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2315
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2316
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2317
#ifdef EXDEV
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2318
            case EXDEV:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2319
                msg = "Cross-device link";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2320
                sym = @symbol(EXDEV);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2321
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2322
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2323
#ifdef ENODEV
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2324
            case ENODEV:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2325
                msg = "No such device";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2326
                sym = @symbol(ENODEV);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2327
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2328
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2329
#ifdef ENOTDIR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2330
            case ENOTDIR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2331
                msg = "Not a directory";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2332
                sym = @symbol(ENOTDIR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2333
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2334
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2335
#ifdef EISDIR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2336
            case EISDIR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2337
                msg = "Is a directory";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2338
                sym = @symbol(EISDIR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2339
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2340
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2341
#ifdef EINVAL
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2342
            case EINVAL:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2343
                msg = "Invalid argument";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2344
                sym = @symbol(EINVAL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2345
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2346
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2347
#ifdef ENFILE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2348
            case ENFILE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2349
                msg = "File table overflow";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2350
                sym = @symbol(ENFILE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2351
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2352
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2353
#ifdef EMFILE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2354
            case EMFILE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2355
                msg = "Too many open files";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2356
                sym = @symbol(EMFILE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2357
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2358
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2359
#ifdef ENOTTY
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2360
            case ENOTTY:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2361
                msg = "Not a typewriter";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2362
                sym = @symbol(ENOTTY);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2363
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2364
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2365
#ifdef EFBIG
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2366
            case EFBIG:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2367
                msg = "File too large";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2368
                sym = @symbol(EFBIG);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2369
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2370
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2371
#ifdef ENOSPC
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2372
            case ENOSPC:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2373
                msg = "No space left on device";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2374
                sym = @symbol(ENOSPC);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2375
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2376
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2377
#ifdef ESPIPE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2378
            case ESPIPE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2379
                msg = "Illegal seek";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2380
                sym = @symbol(ESPIPE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2381
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2382
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2383
#ifdef EROFS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2384
            case EROFS:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2385
                msg = "Read-only file system";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2386
                sym = @symbol(EROFS);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2387
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2388
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2389
#ifdef EMLINK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2390
            case EMLINK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2391
                msg = "Too many links";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2392
                sym = @symbol(EMLINK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2393
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2394
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2395
#ifdef EPIPE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2396
            case EPIPE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2397
                msg = "Broken pipe";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2398
                sym = @symbol(EPIPE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2399
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2400
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2401
#ifdef EDOM
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2402
            case EDOM:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2403
                msg = "Math argument out of domain";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2404
                sym = @symbol(EDOM);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2405
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2406
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2407
#ifdef ERANGE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2408
            case ERANGE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2409
                msg = "Math result not representable";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2410
                sym = @symbol(ERANGE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2411
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2412
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2413
#ifdef EDEADLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2414
# if EDEADLK != EWOULDBLOCK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2415
            case EDEADLK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2416
                msg = "Resource deadlock would occur";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2417
                sym = @symbol(EDEADLK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2418
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2419
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2420
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2421
#ifdef ENAMETOOLONG
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2422
            case ENAMETOOLONG:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2423
                msg = "File name too long";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2424
                sym = @symbol(ENAMETOOLONG);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2425
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2426
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2427
#ifdef ENOLCK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2428
            case ENOLCK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2429
                msg = "No record locks available";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2430
                sym = @symbol(ENOLCK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2431
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2432
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2433
#ifdef ENOSYS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2434
            case ENOSYS:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2435
                msg = "Function not implemented";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2436
                sym = @symbol(ENOSYS);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2437
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2438
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2439
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2440
            case ENOTEMPTY:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2441
                msg = "Directory not empty";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2442
                sym = @symbol(ENOTEMPTY);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2443
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2444
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2445
#ifdef EILSEQ
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2446
            case EILSEQ:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2447
                msg = "Illegal byte sequence";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2448
                sym = @symbol(EILSEQ);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2449
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2450
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2451
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2452
             * XPG3 errnos - defined on most systems
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2453
             */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2454
#ifdef ENOTBLK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2455
            case ENOTBLK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2456
                msg = "Block device required";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2457
                sym = @symbol(ENOTBLK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2458
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2459
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2460
#ifdef ETXTBSY
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2461
            case ETXTBSY:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2462
                msg = "Text file busy";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2463
                sym = @symbol(ETXTBSY);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2464
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2465
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2466
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2467
             * some others
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2468
             */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2469
#ifdef EWOULDBLOCK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2470
            case EWOULDBLOCK:
3558
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  2471
# if defined(EAGAIN) && (EWOULDBLOCK == EAGAIN)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2472
                msg = "Operation would block / No more processes";
3558
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  2473
# else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2474
                msg = "Operation would block";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2475
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2476
                sym = @symbol(EWOULDBLOCK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2477
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2478
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2479
#ifdef ENOMSG
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2480
            case ENOMSG:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2481
                msg = "No message of desired type";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2482
                sym = @symbol(ENOMSG);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2483
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2484
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2485
#ifdef ELOOP
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2486
            case ELOOP:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2487
                msg = "Too many levels of symbolic links";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2488
                sym = @symbol(ELOOP);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2489
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2490
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2491
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2492
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2493
             * some stream errors
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2494
             */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2495
#ifdef ETIME
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2496
            case ETIME:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2497
                msg = "Timer expired";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2498
                sym = @symbol(ETIME);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2499
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2500
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2501
#ifdef ENOSR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2502
            case ENOSR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2503
                msg = "Out of streams resources";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2504
                sym = @symbol(ENOSR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2505
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2506
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2507
#ifdef ENOSTR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2508
            case ENOSTR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2509
                msg = "Device not a stream";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2510
                sym = @symbol(ENOSTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2511
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2512
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2513
#ifdef ECOMM
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2514
            case ECOMM:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2515
                msg = "Communication error on send";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2516
                sym = @symbol(ECOMM);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2517
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2518
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2519
#ifdef EPROTO
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2520
            case EPROTO:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2521
                msg = "Protocol error";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2522
                sym = @symbol(EPROTO);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2523
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2524
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2525
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2526
             * nfs errors
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2527
             */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2528
#ifdef ESTALE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2529
            case ESTALE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2530
                msg = "Stale NFS file handle";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2531
                sym = @symbol(ESTALE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  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 EREMOTE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2535
            case EREMOTE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2536
                msg = "Too many levels of remote in path";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2537
                sym = @symbol(EREMOTE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2538
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2539
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2540
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2541
             * some networking errors
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2542
             */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2543
#ifdef EINPROGRESS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2544
            case EINPROGRESS:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2545
                msg = "Operation now in progress";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2546
                sym = @symbol(EINPROGRESS);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2547
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2548
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2549
#ifdef EALREADY
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2550
            case EALREADY:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2551
                msg = "Operation already in progress";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2552
                sym = @symbol(EALREADY);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2553
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2554
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2555
#ifdef ENOTSOCK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2556
            case ENOTSOCK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2557
                msg = "Socket operation on non-socket";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2558
                sym = @symbol(ENOTSOCK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2559
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2560
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2561
#ifdef EDESTADDRREQ
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2562
            case EDESTADDRREQ:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2563
                msg = "Destination address required";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2564
                sym = @symbol(EDESTADDRREQ);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2565
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2566
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2567
#ifdef EMSGSIZE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2568
            case EMSGSIZE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2569
                msg = "Message too long";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2570
                sym = @symbol(EMSGSIZE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2571
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2572
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2573
#ifdef EPROTOTYPE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2574
            case EPROTOTYPE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2575
                msg = "Protocol wrong type for socket";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2576
                sym = @symbol(EPROTOTYPE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2577
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2578
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2579
#ifdef ENOPROTOOPT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2580
            case ENOPROTOOPT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2581
                msg = "Protocol not available";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2582
                sym = @symbol(ENOPROTOOPT);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2583
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2584
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2585
#ifdef EPROTONOSUPPORT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2586
            case EPROTONOSUPPORT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2587
                msg = "Protocol not supported";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2588
                sym = @symbol(EPROTONOSUPPORT);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2589
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2590
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2591
#ifdef ESOCKTNOSUPPORT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2592
            case ESOCKTNOSUPPORT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2593
                msg = "Socket type not supported";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2594
                sym = @symbol(ESOCKTNOSUPPORT);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2595
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2596
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2597
#ifdef EOPNOTSUPP
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2598
            case EOPNOTSUPP:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2599
                msg = "Operation not supported on socket";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2600
                sym = @symbol(EOPNOTSUPP);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2601
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2602
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2603
#ifdef EPFNOSUPPORT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2604
            case EPFNOSUPPORT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2605
                msg = "Protocol family not supported";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2606
                sym = @symbol(EPFNOSUPPORT);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2607
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2608
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2609
#ifdef EAFNOSUPPORT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2610
            case EAFNOSUPPORT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2611
                msg = "Address family not supported by protocol family";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2612
                sym = @symbol(EAFNOSUPPORT);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2613
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2614
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2615
#ifdef EADDRINUSE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2616
            case EADDRINUSE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2617
                msg = "Address already in use";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2618
                sym = @symbol(EADDRINUSE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2619
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2620
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2621
#ifdef EADDRNOTAVAIL
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2622
            case EADDRNOTAVAIL:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2623
                msg = "Can\'t assign requested address";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2624
                sym = @symbol(EADDRNOTAVAIL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2625
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2626
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2627
#ifdef ETIMEDOUT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2628
            case ETIMEDOUT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2629
                msg = "Connection timed out";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2630
                sym = @symbol(ETIMEDOUT);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2631
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2632
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2633
#ifdef ECONNREFUSED
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2634
            case ECONNREFUSED:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2635
                msg = "Connection refused";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2636
                sym = @symbol(ECONNREFUSED);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2637
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2638
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2639
#ifdef ENETDOWN
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2640
            case ENETDOWN:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2641
                msg = "Network is down";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2642
                sym = @symbol(ENETDOWN);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2643
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2644
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2645
#ifdef ENETUNREACH
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2646
            case ENETUNREACH:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2647
                msg = "Network is unreachable";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2648
                sym = @symbol(ENETUNREACH);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2649
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2650
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2651
#ifdef ENETRESET
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2652
            case ENETRESET:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2653
                msg = "Network dropped conn due to reset";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2654
                sym = @symbol(ENETRESET);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2655
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2656
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2657
#ifdef ECONNABORTED
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2658
            case ECONNABORTED:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2659
                msg = "Software caused connection abort";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2660
                sym = @symbol(ECONNABORTED);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2661
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2662
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2663
#ifdef ECONNRESET
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2664
            case ECONNRESET:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2665
                msg = "Connection reset by peer";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2666
                sym = @symbol(ECONNRESET);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2667
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2668
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2669
#ifdef EISCONN
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2670
            case EISCONN:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2671
                msg = "Socket is already connected";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2672
                sym = @symbol(EISCONN);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2673
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2674
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2675
#ifdef ENOTCONN
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2676
            case ENOTCONN:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2677
                msg = "Socket is not connected";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2678
                sym = @symbol(ENOTCONN);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2679
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2680
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2681
#ifdef ESHUTDOWN
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2682
            case ESHUTDOWN:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2683
                msg = "Can't send after socket shutdown";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2684
                sym = @symbol(ESHUTDOWN);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2685
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2686
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2687
#ifdef EHOSTDOWN
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2688
            case EHOSTDOWN:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2689
                msg = "Host is down";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2690
                sym = @symbol(EHOSTDOWN);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2691
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2692
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2693
#ifdef EHOSTUNREACH
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2694
            case EHOSTUNREACH:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2695
                msg = "No route to host";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2696
                sym = @symbol(EHOSTUNREACH);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2697
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2698
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2699
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2700
            default:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2701
                {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2702
                    __BEGIN_PROTECT_REGISTERS__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2703
                    sprintf(buffer, "ErrorNr: %d", __intVal(eno));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2704
                    __END_PROTECT_REGISTERS__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2705
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2706
                msg = buffer;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2707
                sym = @symbol(ERROR_OTHER);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2708
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2709
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2710
        text = __MKSTRING(msg);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2711
    } else {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2712
        text = nil;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2713
        sym = nil;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2714
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2715
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2716
    ^ Array with:sym with:text
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2717
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2718
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2719
     OperatingSystem errorSymbolAndTextForNumber:4
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2720
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2721
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2722
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2723
!UnixOperatingSystem class methodsFor:'executing OS commands'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2724
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2725
commandAndArgsForOSCommand:aCommandString
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2726
    "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
  2727
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2728
    |shell args|
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2729
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2730
    "/
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2731
    "/ '/bin/sh -c <command>'
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2732
    "/
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2733
    shell := '/bin/sh'.
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2734
    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
  2735
    ^ Array with:shell with:args
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2736
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2737
    "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
  2738
    "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
  2739
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2740
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2741
exec:aCommandPath withArguments:argColl environment:env fileDescriptors:fdColl closeDescriptors:closeFdColl fork:doFork newPgrp:newPgrp inDirectory:aDirectory
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2742
    "Internal lowLevel entry for combined fork & exec;
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2743
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2744
     If fork is false (chain a command):
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2745
         execute the OS command specified by the argument, aCommandPath, with
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2746
         arguments in argArray (no arguments, if nil).
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2747
         If successful, this method does not return and smalltalk is gone.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2748
         If not successful, it does return.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2749
         Normal use is with forkForCommand.
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2750
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2751
     If fork is true (subprocess command execution):
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2752
        fork a child to do the above.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2753
        The process id of the child process is returned; nil if the fork failed.
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2754
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2755
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2756
        fdArray[1] = 15 -> use fd 15 as stdin.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2757
        If an element of the array is set to nil, the corresponding filedescriptor
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2758
        will be closed for the child.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2759
        fdArray[0] == StdIn for child
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2760
        fdArray[1] == StdOut for child
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2761
        fdArray[2] == StdErr for child
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2762
        on VMS, these must be channels as returned by createMailBox.
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2763
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2764
     closeFdArray contains descriptors that will be closed in the subprocess.
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2765
        closeDescriptors are ignored in the WIN32 & VMS versions.
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2766
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2767
     If newPgrp is true, the subprocess will be established in a new process group.
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2768
        The processgroup will be equal to id.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2769
        newPgrp is not used on WIN32 and VMS systems.
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2770
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2771
     env specifies environment variables which are passed differently from
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2772
     the current environment. If non-nil, it must be a dictionary providing
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2773
     key-value pairs for changed/added environment variables.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2774
     To pass a variable as empty (i.e. unset), pass a nil value.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2775
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2776
     Notice: this used to be two separate ST-methods; however, in order to use
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2777
            vfork on some machines, it had to be merged into one, to avoid write
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2778
            accesses to ST/X memory from the vforked-child.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2779
            The code below only does read accesses."
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2780
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2781
    |envPairs argArray fdArray closeFdArray dirName|
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2782
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2783
    env notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2784
        envPairs := OrderedCollection new.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2785
        env keysAndValuesDo:[:key :val |
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2786
            envPairs add:key; add:val
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2787
        ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2788
        envPairs := envPairs asArray.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2789
    ].
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2790
    argColl notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2791
        argArray := argColl asArray
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2792
    ].
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2793
    fdColl notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2794
        fdArray := fdColl asArray
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2795
    ].
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2796
    closeFdColl notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2797
        closeFdArray := closeFdColl asArray
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2798
    ].
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2799
    aDirectory notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2800
        dirName := aDirectory asFilename name
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2801
    ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2802
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2803
%{  /* STACK: 16000 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2804
    char **argv;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2805
    int nargs, i, id;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2806
    OBJ arg;
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2807
    extern char **environ;
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  2808
    char **_env, **_nEnv;
3801
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2809
#ifndef __isArrayLike
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2810
# define __isArrayLike __isArray
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2811
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2812
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2813
    if (__isString(aCommandPath) && 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2814
        ((argArray == nil) || __isArrayLike(argArray)) &&
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2815
        ((fdArray == nil) || __isArrayLike(fdArray)) &&
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2816
        ((closeFdArray == nil) || __isArrayLike(closeFdArray))
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2817
    ) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2818
        nargs = argArray == nil ? 0 : __arraySize(argArray);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2819
        argv = (char **) malloc(sizeof(char *) * (nargs + 1));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2820
        if (argv) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2821
            int nOldEnv, nNewEnv;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2822
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2823
            for (i=0; i < nargs; i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2824
                arg = __ArrayInstPtr(argArray)->a_element[i];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2825
                if (__isString(arg)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2826
                    argv[i] = (char *) __stringVal(arg);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2827
                } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2828
                    argv[i] = "";
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2829
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2830
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2831
            argv[i] = NULL;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2832
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2833
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2834
             * number of new items in environment ..       
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2835
             */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2836
            nNewEnv = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2837
            if ((envPairs != nil) && __isArrayLike(envPairs)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2838
                nNewEnv = __arraySize(envPairs) / 2;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2839
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2840
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2841
            if (nNewEnv == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2842
                _nEnv = environ;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2843
            } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2844
                _env = environ;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2845
                /* 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2846
                 * get size of environment
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2847
                 */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2848
                nOldEnv = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2849
                if (_env) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2850
                    while (*_env) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2851
                        nOldEnv++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2852
                        _env++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2853
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2854
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2855
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2856
                /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2857
                 * generate a new environment
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2858
                 * I have not found a spec which defines if
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2859
                 * items at the end overwrite previous definitions,
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2860
                 * or if the first encountered definition is valid.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2861
                 * To be prepared for any case, simply add the new definitions
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2862
                 * at both ends - that should do it in any case.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2863
                 * Someone with more know-how may want to fix this.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2864
                 */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2865
                _nEnv = (char **)malloc(sizeof(char *) * (nNewEnv + nOldEnv + nNewEnv + 1));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2866
                if (_nEnv) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2867
                    char **eO, **eN;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2868
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2869
                    eN = _nEnv;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2870
                    if (nNewEnv) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2871
                        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2872
                         * add new items at the front ...
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2873
                         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2874
                        int i;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2875
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2876
                        for (i=0; (i+1)<__arraySize(envPairs); i+=2) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2877
                            OBJ t;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2878
                            char *var, *val, *e;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2879
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2880
                            t = __ArrayInstPtr(envPairs)->a_element[i];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2881
                            if (__isString(t) || __isSymbol(t)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2882
                                var = (char *)__stringVal(t);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2883
                                t = __ArrayInstPtr(envPairs)->a_element[i+1];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2884
                                if (__isString(t) || __isSymbol(t)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2885
                                    val = (char *)__stringVal(t);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2886
                                } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2887
                                    val = NULL;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2888
                                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2889
                                if (val != NULL) {                
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2890
                                    e = (char *)malloc(strlen(var) + 1 + strlen(val) + 1);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2891
                                    strcpy(e, var);               
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2892
                                    strcat(e, "=");               
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2893
                                    strcat(e, val);               
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2894
                                } else {                          
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2895
                                    e = (char *)malloc(strlen(var) + 1 + 1);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2896
                                    strcpy(e, var);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2897
                                    strcat(e, "=");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2898
                                }   
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2899
                                *eN++ = e;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2900
                            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2901
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2902
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2903
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2904
                    if (nOldEnv) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2905
                        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2906
                         * append old environment 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2907
                         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2908
                        eO = environ;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2909
                        while (*eN = *eO++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2910
                            eN++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2911
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2912
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2913
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2914
                    if (nNewEnv) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2915
                        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2916
                         * new items again at the end
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2917
                         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2918
                        for (eO = _nEnv, i=0; i<nNewEnv; i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2919
                            *eN++ = *eO++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2920
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2921
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2922
                        *eN = NULL;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2923
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2924
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2925
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2926
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2927
            if (doFork == true) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2928
                /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2929
                 * fork a subprocess.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2930
                 */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2931
                int nfd, nclose;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2932
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2933
                nfd = fdArray == nil ? 0 : __arraySize(fdArray);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2934
                nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray);
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2935
#ifdef HAS_VFORK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2936
                id = vfork();
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2937
#else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2938
                id = fork();
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2939
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2940
                if (id == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2941
                    /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2942
                    ** In child.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2943
                    ** first: dup filedescriptors
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2944
                    */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2945
                    for (i = 0; i < nfd; i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2946
                        OBJ fd;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2947
                        int rslt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2948
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2949
                        fd = __ArrayInstPtr(fdArray)->a_element[i];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2950
                        if (__isSmallInteger(fd) && (__intVal(fd) != i)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2951
                            do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2952
                                rslt = dup2(__intVal(fd), i);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2953
                            } while ((rslt < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2954
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2955
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2956
                    /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2957
                    ** second: close unused filedescriptors
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2958
                    */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2959
                    for (i = 0; i < nfd; i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2960
                        if (__ArrayInstPtr(fdArray)->a_element[i] == nil) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2961
                            close(i);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2962
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2963
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2964
                    /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2965
                    ** third: close filedescriptors
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2966
                    */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2967
                    for (i = 0; i < nclose; i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2968
                        OBJ fd;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2969
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2970
                        fd = __ArrayInstPtr(closeFdArray)->a_element[i];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2971
                        if (__isSmallInteger(fd)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2972
                            close(__intVal(fd));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2973
                        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2974
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2975
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2976
                    if (newPgrp == true) {
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2977
#ifndef NEXT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2978
                        setsid();
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2979
#endif
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  2980
#if defined(TIOCSCTTY)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2981
                        ioctl(0, TIOCSCTTY, 0) ;
3561
9a117ea69e2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3558
diff changeset
  2982
#endif
9a117ea69e2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3558
diff changeset
  2983
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  2984
#if defined(TIOCSPGRP)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2985
                        {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2986
                            int pgrp = getpid();
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2987
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2988
                            ioctl(0, TIOCSPGRP, (char *)&pgrp);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2989
                        }
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  2990
#endif
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2991
#if defined(_POSIX_JOB_CONTROL)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2992
                        (void) setpgid(0, 0);
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2993
#else
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2994
# if defined(BSD) || defined(LINUX)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2995
                        (void) setpgrp(0);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2996
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2997
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2998
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  2999
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3000
                    if (dirName != nil) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3001
                        chdir(__stringVal(dirName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3002
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3003
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3004
                    execve(__stringVal(aCommandPath), argv, _nEnv);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3005
                    /* should not be reached */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3006
                    _exit(127);                 /* POSIX 2 compatible exit value */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3007
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3008
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3009
            } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3010
                if (dirName != nil) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3011
                    chdir(__stringVal(dirName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3012
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3013
                /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3014
                 * no subprocess (i.e. transfer to another program)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3015
                 */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3016
                execve(__stringVal(aCommandPath), argv, _nEnv);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3017
                /* 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3018
                 * should not be reached
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3019
                 * (well, it is, if you pass a wrong command-path)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3020
                 */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3021
                id = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3022
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3023
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3024
            if (nNewEnv && (_nEnv != NULL)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3025
                /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3026
                 * free new environment stuff
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3027
                 */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3028
                for (i=0; i<nNewEnv;i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3029
                    char *e = _nEnv[i];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3030
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3031
                    if (e) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3032
                        free(e);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3033
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3034
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3035
                free(_nEnv);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3036
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3037
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3038
            free(argv);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3039
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3040
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3041
             * In parent: succes or failure
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3042
             */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3043
            if (id == -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3044
                RETURN (nil);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3045
            } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3046
                RETURN (__MKSMALLINT(id));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3047
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3048
        }
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3049
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3050
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3051
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3052
     path-argument not string
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3053
     or argArray not an array/nil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3054
     or malloc failed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3055
     or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3056
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3057
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3058
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3059
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3060
     |id|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3061
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3062
     id := OperatingSystem fork.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3063
     id == 0 ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3064
        'I am the child'.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3065
        OperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3066
        'not reached'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3067
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3068
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3069
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3070
     |id|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3071
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3072
     id := OperatingSystem fork.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3073
     id == 0 ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3074
        'I am the child'.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3075
        OperatingSystem
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3076
           exec:'/bin/sh'
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3077
           withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3078
        'not reached'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3079
     ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3080
     id printNL.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3081
     (Delay forSeconds:3.5) wait.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3082
     'killing ...' printNL.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3083
     OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id.
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3084
     OperatingSystem sendSignal:(OperatingSystem sigKILL) to:id
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3085
    "
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3086
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3087
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3088
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3089
executeCommand:aCommandString inDirectory:aDirectory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3090
    "much like #executeCommand:, but changes the current directory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3091
     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
  3092
     hardwiring any 'cd ..' command strings into your applictions."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3093
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3094
     ^ self
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3095
        executeCommand:aCommandString 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3096
        inputFrom:nil 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3097
        outputTo:nil 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3098
        errorTo:nil 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3099
        inDirectory:aDirectory asFilename name
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3100
        onError:[:status| false].
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3101
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3102
"/    | cmd |
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3103
"/
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3104
"/    "/ unix - prepend a 'cd' to the command
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3105
"/
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3106
"/    cmd := 'cd ' , aDirectory asFilename name, '; ' , aCommandString.
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3107
"/    ^ self executeCommand:cmd
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3108
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3109
    "Modified: / 20.1.1998 / 17:03:03 / md"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3110
    "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
  3111
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3112
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3113
fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3114
    "fork a new (HEAVY-weight) unix process.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3115
     Not supported with MSDOS & VMS systems.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3116
     Dont confuse this with Block>>fork, which creates 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3117
     lightweight smalltalk processes. This method will return
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3118
     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
  3119
     unix-process-id) to the parent (original) process.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3120
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3121
     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
  3122
     #startProcess: and #executCommand: for higher level interfaces."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3123
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3124
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3125
    int pid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3126
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3127
    pid = fork();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3128
    RETURN ( __MKUINT(pid) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3129
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3130
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3131
    "/ not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3132
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3133
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3134
    ^ UnsupportedOperationSignal raise
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3135
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3136
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3137
     |id|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3138
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3139
     id := OperatingSystem fork.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3140
     id == 0 ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3141
        'I am the child process' printCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3142
        OperatingSystem exit
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3143
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3144
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3145
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3146
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3147
getStatusOfProcess:aProcessId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3148
    "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
  3149
     This is required to avoid zombie processes."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3150
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3151
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3152
    int status;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3153
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3154
    if (__isSmallInteger(aProcessId)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3155
        pid_t pid = (pid_t)(__intVal(aProcessId));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3156
        {
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3157
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3158
# ifdef  NO_WAITPID
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3159
            pid_t child;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3160
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3161
            do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3162
                __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3163
                child = __wait (&status);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3164
                __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3165
                if (child < 0 && errno != EINTR) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3166
                    fprintf(stderr, "OS: child-wait errno=%d\n", errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3167
                    status = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3168
                    break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3169
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3170
            } while (child != pid);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3171
# else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3172
            pid_t child;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3173
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3174
            /* claus: the original did not care for EINTR here ... */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3175
            do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3176
                __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3177
                child = __waitpid (pid, &status, 0);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3178
                __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3179
            } while ((child != pid) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3180
            if (child != pid) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3181
                fprintf(stderr, "OS: child-waitpid errno=%d\n", errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3182
                status = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3183
            }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3184
# endif /* NO_WAITPID */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3185
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3186
        RETURN ( __MKSMALLINT(status));
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3187
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3188
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3189
    self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3190
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3191
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3192
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3193
pathOfCommand:aCommand
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3194
    "find where aCommand's executable file is;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3195
     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
  3196
     return nil."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3197
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3198
    |path f fExt|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3199
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3200
    aCommand asFilename isAbsolute ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3201
        ^ aCommand
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3202
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3203
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3204
    path := self getEnvironment:'PATH'.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3205
    path notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3206
        (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3207
            path isEmpty ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3208
                f := aCommand asFilename
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3209
            ] ifFalse:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3210
                f := path asFilename construct:aCommand.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3211
            ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3212
            self executableFileExtensions do:[:ext |
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3213
                ext notEmpty ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3214
                    fExt := (f pathName , ext) asFilename.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3215
                ] ifFalse:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3216
                    fExt := f.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3217
                ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3218
                fExt isExecutable ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3219
                    ^ fExt pathName
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3220
                ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3221
            ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3222
        ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3223
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3224
    ^ nil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3225
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3226
    "unix:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3227
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3228
     OperatingSystem pathOfCommand:'fooBar'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3229
     OperatingSystem pathOfCommand:'ls'    
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3230
     OperatingSystem pathOfCommand:'cvs'   
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3231
     OperatingSystem pathOfCommand:'stx'   
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
    "windows:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3234
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3235
     OperatingSystem pathOfCommand:'windbg'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3236
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3237
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3238
    "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
  3239
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3240
3928
c299502a62b9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  3241
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream inDirectory:dir
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3242
    "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
  3243
     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
  3244
     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
  3245
     '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
  3246
     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
  3247
     each may be nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3248
     Return the processId if successful, nil otherwise.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3249
     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
  3250
     or #killProcess: to stop it."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3251
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3252
    |in out err shellAndArgs rslt|
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3253
4753
214fc4e89e7a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4436
diff changeset
  3254
    aCommandString isNil ifTrue:[^ nil].
214fc4e89e7a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4436
diff changeset
  3255
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3256
    (in := anExternalInStream) isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3257
        in := '/dev/null' asFilename readStream
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3258
    ].
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3259
    (out := anExternalOutStream) isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3260
        out := '/dev/null' asFilename writeStream
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3261
    ].
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3262
    (err := anExternalErrStream) isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3263
        anExternalOutStream isNil ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3264
            err := out
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3265
        ] ifFalse:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3266
            err := '/dev/null' asFilename writeStream
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3267
        ]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3268
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3269
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3270
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
4753
214fc4e89e7a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4436
diff changeset
  3271
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3272
    rslt := self
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3273
        exec:(shellAndArgs at:1)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3274
        withArguments:(shellAndArgs at:2)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3275
        fileDescriptors:(Array with:in fileDescriptor
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3276
                               with:out fileDescriptor
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3277
                               with:err fileDescriptor)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3278
        closeDescriptors:nil
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3279
        fork:true
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3280
        newPgrp:false
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3281
        inDirectory:dir.
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3282
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3283
    ^ rslt
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3284
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3285
    "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
  3286
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3287
     OperatingSystem executeCommand:'ls -l > out'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3288
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3289
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3290
    "non-blocking (lower prio threads continue):
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3291
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3292
     |in out err pid sema|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3293
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3294
     in := 'out' asFilename readStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3295
     out := 'out2' asFilename writeStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3296
     err := 'err' asFilename writeStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3297
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3298
     sema := Semaphore new.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3299
     pid := OperatingSystem startProcess:'sleep 10; grep drw' inputFrom:in outputTo:out errorTo:err.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3300
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3301
     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
  3302
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3303
     pid notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3304
         Processor monitorPid:pid action:[:OSstatus | sema signal ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3305
     ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3306
     in close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3307
     out close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3308
     err close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3309
     sema wait.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3310
     Transcript showCR:'finished'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3311
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3312
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3313
    "Modified: / 21.3.1997 / 10:04:35 / dq"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3314
    "Modified: / 15.7.1997 / 16:03:51 / stefan"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3315
    "Modified: / 5.6.1998 / 19:03:51 / cg"
3928
c299502a62b9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  3316
    "Created: / 12.11.1998 / 14:39:20 / cg"
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3317
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3318
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3319
!UnixOperatingSystem class methodsFor:'file access'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3320
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3321
closeFd:anInteger
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3322
    "low level close of a filedescriptor"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3323
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3324
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3325
     if (__isSmallInteger(anInteger)) {
5203
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5157
diff changeset
  3326
	if (@global(ExternalStream:FileOpenTrace) == true) {
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5157
diff changeset
  3327
	    fprintf(stderr, "close [UnixOp] fd=%d\n", __intVal(anInteger));
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5157
diff changeset
  3328
	}
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3329
        close(__intVal(anInteger));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3330
        RETURN(self);
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
     ^ self primitiveFailed.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3334
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3335
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3336
createDirectory:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3337
    "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
  3338
     path, or relative to the current directory.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3339
     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
  3340
     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
  3341
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3342
    "/ if it already exists this is ok
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3343
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3344
    (self isDirectory:aPathName) ifTrue:[^ true].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3345
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3346
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3347
    if (__isString(aPathName)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3348
        int ret;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3349
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3350
        ret = mkdir(__stringVal(aPathName), 0755);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3351
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3352
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3353
            RETURN (false);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3354
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3355
        RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3356
      }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3357
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3358
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3359
"/    self isUNIXlike ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3360
"/      ^ self executeCommand:('mkdir 2>/dev/null ', newPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3361
"/    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3362
"/    ^ self executeCommand:('mkdir ', newPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3363
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3364
    self primitiveFailed
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3367
     OperatingSystem createDirectory:'foo'  
3496
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
    "Modified: 20.12.1995 / 11:24:13 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3371
    "Modified: 29.6.1996 / 14:06:54 / cg"
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
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3374
createHardLinkFrom:oldPath to:newPath
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3375
    "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
  3376
     Return true if successful, false if not."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3377
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3378
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3379
    int ret;
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
    if (__isString(oldPath) && __isString(newPath)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3382
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3383
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3384
            ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3385
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3386
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3387
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3388
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3389
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3390
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3391
        RETURN (true);
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3392
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3393
%}.
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3394
    "/
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3395
    "/ bad argument(s) given
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3396
    "/
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3397
    ^ self primitiveFailed 
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3398
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3399
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3400
     OperatingSystem linkFile:'foo' to:'bar'
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3401
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3402
!
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3403
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3404
createSymbolicLinkFrom:oldPath to:newPath
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3405
    "make a symbolic link for 'newPath' to the file 'oldPath'.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3406
     The link will be a soft (symbolic) link.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3407
     Return true if successful, false if not."
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3408
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3409
%{
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3410
#ifdef S_IFLNK
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3411
    int ret;
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3412
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3413
    if (__isString(oldPath) && __isString(newPath)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3414
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3415
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3416
            ret = symlink((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3417
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3418
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3419
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3420
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3421
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3422
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3423
        RETURN (true);
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3424
    }
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3425
#endif
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3426
%}.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3427
    (oldPath isString not or:[newPath isString not]) ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3428
        "/
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3429
        "/ bad argument(s) given
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3430
        "/
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3431
        ^ self primitiveFailed 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3432
    ].
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
    "/
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3435
    "/ this Unix does not seem to support symbolic links
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3436
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3437
    ^ UnsupportedOperationSignal raise
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3440
     OperatingSystem symbolicLinkFile:'foo' to:'bar'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3441
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3442
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3443
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3444
recursiveCopyDirectory:sourcePathName to:destination
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3445
    "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
  3446
     Return true if successful."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3447
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3448
    ^ 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
  3449
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3450
    "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
  3451
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3452
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3453
recursiveRemoveDirectory:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3454
    "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
  3455
     Return true if successful."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3456
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3457
    ^ self executeCommand:('rm -rf ' , fullPathName)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3458
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3459
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3460
     OperatingSystem recursiveCreateDirectory:'foo/bar/baz'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3461
     OperatingSystem recursiveRemoveDirectory:'foo'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3462
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3463
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3464
    "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
  3465
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3466
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3467
removeDirectory:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3468
    "remove the directory named 'fullPathName'. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3469
     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
  3470
     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
  3471
     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
  3472
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3473
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3474
    int ret;
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
    if (__isString(fullPathName)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3477
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3478
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3479
            ret = rmdir((char *) __stringVal(fullPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3480
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3481
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3482
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3483
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3484
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3485
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3486
        RETURN (true);
3496
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
%}.
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
    "/ either not a string argument,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3491
    "/ or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3492
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3493
    ^ self primitiveFailed
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3496
     OperatingSystem createDirectory:'foo'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3497
     OperatingSystem removeDirectory:'foo'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3498
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3499
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
removeFile:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3503
    "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
  3504
     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
  3505
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3506
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3507
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3508
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3509
    if (__isString(fullPathName)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3510
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3511
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3512
            ret = unlink((char *) __stringVal(fullPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3513
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3514
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3515
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3516
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3517
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3518
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3519
        RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3520
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3521
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3522
    ^ self primitiveFailed
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3525
renameFile:oldPath to:newPath
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3526
    "rename the file 'oldPath' to 'newPath'. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3527
     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
  3528
     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
  3529
     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
  3530
     any invalid names.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3531
     Returns true if successful, false if not"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3532
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3533
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3534
    int ret, eno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3535
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3536
    if (__isString(oldPath) && __isString(newPath)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3537
#if defined(HAS_RENAME)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3538
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3539
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3540
            ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3541
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3542
        __END_INTERRUPTABLE__
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3543
#else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3544
        ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3545
        if (ret >= 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3546
            ret = unlink((char *) __stringVal(oldPath));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3547
            if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3548
                eno = errno;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3549
                unlink((char *) __stringVal(newPath));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3550
                errno = eno;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3551
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3552
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3553
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3554
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3555
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3556
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3557
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3558
        RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3559
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3560
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3561
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3562
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3563
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3564
     OperatingSystem renameFile:'foo' to:'bar'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3565
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3568
truncateFile:aPathName to:newSize
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3569
    "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
  3570
     This may not be supported on all architectures.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3571
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3572
     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
  3573
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3574
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3575
#ifdef HAS_TRUNCATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3576
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3577
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3578
    if (__isString(aPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3579
     && __isSmallInteger(newSize)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3580
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3581
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3582
            ret = truncate((char *) __stringVal(aPathName), __intVal(newSize));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3583
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3584
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3585
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3586
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3587
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3588
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3589
        RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3590
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3591
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3592
# ifdef HAS_FTRUNCATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3593
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3594
    int fd;
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
    if (__isString(aPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3597
     && __isSmallInteger(newSize)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3598
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3599
            fd = open((char *) __stringVal(aPathName), 2);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3600
        } while (fd < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3601
        if (fd < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3602
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3603
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3604
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3605
        
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3606
        ret = ftruncate(fd, __intVal(newSize));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3607
        close(fd);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3608
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3609
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3610
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3611
        } 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3612
        RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3613
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3614
# endif /* using FTRUNCATE */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3615
#endif
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3618
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3619
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3620
!UnixOperatingSystem class methodsFor:'file access rights'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3621
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3622
accessMaskFor:aSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3623
    "return the access bits mask for numbers as returned by 
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3624
     OperatingSystem>>accessModeOf:
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3625
     and expected by OperatingSystem>>changeAccessModeOf:to:.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3626
     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
  3627
     (never hardcode 8rxxx into your code)."
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3630
#   ifndef S_IRUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3631
    /* posix systems should define these ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3632
#    define S_IRUSR 0400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3633
#    define S_IWUSR 0200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3634
#    define S_IXUSR 0100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3635
#    define S_IRGRP 0040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3636
#    define S_IWGRP 0020
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3637
#    define S_IXGRP 0010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3638
#    define S_IROTH 0004
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3639
#    define S_IWOTH 0002
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3640
#    define S_IXOTH 0001
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
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3643
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3644
    if (aSymbol == @symbol(readUser)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3645
        RETURN ( __MKSMALLINT(S_IRUSR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3646
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3647
    if (aSymbol == @symbol(writeUser)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3648
        RETURN ( __MKSMALLINT(S_IWUSR) );
3496
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
    if (aSymbol == @symbol(executeUser)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3651
        RETURN ( __MKSMALLINT(S_IXUSR) );
3496
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
    if (aSymbol == @symbol(readGroup)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3654
        RETURN ( __MKSMALLINT(S_IRGRP) );
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
    if (aSymbol == @symbol(writeGroup)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3657
        RETURN ( __MKSMALLINT(S_IWGRP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3658
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3659
    if (aSymbol == @symbol(executeGroup)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3660
        RETURN ( __MKSMALLINT(S_IXGRP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3661
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3662
    if (aSymbol == @symbol(readOthers)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3663
        RETURN ( __MKSMALLINT(S_IROTH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3664
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3665
    if (aSymbol == @symbol(writeOthers)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3666
        RETURN ( __MKSMALLINT(S_IWOTH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3667
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3668
    if (aSymbol == @symbol(executeOthers)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3669
        RETURN ( __MKSMALLINT(S_IXOTH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3670
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3671
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3672
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3673
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3674
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3675
     OperatingSystem accessMaskFor:#readUser
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3676
    "
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
accessModeOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3680
    "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
  3681
     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
  3682
     Notice that the returned number is OS dependent - use the 
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3683
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
3496
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
     this could have been implemented as:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3687
        (self infoOf:aPathName) at:#mode
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3688
     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
  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
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3693
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3694
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3695
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3696
# ifdef TRACE_STAT_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3697
        printf("stat on '%s' for accessMode\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3698
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3699
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3700
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3701
            ret = stat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3702
        } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3703
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3704
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3705
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3706
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3707
            RETURN ( nil );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3708
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3709
        RETURN ( __MKSMALLINT(buf.st_mode & 0777) );
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
   "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3715
    (OperatingSystem accessModeOf:'/') printStringRadix:8
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3716
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3717
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3718
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3719
changeAccessModeOf:aPathName to:modeBits
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3720
    "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
  3721
     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
  3722
     independent. Return true if changed, 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3723
     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
  3724
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
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3727
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3728
    if (__isString(aPathName) && __isSmallInteger(modeBits)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3729
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3730
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3731
            ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3732
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3733
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3734
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3735
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3736
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3737
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3738
        RETURN ( true );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3739
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3740
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3741
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3742
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3743
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3744
!UnixOperatingSystem class methodsFor:'file locking'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3745
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3746
lockFD:aFileDescriptor shared:isSharedReadLock blocking:blockIfLocked
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3747
   "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
  3748
    (such as returned by ExternalStream>>fileDescriptor).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3749
    On some systems, only advisory locks are available -
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3750
    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
  3751
    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
  3752
    (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
  3753
    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
  3754
    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
  3755
    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
  3756
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3757
    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
  3758
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3759
    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
  3760
    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
  3761
    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
  3762
    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
  3763
    argument."
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
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3766
    if (__isSmallInteger(aFileDescriptor)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3767
        int fd = __intVal(aFileDescriptor);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3768
        int lockArg;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3769
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3770
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3771
         * claus: sigh - each one has a different interface ... 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3772
         */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3773
#if defined(F_SETLK)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3774
        {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3775
            /* 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3776
             * new fcntl(SETLK) interface;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3777
             * available on SYSV4 and Linux
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3778
             */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3779
            struct flock flock;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3780
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3781
            if (isSharedReadLock == true) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3782
                flock.l_type = F_RDLCK;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3783
            } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3784
                flock.l_type = F_WRLCK;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3785
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3786
            flock.l_whence = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3787
            flock.l_start = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3788
            flock.l_len = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3789
            lockArg = F_SETLK;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3790
# if defined(F_SETLKW)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3791
            if (blockIfLocked == true) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3792
                lockArg = F_SETLKW;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3793
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3794
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3795
            if (fcntl(fd, lockArg, &flock) != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3796
                RETURN (true);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3797
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3798
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3799
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3800
#else /* no F_SETLK available */
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
# if defined(LOCK_EX) && defined(LOCK_UN)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3803
        /* 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3804
         * BSD 4.3 advisory locks
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3805
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3806
        lockArg = LOCK_EX;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3807
#  if defined(LOCK_SH)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3808
        if (isSharedReadLock == true) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3809
            lockArg = LOCK_SH
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3810
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3811
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3812
#  if defined(LOCK_NB)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3813
        if (blockIfLocked == false) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3814
            lockArg |= LOCK_NB;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3815
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3816
#  endif
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3817
        if (flock(fd, lockArg) != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3818
            RETURN (true);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3819
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3820
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3821
# else /* no flock available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3822
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3823
#  if defined(F_LOCK) && defined(F_UNLOCK)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3824
        /* 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3825
         * SYSV3 advisory locks
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3826
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3827
        if (lockf(fd, F_LOCK, 0) != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3828
            RETURN (true);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3829
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3830
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3831
# endif
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3835
    ^ false
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3838
supportsFileLinks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3839
    "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
  3840
     Typically, only unix returns true here."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3841
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3842
    ^ true
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3843
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3844
    "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
  3845
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3846
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3847
supportsFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3848
    "return true, if the OS supports file locking"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3849
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3850
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3851
#if defined(F_SETLK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3852
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3853
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3854
# if defined(LOCK_EX) && defined(LOCK_UN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3855
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3856
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3857
#  if defined(F_LOCK) && defined(F_UNLOCK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3858
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3859
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3860
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3861
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3862
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3863
    ^ false
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3866
     OperatingSystem supportsFileLocks
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3870
supportsNonBlockingFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3871
    "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
  3872
     (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
  3873
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3874
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3875
#if defined(F_SETLK) && defined(F_SETLKW)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3876
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3877
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3878
# 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
  3879
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3880
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3881
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3882
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3883
    ^ false
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3886
     OperatingSystem supportsNonBlockingFileLocks
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3887
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3888
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3889
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3890
supportsSharedLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3891
    "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
  3892
     file locking."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3893
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3894
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3895
#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
  3896
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3897
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3898
# 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
  3899
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3900
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3901
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3902
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3903
    ^ false
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3906
     OperatingSystem supportsNonBlockingFileLocks
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3910
unlockFD:aFileDescriptor
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3911
    "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
  3912
     which was previously aquired by #lockFD:.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3913
     Return false, if the unlock failed 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3914
     (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
  3915
      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
  3916
     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
  3917
     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
  3918
     
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3919
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3920
    if (__isSmallInteger(aFileDescriptor)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3921
        int fd = __intVal(aFileDescriptor);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3922
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3923
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3924
         * claus: sigh - each one has a different interface ...
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3925
         */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3926
#if defined(F_SETLK)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3927
        {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3928
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3929
             * new fcntl(SETLK) interface;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3930
             * available on SYSV4 and Linux
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3931
             */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3932
            struct flock flock;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3933
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3934
            flock.l_type = F_UNLCK;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3935
            flock.l_whence = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3936
            flock.l_start = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3937
            flock.l_len = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3938
            if (fcntl(fd, F_SETLK, &flock) != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3939
                RETURN (true);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3940
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3941
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3942
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3943
#else /* no F_SETLK available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3944
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3945
# if defined(LOCK_EX) && defined(LOCK_UN)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3946
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3947
         * BSD 4.3 advisory locks
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3948
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3949
        if (flock(fd, LOCK_UN) != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3950
            RETURN (true);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3951
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3952
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3953
# else /* no flock available */
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
#  if defined(F_LOCK) && defined(F_UNLOCK)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3956
        /* 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3957
         * SYSV3 advisory locks
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3958
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3959
        if (lockf(fd, F_UNLOCK, 0) != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3960
            RETURN (true);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3961
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3962
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3963
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3964
#endif
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3967
    ^ false
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3970
!UnixOperatingSystem class methodsFor:'file queries'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3971
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3972
caseSensitiveFilenames
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3973
    "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
  3974
     On MSDOS, this will return false; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3975
     on a real OS, we return true."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3976
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3977
    ^ true
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3978
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3979
    "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
  3980
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3981
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3982
compressPath:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3983
    "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
  3984
     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
  3985
     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
  3986
     if realPath and popen failed."
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
    |names n "{ Class: SmallInteger }" |
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
    names := pathName 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3991
                asCollectionOfSubstringsSeparatedBy:self fileSeparator.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3992
    names := names asOrderedCollection.
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
     cut off initial double-slashes
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
    [names startsWith:#('' '')] whileTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  3997
        names removeFirst.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3998
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3999
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4000
     cut off double-slashes at end
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4001
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4002
    [names endsWith:#('')] whileTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4003
        names removeLast.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4004
    ].
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
     cut off current-dir at beginning
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4007
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4008
    n := names size.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4009
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4010
        names removeFirst.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4011
        n := n - 1.
3496
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
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
     cut off parent-dirs at end
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
    [(n > 2) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4018
     and:[(names endsWith:#('..'))
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4019
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4020
        names removeLast; removeLast.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4021
        n := n - 2.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4022
    ].
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
    ^ names asStringWith:self fileSeparator 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4025
                    from:1
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4026
                    to:n
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4027
                    compressTabs:false final:nil 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4028
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4029
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4030
     OperatingSystem compressPath:'./..'    
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4031
     OperatingSystem compressPath:'/foo/bar/baz/..'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4032
     OperatingSystem compressPath:'foo/bar/baz/..'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4033
     OperatingSystem compressPath:'foo/bar/baz/../'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4034
     OperatingSystem compressPath:'foo/bar/baz/..///' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4035
     OperatingSystem compressPath:'///foo/bar/baz/..///' 
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4038
    "Modified: 1.11.1996 / 20:13:48 / cg"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4041
fileSeparator
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4042
    "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
  4043
     This character differs for MSDOS and other systems,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4044
     (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
  4045
      preparation for the future)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4046
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4047
    ^ $/
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4048
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4049
    "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
  4050
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4051
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4052
getDiskInfoOf:aDirectoryPath
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4053
    "return some disk info. 
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4054
     The amountof information returned depends upon the OS, and is
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4055
     not guaranteed to be consistent across architectures.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4056
     On unix, the information returned is (at least):
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4057
        freeBytes
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4058
        totalBytes
4262
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  4059
    "
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  4060
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  4061
    |p outputText keys values n info
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4062
     fileSystemIdx sizeIdx usedIdx availIdx capacityIdx mountIdx|
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4063
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4064
    p := PipeStream readingFrom:('df -k ' , aDirectoryPath).
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4065
    p isNil ifTrue:[^ nil].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4066
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4067
    [
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4068
        outputText := p contentsOfEntireFile.
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4069
    ] valueNowOrOnUnwindDo:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4070
        p close.
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4071
    ].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4072
"/ Transcript showCR:outputText asString.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4073
    outputText isNil ifTrue:[^ nil].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4074
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4075
    outputText := outputText asCollectionOfLines.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4076
    outputText size < 2 ifTrue:[^ nil].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4077
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4078
    keys := (outputText at:1) asLowercase asCollectionOfWords.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4079
    values := (outputText at:2) asCollectionOfWords.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4080
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4081
    "/ we may have to validate the following column indices
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4082
    "/ on some rude Unix versions ...
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4083
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4084
    fileSystemIdx := 1.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4085
    sizeIdx := 2.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4086
    usedIdx := 3.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4087
    availIdx := 4.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4088
    capacityIdx := 5.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4089
    mountIdx := 6.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4090
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4091
    values size < 6 ifTrue:[^ nil].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4092
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4093
    info := IdentityDictionary new.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4094
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4095
    n := Integer readFrom:(values at:capacityIdx) onError:nil.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4096
    n notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4097
        info at:#percentUsed put:n
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4098
    ].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4099
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4100
    n := Integer readFrom:(values at:availIdx) onError:nil.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4101
    n notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4102
        info at:#freeBytes put:(n * 1024)
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4103
    ].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4104
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4105
    n := Integer readFrom:(values at:usedIdx) onError:nil.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4106
    n notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4107
        info at:#usedBytes put:(n * 1024)
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4108
    ].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4109
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4110
    n := Integer readFrom:(values at:sizeIdx) onError:nil.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4111
    n notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4112
        info at:#totalBytes put:(n * 1024)
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4113
    ].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4114
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4115
    info at:#mountPoint put:(values at:mountIdx).
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4116
    info at:#fileSystem put:(values at:fileSystemIdx).
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4117
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4118
    ^ info
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4119
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4120
    "
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4121
     OperatingSystem getDiskInfoOf:'/'
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4122
     OperatingSystem getDiskInfoOf:'.'
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4123
    "
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4124
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4125
    "Modified: / 22.5.1999 / 00:32:13 / cg"
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4126
!
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4127
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4128
getDriveList
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4129
    "return a list of volumes in the system. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4130
     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
  4131
     - 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
  4132
     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
  4133
     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
  4134
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4135
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4136
    "/ default: retrurn array filled with
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4137
    "/ root, home and current directories.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4138
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4139
    ^ Array 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4140
        with:'/'
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4141
        with:(self getHomeDirectory)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4142
        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
  4143
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4144
    "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
  4145
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4146
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4147
getMountedVolumes
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4148
    "return info about mounted volumes. 
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4149
     The amount of information returned depends upon the OS, and is
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4150
     not guaranteed to be consistent across architectures.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4151
     On unix, the information returned is (at least):
4933
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4152
        mountPoint - mount point
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4153
        fileSystem - device or NFS-remotePath
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4154
    "
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4155
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4156
    |p outputText keys values info infoEntry|
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4157
4933
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4158
    p := PipeStream readingFrom:('df -k').
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4159
    p isNil ifTrue:[^ nil].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4160
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4161
    [
4933
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4162
        outputText := p contentsOfEntireFile.
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4163
    ] valueNowOrOnUnwindDo:[
4933
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4164
        p close.
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4165
    ].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4166
"/ Transcript showCR:outputText asString.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4167
    outputText isNil ifTrue:[^ nil].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4168
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4169
    outputText := outputText asCollectionOfLines.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4170
    outputText size < 2 ifTrue:[^ nil].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4171
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4172
    keys := (outputText at:1) asLowercase asCollectionOfWords.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4173
    "/ we may have to validate the following column indices
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4174
    "/ on some rude Unix versions ...
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4175
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4176
    info := OrderedCollection new.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4177
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4178
    outputText from:2 do:[:line |
4933
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4179
        values := line asCollectionOfWords.
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4180
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4181
        values size >= 2 ifTrue:[
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4182
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4183
            infoEntry := IdentityDictionary new.
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4184
            infoEntry at:#mountPoint put:(values last).
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4185
            infoEntry at:#fileSystem put:(values first).
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4186
            info add:infoEntry.
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4187
        ]
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4188
    ].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4189
    ^ info
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4190
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4191
    "
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4192
     OperatingSystem getMountedVolumes
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4193
    "
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4194
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4195
    "Modified: / 22.5.1999 / 00:32:13 / cg"
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4196
!
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4197
4201
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4198
getNullDevice
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4199
    "return the name of the OS's null device"
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4200
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4201
    ^ '/dev/null'
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4202
!
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4203
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4204
infoOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4205
    "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
  4206
     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
  4207
     the returned object) is:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4208
         type            - a symbol giving the files type
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4209
         mode            - numeric access mode 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4210
         uid             - owners user id
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4211
         gid             - owners group id
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4212
         size            - files size
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4213
         id              - files number (i.e. inode number)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4214
         accessed        - last access time (as Timestamp)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4215
         modified        - last modification time (as Timestamp)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4216
         statusChanged   - last status change time (as Timestamp)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4217
         alternativeName     - (windows only:) the MSDOS name of the file
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4218
         recordFormatNumeric - (VMS only:) numeric value of the recordFormat
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4219
         recordFormat        - (VMS only:) symbolic value of the recordFormat
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4220
         recordAttributes    - (VMS only:) recordAttributes
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4221
         fixedHeaderSize     - (VMS only:) fixed header size in a variable record format
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4222
         recordSize          - (VMS only:) record size.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4223
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4224
     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
  4225
     all of the information.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4226
     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
  4227
     For symbolic links (if supported by the OS), 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4228
     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
  4229
     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
  4230
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4231
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4232
    |info type mode uid gid size id 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4233
     atime mtime ctime 
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  4234
     aOStime mOStime cOStime|
3496
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
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4237
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4238
    char nameBuffer[15];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4239
    unsigned INT ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4240
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4241
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4242
# ifdef TRACE_STAT_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4243
        printf("stat on '%s' for info\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4244
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4245
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4246
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4247
            ret = stat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4248
        } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4249
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4250
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4251
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4252
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4253
            RETURN ( nil );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4254
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4255
        switch (buf.st_mode & S_IFMT) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4256
            case S_IFDIR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4257
                type = @symbol(directory);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4258
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4259
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4260
            case S_IFREG:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4261
                type = @symbol(regular);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4262
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4263
# ifdef S_IFCHR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4264
            case S_IFCHR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4265
                type = @symbol(characterSpecial);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4266
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4267
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4268
# ifdef S_IFBLK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4269
            case S_IFBLK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4270
                type = @symbol(blockSpecial);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4271
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4272
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4273
# ifdef S_IFMPC
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4274
            case S_IFMPC:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4275
                type = @symbol(multiplexedCharacterSpecial);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4276
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4277
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4278
# ifdef S_IFMPB
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4279
            case S_IFMPB:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4280
                type = @symbol(multiplexedBlockSpecial);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4281
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4282
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4283
# ifdef S_IFLNK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4284
            case S_IFLNK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4285
                type = @symbol(symbolicLink);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4286
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4287
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4288
# ifdef S_IFSOCK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4289
            case S_IFSOCK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4290
                type = @symbol(socket);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4291
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4292
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4293
# ifdef S_IFIFO
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4294
            case S_IFIFO:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4295
                type = @symbol(fifo);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4296
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4297
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4298
            default:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4299
                type = @symbol(unknown);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4300
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4301
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4302
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4303
        ino = buf.st_ino;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4304
        id = __MKUINT(ino);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4305
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4306
        mode = __MKSMALLINT(buf.st_mode & 0777);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4307
        uid = __MKSMALLINT(buf.st_uid);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4308
        gid = __MKSMALLINT(buf.st_gid);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4309
        size = __MKUINT(buf.st_size);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4310
        aOStime = __MKUINT(buf.st_atime);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4311
        mOStime = __MKUINT(buf.st_mtime);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4312
        cOStime = __MKUINT(buf.st_ctime);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4313
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4314
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4315
    mode notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4316
        atime := AbsoluteTime fromOSTime:(aOStime * 1000).
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4317
        mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4318
        ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4319
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4320
        info := FileStatusInfo
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4321
                    type:type 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4322
                    mode:mode 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4323
                    uid:uid 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4324
                    gid:gid 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4325
                    size:size 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4326
                    id:id 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4327
                    accessed:atime 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4328
                    modified:mtime 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4329
                    statusChanged:ctime
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4330
                    path:nil.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4331
        ^ info
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4332
   ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4333
   ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4334
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4335
   "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4336
    OperatingSystem infoOf:'/'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4337
    (OperatingSystem infoOf:'/') uid
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4338
    (OperatingSystem infoOf:'/') accessed
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4339
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4340
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4341
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4342
isDirectory:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4343
    "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
  4344
     (i.e. exists and is a directory).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4345
     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
  4346
     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
  4347
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4348
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4349
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4350
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4351
    if (__isString(aPathName)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4352
        struct stat buf;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4353
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4354
# ifdef TRACE_STAT_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4355
        printf("stat on '%s' for isDirectory\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4356
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4357
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4358
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4359
            ret = stat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4360
        } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4361
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4362
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4363
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4364
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4365
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4366
        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
  4367
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4368
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4369
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4370
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4371
    "an alternative implementation would be:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4372
        ^ (self infoOf:aPathName) type == #directory
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4373
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4374
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4375
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4376
isExecutable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4377
    "return true, if the given file is executable.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4378
     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
  4379
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4380
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4381
    int ret;
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
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4384
# ifdef TRACE_ACCESS_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4385
        printf("access on '%s' for executable\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4386
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4387
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4388
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4389
            ret = access(__stringVal(aPathName), X_OK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4390
        } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4391
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4392
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4393
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4394
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4395
        RETURN ( ((ret == 0) ? true : false) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4396
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4397
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4398
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4399
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4401
isReadable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4402
    "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
  4403
     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
  4404
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4405
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4406
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4407
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4408
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4409
# ifdef TRACE_ACCESS_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4410
        printf("access on '%s' for readable\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4411
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4412
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4413
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4414
            ret = access(__stringVal(aPathName), R_OK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4415
        } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4416
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4417
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4418
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4419
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4420
        RETURN ( ((ret == 0) ? true : false) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4421
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4422
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4423
    ^ self primitiveFailed
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
isSymbolicLink:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4427
    "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
  4428
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4429
    ^ (self linkInfoOf:aPathName) notNil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4430
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4431
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4432
     OperatingSystem isSymbolicLink:'Make.proto'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4433
     OperatingSystem isSymbolicLink:'Makefile' 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4434
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4437
isValidPath:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4438
    "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
  4439
     (i.e. the file or directory exists)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4440
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4441
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4442
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4443
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4444
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4445
    if (__isString(aPathName) || __isSymbol(aPathName) ) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4446
# ifdef TRACE_STAT_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4447
        printf("stat on '%s' for isValidPath\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4448
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4449
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4450
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4451
            ret = stat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4452
        } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4453
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4454
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4455
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4456
            RETURN (false);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4457
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4458
        RETURN ( ret ? false : true );
3496
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
    ^ self primitiveFailed
5407
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  4462
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  4463
"/ alternative:
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  4464
"/        ^ (self infoOf:aPathName) notNil
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  4465
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4466
!
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
isWritable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4469
    "return true, if the given file is writable.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4470
     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
  4471
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4472
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4473
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4474
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4475
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4476
# ifdef TRACE_ACCESS_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4477
        printf("access on '%s' for writable\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4478
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4479
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4480
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4481
            ret = access(__stringVal(aPathName), W_OK);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4482
        } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4483
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4484
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4485
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4486
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4487
        RETURN ( ((ret == 0) ? true : false) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4488
    }
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4491
!
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
linkInfoOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4494
    "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
  4495
     IFF aPathName is a symbolic link. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4496
     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
  4497
     (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
  4498
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4499
     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
  4500
     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
  4501
     in case of a symbolic link."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4502
     
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4503
    |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
  4504
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4505
%{  /* STACK: 1200 */
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  4506
#if defined(S_IFLNK)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4507
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4508
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4509
    char pathBuffer[1024];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4510
    unsigned INT ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4511
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4512
    if (__isString(aPathName)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4513
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4514
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4515
            ret = lstat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4516
        } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4517
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4518
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4519
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4520
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4521
            RETURN ( nil );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4522
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4523
        switch (buf.st_mode & S_IFMT) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4524
            default:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4525
                RETURN ( nil ); /* not a symbolic link */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4526
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4527
            case S_IFLNK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4528
                type = @symbol(symbolicLink);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4529
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4530
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4531
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4532
        ino = buf.st_ino;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4533
        id = __MKUINT(ino);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4534
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4535
        mode = __MKSMALLINT(buf.st_mode & 0777);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4536
        uid = __MKSMALLINT(buf.st_uid);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4537
        gid = __MKSMALLINT(buf.st_gid);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4538
        size = __MKUINT(buf.st_size);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4539
        atime = __MKUINT(buf.st_atime);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4540
        mtime = __MKUINT(buf.st_mtime);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4541
        ctime = __MKUINT(buf.st_ctime);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4542
        if ((ret = readlink((char *) __stringVal(aPathName), pathBuffer, sizeof(pathBuffer))) < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4543
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4544
            RETURN ( nil );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4545
        } 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4546
        pathBuffer[ret] = '\0';  /* readlink does not 0-terminate */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4547
        path = __MKSTRING(pathBuffer);
3496
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
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4550
    RETURN ( nil );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4551
#endif
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
    mode notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4554
        info := IdentityDictionary new.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4555
        ^ FileStatusInfo
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4556
            type:type 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4557
            mode:mode 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4558
            uid:uid 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4559
            gid:gid 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4560
            size:size 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4561
            id:id 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4562
            accessed:(AbsoluteTime fromOSTime:(atime * 1000)) 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4563
            modified:(AbsoluteTime fromOSTime:(mtime * 1000)) 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4564
            statusChanged:(AbsoluteTime fromOSTime:(ctime * 1000))
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4565
            path:path
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4566
   ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4567
   ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4568
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4569
   "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4570
    OperatingSystem infoOf:'Make.proto'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4571
    OperatingSystem linkInfoOf:'Make.proto' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4572
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4573
    OperatingSystem infoOf:'resources/motif.style'   
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4574
    OperatingSystem linkInfoOf:'resources/motif.style' 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4575
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4576
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4577
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4578
parentDirectoryName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4579
    "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
  4580
     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
  4581
     for other systems.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4582
     (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
  4583
      preparation for the future)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4584
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4585
    ^ '..'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4586
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4587
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4588
pathNameOf:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4589
    "return the pathName of the argument, aPathString,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4590
     - 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
  4591
     This method needs the path to be valid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4592
     (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
  4593
     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
  4594
     from what you expect."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4595
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4596
    |p path command|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4597
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4598
    "some systems have a convenient function for this ..."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4599
    path := self primPathNameOf:pathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4600
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4601
    path isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4602
        (self isValidPath:pathName) ifFalse:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4603
            p := pathName.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4604
            [(p size > 1)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4605
             and:[p endsWith:(self fileSeparator)]
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4606
            ] whileTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4607
                p := p copyWithoutLast:1.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4608
            ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4609
            ^ p
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4610
        ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4611
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4612
        (SlowFork==true or:[PipeFailed==true]) ifFalse:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4613
            PipeStream openErrorSignal handle:[:ex |
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4614
                PipeFailed := true.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4615
                'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4616
                ex return.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4617
            ] do:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4618
                "have to fall back ..."
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4619
                command := 'cd ' , pathName , '; pwd'.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4620
                p := PipeStream readingFrom:command.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4621
            ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4622
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4623
            (p isNil or:[p atEnd]) ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4624
                ('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4625
            ] ifFalse:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4626
                path := p nextLine.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4627
                p close.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4628
            ]
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4629
        ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4630
        path isNil ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4631
            "/
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4632
            "/ return the original - there is nothing else can we do
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4633
            "/
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4634
            path := pathName
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4635
        ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4636
        (SlowFork==true or:[ForkFailed==true]) ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4637
            path := self compressPath:path
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4638
        ]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4639
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4640
    ^ path.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4641
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4642
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4643
     OperatingSystem pathNameOf:'.'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4644
     OperatingSystem pathNameOf:'../smalltalk/../smalltalk'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4645
     OperatingSystem pathNameOf:'../../..'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4646
     OperatingSystem pathNameOf:'..'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4647
     OperatingSystem pathNameOf:'/tmp////' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4648
     OperatingSystem pathNameOf:'/foo/bar' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4649
     OperatingSystem pathNameOf:'/foo/bar/'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4650
     OperatingSystem pathNameOf:'/foo/bar//'
3496
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
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4653
    "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
  4654
    "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
  4655
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4656
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4657
primIdOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4658
    "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
  4659
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  4660
%{
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4661
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4662
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4663
    unsigned INT ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4664
    OBJ retVal;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4665
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4666
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4667
# ifdef TRACE_STAT_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4668
        printf("stat on '%s' for id\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4669
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4670
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4671
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4672
            ret = stat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4673
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4674
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4675
        if (ret >= 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4676
            ino = buf.st_ino;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4677
            retVal = __MKUINT(ino);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4678
            RETURN (retVal);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4679
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4680
        @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4681
        RETURN (nil);
3496
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
    RETURN (nil);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4684
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4685
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4686
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4687
primPathNameOf:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4688
    "return the pathName of the argument, aPathString,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4689
     - 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
  4690
     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
  4691
     realPath library function.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4692
     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
  4693
     from what you expect."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4694
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4695
    |path|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4696
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4697
%{  /* STACK: 16000 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4698
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4699
    if (__isString(pathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4700
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4701
#ifdef HAS_GETCWD
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4702
        if (strcmp(__stringVal(pathName), ".") == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4703
            char nameBuffer[MAXPATHLEN + 1];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4704
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4705
            if (@global(CurrentDirectory) == nil) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4706
                if (getcwd(nameBuffer, MAXPATHLEN)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4707
                    OBJ d;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4708
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4709
                    @global(CurrentDirectory) = d = __MKSTRING(nameBuffer);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4710
                    __GSTORE(d);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4711
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4712
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4713
            RETURN (@global(CurrentDirectory));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4714
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4715
#endif /* HAS_GETCWD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4716
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4717
#ifdef HAS_REALPATH
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4718
        {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4719
            char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4720
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4721
            if (realpath(__stringVal(pathName), nameBuffer)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4722
                RETURN ( __MKSTRING(nameBuffer) );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4723
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4724
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4725
#endif /* ! HAS_REALPATH */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4726
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4727
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4728
    ^ nil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4729
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4730
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4731
timeOfLastAccess:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4732
    "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
  4733
     For nonexistent files, nil is returned."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4734
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4735
    "could be implemented as:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4736
        (self infoOf:aPathName) accessed 
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
    |osSeconds i|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4739
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4740
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4741
    time_t mtime;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4742
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4743
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4744
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4745
# ifdef TRACE_STAT_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4746
        printf("stat on '%s' for timeOfLastAccess\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4747
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4748
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4749
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4750
            ret = stat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4751
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4752
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4753
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4754
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4755
            RETURN (nil);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4756
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4757
        osSeconds = __MKUINT(buf.st_atime);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4758
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4759
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4760
    osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4761
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4762
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4763
    i notNil ifTrue:[^ i accessed].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4764
    ^ nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4765
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4766
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4767
     OperatingSystem timeOfLastAccess:'/'
3496
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4770
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4771
timeOfLastChange:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4772
    "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
  4773
     For nonexistent files, nil is returned."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4774
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4775
    "could be implemented as:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4776
        (self infoOf:aPathName) modified
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4777
    "
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
    |osSeconds i|
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
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4782
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4783
    time_t mtime;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4784
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4785
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4786
# ifdef TRACE_STAT_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4787
        printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4788
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4789
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4790
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4791
            ret = stat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4792
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4793
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4794
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4795
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4796
            RETURN ( nil );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4797
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4798
        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
  4799
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4800
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4801
    osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4802
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4803
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4804
    i notNil ifTrue:[^ i modified].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4805
    ^ nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4806
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4807
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4808
     OperatingSystem timeOfLastChange:'/'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4809
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4810
!
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
typeOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4813
    "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
  4814
     nil is returned.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4815
     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
  4816
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4817
    |i|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4818
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
     this could have been implemented as:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4821
        (self infoOf:aPathName) type 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4822
     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
  4823
    "
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
%{
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
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4828
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4829
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4830
# ifdef TRACE_STAT_CALLS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4831
        printf("stat on '%s' for type\n", __stringVal(aPathName));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4832
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4833
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4834
        do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4835
            ret = stat((char *) __stringVal(aPathName), &buf);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4836
        } while (ret < 0 && errno == EINTR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4837
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4838
        if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4839
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4840
            RETURN ( nil );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4841
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4842
        switch (buf.st_mode & S_IFMT) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4843
            case S_IFDIR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4844
                RETURN ( @symbol(directory) );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4845
            case S_IFREG:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4846
                RETURN ( @symbol(regular) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4847
# ifdef S_IFCHR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4848
            case S_IFCHR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4849
                RETURN ( @symbol(characterSpecial) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4850
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4851
# ifdef S_IFBLK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4852
            case S_IFBLK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4853
                RETURN ( @symbol(blockSpecial) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4854
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4855
# ifdef S_IFLNK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4856
            case S_IFLNK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4857
                RETURN ( @symbol(symbolicLink) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4858
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4859
# ifdef S_IFSOCK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4860
            case S_IFSOCK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4861
                RETURN ( @symbol(socket) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4862
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4863
# ifdef S_IFIFO
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4864
            case S_IFIFO:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4865
                RETURN ( @symbol(fifo) );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4866
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4867
            default:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4868
                RETURN ( @symbol(unknown) );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4869
        }
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4870
    }
3496
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
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4873
    i notNil ifTrue:[^ i type].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4874
    ^ nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4875
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4876
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4877
     OperatingSystem typeOf:'/'   
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4878
     OperatingSystem typeOf:'.'   
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4879
     OperatingSystem typeOf:'Make.proto' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4880
     OperatingSystem typeOf:'resources/motif.style' 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4881
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4882
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4883
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4884
volumeNameOf:aPathString
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4885
    "return the volumeName of the argument, aPath
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4886
     - thats the name of the volume where aPath is.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4887
     Not all OperatingSystems support/use volumes; on unix,
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4888
     this always returns an empty string."
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
    ^ ''
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4891
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4892
    "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
  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 class methodsFor:'interrupts & signals'!
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
defaultSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4898
    "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
  4899
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4900
     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
  4901
     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
  4902
     default for SIGQUIT (^ \) is to dump core.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4903
     Also, NOTICE that signal numbers are not portable between unix
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4904
     systems - use OperatingSystem sigXXX to get the numeric value for
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4905
     a signal."
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4908
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4909
    if (__isSmallInteger(signalNumber)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4910
#ifdef SIG_DFL
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4911
        signal(__intVal(signalNumber), SIG_DFL);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4912
        RETURN (self);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4913
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4914
    }
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4917
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4918
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4919
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4920
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4921
    "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
  4922
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4923
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4924
     OperatingSystem defaultSignal:(OperatingSystem sigINT).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4925
     1 to:1000000 do:[:i| ].
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4926
     OperatingSystem enableSignal:(OperatingSystem sigINT).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4927
     'normal ^C handling again.' printNewline
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4928
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4929
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4930
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4931
disableIOInterruptsOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4932
    "turn off IO interrupts for a filedescriptor"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4933
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4934
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4935
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4936
    int ret, flags, f;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4937
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4938
#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
  4939
    if (__isSmallInteger(fd)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4940
        f = __intVal(fd);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4941
# if defined(SYSV4)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4942
        ret = ioctl(f, I_SETSIG, 0);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4943
# else /*! SYSV4*/
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4944
        flags = fcntl(f, F_GETFL, 0);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4945
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4946
         * if already clear, there is no need for this syscall ...
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4947
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4948
        if (flags & FASYNC) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4949
            ret = fcntl(f, F_SETFL, flags & ~FASYNC);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4950
            if (ret >= 0) ret = flags;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4951
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4952
            ret = flags;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4953
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4954
# endif /* !SYSV4 */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4955
        RETURN ( __MKSMALLINT(ret) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4956
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4957
#endif
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4960
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4961
     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
  4962
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4963
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4964
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4965
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4966
disableSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4967
    "disable (Unix-) signal processing for signalNumber.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4968
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4969
     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
  4970
     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
  4971
     handling.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4972
     Also, NOTICE that signal numbers are not portable between unix
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4973
     systems - use OperatingSystem sigXXX to get the numeric value for
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4974
     a signal.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4975
     Use only for fully debugged stand alone applications."
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4978
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4979
    if (__isSmallInteger(signalNumber)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4980
        int sigNo = __intVal(signalNumber);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4981
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4982
        if (sigNo == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4983
            RETURN (self);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4984
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4985
#ifdef SIG_IGN
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4986
        signal(sigNo, SIG_IGN);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  4987
        RETURN (self);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4988
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4989
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4990
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4991
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4992
     this error is triggered on non-integer argument
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
    ^ self primitiveFailed
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4997
     'now, ^C is totally ignored ...' printNewline.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4998
     OperatingSystem disableSignal:(OperatingSystem sigINT).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4999
     1 to:1000000 do:[:i| ].
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5000
     OperatingSystem enableSignal:(OperatingSystem sigINT).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5001
     '^C handled again.' printNewline
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5005
disableTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5006
    "disable timer interrupts.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5007
     WARNING: 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5008
        the system will not operate correctly with timer interrupts
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5009
        disabled, because no scheduling or timeouts are possible."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5011
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5012
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5013
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5014
    struct itimerval dt;
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
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5017
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5018
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5019
    dt.it_value.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5020
    setitimer(ITIMER_REAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5021
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5022
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5023
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5024
# if defined(USE_SLOW_ALARM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5025
#  if defined(SIGALRM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5026
    alarm(0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5027
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5028
#  endif /* SIGALRM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5029
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5030
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5031
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5032
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5033
    ^ false
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5036
enableChildSignalInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5037
    "enable childSignal interrupts 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5038
     (SIGCHLD, if the architecture supports it).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5039
     After enabling, these signals will send the message 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5040
     'childSignalInterrupt' to the ChildSignalInterruptHandler object."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5041
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5042
    self enableSignal:(self sigCHLD)
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5045
enableIOInterruptsOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5046
    "turn on IO interrupts for a filedescriptor"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5047
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5048
%{  /* NOCONTEXT */
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
    int ret, flags, f;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5051
#ifndef __signalIoInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5052
    extern void __signalIoInterrupt();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5053
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5054
    static int firstCall = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5055
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5056
#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
  5057
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5058
 * SIGIO/SIGPOLL - data available for I/O
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5059
 * (used to wake up waiting processes)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5060
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5061
#ifdef SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5062
# define THESIGNAL SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5063
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5064
# ifdef SIGPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5065
#  define THESIGNAL SIGPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5066
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5067
#  ifdef SIGURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5068
#   define THESIGNAL SIGURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5069
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5070
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5071
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5072
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5073
    if (__isSmallInteger(fd)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5074
        if (firstCall) {
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5075
#ifdef HAS_SIGACTION
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5076
            struct sigaction act;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5077
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5078
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5079
             * Do not add SA_RESTART here. A signal can cause a
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5080
             * thread switch, another thread can do a garbage collect
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5081
             * and restarted system calls may write into old
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5082
             * (collected) addresses.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5083
             */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5084
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5085
            act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5086
            sigemptyset(&act.sa_mask);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5087
            act.sa_handler = __signalIoInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5088
            sigaction(THESIGNAL, &act, 0);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5089
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5090
# ifdef HAS_SIGVEC
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5091
            struct sigvec vec;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5092
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5093
            vec.sv_flags = SV_INTERRUPT;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5094
            sigemptyset(&vec.sv_mask);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5095
            vec.sv_handler = __signalIoInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5096
            sigvec(THESIGNAL, &vec, NULL);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5097
# else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5098
            signal(THESIGNAL, __signalIoInterrupt);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5099
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5100
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5101
            firstCall = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5102
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5103
#undef THESIGNAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5104
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5105
        f = __intVal(fd);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5106
# if defined(SYSV4)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5107
        ret = ioctl(f, I_SETSIG, S_INPUT | S_HIPRI | S_ERROR | S_RDNORM | S_RDBAND | S_MSG | S_HANGUP);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5108
# else /*! SYSV4*/
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5109
        flags = fcntl(f, F_GETFL, 0);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5110
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5111
         * if already set, there is no need for this syscall ...
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5112
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5113
        if (flags & FASYNC) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5114
            ret = flags;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5115
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5116
            ret = fcntl(f, F_SETFL, flags | FASYNC);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5117
            if (ret >= 0) ret = flags;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5118
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5119
# endif /*!SYSV4*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5120
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5121
#if defined(F_SETOWN) || defined(FIOSETOWN)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5122
        {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5123
            int pid;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5124
            int ok;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5125
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5126
            pid = getpid();
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5127
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5128
# if defined(F_SETOWN)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5129
            ok = fcntl(f, F_SETOWN, pid);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5130
            /* printf("F_SETOWN returns %d (%d)\n", ret, errno); */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5131
# else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5132
            ok = ioctl(f, FIOSETOWN, &pid);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5133
            /* printf("FIOSETOWN returns %d (%d)\n", ret, errno); */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5134
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5135
            if (ok < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5136
                ret = ok;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5137
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5138
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5139
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5140
        RETURN ( __MKUINT(ret) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5143
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5144
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5145
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5146
     or if the system does not support SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5147
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5148
    ^ self primitiveFailed
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5151
enableSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5152
    "enable (Unix-)signal processing for signalNumber.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5153
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5154
     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
  5155
     (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
  5156
     sends #signalInterrupt:.
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
     NOTICE that signal numbers are not portable between unix
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5159
     systems - use OperatingSystem sigXXX to get the numeric value for
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5160
     a signal."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5161
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5162
%{  /* NOCONTEXT */
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
#ifdef NSIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5165
# define SIG_LIMIT NSIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5166
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5167
# ifdef SIGUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5168
#  define SIG_LIMIT SIGUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5169
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5170
#  ifdef SIGUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5171
#   define SIG_LIMIT SIGUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5172
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5173
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5174
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5175
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5176
#if defined(SIGPOLL) && !defined(SIGIO)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5177
# define SIGIO SIGPOLL
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5180
#ifdef SIGCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5181
# define CHILD_SIGNAL   SIGCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5182
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5183
# ifdef SIGCLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5184
#  define CHILD_SIGNAL  SIGCLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5185
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5186
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5187
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5188
    int sigNr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5189
#if defined(SIGINT) || defined(SIGQUIT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5190
# ifndef __signalUserInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5191
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5192
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5193
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5194
#ifdef SIGFPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5195
# ifndef __signalFpExceptionInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5196
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5197
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5198
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5199
#ifdef SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5200
# ifndef __signalIoInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5201
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5202
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5203
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5204
#ifdef CHILD_SIGNAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5205
# ifndef __signalChildInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5206
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
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
#ifdef SIGPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5210
# ifndef __signalPIPEInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5211
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5212
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5213
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5214
#ifdef SIGBUS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5215
# ifndef __signalBUSInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5216
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5217
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5218
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5219
#ifdef SIGSEGV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5220
# ifndef __signalSEGVInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5221
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5222
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5223
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5224
#if defined(SIGILL) || defined(SIGEMT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5225
# ifndef __signalTrapInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5226
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5227
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5228
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5229
#ifdef SIGALRM
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
  5230
# ifndef __signalTimerInterrupt
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5231
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5232
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5233
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5234
#ifndef __signalInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5235
    extern void __signalInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5236
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5237
    void (*handler)(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5238
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5239
    if (__isSmallInteger(signalNumber)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5240
     && ((sigNr = __intVal(signalNumber)) >= 0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5241
#ifdef SIG_LIMIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5242
     &&  (sigNr <= SIG_LIMIT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5243
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5244
    ) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5245
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5246
         * standard signals are forced into standard handlers
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5247
         * - all others go into general signalInterrupt
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5248
         */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5249
#if defined(SIGPOLL) && defined(SIGIO)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5250
        if (sigNr == SIGPOLL)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5251
            sigNr = SIGIO;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5252
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5253
        switch (sigNr) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5254
            case 0:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5255
                /* enabling a non-supported signal */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5256
                RETURN (self);
3496
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
#ifdef SIGBREAK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5259
            case SIGBREAK:
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5260
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5261
#ifdef SIGINT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5262
            case SIGINT:
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5263
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5264
#ifdef SIGQUIT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5265
            case SIGQUIT:
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5266
#endif
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  5267
#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGBREAK)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5268
                handler = __signalUserInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5269
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5270
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5271
#ifdef SIGFPE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5272
            case SIGFPE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5273
                handler = __signalFpExceptionInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5274
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5275
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5276
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5277
#ifdef SIGPIPE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5278
            case SIGPIPE:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5279
                handler = __signalPIPEInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5280
                break;
3496
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
#ifdef SIGBUS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5283
            case SIGBUS:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5284
                handler = __signalBUSInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5285
                break;
3496
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
#ifdef SIGSEGV
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5288
            case SIGSEGV:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5289
                handler = __signalSEGVInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5290
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5291
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5292
#ifdef SIGILL
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5293
            case SIGILL:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5294
                handler = __signalTrapInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5295
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5296
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5297
#ifdef SIGEMT
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5298
            case SIGEMT:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5299
                handler = __signalTrapInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5300
                break;
3496
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 SIGIO
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5303
            case SIGIO:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5304
                handler = __signalIoInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5305
                break;
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5308
#ifdef CHILD_SIGNAL
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5309
            case CHILD_SIGNAL:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5310
                handler = __signalChildInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5311
                break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5312
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5313
#ifdef SIGALRM
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5314
            case SIGALRM:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5315
                handler = __signalTimerInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5316
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5317
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5318
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5319
            default:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5320
                handler = __signalInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5321
                break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5322
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5323
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5324
        {
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5325
#ifdef HAS_SIGACTION
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5326
            struct sigaction act;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5327
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5328
            /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5329
             * Do not add SA_RESTART here. A signal can cause a
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5330
             * thread switch, another thread can do a garbage collect
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5331
             * and restarted system calls may write into old
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5332
             * (collected) addresses.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5333
             */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5334
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5335
            act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5336
            sigemptyset(&act.sa_mask);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5337
            act.sa_handler = handler;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5338
            sigaction(sigNr, &act, 0);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5339
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5340
# ifdef HAS_SIGVEC
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5341
            struct sigvec vec;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5342
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5343
            vec.sv_flags = SV_INTERRUPT;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5344
            sigemptyset(&vec.sv_mask);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5345
            vec.sv_handler = handler;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5346
            sigvec(sigNr, &vec, NULL);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5347
# else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5348
            (void) signal(sigNr, handler);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5349
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5350
#endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5351
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5352
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5353
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5354
         * maybe, we should ret the old enable-status
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5355
         * as boolean here ...
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5356
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5357
        RETURN (self);
3496
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5360
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5361
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5362
     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
  5363
     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
  5364
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5365
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5366
!
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
enableTimer:milliSeconds
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5369
    "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
  5370
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5371
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5372
    int millis;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5373
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5374
    millis = __intVal(milliSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5375
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5376
#ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5377
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5378
        static int firstCall = 1;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5379
# ifndef __signalTimerInterrupt
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5380
        extern void __signalTimerInterrupt(SIGHANDLER_ARG);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5381
# endif
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5382
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5383
        if (firstCall) {
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5384
# ifdef HAS_SIGACTION
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5385
            struct sigaction act;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5386
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5387
            act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5388
            sigemptyset(&act.sa_mask);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5389
            act.sa_handler = __signalTimerInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5390
            sigaction(SIGALRM, &act, 0);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5391
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5392
#  ifdef HAS_SIGVEC
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5393
            struct sigvec vec;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5394
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5395
            vec.sv_flags = SV_INTERRUPT;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5396
            sigemptyset(&vec.sv_mask);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5397
            vec.sv_handler = __signalTimerInterrupt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5398
            sigvec(SIGALRM, &vec, NULL);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5399
#  else /* neither SIGACTION nor SIGVEC */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5400
            signal(SIGALRM, __signalTimerInterrupt);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5401
#  endif /* stupid system  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5402
# endif
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5403
            firstCall = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5404
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5405
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5406
#endif /* SIGALRM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5407
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5408
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5409
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5410
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5411
        struct itimerval dt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5412
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5413
        dt.it_interval.tv_sec = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5414
        dt.it_interval.tv_usec = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5415
        dt.it_value.tv_sec = millis / 1000;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5416
        dt.it_value.tv_usec = (millis % 1000) * 1000;  
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5417
        setitimer(ITIMER_REAL, &dt, 0);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5418
        RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5419
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5420
#else /* no ITIMER_REAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5421
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5422
# ifdef USE_SLOW_ALARM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5423
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5424
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5425
         * last fallback - use alarm (which only gives 1 second resolution).
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5426
         * If the system does not support any of the above, you have to life
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5427
         * with this. The consequence is that pressing CTRL-C processing and
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5428
         * thread switching will take place much delayed.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5429
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5430
        alarm(1);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5431
        RETURN(true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5432
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5433
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5434
#endif /* ITIMER_REAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5435
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5436
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5437
!
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
killProcess:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5440
    "kill a unix process.
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5441
     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
  5442
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5443
     WARNING: in order to avoid zombie processes (on unix),
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5444
              you may have to fetch the processes exitstatus with
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5445
              OperatingSystem>>getStatusOfProcess:aProcessId."
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5446
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5447
    self sendSignal:(self sigKILL) to:processId.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5448
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5449
    "Modified: / 10.6.1998 / 11:59:12 / cg"
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5450
!
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5451
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5452
killProcessGroup:processGroupId
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5453
    "kill a unix process group.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5454
     The process has a no chance to do some cleanup.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5455
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5456
     WARNING: in order to avoid zombie processes (on unix),
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5457
              you may have to fetch the processes exitstatus with
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5458
              OperatingSystem>>getStatusOfProcess:aProcessId."
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5459
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5460
    self sendSignal:(self sigKILL) to:(processGroupId negated).
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5461
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5462
    "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
  5463
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5464
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5465
sendSignal:signalNumber to:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5466
    "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
  5467
     Returns false if any error occurred, true otherwise.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5468
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5469
     Do not confuse UNIX signals with Smalltalk-Signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5470
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5471
     WARNING: in order to avoid zombie processes (on unix),
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5472
              you may have to fetch the processes exitstatus with
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5473
              OperatingSystem>>getStatusOfProcess:aProcessId
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5474
              if the signal terminates that process."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5475
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5476
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5477
    if (__bothSmallInteger(signalNumber, processId)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5478
        if (kill(__intVal(processId), __intVal(signalNumber)) < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5479
            @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5480
            RETURN ( false );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5481
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5482
        RETURN ( true );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5483
    }
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
    "/ either invalid argument (non-integers)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5487
    "/ or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5488
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5489
    ^ self primitiveFailed
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5492
startSpyTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5493
    "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
  5494
     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
  5495
     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
  5496
     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
  5497
     (which is of course less correct).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5498
     OBSOLETE: the new messageTally runs as a high prio process, not using 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5499
               spy interrupts."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5500
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5501
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5502
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5503
#ifndef __spyInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5504
    extern void __spyInterrupt();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5505
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5506
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5507
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5508
    struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5509
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5510
# ifdef SIGVTALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5511
    signal(SIGVTALRM, __spyInterrupt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5512
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5513
#  ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5514
    signal(SIGALRM, __spyInterrupt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5515
#  else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5516
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5517
     * mhmh - system has neither SIGBTALRM nor SIGALRM ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5518
     * what should we do here ?
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5519
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5520
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5521
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5522
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5523
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5524
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5525
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5526
    dt.it_value.tv_usec = 1000;   /* 1000 Hz */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5527
    setitimer(ITIMER_VIRTUAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5528
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5529
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5530
#endif /* ITIMER_VIRTUAL */
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
    ^ false
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
stopSpyTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5536
    "stop spy timing - disable spy timer.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5537
     OBSOLETE: the new messageTally runs as a high prio process, not using 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5538
               spy interrupts."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5539
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5540
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5541
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5542
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5543
    struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5544
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5545
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5546
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5547
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5548
    dt.it_value.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5549
    setitimer(ITIMER_VIRTUAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5550
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5551
#endif /* ITIMER_VIRTUAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5552
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5553
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5554
!
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
terminateProcess:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5557
    "terminate a unix process.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5558
     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
  5559
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5560
     WARNING: in order to avoid zombie processes (on unix),
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5561
              you may have to fetch the processes exitstatus with
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5562
              OperatingSystem>>getStatusOfProcess:aProcessId."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5563
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5564
    self sendSignal:(self sigTERM) to:processId.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5565
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5566
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5567
    "Modified: / 27.1.1998 / 20:05:47 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5568
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5569
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5570
terminateProcessGroup:processGroupId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5571
    "terminate a unix process group.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5572
     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
  5573
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5574
     WARNING: in order to avoid zombie processes (on unix),
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5575
              you may have to fetch the processes exitstatus with
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5576
              OperatingSystem>>getStatusOfProcess:aProcessId."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5577
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5578
    self sendSignal:(self sigTERM) to:(processGroupId negated).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5579
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5580
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5581
    "Created: / 23.4.1996 / 16:40:34 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5582
    "Modified: / 27.1.1998 / 20:05:59 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5583
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5584
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5585
!UnixOperatingSystem class methodsFor:'ipc support - UNIX'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5586
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5587
makePTYPair
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5588
    "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
  5589
     nil on failure.
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5590
     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
  5591
     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
  5592
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5593
    |fdS fdM|    
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5594
                
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5595
%{       
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5596
    /*
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5597
     * Find a pseudo tty to use and open both sides.
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5598
     *  _fdM receives the master file descriptor while _fdS
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5599
     *  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
  5600
     *  needed in daemons such as rlogind and telnetd.
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5601
     */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5602
3536
adad0d12c9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3534
diff changeset
  5603
#ifdef IRIX5
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5604
    int _fdM, _fdS;
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5605
    char *line;
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5606
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5607
    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
  5608
    if ((line != 0) && (_fdM >= 0)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5609
        _fdS = open(line, O_RDWR);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5610
        if (_fdS < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5611
            (void)close(_fdM);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5612
            _fdS = _fdM = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5613
        }
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5614
    } else {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5615
        _fdM -1;
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5616
    }
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5617
    if ((_fdM >= 0) && (_fdS >= 0)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5618
         fdM = __MKSMALLINT(_fdM);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5619
         fdS = __MKSMALLINT(_fdS);
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5620
    }
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5621
#   define NO_PTY_TEMPL
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5622
#endif /* IRIX5 */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5623
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5624
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5625
#ifdef LINUX
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5626
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5627
#   define PT_INDEX      5
3550
6c3824d07eac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
  5628
#   define PTY_1_CHARS  "pqrstuabcdevwxyz"
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5629
#   define PTY_2_CHARS  "0123456789abcdef"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5630
#endif /* LINUX */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5631
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5632
#ifdef solaris
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5633
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5634
#   define PT_INDEX      5
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5635
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5636
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5637
#endif /* solaris */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5638
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5639
#ifdef aix
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5640
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5641
#   define PT_INDEX      5
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5642
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5643
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5644
#endif /* aix */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5645
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5646
#ifdef next3
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5647
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5648
#   define PT_INDEX      5
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5649
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5650
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5651
#endif /* next3 */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5652
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5653
#ifdef hpux
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5654
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5655
#   define PT_INDEX      5
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5656
#   define PTY_1_CHARS  "pqrs"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5657
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5658
#endif /* hpux */
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5659
4262
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5660
#if defined(__osf__)
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5661
#   define PTY_TEMPL    "/dev/ptyXX"
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5662
#   define PT_INDEX      5
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5663
#   define PTY_1_CHARS  "pq"
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5664
#   define PTY_2_CHARS  "0123456789abcdef"
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5665
#endif /* osf1 */
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5666
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5667
#if defined(BSD) && !defined(PTY_TEMPL)
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5668
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5669
#   define PT_INDEX      5
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5670
#   define PTY_1_CHARS  "p"
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5671
#   define PTY_2_CHARS  "0123456789abcdefghijklmnopqrstuv"
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5672
#endif /* BSD */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5673
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5674
#ifdef NO_PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5675
# undef PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5676
#endif
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5677
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5678
#ifdef PTY_TEMPL
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5679
#   include <grp.h>
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5680
3981
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5681
# ifdef OLD /* mhmh - suse linux6 places line into rodata ??? */
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5682
    static char line[] = PTY_TEMPL;
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5683
# else
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5684
    char line[128];
3981
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5685
# endif
3575
39723f691a0e hp-cc does not recognize const keyword
Claus Gittinger <cg@exept.de>
parents: 3571
diff changeset
  5686
    register CONST char *cp1, *cp2;
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5687
    int len, _fdM = -1, _fdS = -1, ttygid;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5688
    struct group *gr;
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5689
3981
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5690
# ifdef OLD
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5691
    len = sizeof(PTY_TEMPL) - 1;
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5692
# else
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5693
    strcpy(line, PTY_TEMPL);
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5694
    len = strlen(line);
3981
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5695
# endif
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5696
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5697
    if ((gr = getgrnam("tty")) != NULL)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5698
        ttygid = gr->gr_gid;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5699
    else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5700
        ttygid = -1;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5701
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5702
    for (cp1 = PTY_1_CHARS; *cp1; cp1++) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5703
        line[len-2] = * cp1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5704
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5705
        for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5706
            line[PT_INDEX] = 'p';
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5707
            line[len-1] = *cp2;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5708
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5709
            if ((_fdM = open(line, O_RDWR, 0)) < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5710
                if (errno == ENOENT) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5711
                    _fdM = _fdS = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5712
                    goto getOutOfHere; /* out of ptys */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5713
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5714
            } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5715
                line[PT_INDEX] = 't';
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5716
                (void) chown( line, getuid(), ttygid );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5717
                (void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5718
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5719
                if( (_fdS = open(line, O_RDWR, 0)) >= 0 ) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5720
                    goto getOutOfHere;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5721
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5722
                (void) close( _fdM );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5723
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5724
        }
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5725
    }
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5726
  getOutOfHere: ;
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5727
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5728
    if ((_fdM >= 0) && (_fdS >= 0)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5729
         fdM = __MKSMALLINT(_fdM);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5730
         fdS = __MKSMALLINT(_fdS);
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5731
    }
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5732
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5733
#endif /* PTY_TEMPL */
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5734
#undef NO_PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5735
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5736
%}.
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5737
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5738
    fdM notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5739
        ^ Array with:fdM with:fdS.
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5740
    ].
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5741
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5742
    ^ nil
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5743
!
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5744
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5745
makePipe
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5746
    "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
  5747
     nil on failure.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5748
     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
  5749
     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
  5750
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5751
    |fd1 fd2|    
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5752
                
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5753
%{       
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5754
     int fds[2];
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
     if (pipe(fds) < 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5757
        @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5758
        RETURN ( nil );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5759
     }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5760
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5761
     fd1 = __MKSMALLINT(fds[0]);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5762
     fd2 = __MKSMALLINT(fds[1]);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5763
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5764
    fd1 notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5765
        ^ Array with:fd1 with:fd2.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5766
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5767
    ^ nil
3556
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5768
!
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5769
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5770
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
  5771
    "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
  5772
%{
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5773
#ifdef TIOCSWINSZ
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5774
    struct winsize wsize;
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5775
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5776
    if (__isSmallInteger(fd)
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5777
     && __isSmallInteger(w)
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5778
     && __isSmallInteger(h)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5779
        wsize.ws_row = (unsigned short)__intVal(h);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5780
        wsize.ws_col = (unsigned short)__intVal(w);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5781
        if (ioctl(__intVal(fd), TIOCSWINSZ, (char *)&wsize) >= 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5782
            RETURN (true);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5783
        }
3556
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5784
    }
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5785
#endif
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5786
%}.
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5787
    ^ false
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5788
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5789
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5790
!UnixOperatingSystem class methodsFor:'misc'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5791
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5792
closePid:pid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5793
    "free pid resource"
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5794
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5795
    ^ true.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5796
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5797
    "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
  5798
    "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
  5799
    "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
  5800
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5801
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5802
slowFork:aBoolean
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5803
    "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
  5804
     Only used internally on SYSV3 systems"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5805
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5806
    SlowFork := aBoolean
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5807
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5808
    "Modified: 22.4.1996 / 13:13:09 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5809
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5810
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5811
!UnixOperatingSystem class methodsFor:'os queries'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5812
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5813
executableFileExtensions
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5814
    "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
  5815
     Only req'd for msdos like systems ..."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5816
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5817
    ^ #('')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5818
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5819
    "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
  5820
    "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
  5821
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5822
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5823
getDomainName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5824
    "return the domain this host is in.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5825
     Notice:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5826
        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
  5827
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5828
    |name idx hostName|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5829
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5830
    DomainName notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5831
        ^ DomainName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5832
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5833
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5834
%{  /* STACK: 2048 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5835
#if defined(HAS_GETDOMAINNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5836
    char buffer[128];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5837
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5838
    if (getdomainname(buffer, sizeof(buffer)) == 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5839
        name = __MKSTRING(buffer);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5840
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5841
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5842
# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5843
    struct utsname ubuff;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5844
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5845
    if (uname(&ubuff) >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5846
        name = __MKSTRING(ubuff.domainname);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5847
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5848
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5849
#  if defined(HAS_SYSINFO) && defined(SI_SRPC_DOMAIN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5850
    char buffer[256];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5851
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5852
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5853
    if ((ret = sysinfo(SI_SRPC_DOMAIN, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5854
        name = __MKSTRING(buffer);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5855
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5856
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5857
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5858
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5859
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5860
    name isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5861
        name := self getEnvironment:'DOMAIN'.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5862
        name isNil ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5863
            name := self getCommandOutputFrom:'domainname'
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5864
        ]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5865
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5866
    name isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5867
        "/ sometimes, we can extract the domainName from the hostName ...
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5868
        hostName := self getHostName.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5869
        hostName notNil ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5870
            idx := hostName indexOf:$..
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5871
            idx ~~ 0 ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5872
                name := hostName copyFrom:idx+1.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5873
            ]
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5874
        ]. 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5875
        name isNil ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5876
            'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5877
            name := 'unknown'.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5878
        ]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5879
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5880
    DomainName := name.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5881
    ^ name
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5882
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5883
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5884
     OperatingSystem getDomainName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5885
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5886
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5887
    "Modified: 26.4.1996 / 10:04:54 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5888
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5889
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5890
getEnvironment:aStringOrSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5891
    "get an environment string"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5892
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5893
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5894
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5895
    char *env;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5896
    extern char *getenv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5897
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5898
    if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5899
        env =  getenv(__stringVal(aStringOrSymbol));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5900
        if (env) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5901
            RETURN ( __MKSTRING(env) );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5902
        }
5407
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  5903
        RETURN ( nil );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5904
    }
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5905
%}.
5407
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  5906
    ^ self primitiveFailed
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5909
     OperatingSystem getEnvironment:'LANG'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5910
     OperatingSystem getEnvironment:'LOGIN'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5911
     OperatingSystem getEnvironment:'HOME'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5912
     OperatingSystem getEnvironment:'NNTPSERVER'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5913
     OperatingSystem getEnvironment:'MAIL'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5914
     OperatingSystem getEnvironment:'PATH'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5915
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5916
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5917
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5918
getHostName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5919
    "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
  5920
     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
  5921
     Notice:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5922
        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
  5923
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5924
    |name idx|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5925
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5926
    HostName notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5927
        ^ HostName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5928
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5929
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5930
%{  /* STACK: 2048 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5931
#if defined(HAS_GETHOSTNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5932
    char buffer[256];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5933
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5934
    if (gethostname(buffer, sizeof(buffer)) == 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5935
        name = __MKSTRING(buffer);
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
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5938
# if defined(HAS_UNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5939
    struct utsname ubuff;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5940
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5941
    if (uname(&ubuff) >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5942
        name = __MKSTRING(ubuff.nodename);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5943
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5944
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5945
#  if defined(HAS_SYSINFO) && defined(SI_HOSTNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5946
    char buffer[256];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5947
    int ret;
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
    if ((ret = sysinfo(SI_HOSTNAME, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5950
        name = __MKSTRING(buffer);
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5951
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5952
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5953
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5954
#endif
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
    name isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5957
        name := self getEnvironment:'HOST'.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5958
        name isNil ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5959
            name := self getCommandOutputFrom:'hostname'
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5960
        ]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5961
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5962
    name isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5963
        'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5964
        name := 'unknown'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5965
    ] ifFalse:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5966
        "/ on some systems, the hostname already contains the domain.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5967
        "/ decompose it here.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5968
        idx := name indexOf:$..
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5969
        idx ~~ 0 ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5970
            DomainName := name copyFrom:(idx+1).
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5971
            name := name copyTo:(idx-1).
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5972
        ]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5973
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5974
    HostName := name.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5975
    ^ name
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5976
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5977
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5978
     OperatingSystem getHostName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5979
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5980
!
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
getLocaleInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5983
    "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
  5984
     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
  5985
     Possible fields are:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5986
        decimalPoint                    <String>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5987
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5988
        thousandsSep                    <String>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5989
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5990
        internationalCurrencySymbol     <String>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5991
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5992
        currencySymbol                  <String>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5993
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5994
        monetaryDecimalPoint            <String>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5995
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5996
        monetaryThousandsSeparator      <String>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5997
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5998
        positiveSign                    <String>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  5999
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6000
        negativeSign                    <String>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6001
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6002
        internationalFractionalDigits   <Integer>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6003
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6004
        fractionalDigits                <Integer>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6005
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6006
        positiveSignPrecedesCurrencySymbol      <Boolean>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6007
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6008
        negativeSignPrecedesCurrencySymbol      <Boolean>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6009
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6010
        positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6011
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6012
        negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6013
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6014
        positiveSignPosition                            <Symbol>
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6015
                                                        one of: #parenthesesAround, 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6016
                                                                #signPrecedes, 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6017
                                                                #signSuceeds, 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6018
                                                                #signPrecedesCurrencySymbol,
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6019
                                                                #signSuceedsCurrencySymbol
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6020
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6021
        negativeSignPosition                            <like above>
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6022
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6023
     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
  6024
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6025
     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
  6026
     it should be used by applications as required.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6027
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6028
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6029
    |info val|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6030
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6031
    LocaleInfo notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6032
        "/ return the internal info; useful on systems which do not
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6033
        "/ support this.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6034
        ^ LocaleInfo
3496
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
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6038
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6039
    char *decimalPoint;         /* something like "." (US) or "," (german) */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6040
    char *thousandsSep;         /* something like "," (US) or "." (german) */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6041
    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
  6042
    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
  6043
    char *monDecimalPoint;      /* money: decimal point */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6044
    char *monThousandsSep;      /* money: thousands sep */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6045
    char *positiveSign;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6046
    char *negativeSign;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6047
    int   intFractDigits;       /* money: international digits after decPoint */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6048
    int   fractDigits;          /* money: local digits after decPoint */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6049
    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
  6050
    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
  6051
    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
  6052
    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
  6053
    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
  6054
    int   csNegSignPosition;    /*        1: sign precedes the value & currency symbol */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6055
                                /*        2: sign succeeds the value & currency symbol */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6056
                                /*        3: sign immediately precedes the currency symbol */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6057
                                /*        4: sign immediately suceeds the currency symbol */
3496
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
#if defined(HAS_LOCALECONV)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6060
    struct lconv *conf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6061
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6062
    conf = localeconv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6063
    if (conf) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6064
        decimalPoint = conf->decimal_point;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6065
        thousandsSep = conf->thousands_sep;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6066
        intCurrencySymbol = conf->int_curr_symbol;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6067
        currencySymbol = conf->currency_symbol;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6068
        monDecimalPoint = conf->mon_decimal_point;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6069
        monThousandsSep = conf->mon_thousands_sep;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6070
        positiveSign = conf->positive_sign;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6071
        negativeSign = conf->negative_sign;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6072
        intFractDigits = conf->int_frac_digits;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6073
        fractDigits = conf->frac_digits;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6074
        csPosPrecedes = conf->p_cs_precedes; 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6075
        csNegPrecedes = conf->n_cs_precedes; 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6076
        csPosSepBySpace = conf->p_sep_by_space; 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6077
        csNegSepBySpace = conf->n_sep_by_space; 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6078
        csPosSignPosition = conf->p_sign_posn;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6079
        csNegSignPosition = conf->n_sign_posn;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6080
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6081
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6082
    decimalPoint = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6083
    thousandsSep = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6084
    intCurrencySymbol = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6085
    currencySymbol = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6086
    monDecimalPoint = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6087
    monThousandsSep = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6088
    positiveSign =  (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6089
    negativeSign =(char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6090
    intFractDigits = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6091
    fractDigits = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6092
    csPosPrecedes = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6093
    csNegPrecedes = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6094
    csPosSepBySpace = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6095
    csNegSepBySpace = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6096
    csPosSignPosition = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6097
    csNegSignPosition = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6098
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6099
    if (decimalPoint) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6100
        val = __MKSTRING(decimalPoint);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6101
        __AT_PUT_(info, @symbol(decimalPoint), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6102
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6103
    if (thousandsSep) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6104
        val = __MKSTRING(thousandsSep);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6105
        __AT_PUT_(info, @symbol(thousandsSeparator), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6106
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6107
    if (intCurrencySymbol) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6108
        val = __MKSTRING(intCurrencySymbol);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6109
        __AT_PUT_(info, @symbol(internationCurrencySymbol), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6110
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6111
    if (currencySymbol) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6112
        val = __MKSTRING(currencySymbol);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6113
        __AT_PUT_(info, @symbol(currencySymbol), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6114
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6115
    if (monDecimalPoint) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6116
        val = __MKSTRING(monDecimalPoint);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6117
        __AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6118
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6119
    if (monThousandsSep) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6120
        val = __MKSTRING(monThousandsSep);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6121
        __AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6122
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6123
    if (positiveSign) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6124
        val = __MKSTRING(positiveSign);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6125
        __AT_PUT_(info, @symbol(positiveSign), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6126
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6127
    if (negativeSign) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6128
        val = __MKSTRING(negativeSign);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6129
        __AT_PUT_(info, @symbol(negativeSign), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6130
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6131
    if (intFractDigits >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6132
        __AT_PUT_(info, @symbol(internationalFractionalDigits),  __MKSMALLINT(intFractDigits));
3496
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
    if (fractDigits >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6135
        __AT_PUT_(info, @symbol(fractionalDigits),  __MKSMALLINT(fractDigits));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6136
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6137
    if (csPosPrecedes >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6138
        if (csPosPrecedes == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6139
            val = false;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6140
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6141
            val = true;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6142
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6143
        __AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6144
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6145
    if (csNegPrecedes >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6146
        if (csNegPrecedes == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6147
            val = false;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6148
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6149
            val = true;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6150
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6151
        __AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6152
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6153
    if (csPosSepBySpace >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6154
        if (csPosSepBySpace == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6155
            val = false;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6156
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6157
            val = true;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6158
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6159
        __AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6160
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6161
    if (csNegSepBySpace >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6162
        if (csNegSepBySpace == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6163
            val = false;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6164
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6165
            val = true;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6166
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6167
        __AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6168
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6169
    switch (csPosSignPosition) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6170
        case 0:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6171
            val = @symbol(parenthesesAround);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6172
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6173
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6174
        case 1:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6175
            val = @symbol(signPrecedes);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6176
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6177
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6178
        case 2:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6179
            val = @symbol(signSuceeds);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6180
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6181
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6182
        case 3:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6183
            val = @symbol(signPrecedesCurrencySymbol);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6184
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6185
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6186
        case 4:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6187
            val = @symbol(signSuceedsCurrencySymbol);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6188
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6189
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6190
        default:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6191
            val = nil;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6192
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6193
    if (val != nil) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6194
        __AT_PUT_(info, @symbol(positiveSignPosition), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6195
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6196
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6197
    switch (csNegSignPosition) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6198
        case 0:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6199
            val = @symbol(parenthesesAround);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6200
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6201
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6202
        case 1:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6203
            val = @symbol(signPrecedes);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6204
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6205
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6206
        case 2:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6207
            val = @symbol(signSuceeds);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6208
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6209
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6210
        case 3:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6211
            val = @symbol(signPrecedesCurrencySymbol);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6212
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6213
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6214
        case 4:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6215
            val = @symbol(signSuceedsCurrencySymbol);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6216
            break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6217
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6218
        default:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6219
            val = nil;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6220
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6221
    if (val != nil) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6222
        __AT_PUT_(info, @symbol(negativeSignPosition), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6223
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6224
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6225
    ^ info
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6226
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6227
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6228
     OperatingSystem getLocaleInfo
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6229
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6230
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6231
    "Created: 23.12.1995 / 14:19:20 / cg"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6234
getProcessId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6235
    "return the (unix-)processId"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6236
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6237
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6238
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6239
    int pid = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6240
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6241
    pid = getpid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6242
    RETURN ( __MKSMALLINT(pid) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6243
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6244
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6245
     OperatingSystem getProcessId
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6246
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6247
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6248
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6249
getSystemID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6250
    "if supported by the OS, return the systemID;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6251
     a unique per machine identification.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6252
     WARNING:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6253
        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
  6254
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6255
%{  /* NO_CONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6256
#if defined(IRIX5) && !defined(HAS_GETHOSTID)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6257
    char idBuffer[MAXSYSIDSIZE];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6258
    int retVal;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6259
    OBJ arr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6260
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6261
    if ((retVal = syssgi(SGI_SYSID, idBuffer)) == 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6262
        arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6263
        bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6264
        RETURN (arr);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6265
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6266
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6267
#if defined(HAS_GETHOSTID)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6268
    int runningId;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6269
    OBJ arr;
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
    runningId = gethostid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6272
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6273
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6274
    RETURN (arr);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6275
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6276
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6277
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6278
        char buffer[128];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6279
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6280
        buffer[0] = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6281
        if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6282
            buffer[127] = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6283
            if (strlen(buffer) > 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6284
                RETURN(__MKSTRING(buffer));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6285
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6286
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6287
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6288
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6289
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6290
    ^ 'unknown'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6291
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6292
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6293
     OperatingSystem getSystemID
3496
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
!
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
getSystemInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6298
    "return info on the system weare running on.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6299
     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
  6300
     otherwise, some simulated info is returned.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6301
 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6302
     WARNING:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6303
       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
  6304
       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
  6305
       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
  6306
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6307
       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
  6308
       information. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6309
       (in case of system/version specific OS errors, conditional workarounds and patches
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6310
        may be based upon this info).
4020
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6311
       Also, applications could enable/disable buffering or otherwise reduce
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6312
       their memory usage depending upon the amount of memory installed.
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6313
       Your application may make use of available information for tuning,
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6314
       but should NEVER DEPEND upon this in any way.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6315
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6316
     The returned info may (or may not) contain:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6317
        #system -> some operating system identification (irix, Linux, nt, win32s ...) 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6318
        #version -> OS version (some os version identification)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6319
        #release -> OS release (3.5, 1.2.1 ...)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6320
        #node   -> some host identification (hostname)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6321
        #domain  -> domain name (hosts domain)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6322
        #machine -> type of CPU (i586, mips ...)
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6323
     
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6324
     those are currently returned on some machines (no warranty)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6325
     linux:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6326
        #totalRam         -> total amount of memory available
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6327
        #sharedRam        -> amount of memory which is shared among processes
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6328
                             (i.e. shared code)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6329
        #bufferRam        -> amount used for buffers
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6330
        #swapSize         -> total size of swap space
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6331
        #freeSwap         -> free amount in swapSpace
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6332
        #extendedInstructions -> extended instruction set info
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6333
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6334
     osf:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6335
        #physicalRam      -> total amount of physical memory
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6336
        #cpuType          -> type of cpu (more detailed than machine)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6337
        #numberOfCPUs     -> number of cpus in box
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6338
        
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6339
     solaris:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6340
        #physicalRam      -> total amount of physical memory
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6341
        #availableRam     -> total available amount of physical memory (i.e. unused ram)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6342
        #freeRam          -> amount of free memory
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6343
        #numberOfCPUs     -> number of cpus in box (online CPUS)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6344
        [#dCacheSize]     -> bytes in data cache (only available on some solaris versions)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6345
        [#iCacheSize]     -> bytes in data cache (only available on some solaris versions)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6346
        [#instructionSets]-> instruction sets available (only available on some solaris versions)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6347
        [#platform]       -> platform name (only available on some solaris versions)
4020
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6348
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6349
     hpux:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6350
        #physicalRam      -> total amount of physical memory in box
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6351
        #activeRealMemory -> ? - read pstat documentation
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6352
        #activeVirtualRam -> ? - read pstat documentation
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6353
        #freeMemory       -> ? - read pstat documentation
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6354
        #realMemory       -> ? (amount of memory left to user programs)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6355
        #virtualRam       -> ? - read pstat documentation
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6356
    "
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6357
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6358
    |sys node rel ver mach dom mtyp brel info arch cpuType cpuSpeed
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6359
     physicalRam availableRam totalRam sharedRam bufferRam swapSize freeSwap
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6360
     numberOfCPUs pageSize physicalPages availablePages dCacheSize iCacheSize
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6361
     virtualRam activeVirtualRam realMemory activeRealMemory freeMemory
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6362
     instructionSets extendedInstructions platform|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6363
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6364
%{  /* STACK: 4096 */
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6365
#ifdef LINUX
3696
a0c77f9bdbc7 oops - a.out linux has no sysinfo
Claus Gittinger <cg@exept.de>
parents: 3692
diff changeset
  6366
# ifdef ELF /* old a.out unixes do not have this ... */
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6367
    /* 
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6368
     * additional info available ...
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6369
     */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6370
    struct sysinfo infoBuffer;
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6371
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6372
    if (sysinfo(&infoBuffer) >= 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6373
        totalRam   = __MKUINT(infoBuffer.totalram);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6374
        sharedRam = __MKUINT(infoBuffer.sharedram);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6375
        bufferRam = __MKUINT(infoBuffer.bufferram);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6376
        swapSize  = __MKUINT(infoBuffer.totalswap);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6377
        freeSwap  = __MKUINT(infoBuffer.freeswap);
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6378
    }
3696
a0c77f9bdbc7 oops - a.out linux has no sysinfo
Claus Gittinger <cg@exept.de>
parents: 3692
diff changeset
  6379
# endif
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6380
#endif /* LINUX */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6381
4088
622551d3c0d7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4084
diff changeset
  6382
#if defined(hpux) && !defined(__GNUC__)
4020
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6383
# include <sys/pstat.h>
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6384
    struct pst_static stat_buf;
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6385
    struct pst_dynamic dynam_buf;
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6386
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6387
    pstat(PSTAT_STATIC,&stat_buf,sizeof(stat_buf),0,0);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6388
    pstat(PSTAT_DYNAMIC,&dynam_buf,sizeof(dynam_buf),0,0);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6389
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6390
    physicalRam        = __MKUINT(stat_buf.physical_memory/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6391
    virtualRam         = __MKUINT(dynam_buf.psd_vm/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6392
    activeVirtualRam   = __MKUINT(dynam_buf.psd_avm/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6393
    realMemory         = __MKUINT(dynam_buf.psd_rm/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6394
    activeRealMemory   = __MKUINT(dynam_buf.psd_arm/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6395
    freeMemory         = __MKUINT(dynam_buf.psd_free/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6396
#endif
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6397
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6398
#if defined(HAS_UNAME)
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6399
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6400
        struct utsname ubuff;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6401
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6402
        if (uname(&ubuff) >= 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6403
            sys  = __MKSTRING(ubuff.sysname);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6404
            node = __MKSTRING(ubuff.nodename);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6405
            rel  = __MKSTRING(ubuff.release);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6406
            ver  = __MKSTRING(ubuff.version);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6407
            mach = __MKSTRING(ubuff.machine);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6408
# ifdef HAS_UTS_DOMAINNAME
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6409
            dom  = __MKSTRING(ubuff.domainname);
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6410
# endif /* no HAS_UTS_DOMAINNAME */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6411
        }
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6412
    }
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6413
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6414
#else /* no UNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6415
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6416
    /*
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6417
     * use fallBack code below
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6418
     */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6419
#endif /* no UNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6420
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6421
#if defined(HAS_SYSINFO)
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6422
# if defined(SI_ARCHITECTURE)
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6423
    if (arch == nil) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6424
        char buffer[128];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6425
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6426
        if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6427
            arch = __MKSTRING(buffer);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6428
        }
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6429
    }
4923
1cacdcfc82c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4922
diff changeset
  6430
# endif /* SI_ARCHITECTURE */
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6431
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6432
# if defined(SI_ISALIST)
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6433
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6434
        char buffer[128];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6435
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6436
        if (sysinfo(SI_ISALIST, buffer, sizeof(buffer))) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6437
            instructionSets = __MKSTRING(buffer);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6438
        }
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6439
    }
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6440
# endif /* SI_ISALIST */
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6441
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6442
# if defined(SI_PLATFORM)
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6443
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6444
        char buffer[128];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6445
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6446
        if (sysinfo(SI_PLATFORM, buffer, sizeof(buffer))) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6447
            platform = __MKSTRING(buffer);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6448
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6449
    }
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6450
# endif /* SI_PLATFORM */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6451
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6452
# if defined(SI_RELEASE)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6453
    {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6454
        char buffer[128];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6455
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6456
        if (sysinfo(SI_RELEASE, buffer, sizeof(buffer))) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6457
            rel = __MKSTRING(buffer);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6458
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6459
    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6460
# endif /* SI_RELEASE */
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6461
#endif /* HAS_SYSINFO */
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6462
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6463
#if defined(HAS_GETDOMAINNAME)
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6464
    if (dom == nil) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6465
        char buffer[128];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6466
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6467
        if (getdomainname(buffer, sizeof(buffer)) == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6468
            dom = __MKSTRING(buffer);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6469
        }
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6470
    }
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6471
#endif /* HAS_GETDOMAINNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6472
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6473
#if defined(HAS_SYSCONF)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6474
# ifdef _SC_NPROCESSORS_ONLN
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6475
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6476
        long val;
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6477
 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6478
        val = sysconf(_SC_NPROCESSORS_ONLN);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6479
        if (val > 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6480
            numberOfCPUs = __MKINT(val);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6481
        }
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6482
    }
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6483
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6484
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6485
# if defined(_SC_PAGESIZE)
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6486
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6487
        long val;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6488
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6489
        val = sysconf(_SC_PAGESIZE);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6490
        if (val != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6491
            pageSize = __MKUINT(val);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6492
        }
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6493
    }
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6494
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6495
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6496
# if defined(_SC_PHYS_PAGES)
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6497
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6498
        long val;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6499
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6500
        val = sysconf(_SC_PHYS_PAGES);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6501
        if (val != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6502
            physicalPages = __MKUINT(val);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6503
        }
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6504
    }
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6505
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6506
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6507
# if defined(_SC_AVPHYS_PAGES)
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6508
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6509
        long val;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6510
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6511
        val = sysconf(_SC_AVPHYS_PAGES);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6512
        if (val != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6513
            availablePages = __MKUINT(val);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6514
        }
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6515
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6516
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6517
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6518
# if defined(_SC_ICACHE_SZ)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6519
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6520
        long val;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6521
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6522
        val = sysconf(_SC_ICACHE_SZ);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6523
        if (val != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6524
            iCacheSize = __MKUINT(val);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6525
        }
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6526
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6527
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6528
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6529
# if defined(_SC_DCACHE_SZ)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6530
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6531
        long val;
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6532
 
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6533
        val = sysconf(_SC_DCACHE_SZ);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6534
        if (val != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6535
            dCacheSize = __MKUINT(val);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6536
        }
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6537
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6538
# endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6539
#endif /* HAS_SYSCONF */
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6540
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6541
#if defined(HAS_GETSYSINFO)
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6542
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6543
        INT index;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6544
        int retInt32 = 0;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6545
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6546
# if defined(GSI_CPU)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6547
        index = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6548
        if (getsysinfo(GSI_CPU, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6549
            switch (retInt32) {
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6550
#  ifdef VAX_780
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6551
                case VAX_780:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6552
                    cpuType = __MKSTRING("VAX_780");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6553
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6554
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6555
#  ifdef VAX_750
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6556
                case VAX_750:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6557
                    cpuType = __MKSTRING("VAX_750");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6558
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6559
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6560
#  ifdef VAX_730
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6561
                case VAX_730:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6562
                    cpuType = __MKSTRING("VAX_730");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6563
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6564
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6565
#  ifdef VAX_8600
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6566
                case VAX_8600:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6567
                    cpuType = __MKSTRING("VAX_8600");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6568
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6569
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6570
#  ifdef VAX_8200
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6571
                case VAX_8200:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6572
                    cpuType = __MKSTRING("VAX_8200");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6573
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6574
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6575
#  ifdef VAX_8800
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6576
                case VAX_8800:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6577
                    cpuType = __MKSTRING("VAX_8800");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6578
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6579
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6580
#  ifdef MVAX_I
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6581
                case MVAX_I:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6582
                    cpuType = __MKSTRING("MVAX_I");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6583
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6584
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6585
#  ifdef MVAX_II
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6586
                case MVAX_II:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6587
                    cpuType = __MKSTRING("MVAX_II");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6588
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6589
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6590
#  ifdef V_VAX
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6591
                case V_VAX:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6592
                    cpuType = __MKSTRING("V_VAX");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6593
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6594
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6595
#  ifdef VAX_3600
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6596
                case VAX_3600:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6597
                    cpuType = __MKSTRING("VAX_3600");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6598
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6599
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6600
#  ifdef VAX_6200
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6601
                case VAX_6200:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6602
                    cpuType = __MKSTRING("VAX_6200");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6603
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6604
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6605
#  ifdef VAX_3400
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6606
                case VAX_3400:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6607
                    cpuType = __MKSTRING("VAX_3400");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6608
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6609
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6610
#  ifdef C_VAXSTAR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6611
                case C_VAXSTAR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6612
                    cpuType = __MKSTRING("C_VAXSTAR");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6613
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6614
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6615
#  ifdef VAX_60
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6616
                case VAX_60:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6617
                    cpuType = __MKSTRING("VAX_60");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6618
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6619
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6620
#  ifdef VAX_3900
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6621
                case VAX_3900:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6622
                    cpuType = __MKSTRING("VAX_3900");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6623
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6624
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6625
#  ifdef DS_3100
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6626
                case DS_3100:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6627
                    cpuType = __MKSTRING("DS_3100");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6628
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6629
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6630
#  ifdef VAX_8820
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6631
                case VAX_8820:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6632
                    cpuType = __MKSTRING("VAX_8820");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6633
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6634
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6635
#  ifdef DS_5400
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6636
                case DS_5400:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6637
                    cpuType = __MKSTRING("DS_5400");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6638
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6639
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6640
#  ifdef DS_5800
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6641
                case DS_5800:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6642
                    cpuType = __MKSTRING("DS_5800");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6643
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6644
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6645
#  ifdef DS_5000
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6646
                case DS_5000:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6647
                    cpuType = __MKSTRING("DS_5000");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6648
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6649
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6650
#  ifdef DS_CMAX
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6651
                case DS_CMAX:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6652
                    cpuType = __MKSTRING("DS_CMAX");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6653
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6654
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6655
#  ifdef VAX_6400
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6656
                case VAX_6400:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6657
                    cpuType = __MKSTRING("VAX_6400");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6658
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6659
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6660
#  ifdef VAXSTAR
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6661
                case VAXSTAR:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6662
                    cpuType = __MKSTRING("VAXSTAR");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6663
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6664
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6665
#  ifdef DS_5500
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6666
                case DS_5500:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6667
                    cpuType = __MKSTRING("DS_5500");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6668
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6669
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6670
#  ifdef DS_5100
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6671
                case DS_5100:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6672
                    cpuType = __MKSTRING("DS_5100");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6673
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6674
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6675
#  ifdef VAX_9000
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6676
                case VAX_9000:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6677
                    cpuType = __MKSTRING("VAX_9000");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6678
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6679
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6680
#  ifdef DS_500_100
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6681
                case DS_500_100:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6682
                    cpuType = __MKSTRING("DS_500_100");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6683
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6684
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6685
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6686
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6687
#  ifdef ALPHA_ADU
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6688
                case ALPHA_ADU:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6689
                    cpuType = __MKSTRING("ALPHA_ADU");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6690
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6691
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6692
#  ifdef DEC_4000
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6693
                case DEC_4000:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6694
                    cpuType = __MKSTRING("DEC_4000");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6695
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6696
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6697
#  ifdef DEC_3000_500
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6698
                case DEC_3000_500:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6699
                    cpuType = __MKSTRING("DEC_3000_500");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6700
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6701
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6702
#  ifdef DEC_7000
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6703
                case DEC_7000:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6704
                    cpuType = __MKSTRING("DEC_7000");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6705
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6706
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6707
#  ifdef DS_5000_300
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6708
                case DS_5000_300:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6709
                    cpuType = __MKSTRING("DS_5000_300");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6710
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6711
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6712
#  ifdef DEC_3000_300
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6713
                case DEC_3000_300:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6714
                    cpuType = __MKSTRING("DEC_3000_300");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6715
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6716
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6717
#  ifdef DEC_2000_300
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6718
                case DEC_2000_300:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6719
                    cpuType = __MKSTRING("DEC_2000_300");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6720
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6721
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6722
#  ifdef DEC_2100_A500
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6723
                case DEC_2100_A500:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6724
                    cpuType = __MKSTRING("DEC_2100_A500");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6725
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6726
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6727
#  ifdef DEC_2100_A50
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6728
                case DEC_2100_A50:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6729
                    cpuType = __MKSTRING("DEC_2100_A50");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6730
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6731
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6732
#  ifdef ALPHA_KN20AA
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6733
                case ALPHA_KN20AA:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6734
                    cpuType = __MKSTRING("ALPHA_KN20AA");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6735
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6736
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6737
#  ifdef DEC_21000
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6738
                case DEC_21000:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6739
                    cpuType = __MKSTRING("DEC_21000");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6740
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6741
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6742
#  ifdef DEC_AXPVME_64
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6743
                case DEC_AXPVME_64:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6744
                    cpuType = __MKSTRING("DEC_AXPVME_64");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6745
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6746
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6747
#  ifdef DEC_2100_C500
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6748
                case DEC_2100_C500:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6749
                    cpuType = __MKSTRING("DEC_2100_C500");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6750
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6751
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6752
#  ifdef DEC_AXPPCI_33
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6753
                case DEC_AXPPCI_33:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6754
                    cpuType = __MKSTRING("DEC_AXPPCI_33");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6755
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6756
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6757
#  ifdef DEC_1000
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6758
                case DEC_1000:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6759
                    cpuType = __MKSTRING("DEC_1000");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6760
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6761
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6762
#  ifdef EB64_PLUS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6763
                case EB64_PLUS:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6764
                    cpuType = __MKSTRING("EB64_PLUS");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6765
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6766
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6767
#  ifdef LCA_EB66
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6768
                case LCA_EB66:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6769
                    cpuType = __MKSTRING("LCA_EB66");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6770
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6771
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6772
#  ifdef ALPHA_EB164
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6773
                case ALPHA_EB164:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6774
                    cpuType = __MKSTRING("ALPHA_EB164");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6775
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6776
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6777
#  ifdef DEC_EV45_PBP
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6778
                case DEC_EV45_PBP:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6779
                    cpuType = __MKSTRING("DEC_EV45_PBP");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6780
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6781
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6782
#  ifdef DEC_1000A
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6783
                case DEC_1000A:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6784
                    cpuType = __MKSTRING("DEC_1000A");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6785
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6786
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6787
#  ifdef DEC_4100
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6788
                case DEC_4100:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6789
                    cpuType = __MKSTRING("DEC_4100");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6790
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6791
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6792
#  ifdef DEC_ALPHAVME_224
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6793
                case DEC_ALPHAVME_224:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6794
                    cpuType = __MKSTRING("DEC_ALPHAVME_224");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6795
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6796
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6797
#  ifdef DEC_1000_5
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6798
                case DEC_1000_5:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6799
                    cpuType = __MKSTRING("DEC_1000_5");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6800
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6801
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6802
#  ifdef DEC_1000A_5
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6803
                case DEC_1000A_5:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6804
                    cpuType = __MKSTRING("DEC_1000A_5");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6805
                    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6806
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6807
#  ifdef DEC_EV56_PBP
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6808
                case DEC_EV56_PBP:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6809
                    cpuType = __MKSTRING("DEC_EV56_PBP");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6810
                    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6811
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6812
#  ifdef ALPHABOOK
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6813
                case ALPHABOOK:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6814
                    cpuType = __MKSTRING("ALPHABOOK");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6815
                    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6816
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6817
#  ifdef DEC_ALPHAVME_320
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6818
                case DEC_ALPHAVME_320:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6819
                    cpuType = __MKSTRING("DEC_ALPHAVME_320");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6820
                    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6821
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6822
#  ifdef DEC_550
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6823
                case DEC_550:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6824
                    cpuType = __MKSTRING("DEC_550");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6825
                    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6826
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6827
#  ifdef DEC_6600
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6828
                case DEC_6600:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6829
                    cpuType = __MKSTRING("DEC_6600");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6830
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6831
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6832
#  ifdef UNKN_SYSTEM
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6833
                case UNKN_SYSTEM:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6834
                    cpuType = __MKSTRING("UNKN_SYSTEM");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6835
                    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6836
#  endif
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6837
                default:
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6838
                    cpuType = __MKSTRING("OTHER_DEC_SYSTEM");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6839
                    break;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6840
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6841
        }
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6842
# endif /* GSI_CPU */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6843
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6844
# if defined(GSI_CPU_INFO)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6845
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6846
         * stupid: OSF1 pre V4.0 has no mhz, but V4.0 has it.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6847
         * use the GSI_PLATFORM_NAME as a hint - it is only defined in
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6848
         * V4.0 and higher ... (sigh)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6849
         */
4258
4c1f909de78e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  6850
#  if defined GSI_PLATFORM_NAME
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6851
        {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6852
            struct cpu_info cpuInfo;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6853
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6854
            index = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6855
            if (getsysinfo(GSI_CPU_INFO, &cpuInfo, sizeof(cpuInfo), &index, NULL) > 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6856
                cpuSpeed   = __MKUINT(cpuInfo.mhz);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6857
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6858
        }
4258
4c1f909de78e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  6859
#  endif
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6860
# endif /* GSI_CPU_INFO */
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6861
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6862
# if defined(GSI_CPUS_IN_BOX)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6863
        index = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6864
        if (getsysinfo(GSI_CPUS_IN_BOX, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6865
            numberOfCPUs   = __MKUINT(retInt32);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6866
        }
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6867
# endif /* GSI_CPUS_IN_BOX */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6868
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6869
# if defined(GSI_PHYSMEM)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6870
        index = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6871
        if (getsysinfo(GSI_PHYSMEM, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6872
            INT bytes = retInt32 * 1024;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6873
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6874
            physicalRam   = __MKUINT(bytes);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6875
        }
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6876
# endif /* GSI_PHYSMEM */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6877
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6878
# if defined(GSI_PLATFORM_NAME) && (!defined(HAS_SYSINFO) || !defined(SI_PLATFORM))
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6879
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6880
        char buffer[128];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6881
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6882
        index = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6883
        if (getsysinfo(GSI_PLATFORM_NAME, buffer, sizeof(buffer), &index, NULL) > 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6884
            platform = __MKSTRING(buffer);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6885
        }
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6886
    }
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6887
# endif /* GSI_PLATFORM_NAME */
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6888
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6889
    }
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6890
#endif /* HAS_GETSYSINFO */
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6891
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6892
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6893
        extern OBJ __getInstructionSetInfo();
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6894
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6895
        extendedInstructions = __getInstructionSetInfo();
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6896
    }
3496
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
    sys isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6899
        sys := self getSystemType.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6900
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6901
    node isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6902
        node := self getHostName.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6903
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6904
    dom isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6905
        dom := self getDomainName.
3496
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
    mach isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6908
        mach := self getCPUType.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6909
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6910
    arch isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6911
        arch := sys.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6912
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6913
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6914
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6915
    info at:#system put:sys.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6916
    info at:#node put:node.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6917
    rel notNil ifTrue:[info at:#release put:rel].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6918
    ver notNil ifTrue:[info at:#version put:ver].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6919
    mach notNil ifTrue:[info at:#machine put:mach].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6920
    arch notNil ifTrue:[info at:#architecture put:arch].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6921
    dom notNil ifTrue:[info at:#domain put:dom].
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6922
    (pageSize notNil and:[physicalPages notNil]) ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6923
        physicalRam := pageSize * physicalPages. "/ done here - could be largeInt.
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6924
    ].
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6925
    physicalRam notNil ifTrue:[info at:#physicalRam put:physicalRam].
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6926
    (pageSize notNil and:[availablePages notNil]) ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6927
        availableRam := pageSize * availablePages. "/ done here - could be largeInt.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6928
        availableRam notNil ifTrue:[info at:#availableRam put:availableRam].
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6929
    ].
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6930
    totalRam notNil ifTrue:[info at:#totalRam put:totalRam].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6931
    sharedRam notNil ifTrue:[info at:#sharedRam put:sharedRam].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6932
    bufferRam notNil ifTrue:[info at:#bufferRam put:bufferRam].
4020
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6933
    virtualRam notNil ifTrue:[info at:#virtualRam put:virtualRam].
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6934
    activeVirtualRam notNil ifTrue:[info at:#activeVirtualRam put:activeVirtualRam].
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6935
    realMemory notNil ifTrue:[info at:#realMemory put:realMemory].
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6936
    activeRealMemory notNil ifTrue:[info at:#activeRealMemory put:activeRealMemory].
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6937
    freeMemory notNil ifTrue:[info at:#freeMemory put:freeMemory].
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6938
    swapSize notNil ifTrue:[info at:#swapSize put:swapSize].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6939
    freeSwap notNil ifTrue:[info at:#freeSwap put:freeSwap].
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6940
    numberOfCPUs notNil ifTrue:[info at:#numberOfCPUs put:numberOfCPUs].
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6941
    cpuType notNil ifTrue:[info at:#cpuType put:cpuType].
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6942
    cpuSpeed notNil ifTrue:[info at:#cpuSpeed put:cpuSpeed].
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6943
    dCacheSize notNil ifTrue:[info at:#dCacheSize put:dCacheSize].
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6944
    iCacheSize notNil ifTrue:[info at:#iCacheSize put:iCacheSize].
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6945
    instructionSets notNil ifTrue:[info at:#instructionSets put:instructionSets].
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6946
    extendedInstructions notNil ifTrue:[info at:#extendedInstructions put:(extendedInstructions asOrderedCollection select:[:e | e notNil])].
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6947
    platform notNil ifTrue:[info at:#platform put:platform].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6948
    info at:#osType put:(self getOSType).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6949
    ^ info
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6952
     OperatingSystem getSystemInfo
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6953
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6954
!
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
getSystemType
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6957
    "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
  6958
     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
  6959
     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
  6960
     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
  6961
     here ... 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6962
     (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
  6963
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6964
    |sys|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6965
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6966
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6967
#   ifdef NEXT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6968
#    define SYS_STRING "next"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6969
#   endif
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
#   ifdef IRIS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6972
#    define SYS_STRING "iris"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6973
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6974
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6975
#   ifdef SYS_STRING
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6976
     sys = __MKSTRING(SYS_STRING);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6977
#    undef SYS_STRING
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6978
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6979
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6980
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6981
    sys isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6982
        ^ self getOSType
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6983
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6984
    ^ sys
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6985
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6986
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6987
     OperatingSystem getSystemType
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6988
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6989
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6990
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6991
isBSDlike
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6992
    "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
  6993
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6994
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6995
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6996
#if defined(BSD) || defined(MACH) || defined(SYSV4)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6997
    RETURN ( true );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6998
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6999
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7000
    ^ false
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
isUNIXlike
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7004
    "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
  7005
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7006
    ^ true
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7007
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7008
    "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
  7009
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7011
maxFileNameLength
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7012
    "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
  7013
     CAVEAT:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7014
         Actually, the following is somewhat wrong - some systems
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7015
         support different sizes, depending on the volume.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7016
         We return a somewhat conservative number here.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7017
         Another entry, to query for volume specific max
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7018
         will be added in the future."
3496
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7021
 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7022
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7023
     * 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
  7024
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7025
#   if defined(BSD) || defined(SYSV4) || defined(LONGFILENAMES)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7026
     RETURN ( __MKSMALLINT(255) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7027
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7028
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7029
#   ifdef realIX
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7030
      RETURN ( __MKSMALLINT(127) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7031
#   endif
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
#   ifdef SYSV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7034
      RETURN ( __MKSMALLINT(14) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7035
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7036
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7037
    "unix default"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7038
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7039
    ^ 14
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7042
maxPathLength
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7043
    "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
  7044
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7045
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7046
    RETURN ( __MKSMALLINT(MAXPATHLEN) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7047
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7048
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7049
     OperatingSystem maxPathLength   
3496
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
!
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
pathSeparator
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7054
    "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
  7055
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7056
    ^ $:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7057
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7058
    "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
  7059
    "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
  7060
!
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
platformName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7063
    "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
  7064
     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
  7065
     #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
  7066
     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
  7067
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7068
    ^ #unix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7069
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7070
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7071
     OperatingSystem platformName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7072
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7073
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7074
    "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
  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
setLocaleInfo:anInfoDictionary
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7078
    "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
  7079
     (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
  7080
     See description of fields in #getLocaleInfo.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7081
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7082
     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
  7083
     it should be used by applications as required."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7084
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7085
    LocaleInfo := anInfoDictionary
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7086
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7087
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7088
     |d|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7089
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7090
     d := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7091
     d at:#decimalPoint                 put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7092
     d at:#thousandsSeparator           put:','         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7093
     d at:#currencySymbol               put:'USD'       .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7094
     d at:#monetaryDecimalPoint         put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7095
     d at:#monetaryThousandsSeparator   put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7096
     d at:#fractionalDigits             put:2           .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7097
     d at:#positiveSign                 put:'+'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7098
     d at:#negativeSign                 put:'-'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7099
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7100
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7101
     OperatingSystem setLocaleInfo:d
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7102
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7105
supportsChildInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7106
    "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
  7107
     through interrupts (i.e. SIGCHILD)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7108
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7109
%{  /* NOCONTEXT */
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  7110
#if defined(SIGCHLD) || defined(SIGCLD)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7111
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7112
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7113
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7114
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7115
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7116
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7117
     OperatingSystem supportsChildInterrupts 
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7121
supportsIOInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7122
    "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
  7123
     (i.e. SIGPOLL/SIGIO).
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
     Currently, this mechanism does not work on all
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7126
     systems ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7127
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7128
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7129
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7130
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7131
  /* positive defines here
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7132
   *  - irix5.2 does not work
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
#if defined(LINUX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7135
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7136
# if defined(SIGIO) || defined(SIGPOLL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7137
#  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
  7138
#   if defined(F_SETOWN) || defined(FIOSETOWN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7139
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7140
    RETURN (true);
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
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7143
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7144
# endif
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
#endif /* machines where it works */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7147
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7148
    ^ false
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7151
     OperatingSystem supportsIOInterrupts 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7152
    "
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7153
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7156
supportsNonBlockingIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7157
    "return true, if the OS supports nonblocking IO."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7158
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7159
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7160
#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
  7161
       RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7162
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7163
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7164
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7165
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7166
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7167
     OperatingSystem supportsNonBlockingIO  
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7168
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7169
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7170
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7171
supportsSelect
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7172
    "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
  7173
     filedescriptors via select.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7174
     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
  7175
     intervals for I/O becoming ready."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7176
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7177
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7178
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7179
#if defined(sco)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7180
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7181
     * 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
  7182
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7183
    RETURN(false);
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7186
    ^ true
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7187
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7188
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7189
     OperatingSystem supportsSelect 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7190
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7191
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7192
!
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7193
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7194
supportsSymbolicLinks
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7195
    "return true, if the OS supports symbolic (soft) links;
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7196
     most UNIX'es do; many other OS's do not."
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7197
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7198
%{  /* NOCONTEXT */
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7199
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7200
#ifdef S_IFLNK
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7201
    /*
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7202
     * assume yes - if that is defined.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7203
     */
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7204
    RETURN(true);
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7205
#endif
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7206
%}.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7207
    ^ false
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7208
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7209
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7210
     OperatingSystem supportsSymbolicLinks 
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7211
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7212
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7213
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7214
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7215
!UnixOperatingSystem class methodsFor:'path queries'!
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7216
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7217
defaultSystemPath
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7218
    |sysPath|
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7219
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7220
    sysPath := super defaultSystemPath.
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7221
    #(
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7222
        '/usr/local/lib/smalltalk'
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7223
        '/usr/lib/smalltalk'
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7224
        '/lib/smalltalk'
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7225
        '/opt/smalltalk'
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7226
    ) do:[:d |
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7227
        (d asFilename isDirectory) ifTrue:[
5157
cb24e77a876c care for gnu smalltalk in #defaultSystemPath
ca
parents: 5035
diff changeset
  7228
            "/ try to guess a gnu-smalltalk; skip it
cb24e77a876c care for gnu smalltalk in #defaultSystemPath
ca
parents: 5035
diff changeset
  7229
            (d asFilename construct:'initialize.st') exists ifFalse:[
cb24e77a876c care for gnu smalltalk in #defaultSystemPath
ca
parents: 5035
diff changeset
  7230
                sysPath add:d
cb24e77a876c care for gnu smalltalk in #defaultSystemPath
ca
parents: 5035
diff changeset
  7231
            ]
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7232
        ]
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7233
    ].
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7234
    ^ sysPath
5035
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
  7235
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
  7236
    "
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
  7237
     OperatingSystem defaultSystemPath
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
  7238
    "
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7239
! !
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7240
3558
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7241
!UnixOperatingSystem class methodsFor:'private'!
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7242
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7243
osProcessStatusClass
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7244
    ^ OSProcessStatus
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7245
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7246
    "Created: / 12.6.1998 / 16:30:43 / cg"
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7247
! !
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7248
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7249
!UnixOperatingSystem class methodsFor:'shared memory access'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7250
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7251
shmAttach:id address:addr flags:flags
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7252
    "low level entry to shmat()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7253
     Not supported on all operatingSystems"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7254
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7255
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7256
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7257
    void *address, *shmaddr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7258
    int shmflg, shmid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7259
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7260
    if (__isSmallInteger(addr)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7261
     && __bothSmallInteger(flags, id)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7262
        shmaddr = (void *) __intVal(addr);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7263
        shmflg = __intVal(flags);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7264
        shmid = __intVal(id);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7265
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7266
        address = shmat(shmid, shmaddr, shmflg);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7267
        if (address != (void *)-1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7268
            RETURN (__MKEXTERNALBYTES(addr));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7269
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7270
        @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7271
        RETURN (nil);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7272
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7273
#endif
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
    ^ self primitiveFailed
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
    "Modified: 22.4.1996 / 13:15:12 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7278
!
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
shmDetach:addr
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7281
    "low level entry to shmdt()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7282
     Not supported on all operatingSystems"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7283
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7284
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7285
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7286
    void *shmaddr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7287
    int rslt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7288
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7289
    if (__isSmallInteger(addr)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7290
        shmaddr = (void *) __intVal(addr);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7291
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7292
        rslt = shmdt(shmaddr);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7293
        if (rslt != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7294
            RETURN (true);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7295
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7296
        @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7297
        RETURN (false);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7298
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7299
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7300
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7301
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7302
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7303
    "Modified: 22.4.1996 / 13:15:03 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7304
!
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
shmGet:key size:size flags:flags
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7307
    "low level entry to shmget()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7308
     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
  7309
     - use the provided wrapper class SharedExternalBytes instead."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7310
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7311
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7312
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7313
    if (__bothSmallInteger(key, size)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7314
     && __isSmallInteger(flags)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7315
        int rslt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7316
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7317
        rslt = shmget(__intVal(key), __intVal(size), __intVal(flags));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7318
        if (rslt != -1) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7319
            RETURN (__MKSMALLINT(rslt));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7320
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7321
        @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7322
        RETURN (nil);
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7325
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7326
    ^ self primitiveFailed
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
    "Modified: 22.4.1996 / 13:14:46 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7329
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7330
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7331
!UnixOperatingSystem class methodsFor:'time and date'!
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
computeDatePartsOf:osTime for:aBlock
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7334
    "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
  7335
     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
  7336
     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
  7337
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7338
    |year month day osSeconds i|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7339
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7340
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7341
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7342
    struct tm* tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7343
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7344
    TIME_T tt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7345
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7346
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7347
    tt = (TIME_T)t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7348
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7349
    tmPtr = localtime(&tt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7350
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7351
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7352
    day = __MKSMALLINT(tmPtr->tm_mday);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7353
%}.
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7354
    year isNil ifTrue:[
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7355
        i := self computeTimeAndDateFrom:osTime.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7356
        year := i at:1.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7357
        month := i at:2.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7358
        day := i at:3.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7359
    ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7360
    aBlock value:year value:month value:day
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7361
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7362
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7363
     OperatingSystem computeDatePartsOf:0 for:[:y :m :d |
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7364
        y printCR. m printCR. d printCR
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7365
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7366
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7367
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7368
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7369
computeOSTimeFromUTCYear:y month:m day:d hour:h minute:min second:s millisecond:millis
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7370
    "return the OS-dependent time for the given time and day. 
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7371
     The arguments are assumed to be in UTC Time"
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7372
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7373
    |osSeconds|
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7374
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7375
%{
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7376
    struct tm tm;
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7377
    TIME_T t;
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7378
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7379
    if (__bothSmallInteger(y, m) 
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7380
     && __bothSmallInteger(d, h)
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7381
     && __bothSmallInteger(min, s)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7382
        tm.tm_hour = __intVal(h);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7383
        tm.tm_min = __intVal(min);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7384
        tm.tm_sec = __intVal(s);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7385
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7386
        tm.tm_year = __intVal(y) - 1900;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7387
        tm.tm_mon = __intVal(m) - 1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7388
        tm.tm_mday = __intVal(d);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7389
        tm.tm_isdst = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7390
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7391
        t = mktime(&tm);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7392
        osSeconds = __MKUINT((INT)t-TIMEZONE(tmPtr));
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7393
    }
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7394
%}.
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7395
    osSeconds notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7396
        ^ osSeconds * 1000 + millis
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7397
    ].    
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7398
    ^ self primitiveFailed
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7399
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7400
    "
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7401
     OperatingSystem computeOSTimeFromUTCYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7402
     OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7403
    "
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7404
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7405
!
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7406
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7407
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
  7408
    "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
  7409
     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
  7410
     any daylight saving adjustings."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7411
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7412
    |osSeconds|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7413
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7414
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7415
    struct tm tm;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7416
    TIME_T t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7417
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7418
    if (__bothSmallInteger(y, m) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7419
     && __bothSmallInteger(d, h)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7420
     && __bothSmallInteger(min, s)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7421
        tm.tm_hour = __intVal(h);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7422
        tm.tm_min = __intVal(min);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7423
        tm.tm_sec = __intVal(s);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7424
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7425
        tm.tm_year = __intVal(y) - 1900;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7426
        tm.tm_mon = __intVal(m) - 1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7427
        tm.tm_mday = __intVal(d);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7428
        tm.tm_isdst = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7429
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7430
        t = mktime(&tm);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7431
        osSeconds = __MKUINT((INT)t);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7432
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7433
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7434
    osSeconds notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7435
        ^ osSeconds * 1000 + millis
3496
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7438
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7439
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7440
     OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7441
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7442
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7445
computeTimeAndDateFrom:osTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7446
    "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
  7447
     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
  7448
     offset to UTC, daylight savings time flag, milliseconds,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7449
     dayInYear (1..) and dayInWeek (1..).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7450
     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
  7451
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7452
    |millis osSeconds ret|
3496
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
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7455
    osSeconds := osTime // 1000.
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7456
    ret := self fillTimeAndDateFromSeconds:osSeconds into:(Array new:11).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7457
    ret at:9 put:millis.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7458
    ^ ret
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7459
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7460
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7461
     OperatingSystem computeTimeAndDateFrom:0
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7462
     OperatingSystem computeTimeAndDateFrom:1011
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7463
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7466
computeTimePartsOf:osTime for:aBlock
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7467
    "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
  7468
     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
  7469
     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
  7470
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7471
    |hours minutes seconds millis osSeconds i|
3496
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
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7474
    millis := osTime \\ 1000.
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
    struct tm *tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7477
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7478
    TIME_T tt;
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
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7481
    tt = (TIME_T)t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7482
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7483
    tmPtr = localtime(&tt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7484
    hours = __MKSMALLINT(tmPtr->tm_hour);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7485
    minutes = __MKSMALLINT(tmPtr->tm_min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7486
    seconds = __MKSMALLINT(tmPtr->tm_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7487
%}.
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7488
    hours isNil ifTrue:[
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7489
        i := self computeTimeAndDateFrom:osTime.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7490
        hours := i at:4.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7491
        minutes := i at:5.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7492
        seconds := i at:6.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7493
    ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7494
    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
  7495
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7496
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7497
     OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7498
        h printCR. m printCR. s printCR. millis printCR
3496
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7501
!
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
computeUTCTimeAndDateFrom:osTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7504
    "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
  7505
     containing year, month, day, hour, minute and seconds,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7506
     offset to UTC, daylight savings time flag, milliseconds,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7507
     dayInYear (1..) and dayInWeek (1..).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7508
     Conversion is to UTC."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7509
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7510
    |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
  7511
     dst yDay wDay osSeconds ret|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7512
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7513
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7514
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7515
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7516
    struct tm *tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7517
    struct tm *gmTmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7518
    long t;
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
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7521
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7522
    tmPtr = gmtime(&t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7523
    hours = __MKSMALLINT(tmPtr->tm_hour);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7524
    minutes = __MKSMALLINT(tmPtr->tm_min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7525
    seconds = __MKSMALLINT(tmPtr->tm_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7526
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7527
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7528
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7529
    day = __MKSMALLINT(tmPtr->tm_mday);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7530
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7531
    yDay = __MKSMALLINT(tmPtr->tm_yday + 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7532
    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
  7533
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7534
    if (tmPtr->tm_isdst == 0) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7535
        dst = false;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7536
        utcOffset = __MKINT(TIMEZONE(tmPtr));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7537
    } else {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7538
        dst = true;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7539
#ifdef HAS_ALTZONE
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7540
        utcOffset = __MKINT(altzone);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7541
#else
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7542
        utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7543
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7544
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7545
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7546
    "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
  7547
    ret := Array new:11.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7548
    ret at:1 put:year.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7549
    ret at:2 put:month.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7550
    ret at:3 put:day.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7551
    ret at:4 put:hours.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7552
    ret at:5 put:minutes.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7553
    ret at:6 put:seconds.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7554
    ret at:7 put:utcOffset.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7555
    ret at:8 put:dst.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7556
    ret at:9 put:millis.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7557
    ret at:10 put:yDay.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7558
    ret at:11 put:wDay.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7559
    ^ ret
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7560
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7561
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7562
     OperatingSystem computeUTCTimeAndDateFrom:0
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7563
    "
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
computeUTCTimePartsOf:osTime for:aBlock
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7567
    "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
  7568
     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
  7569
     Conversion is to UTC."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7570
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7571
    |hours minutes seconds millis osSeconds|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7572
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7573
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7574
    millis := osTime \\ 1000.
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
    struct tm *tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7577
    long t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7578
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7579
    t = __longIntVal(osSeconds);
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
    tmPtr = gmtime(&t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7582
    hours = __MKSMALLINT(tmPtr->tm_hour);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7583
    minutes = __MKSMALLINT(tmPtr->tm_min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7584
    seconds = __MKSMALLINT(tmPtr->tm_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7585
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7586
    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
  7587
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7588
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7589
     OperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli |
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7590
        h printCR. m printCR. s printCR. milli printCR
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7591
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7592
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7593
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7594
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7595
fillTimeAndDateFromSeconds:osSeconds into:timeArray
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7596
    "fill the array with os-time components.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7597
     An internal helper"
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7598
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7599
    |low hi year month day hours minutes seconds  utcOffset 
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7600
     dst yDay wDay |
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7601
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7602
%{
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7603
    struct tm *tmPtr;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7604
    struct tm *gmTmPtr;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7605
    INT t;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7606
    TIME_T tt;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7607
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7608
    t = __longIntVal(osSeconds);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7609
    tt = (TIME_T)t;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7610
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7611
    tmPtr = localtime(&tt);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7612
    hours = __MKSMALLINT(tmPtr->tm_hour);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7613
    minutes = __MKSMALLINT(tmPtr->tm_min);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7614
    seconds = __MKSMALLINT(tmPtr->tm_sec);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7615
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7616
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7617
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7618
    day = __MKSMALLINT(tmPtr->tm_mday);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7619
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7620
    yDay = __MKSMALLINT(tmPtr->tm_yday+1);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7621
    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7622
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7623
    if (tmPtr->tm_isdst == 0) {
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7624
        dst = false;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7625
        utcOffset = __MKINT(TIMEZONE(tmPtr));
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7626
    } else {
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7627
        dst = true;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7628
#ifdef HAS_ALTZONE
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7629
        utcOffset = __MKINT(altzone);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7630
#else
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7631
        utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7632
#endif
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7633
    }
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7634
%}.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7635
    "I would love to have SELF-like inline objects ..."
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7636
    timeArray at:1 put:year.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7637
    timeArray at:2 put:month.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7638
    timeArray at:3 put:day.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7639
    timeArray at:4 put:hours.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7640
    timeArray at:5 put:minutes.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7641
    timeArray at:6 put:seconds.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7642
    timeArray at:7 put:utcOffset.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7643
    timeArray at:8 put:dst.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7644
    timeArray at:9 put:nil.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7645
    timeArray at:10 put:yDay.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7646
    timeArray at:11 put:wDay.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7647
    ^ timeArray
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7648
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7649
    "
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7650
     OperatingSystem fillTimeAndDateFromSeconds:0 into:(Array new:11)
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7651
    "
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7652
!
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7653
3692
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7654
getMicrosecondTime
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7655
    "This returns the microsecond timers value - if available. 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7656
     On some machines, times with this precision may not be available,
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7657
     on those, the returned value may be rounded towards some internal
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7658
     clock resolution value."
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7659
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7660
    |seconds millis micros|
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7661
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7662
%{
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7663
    long _seconds = 0;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7664
    long _millis = 0;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7665
    long _micros = 0;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7666
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7667
#if !defined(HAS_GETTIMEOFDAY)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7668
# if defined(HAS_FTIME)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7669
    struct timeb timebuffer;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7670
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7671
    ftime(&timebuffer);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7672
    _seconds = timebuffer.time.
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7673
    _millis = timebuffer.millitm;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7674
#   define HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7675
# endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7676
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7677
# ifndef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7678
#  if defined(SYSV) && defined(HZ)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7679
    /* 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7680
     * sys5 time - in ticks
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7681
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7682
    long ticks;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7683
    struct tms tb;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7684
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7685
    ticks = times(&tb);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7686
    _seconds = ticks / HZ;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7687
    ticks -= (_seconds * HZ);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7688
    _millis = ticks * 1000 / HZ;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7689
#   define HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7690
#  endif /* old SYSV stuff */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7691
# endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7692
#endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7693
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7694
#ifndef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7695
    /* assume HAS_GETTIMEOFDAY 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7696
     * - will result in a linkage error
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7697
     * if not fixed.
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7698
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7699
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7700
    /*
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7701
     * bsd time
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7702
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7703
    struct timeval tb;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7704
    /* struct timezone tzb; */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7705
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7706
    gettimeofday(&tb, NULL /* &tzb */);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7707
    _seconds = tb.tv_sec;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7708
    _micros = tb.tv_usec;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7709
    if (_micros >= (1000*1000)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7710
        printf("oops\n");
3692
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7711
    }
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7712
#endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7713
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7714
#undef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7715
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7716
    seconds = __MKINT(_seconds);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7717
    millis = __MKINT(_millis);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7718
    micros = __MKINT(_micros);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7719
%}.
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7720
    ^ (((seconds * 1000) + millis) * 1000) + micros
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7721
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7722
    "
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7723
     Transcript showCR:(OperatingSystem getMicrosecondTime).
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7724
     Transcript showCR:(OperatingSystem getMicrosecondTime).
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7725
    "
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7726
!
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7727
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7728
getMillisecondTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7729
    "This returns the millisecond timers value. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7730
     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
  7731
     LargeInteger arithmetic when doing timeouts and delays.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7732
     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
  7733
     short relative time deltas.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7734
     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
  7735
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7736
     BAD DESIGN:
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7737
        This should be changed to return some instance of RelativeTime,
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7738
        and these computations moved there.
3496
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
     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
  7741
     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
  7742
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7743
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7744
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7745
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7746
    long t = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7747
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7748
#if !defined(HAS_GETTIMEOFDAY)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7749
# if defined(HAS_FTIME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7750
    struct timeb timebuffer;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7751
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7752
    ftime(&timebuffer);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7753
    t = (timebuffer.time * 1000) + timebuffer.millitm;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7754
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7755
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7756
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7757
# ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7758
#  if defined(SYSV) && defined(HZ)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7759
    /* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7760
     * sys5 time
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7761
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7762
    long ticks;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7763
    struct tms tb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7764
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7765
    ticks = times(&tb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7766
    t = (ticks * 1000) / HZ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7767
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7768
#  endif /* old SYSV stuff */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7769
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7770
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7771
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7772
#ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7773
    /* assume HAS_GETTIMEOFDAY 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7774
     * - will result in a linkage error
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7775
     * if not fixed.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7776
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7777
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7778
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7779
     * bsd time
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7780
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7781
    struct timeval tb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7782
    struct timezone tzb;
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
    gettimeofday(&tb, &tzb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7785
    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
  7786
#endif
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
#undef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7789
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7790
    RETURN ( __MKSMALLINT(t & 0x1FFFFFFF) );
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7791
%}.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7792
    self primitiveFailed
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7793
!
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
getOSTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7796
    "This returns the OS time.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7797
     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
  7798
     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
  7799
     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
  7800
     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
  7801
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7802
     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
  7803
     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
  7804
     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
  7805
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7806
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7807
    |seconds millis|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7808
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7809
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7810
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7811
    long t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7812
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7813
#if !defined(HAS_GETTIMEOFDAY) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7814
# if defined(HAS_FTIME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7815
    struct timeb timebuffer;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7816
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7817
    ftime(&timebuffer);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7818
    seconds = __MKUINT(timebuffer.time);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7819
    millis = __MKUINT(timebuffer.millitm);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7820
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7821
# endif
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
# ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7824
#  if defined(SYSV) && defined(HZ)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7825
    /* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7826
     * sys5 time; we have to fake the information
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7827
     * the returned value is inexact.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7828
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7829
    int now;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7830
    long ticks;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7831
    struct tms tb;
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
    now = time(0);   /* seconds since 1970 ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7834
    seconds = __MKUINT(now);
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
    ticks = times(&tb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7837
    t = (ticks * 1000) / HZ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7838
    t = t % 1000;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7839
    millis = __MKSMALLINT(t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7840
#  endif /* OLD SYSV stuff */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7841
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7842
#endif
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
#ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7845
    /* assume HAS_GETTIMEOFDAY 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7846
     * - will result in a linkage error
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7847
     * if not fixed.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7848
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7849
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7850
     * bsd time
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7851
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7852
    struct timeval tb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7853
    struct timezone tzb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7854
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7855
    gettimeofday(&tb, &tzb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7856
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
     * 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
  7859
     * on all machines (sparc)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7860
     * being conservative here ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7861
     */
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
# 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
  7864
#   define HAS_LONGLONG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7865
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7866
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7867
# ifdef HAS_LONGLONG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7868
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7869
        unsigned long long _secs, _millis, rslt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7870
        unsigned low, hi;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7871
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7872
        _secs = tb.tv_sec;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7873
        _millis = tb.tv_usec / 1000;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7874
        rslt = _secs * 1000 + _millis;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7875
        low = rslt & 0xFFFFFFFF;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7876
        hi = rslt >> 32;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7877
        RETURN (__MKLARGEINT64(1, low, hi));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7878
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7879
# endif /* long long */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7880
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7881
# ifdef alpha64
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7882
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7883
        unsigned INT _secs, _millis, rslt;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7884
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7885
        _secs = (INT) tb.tv_sec;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7886
        _millis = (INT) tb.tv_usec / 1000;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7887
        rslt = _secs * 1000 + _millis;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7888
        RETURN (__MKUINT(rslt));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7889
    }
4102
8b1a94324035 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4101
diff changeset
  7890
# endif /* alpha64 */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7891
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7892
    seconds = __MKUINT(tb.tv_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7893
    millis = __MKUINT(tb.tv_usec / 1000);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7894
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7895
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7896
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7897
#undef HAVE_TIME
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7900
    ^ (seconds * 1000) + millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7901
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7902
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7903
     OperatingSystem getOSTime printCR.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7904
     Delay waitForSeconds:0.2.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7905
     OperatingSystem getOSTime printCR.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7906
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7907
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7908
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7909
millisecondDelay:millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7910
    "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
  7911
     arrives.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7912
     All lower priority threads will also sleep for the duration, 
5233
e6756175b631 comments
Claus Gittinger <cg@exept.de>
parents: 5203
diff changeset
  7913
     interrupts (and therefore, higher prio processes) are still handled. 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7914
     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
  7915
     (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
  7916
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7917
    |now then delta|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7918
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7919
    now := UnixOperatingSystem getMillisecondTime.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7920
    then := UnixOperatingSystem millisecondTimeAdd:now and:millis.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7921
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7922
    [UnixOperatingSystem millisecondTime:then isAfter:now] whileTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7923
        delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7924
        self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7925
        now := UnixOperatingSystem getMillisecondTime.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7926
    ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7927
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7928
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7929
     OperatingSystem millisecondDelay:2000
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7930
    "
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7931
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7932
    "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
  7933
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7934
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7935
sleep:numberOfSeconds
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7936
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7937
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7938
    "cease ANY action for some time. This suspends the whole smalltalk
5233
e6756175b631 comments
Claus Gittinger <cg@exept.de>
parents: 5203
diff changeset
  7939
     (unix-) process for some time if running threadless;
e6756175b631 comments
Claus Gittinger <cg@exept.de>
parents: 5203
diff changeset
  7940
     if running with threads (which is the default), this will 
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7941
     only block until the next clock tick and return with the next
5233
e6756175b631 comments
Claus Gittinger <cg@exept.de>
parents: 5203
diff changeset
  7942
     timer interrupt.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7943
     Use either OperatingSystem>>millisecondDelay: (which makes all
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7944
     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
  7945
     only the calling thread sleep)."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7946
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7947
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7948
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7949
    if (__isSmallInteger(numberOfSeconds)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7950
        sleep(__intVal(numberOfSeconds));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7951
        RETURN ( self );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7952
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7953
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7954
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7955
     argument not integer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7956
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7957
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7958
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7959
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7960
     OperatingSystem sleep:2
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7961
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7962
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7963
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7964
!UnixOperatingSystem class methodsFor:'users & groups'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7965
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7966
getEffectiveGroupID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7967
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7968
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7969
    "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
  7970
     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
  7971
     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
  7972
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7973
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7974
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7975
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7976
    uid = getegid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7977
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7978
%}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7979
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7980
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7981
     OperatingSystem getEffectiveGroupID
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7982
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7983
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7984
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7985
getEffectiveUserID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7986
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7987
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7988
    "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
  7989
     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
  7990
     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
  7991
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7992
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7993
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7994
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7995
    uid = geteuid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7996
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7997
%}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7998
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7999
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8000
     OperatingSystem getEffectiveUserID
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8001
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8002
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8003
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8004
getFullUserNameFromID:userID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8005
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8006
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8007
    "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
  8008
     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
  8009
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8010
    |info gecos|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8011
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8012
    info := self userInfoOf:userID.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8013
    (info notNil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8014
    and:[info includesKey:#gecos]) ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8015
        gecos := info at:#gecos.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8016
        (gecos includes:$,) ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8017
            ^ gecos copyTo:(gecos indexOf:$,) - 1
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8018
        ].
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8019
        ^ gecos
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8020
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8021
    ^ self getUserNameFromID:userID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8022
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8023
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8024
     OperatingSystem getFullUserNameFromID:0 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8025
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8026
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8027
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)  
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8028
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8029
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8030
    "Modified: 15.7.1996 / 12:44:21 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8031
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8032
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8033
getGroupID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8034
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8035
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8036
    "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
  8037
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8038
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8039
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8040
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8041
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8042
    uid = getgid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8043
    RETURN ( __MKSMALLINT(uid) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8044
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8045
    ^ 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
  8046
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8047
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8048
     OperatingSystem getGroupID
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8049
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8050
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8051
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8052
getGroupNameFromID:aNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8053
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8054
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8055
    "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
  8056
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8057
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8058
    struct group *g;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8059
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8060
    if (__isSmallInteger(aNumber)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8061
        g = getgrgid(__intVal(aNumber));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8062
        if (g) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8063
            RETURN ( __MKSTRING(g->gr_name) );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8064
        }
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8065
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8066
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8067
    ^ '???'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8068
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8069
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8070
     OperatingSystem getGroupNameFromID:0
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8071
     OperatingSystem getGroupNameFromID:10
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8072
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8073
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8074
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8075
getHomeDirectory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8076
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8077
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8078
    "return the name of the users home directory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8079
     (i.e. yours)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8080
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8081
    ^ UnixOperatingSystem getEnvironment:'HOME'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8082
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8083
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8084
     OperatingSystem getHomeDirectory
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8085
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8086
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8087
    "Modified: 24.1.1997 / 11:32:13 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8088
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8089
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8090
getLoginName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8091
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8092
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8093
    "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
  8094
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8095
%{  /* NOCONTEXT */
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  8096
    static char cachedName[128];
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8097
    static firstCall = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8098
    extern char *getenv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8099
    extern char *getlogin();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8101
    char *name = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8102
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8103
    if (firstCall) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8104
        name = getlogin();
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8105
        if (! name || (name[0] == 0)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8106
            name = getenv("LOGNAME");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8107
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8108
        if (name && (strlen(name) < sizeof(cachedName))) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8109
            strcpy(cachedName, name);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8110
            firstCall = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8111
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8112
    } else {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8113
        name = cachedName;
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8114
    }
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8115
3496
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
     * try a few common environment variables ...
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
    if (! name || (name[0] == 0) ) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8120
        name = getenv("LOGIN");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8121
        if (! name || (name[0] == 0) ) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8122
            name = getenv("LOGNAME");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8123
            if (! name || (name[0] == 0) ) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8124
                name = getenv("USER");
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8125
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8126
        }
3496
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
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8129
     * nope - I really font know who you are.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8130
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8131
    if (! name || (name[0] == 0) ) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8132
        name = "you";
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8133
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8134
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8135
    RETURN ( __MKSTRING(name) );
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8138
     OperatingSystem getLoginName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8139
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8140
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8141
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8142
getUserID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8143
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8144
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8145
    "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
  8146
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8147
%{  /* NOCONTEXT */
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
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8150
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8151
    uid = getuid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8152
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8153
%}
3496
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8156
     OperatingSystem getUserID
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8157
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8158
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8159
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8160
getUserNameFromID:aNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8161
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8162
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8163
    "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
  8164
     This is the login name, not the fullName."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8165
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8166
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8167
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8168
# ifndef NO_PWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8169
    struct passwd *p;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8170
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8171
    if (__isSmallInteger(aNumber)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8172
        p = getpwuid(__intVal(aNumber));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8173
        if (p) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8174
            RETURN ( __MKSTRING(p->pw_name) );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8175
        }
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8176
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8177
#endif /* unix-like */
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
    aNumber == self getUserID ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8180
        ^ self getLoginName
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8183
    ^ '? (' , aNumber printString , ')'
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8186
     OperatingSystem getUserNameFromID:0
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8187
     OperatingSystem getUserNameFromID:100
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8188
     OperatingSystem getUserNameFromID:9991 
3496
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
!
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
userInfoOf:aNameOrID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8193
    "{ Pragma: +optSpace }"
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
    "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
  8196
     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
  8197
     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
  8198
     DOS systems return nothing; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8199
     non-SYSV4 systems have no age/comment.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8200
     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
  8201
     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
  8202
     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
  8203
     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
  8204
     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
  8205
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8206
    |info name passw uid gid age comment
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8207
     gecos dir shell|
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
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8210
# ifndef NO_PWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8211
    struct passwd *buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8212
    int ret;
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
    if (__isString(aNameOrID)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8215
        buf = getpwnam(__stringVal(aNameOrID));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8216
    } else if (__isSmallInteger(aNameOrID)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8217
        buf = getpwuid(__intVal(aNameOrID));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8218
    } else {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8219
        buf = (struct passwd *)0;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8220
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8221
    if (buf) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8222
        name = __MKSTRING(buf->pw_name);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8223
#  ifndef NO_PWD_PASSWD
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8224
        passw = __MKSTRING(buf->pw_passwd);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8225
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8226
#  ifdef SYSV4
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8227
        age = __MKSTRING(buf->pw_age);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8228
        comment = __MKSTRING(buf->pw_comment);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8229
#  endif
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8230
        dir = __MKSTRING(buf->pw_dir);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8231
#  ifndef NO_PWD_GECOS
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8232
        gecos = __MKSTRING(buf->pw_gecos);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8233
#  endif
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8234
        shell = __MKSTRING(buf->pw_shell);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8235
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8236
        uid = __MKSMALLINT(buf->pw_uid);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8237
        gid = __MKSMALLINT(buf->pw_gid);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8238
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8239
# endif /* has PWD */
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
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8242
    name isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8243
        aNameOrID == self getUserID ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8244
            name := self getLoginName
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8245
        ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8246
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8247
    name notNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8248
        info at:#name put:name.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8249
    ] ifFalse:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8250
        info at:#name put:'unknown'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8251
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8252
    passw notNil ifTrue:[info at:#passwd put:passw].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8253
    age notNil ifTrue:[info at:#age put:age].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8254
    comment notNil ifTrue:[info at:#comment put:comment].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8255
    gecos notNil ifTrue:[info at:#gecos put:gecos].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8256
    shell notNil ifTrue:[info at:#shell put:shell].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8257
    dir isNil ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8258
        aNameOrID == self getUserID ifTrue:[
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8259
            dir := self getHomeDirectory
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8260
        ]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8261
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8262
    dir notNil ifTrue:[info at:#dir put:dir].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8263
    uid notNil ifTrue:[info at:#uid put:uid].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8264
    gid  notNil ifTrue:[info at:#gid put:gid].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8265
    ^ info
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8266
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8267
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8268
     OperatingSystem userInfoOf:'root'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8269
     OperatingSystem userInfoOf:1
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8270
     OperatingSystem userInfoOf:'claus' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8271
     OperatingSystem userInfoOf:'fooBar' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8272
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
3496
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
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8275
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8276
!UnixOperatingSystem class methodsFor:'waiting for events'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8277
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8278
blockingChildProcessWait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8279
     "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
  8280
      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
  8281
      a subprocesses status (to avoid blocking)."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8282
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8283
%{ /*NOCONTEXT*/
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8284
#if defined(HAS_WAITPID) || defined(HAS_WAIT3)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8285
    RETURN(false);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8286
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8287
    RETURN(true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8288
#endif
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
!
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
childProcessWait:blocking pid:pidToWait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8293
    "{ Pragma: +optSpace }"
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
    "get status changes from child processes.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8296
     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
  8297
     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
  8298
     otherwise we return immediately.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8299
     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
  8300
     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
  8301
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8302
    |pid status code core|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8303
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8304
    int p;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8305
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8306
#if defined(HAS_WAITPID)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8307
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8308
    int s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8309
#   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
  8310
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8311
#else
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8312
# if defined(HAS_WAIT3)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8313
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8314
    union wait s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8315
#   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
  8316
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8317
# else /* neither waitpid, nor wait3; use wait, which is blocking */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8318
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8319
    int s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8320
#   define __WAIT      wait(&s)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8321
#   define __BLOCKING_WAIT__ 1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8322
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8323
    if (blocking != true) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8324
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8325
         * We do not support nonBlocking waits, so signal an error
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8326
         * Sorry about the goto, but with all these ifdefs ...
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8327
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8328
        goto done;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8329
    }
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8330
# endif /*!HAS_WAIT3*/
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8331
#endif  /*!HAS_WAITPID*/
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8332
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8333
#if !defined(WIFEXITED)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8334
# define WIFEXITED(stat)      (((int)((stat)&0377))==0)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8335
# define WIFSIGNALED(stat)    (((int)((stat)&0377))>0&&((int)(((stat)>>8)&0377))==0)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8336
# define WIFSTOPPED(stat)     (((int)((stat)&0377))==0177&&((int)(((stat)>>8)&0377))!=0)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8337
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8338
# define WEXITSTATUS(stat)    ((int)(((stat)>>8)&0377))
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8339
# define WTERMSIG(stat)       (((int)((stat)&0377))&0177)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8340
# define WSTOPSIG(stat)       ((int)(((stat)>>8)&0377))
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8341
#endif /*!WIFEXITED*/
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8342
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8343
#if !defined(WCOREDUMP)
3496
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
    * 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
  8346
    */
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8347
# if defined(HAS_WAIT3)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8348
#  define WCOREDUMP(status)    (((union __wait*)&(status))->__w_coredump)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8349
# else
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8350
#  define WCOREDUMP(status)    ((int)(((status)>>8)&0200))
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8351
# endif
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8352
#endif /*!WCOREDUMP*/
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8353
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8354
#if __BLOCKING_WAIT__
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8355
    __BEGIN_INTERRUPTABLE__
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8356
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8357
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8358
    do {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8359
        p = __WAIT;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8360
    } while (p == -1 && errno == EINTR);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8361
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8362
#if __BLOCKING_WAIT__
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8363
    __END_INTERRUPTABLE__
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8364
#  undef __BLOCKING_WAIT__
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8365
#endif
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8366
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8367
#undef __WAIT
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8368
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8369
    if (p == 0)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8370
        RETURN(nil)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8371
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8372
    if (p == -1) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8373
        if (errno == ECHILD)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8374
            RETURN(nil);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8375
    } else {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8376
        pid = __MKSMALLINT(p);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8377
        if (WIFEXITED(s)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8378
            status = @symbol(exit);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8379
            code = __MKSMALLINT(WEXITSTATUS(s));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8380
            core = WCOREDUMP(s) ? true : false;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8381
        } else if (WIFSIGNALED(s)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8382
            status = @symbol(signal);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8383
            code = __MKSMALLINT(WTERMSIG(s));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8384
        } else if (WIFSTOPPED(s)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8385
            status = @symbol(stop);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8386
            code = __MKSMALLINT(WSTOPSIG(s));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8387
        }
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8388
#if defined(WIFCONTINUED)
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8389
        else if (WIFCONTINUED(s)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8390
            status = @symbol(continue);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8391
        } 
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8392
#endif
3496
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
done: ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8395
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8396
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8397
    (status isNil or:[pid isNil]) ifTrue:[
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8398
        ^ self primitiveFailed
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8399
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8401
"/ 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
  8402
"/ show:' code: '; show:code; show:' core:'; showCR:core.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8403
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8404
    ^ 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
  8405
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8406
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8407
     OperatingSystem childProcessWait:false
3496
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
    "Created: 5.1.1996 / 16:39:14 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8411
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8412
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8413
numAvailableForReadOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8414
    "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
  8415
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
#ifdef NOTDEF   /* does not work ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8418
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8419
     * 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
  8420
     */
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8421
# if defined(FIONREAD)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8422
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8423
        int n;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8424
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8425
        if (__isSmallInteger(fd)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8426
            if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8427
                RETURN (__MKINT(n));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8428
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8429
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8430
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8431
# endif /* FIONREAD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8432
#endif
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
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
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
readCheck:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8438
    "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
  8439
     (i.e. read is possible without blocking).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8440
     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
  8441
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8442
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8443
#ifdef NOTDEF   /* does not work ... */
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
     * 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
  8446
     */
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8447
# if defined(FIONREAD)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8448
    {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8449
        int n;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8450
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8451
        if (__isSmallInteger(fd)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8452
            if (n = ioctl(__intVal(fd), FIONREAD)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8453
                printf("FIONREAD returns %d\n", n);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8454
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8455
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8456
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8457
# endif /* FIONREAD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8458
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8459
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8460
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8461
    ^ super readCheck:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8462
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8463
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8464
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8465
    "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
  8466
     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
  8467
     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
  8468
     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
  8469
     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
  8470
     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
  8471
     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
  8472
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8473
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8474
    fd_set rset, wset, eset;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8475
    struct timeval wt, et;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8476
    int f, maxF, i, lX, bX;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8477
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8478
    OBJ fd, retFd;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8479
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8480
    int count;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8481
    int numFds = 0;
3801
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  8482
#ifndef __isArrayLike
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  8483
# define __isArrayLike __isArray
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  8484
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8485
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8486
    if (__isSmallInteger(millis)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8487
        FD_ZERO(&rset);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8488
        FD_ZERO(&wset);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8489
        FD_ZERO(&eset);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8490
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8491
        maxF = -1;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8492
        if (__isNonNilObject(readFdArray)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8493
            if (! __isArrayLike(readFdArray)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8494
                goto fail;    
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8495
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8496
            count = __arraySize(readFdArray);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8497
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8498
            for (i=0; i<count;i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8499
                fd = __ArrayInstPtr(readFdArray)->a_element[i];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8500
                if (fd != nil) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8501
                    f = __intVal(fd);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8502
                    if ((unsigned)f < FD_SETSIZE) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8503
                        FD_SET(f, &rset);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8504
                        if (f > maxF) maxF = f;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8505
                        numFds++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8506
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8507
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8508
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8509
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8510
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8511
        if (__isNonNilObject(writeFdArray)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8512
            if (! __isArrayLike(writeFdArray)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8513
                goto fail;    
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8514
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8515
            count = __arraySize(writeFdArray);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8516
            for (i=0; i<count;i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8517
                fd = __ArrayInstPtr(writeFdArray)->a_element[i];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8518
                if (fd != nil) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8519
                    f = __intVal(fd);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8520
                    if ((unsigned)f < FD_SETSIZE) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8521
                        FD_SET(f, &wset);       
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8522
                        if (f > maxF) maxF = f;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8523
                        numFds++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8524
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8525
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8526
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8527
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8528
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8529
        if (__isNonNilObject(exceptFdArray)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8530
            if (! __isArrayLike(exceptFdArray)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8531
                goto fail;    
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8532
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8533
            count = __arraySize(exceptFdArray);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8534
            for (i=0; i<count;i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8535
                fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8536
                if (fd != nil) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8537
                    f = __intVal(fd);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8538
                    if ((unsigned)f < FD_SETSIZE) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8539
                        FD_SET(f, &eset);       
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8540
                        if (f > maxF) maxF = f;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8541
                        numFds++;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8542
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8543
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8544
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8545
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8546
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8547
        t = __intVal(millis);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8548
        if (t) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8549
            wt.tv_sec = t / 1000;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8550
            wt.tv_usec = (t % 1000) * 1000;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8551
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8552
            wt.tv_sec = wt.tv_usec = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8553
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8554
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8555
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8556
         * make certain, that interrupt gets us out of the select
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8557
         * However, we must then care for moved objects.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8558
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8559
        __BEGIN_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8560
        errno = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8561
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8562
        if (t == 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8563
            /* 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8564
             * if there is no timeout time, we can stay here interruptable.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8565
             */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8566
            do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8567
                ret = select(maxF+1, &rset, &wset, &eset, &wt);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8568
            } while ((ret < 0) && (errno == EINTR));
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8569
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8570
            do {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8571
                ret = select(maxF+1, &rset, &wset, &eset, &wt);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8572
                /* 
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8573
                 * for now: dont loop; if we did, we had to adjust the vt-timeval;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8574
                 * could otherwise stay in this loop forever ...
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8575
                 * Premature ret (before the time expired) must be handled by the caller.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8576
                 * A good solution is to update the wt-timeval and redo the select.
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8577
                 */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8578
            } while (0 /* (ret < 0) && (errno == EINTR) */ );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8579
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8580
        __END_INTERRUPTABLE__
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8581
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8582
        if (ret > 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8583
            for (i=0; i <= maxF; i++) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8584
                if (FD_ISSET(i, &rset)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8585
                 || FD_ISSET(i, &wset)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8586
                 || FD_ISSET(i, &eset)) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8587
                    RETURN ( __MKSMALLINT(i) );
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8588
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8589
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8590
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8591
            if (ret < 0) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8592
                if (errno == EINTR) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8593
                    errno = 0;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8594
                    @global(LastErrorNumber) = nil;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8595
                } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8596
                    if (@global(InfoPrinting) == true) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8597
                        fprintf(stderr, "OS [info]: select errno = %d\n", errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8598
                    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8599
                    @global(LastErrorNumber) = __MKSMALLINT(errno);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8600
                }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8601
            } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8602
                @global(LastErrorNumber) = nil;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8603
            }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8604
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8605
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8606
        /*
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8607
         * Return nil (means time expired or interrupted)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8608
         */
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8609
        RETURN ( nil );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8610
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8611
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8612
fail: ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8613
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8614
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8615
     timeout argument not integer,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8616
     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
  8617
     or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8618
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8619
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8620
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8621
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8622
setBlocking:aBoolean on:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8623
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8624
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8625
    "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
  8626
     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
  8627
     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
  8628
     nil."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8629
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8630
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8631
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8632
    int ret, flags;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8633
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8634
#if defined(F_GETFL) && defined(F_SETFL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8635
# if defined(FNDELAY)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8636
    if (__isSmallInteger(fd)) {
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8637
        int f = __intVal(fd);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8638
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8639
        flags = fcntl(f, F_GETFL, 0);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8640
        if (aBoolean == true) {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8641
            ret = fcntl(f, F_SETFL, flags & ~FNDELAY);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8642
        } else {
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8643
            ret = fcntl(f, F_SETFL, flags | FNDELAY);
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8644
        }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8645
        if (ret >= 0) ret = flags;
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8646
        RETURN ( __MKSMALLINT(ret) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8647
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8648
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8649
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8650
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8651
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8652
     fd argument not integer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8653
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8654
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8655
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8656
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8657
!UnixOperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8658
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8659
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8660
    ^ self basicNew
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8661
        type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP 
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8662
! !
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8663
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8664
!UnixOperatingSystem::FileStatusInfo methodsFor:'accessing'!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8665
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8666
accessed
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8667
    "return accessed"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8668
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8669
    ^ accessed!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8670
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8671
alternativeName
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8672
    "return the files other name (DOS name on windows).
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8673
     Nil if there is no other name"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8674
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8675
    ^ nil
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8676
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8677
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8678
fixedHeaderSize
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8679
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8680
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8681
    ^ nil
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8682
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8683
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8684
gid
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8685
    "return gid"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8686
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8687
    ^ gid!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8688
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8689
id
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8690
    "return id"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8691
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8692
    ^ id!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8693
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8694
mode
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8695
    "return mode"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8696
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8697
    ^ mode!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8698
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8699
modified
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8700
    "return modified"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8701
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8702
    ^ modified!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8703
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8704
path
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8705
    "for symbolic links only: return the path where the symbolic link points to"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8706
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8707
    ^ path
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8708
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8709
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8710
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8711
recordAttributes
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8712
    "return the recordAttributes (VMS only; nil everywhere else)"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8713
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8714
    ^ nil
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8715
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8716
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8717
recordFormat
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8718
    "return the recordFormat (VMS only; nil everywhere else)"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8719
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8720
    ^ nil
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8721
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8722
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8723
recordFormatNumeric
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8724
    "return the recordFormat as numeric (VMS only; nil everywhere else)"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8725
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8726
    ^ nil
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8727
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8728
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8729
recordSize
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8730
    "return the recordSize (VMS only; nil everywhere else)"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8731
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8732
    ^ nil
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8733
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8734
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8735
size
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8736
    "return size"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8737
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8738
    ^ size!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8739
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8740
statusChanged
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8741
    "return statusChanged"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8742
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8743
    ^ statusChanged!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8744
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8745
type
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8746
    "return type"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8747
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8748
    ^ type!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8749
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8750
uid
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8751
    "return uid"
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8752
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8753
    ^ uid
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8754
! !
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8755
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8756
!UnixOperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8757
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8758
at:key
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8759
    "backward compatibility access: in previous releases, IdentityDictionaries
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8760
     were used to hold my information. Allow access via key messages.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8761
     This method will vanish - use the proper access protocol."
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8762
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8763
    ^ self perform:key
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8764
! !
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8765
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8766
!UnixOperatingSystem::FileStatusInfo methodsFor:'private accessing'!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8767
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8768
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8769
    type := t.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8770
    mode := m.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8771
    uid := u.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8772
    gid := g.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8773
    size := s.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8774
    id := i.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8775
    accessed := aT.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8776
    modified := mT.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8777
    statusChanged := sT.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8778
    path := lP.
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8779
! !
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  8780
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8781
!UnixOperatingSystem::OSProcessStatus class methodsFor:'documentation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8782
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8783
documentation
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8784
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8785
    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
  8786
    operating system processes (these are no smalltalk processes!!).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8787
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8788
    [Instance variables:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8789
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8790
        pid     <Integer>       OS-Process identifier
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8791
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8792
        status  <Symbol>        either #exit #signal #stop #continue
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8793
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8794
        code    <Integer>       either exitcode or signalnumber
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8795
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8796
        core    <Boolean>       true if core has been dumped
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8797
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8798
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8799
    [author:]
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8800
        Stefan Vogel
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8801
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8802
    [see also:]
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  8803
        OperatingSystem
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8804
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8805
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8806
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8807
!UnixOperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8808
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8809
pid:pid status:status code:code core:core
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8810
    "private interface for UnixOperatingSystem"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8811
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8812
    ^ 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
  8813
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8814
    "Created: 28.12.1995 / 14:16:14 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8815
    "Modified: 30.4.1996 / 18:25:00 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8816
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8817
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8818
processCreationFailure
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8819
    "private interface for UnixOperatingSystem"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8820
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8821
    ^ 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
  8822
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8823
    "Created: 28.12.1995 / 14:35:29 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8824
    "Modified: 30.4.1996 / 18:25:05 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8825
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8826
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8827
!UnixOperatingSystem::OSProcessStatus methodsFor:'accessing'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8828
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8829
code
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8830
    "return the exitcode / signalNumber"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8831
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8832
    ^ code
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8833
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8834
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8835
    "Modified: 30.4.1996 / 18:26:23 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8836
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8837
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8838
core
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8839
    "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
  8840
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8841
    ^ core == true
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8842
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8843
    "Modified: 28.12.1995 / 14:14:38 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8844
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8845
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8846
pid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8847
    "return the pid"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8848
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8849
    ^ pid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8850
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8851
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8852
    "Modified: 30.4.1996 / 18:26:30 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8853
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8854
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8855
status
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8856
    "return status as a Symbol;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8857
     one of #exit #signal #stop #continue"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8858
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8859
    ^ status
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8860
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8861
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8862
    "Modified: 30.4.1996 / 18:26:54 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8863
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8864
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8865
!UnixOperatingSystem::OSProcessStatus methodsFor:'initialization'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8866
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8867
pid:newPid status:newStatus code:newCode core:newCore
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8868
    pid := newPid.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8869
    status := newStatus.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8870
    code := newCode.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8871
    core := newCore.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8872
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8873
    "Created: 28.12.1995 / 14:18:22 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8874
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8875
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8876
!UnixOperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8877
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8878
code:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8879
    "set the exitCode"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8880
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8881
    code := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8882
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8883
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8884
    "Modified: 30.4.1996 / 18:25:18 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8885
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8886
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8887
core:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8888
    "set core"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8889
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8890
    core := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8891
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8892
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8893
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8894
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8895
pid:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8896
    "set pid"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8897
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8898
    pid := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8899
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8900
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8901
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8902
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8903
status:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8904
    "set status"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8905
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8906
    status := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8907
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8908
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8909
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8910
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8911
!UnixOperatingSystem::OSProcessStatus methodsFor:'queries'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8912
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8913
couldNotExecute
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8914
    "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
  8915
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8916
    ^ status == #exit and:[code = 127].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8917
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8918
    "Created: 28.12.1995 / 15:43:17 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8919
    "Modified: 30.4.1996 / 18:27:03 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8920
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8921
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8922
stillAlive
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8923
    "true if process is still alive"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8924
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8925
    ^ status == #stop or:[status == #continue]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8926
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8927
    "Created: 28.12.1995 / 14:27:26 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8928
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8929
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8930
success
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8931
    "true if process terminated successfully"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8932
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8933
    ^ status == #exit and:[code = 0]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8934
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8935
    "Created: 28.12.1995 / 14:13:05 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8936
    "Modified: 28.12.1995 / 14:13:41 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8937
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8938
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8939
!UnixOperatingSystem class methodsFor:'documentation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8940
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8941
version
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  8942
    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.83 2000-07-02 12:50:18 cg Exp $'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8943
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8944
UnixOperatingSystem initialize!