UnixOperatingSystem.st
author Claus Gittinger <cg@exept.de>
Sat, 17 Nov 2001 11:10:08 +0100
changeset 6211 69f320c220d5
parent 6050 af9ae36d6fdb
child 6287 f1a8f0ac8048
permissions -rw-r--r--
initial checkin
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
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
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
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
    22
Object subclass:#FileStatusInfo
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
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
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
    29
Object subclass:#OSProcessStatus
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
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__
5886
78c6f9c5fe8e *** empty log message ***
penk
parents: 5855
diff changeset
    63
# include "linuxIntern.h"
3496
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
5886
78c6f9c5fe8e *** empty log message ***
penk
parents: 5855
diff changeset
    71
# include <time.h>
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
#ifdef IRIX5
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
#ifdef ultrix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
#ifdef hpux
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
#ifdef solaris
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
#if defined(SYSV4) && defined(i386) /* e.g. unixware */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
#endif
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
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
 * notice: although many systems' include files
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
 * already block against multiple inclusion, some
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
 * do not. Therefore, this is done here again.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
 * (it does not hurt)
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
#ifdef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
# ifndef NO_SYS_PARAM_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
#  include <sys/param.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
#  define _SYS_PARAM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
# include <errno.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
# define _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
# include <sys/stat.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
# define _SYS_STAT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
#endif /* WANT_REALPATH */
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
extern int shmctl(), shmget(), shmdt();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
extern char * shmat();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
# include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
# define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
# include <sys/ipc.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
# define _SYS_IPC_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
# include <sys/shm.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
# define _SYS_SHM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
#endif /* WANT_SHM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
#ifdef IRIX5
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
# include <sys/syssgi.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
#endif
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
#ifdef transputer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
# define unlink(f)      ((remove(f) == 0) ? 0 : -1)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
#else /* not transputer */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
# ifndef _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
#  include <signal.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
#  define _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
# ifdef SYSV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
#  ifndef _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
#   include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
#   define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
#  ifndef _SYS_PARAM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
#   ifndef NO_SYS_PARAM_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
#    include <sys/param.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
#    define _SYS_PARAM_H_INCLUDED_
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
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
#  ifndef _SYS_TIMES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
#   include <sys/times.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
#   define _SYS_TIMES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
#  ifndef _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
#   include <sys/file.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
#   define _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
#  if ! defined(sco3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
#   ifndef _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
#    include <unistd.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
#    define _UNISTD_H_INCLUDED_
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
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
#  if defined(isc3_2) || defined(sco3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
#   ifndef _SYS_TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
#    include <sys/time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
#    define _SYS_TIME_H_INCLUDED_
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
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
#  if !defined(isc3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
#   if defined(PCS) && defined(mips)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
#    include "/usr/include/bsd/sys/time.h"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
#    include "/usr/include/sys/time.h"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
#    ifndef _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
#     include <time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
#     define _TIME_H_INCLUDED_
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
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
#  if defined(isc3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
#   include <sys/bsdtypes.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
# else /* not SYSV */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   203
#  ifndef _SYS_TIME_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   204
#   include <sys/time.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   205
#   define _SYS_TIME_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   206
#  endif
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   207
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   208
#  ifndef _SYS_TYPES_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   209
#   include <sys/types.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   210
#   define _SYS_TYPES_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   211
#  endif
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   212
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
# endif /* not SYSV */
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
# ifdef aix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
#  ifndef _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
#   include <time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
#   define _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
#  ifndef _SYS_SELECT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
#   include <sys/select.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
#   define _SYS_SELECT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
# endif /* aix */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
4882
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   229
# ifndef _STDIO_H_INCLUDED_
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   230
#  include <stdio.h>
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   231
#  define _STDIO_H_INCLUDED_
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   232
# endif
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   233
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   234
# ifndef _PWD_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   235
#  include <pwd.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   236
#  define _PWD_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   237
# endif
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   238
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   239
# ifndef NO_GRP_H
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   240
#  ifndef _GRP_H_INCLUDED_
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   241
#   include <grp.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   242
#   define _GRP_H_INCLUDED_
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
#  endif
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   244
# endif
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   245
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
# ifndef _SYS_STAT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
#  include <sys/stat.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
#  define _SYS_STAT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
# ifndef _SYS_FILE_H_INCLUDED_
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   253
#  include <sys/file.h>
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
#  define _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
# ifndef _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
#  include <errno.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
#  define _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
# ifndef _FCNTL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
#  include <fcntl.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
#  define _FCNTL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
# ifndef _IOCTL_H_INCLUDED_
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   268
#  include <sys/ioctl.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   269
#  define _IOCTL_H_INCLUDED_
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
# if defined(LINUX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
#  define HAS_LOCALECONV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
# if defined (HAS_LOCALECONV)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
#  ifndef _LOCALE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
#   include <locale.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
#   define _LOCALE_H_INCLUDED_
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
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   283
# if defined (HAS_FTIME)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   284
#  include <sys/timeb.h>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   285
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   286
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
/* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
 * posix systems should define these ... 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
 * but on some (older) systems, they are not.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
# ifndef S_IXUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
#  ifdef S_IEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
#   define S_IXUSR S_IEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
#   define S_IXGRP (S_IEXEC>>3)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
#   define S_IXOTH (S_IEXEC>>6)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
# ifndef S_IXUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
#  define S_IXUSR 0100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
#  define S_IXGRP 0010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
#  define S_IXOTH 0001
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   303
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
# ifndef S_IRUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
#  define S_IRUSR 0400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
#  define S_IRGRP 0040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
#  define S_IROTH 0004
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
# ifndef S_IWUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
#  define S_IWUSR 0200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
#  define S_IWGRP 0020
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
#  define S_IWOTH 0002
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
# ifndef MAXPATHLEN
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   318
#  ifndef NO_SYS_PARAM_H
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   319
#   include <sys/param.h>
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
#  ifndef MAXPATHLEN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
#   ifdef FILENAME_MAX  /* i.e. MSDOS_LIKE */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
#    define MAXPATHLEN FILENAME_MAX
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
#    ifdef MAX_PATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
#     define MAXPATHLEN MAX_PATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
#    else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
#     define MAXPATHLEN 1024
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
#    endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
#   endif
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
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
# if defined(HAS_UNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
#  include <sys/utsname.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
# if defined(SYSV4)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
#  include <stropts.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
4285
342a32e855b4 aix has no sys/termios.h
Claus Gittinger <cg@exept.de>
parents: 4262
diff changeset
   342
# ifndef aix
342a32e855b4 aix has no sys/termios.h
Claus Gittinger <cg@exept.de>
parents: 4262
diff changeset
   343
#  include <sys/termios.h>
342a32e855b4 aix has no sys/termios.h
Claus Gittinger <cg@exept.de>
parents: 4262
diff changeset
   344
# endif
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   345
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
 * NeXT has no pid_t
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
 * and no sigemptyset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
# ifdef NEXT3
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
   typedef int pid_t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
#  define sigemptyset(set)      ((*(set) = 0L), 0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
#  define HAS_GETDOMAINNAME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
#  define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
# ifdef sunos
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
#  undef NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
#  undef HAS_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
#  define HAS_WAIT3
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
#  define HAS_SIGACTION
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
 * some (BSD ?) have no timezone global,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
 * but provide the info in struct timezone.
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
# if defined(ultrix) || defined(sunos) || defined(NEXT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
#  define HAS_NO_TIMEZONE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
 * 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
   374
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
# ifndef SA_RESTART
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
#  define SA_RESTART    0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
# ifndef SA_SIGINFO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
#  define SA_SIGINFO    0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
# if defined(HAS_WAITPID) || defined(HAS_WAIT3)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
#  include <sys/wait.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
# if defined(HAS_SYSINFO)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
#  include <sys/systeminfo.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   390
# ifdef LINUX
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   391
#  include <linux/kernel.h>
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   392
#  include <linux/sys.h>
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   393
# endif
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   394
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   395
# if defined(HAS_GETSYSINFO)
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   396
#  include <sys/sysinfo.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   397
#  include <machine/hal_sysinfo.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   398
#  include <machine/hal/cpuconf.h>
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   399
# endif
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   400
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   401
# if defined(HAS_SYSCONF)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   402
#  ifndef _UNISTD_H_INCLUDED_
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   403
#   include <unistd.h>
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   404
#   define _UNISTD_H_INCLUDED_
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   405
#  endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   406
# endif
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   407
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
#endif /* not transputer */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   411
 * 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
   412
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
#ifndef errno
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
 extern errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
 * some (old ?) systems do not define this ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
#if !defined(R_OK) && !defined(_AIX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
# define R_OK    4       /* Test for Read permission */ 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
# define W_OK    2       /* Test for Write permission */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
# define X_OK    1       /* Test for eXecute permission */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
# 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
   425
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
   427
#define SIGHANDLER_ARG
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
#ifdef sunos
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
# define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
#ifdef NEXT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
# define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
 * 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
   438
 * explicit add of those we know to have ...
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
#ifdef __osf__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
# define TIME_T time_t
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
# define OFF_T  off_t
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
#ifndef TIME_T
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
# define TIME_T long
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
#ifndef OFF_T
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
# define OFF_T  long
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   451
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   452
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   453
 * where is the timezone info ?
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
#if defined(HAS_NO_TIMEZONE)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
# if defined(HAS_NO_TM_GMTOFF)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
#  define TIMEZONE(tmPtr)       0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
#  define TIMEZONE(tmPtr)       ((tmPtr)->tm_gmtoff)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   461
#else
5656
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
   462
# if defined(HAS_ALTZONE)
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
   463
#  define TIMEZONE(tmPtr)       ((tmPtr)->tm_isdst == 0 ? timezone : altzone)
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
   464
# else  /*!HAS_ALTZONE*/
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
   465
#  define TIMEZONE(tmPtr)       ((tmPtr)->tm_isdst == 0 ? timezone : timezone-3600)
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
   466
# endif /*!HAS_ALTZONE*/
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
   467
#endif                                                                                                                                                                                                                                                                                                                                                                                                                               
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
3595
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   469
#ifndef CONST
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   470
# ifdef __GNUC__
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   471
#  define CONST const
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   472
# else
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   473
#  define CONST /* nothing */
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   474
# endif
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   475
#endif
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   476
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
%}
5656
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
   478
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
!UnixOperatingSystem primitiveFunctions!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
 * 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
   486
 * 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
   487
 * (LINUX is one of them)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
 * 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
   489
 * UnixOperatingSystem>>executeCommand, you ought to define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
 * 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
   491
 *
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
 * 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
   493
 * 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
   494
 * (i.e. it is RT safe)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
 */
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
#if defined(WANT_SYSTEM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   499
/* # define DPRINTF(x)     printf x */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
# define DPRINTF(x)     /* nothing */
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 _STDDEF_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
#  include <stddef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
#  define _STDDEF_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 _STDLIB_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
#  include <stdlib.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
#  define _STDLIB_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 _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
#  include <unistd.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
#  define _UNISTD_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_WAIT_H_INCLUDED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
#  include <sys/wait.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
#  define _SYS_WAIT_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
# ifndef _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
#  include <signal.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
#  define _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
# ifndef _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
#  include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
#  define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
# 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
   533
#  define       __environ       environ
4882
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   534
#  if 1 /* !defined(LINUX) */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
#   define      __sigemptyset   sigemptyset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
#   define      __sigaction     sigaction
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
#   define      __sigaddset     sigaddset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
#   define      __sigprocmask   sigprocmask
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
#   define      __execve        execve
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
#   define      __wait          wait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
#   define      __waitpid       waitpid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
#   if defined(HAS_VFORK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
#    define     FORK            vfork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
#    define     FORK            fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   546
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   547
#  endif /* ! LINUX */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   548
   extern char **environ;
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
4882
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   551
# define      __sigprocmask   sigprocmask
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   552
# define      __execve        execve
fb4dafb482fb make it compilable under suse6.2
Claus Gittinger <cg@exept.de>
parents: 4853
diff changeset
   553
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   554
# 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
   555
# define        SHELL_NAME      "sh"            /* Name to give it.  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   556
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   557
# ifndef        FORK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   558
#  define       FORK    __fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   559
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   560
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   561
static int
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
mySystem(line)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
    register CONST char *line;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
    int status, save;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
    pid_t pid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
    struct sigaction sa, intr, quit;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
    sigset_t block, omask;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   570
    if (line == NULL)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   571
	return -1;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
    sa.sa_handler = SIG_IGN;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
    sa.sa_flags = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
    __sigemptyset (&sa.sa_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
    if (__sigaction (SIGINT, &sa, &intr) < 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   578
	DPRINTF(("1: errno=%d\n", errno));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   579
	return -1;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
    if (__sigaction (SIGQUIT, &sa, &quit) < 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   582
	save = errno;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   583
	(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   584
	errno = save;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   585
	DPRINTF(("2: errno=%d\n", errno));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   586
	return -1;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   587
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   588
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   589
    __sigemptyset (&block);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   590
    __sigaddset (&block, SIGCHLD);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   591
    save = errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   592
    if (__sigprocmask(SIG_BLOCK, &block, &omask) < 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   593
	if (errno == ENOSYS)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   594
	    errno = save;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   595
	else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   596
	    save = errno;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   597
	    (void) __sigaction(SIGINT, &intr, (struct sigaction *) NULL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   598
	    (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   599
	    errno = save;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   600
	    DPRINTF(("3: errno=%d\n", errno));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   601
	    return -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   602
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   603
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
    pid = FORK ();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
    if (pid == (pid_t) 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   607
	/* Child side.  */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   608
	CONST char *new_argv[4];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   609
	new_argv[0] = SHELL_NAME;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   610
	new_argv[1] = "-c";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   611
	new_argv[2] = line;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   612
	new_argv[3] = NULL;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   613
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   614
	/* Restore the signals.  */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   615
	(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   616
	(void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   617
	(void) __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   618
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   619
	/* Exec the shell.  */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   620
	(void) __execve (SHELL_PATH, (char *CONST *) new_argv, __environ);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   621
	_exit (127);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
    } else {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   623
	if (pid < (pid_t) 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   624
	    /* The fork failed.  */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   625
	    DPRINTF(("4: errno=%d\n", errno));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   626
	    status = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   627
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   628
	    /* Parent side.  */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
#ifdef  NO_WAITPID
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   630
	    pid_t child;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   631
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   632
	    do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   633
		__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   634
		child = __wait (&status);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   635
		__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   636
		if (child < 0 && errno != EINTR) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   637
		    DPRINTF(("5: errno=%d\n", errno));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   638
		    status = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   639
		    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   640
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   641
	    } while (child != pid);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   642
#else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   643
	    pid_t child;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   644
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   645
	    /* claus: the original did not care for EINTR here ... */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   646
	    do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   647
		__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   648
		child = __waitpid (pid, &status, 0);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   649
		__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   650
	    } while ((child != pid) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   651
	    if (child != pid) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   652
		DPRINTF(("6: errno=%d\n", errno));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   653
		status = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   654
	    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
#endif /* NO_WAITPID */
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   656
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
    save = errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
    if ((__sigaction (SIGINT, &intr, (struct sigaction *) NULL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
     | __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
     | __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL)) != 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   662
	if (errno == ENOSYS) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   663
	    errno = save;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   664
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   665
	    status = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   666
	    DPRINTF(("7: errno=%d\n", errno));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   667
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
    return status;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   673
# define __wait wait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   674
#endif /* WANT_SYSTEM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   677
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   678
 * some systems do not have realpath();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
 * the alternative of reading from a 'pwp'-pipe
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
 * 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
   681
 * 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
   682
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
#if defined(HAS_REALPATH)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
# undef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
#if !defined(HAS_GETWD) && !defined(HAS_GETCWD)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
# undef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
#if defined(WANT_REALPATH)
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
# ifndef NULL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   694
#  define NULL (char *)0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   695
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   696
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
# define MAX_READLINKS 32
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
# ifndef MAXPATHLEN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
#  define MAXPATHLEN     1024
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   701
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
static
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
char *realpath(path, resolved_path)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
char *path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   706
char resolved_path [];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
{
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   708
	char copy_path[MAXPATHLEN];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   709
	char link_path[MAXPATHLEN];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   710
	char *new_path = resolved_path;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   711
	char *max_path;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   712
	int readlinks = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   713
	int n;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   714
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   715
	/* Make a copy of the source path since we may need to modify it. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   716
	strcpy(copy_path, path);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   717
	path = copy_path;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   718
	max_path = copy_path + MAXPATHLEN - 2;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   719
	/* If it's a relative pathname use getwd for starters. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   720
	if (*path != '/') {
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
#ifdef HAS_GETCWD
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   722
		new_path = getcwd(new_path, MAXPATHLEN - 1);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
#else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   724
		new_path = getwd(new_path);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   725
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   726
		if (new_path == NULL) 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   727
		    return(NULL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   728
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   729
		new_path += strlen(new_path);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   730
		if (new_path[-1] != '/')
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   731
			*new_path++ = '/';
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   732
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   733
	else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   734
		*new_path++ = '/';
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   735
		path++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   736
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   737
	/* Expand each slash-separated pathname component. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   738
	while (*path != '\0') {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   739
		/* Ignore stray "/". */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   740
		if (*path == '/') {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   741
			path++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   742
			continue;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   743
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   744
		if (*path == '.') {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   745
			/* Ignore ".". */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   746
			if (path[1] == '\0' || path[1] == '/') {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   747
				path++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   748
				continue;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   749
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   750
			if (path[1] == '.') {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   751
				if (path[2] == '\0' || path[2] == '/') {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   752
					path += 2;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   753
					/* Ignore ".." at root. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   754
					if (new_path == resolved_path + 1)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   755
						continue;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   756
					/* Handle ".." by backing up. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   757
					while ((--new_path)[-1] != '/')
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   758
						;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   759
					continue;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   760
				}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   761
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   762
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   763
		/* Safely copy the next pathname component. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   764
		while (*path != '\0' && *path != '/') {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   765
			if (path > max_path) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   766
				errno = ENAMETOOLONG;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   767
				return NULL;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   768
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   769
			*new_path++ = *path++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   770
		}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
#ifdef S_IFLNK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   772
		/* Protect against infinite loops. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   773
		if (readlinks++ > MAX_READLINKS) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   774
			errno = ELOOP;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   775
			return NULL;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   776
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   777
		/* See if latest pathname component is a symlink. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   778
		*new_path = '\0';
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   779
		n = readlink(resolved_path, link_path, MAXPATHLEN - 1);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   780
		if (n < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   781
			/* EINVAL means the file exists but isn't a symlink. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   782
			if (errno != EINVAL)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   783
				return NULL;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   784
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   785
		else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   786
			/* Note: readlink doesn't add the null byte. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   787
			link_path[n] = '\0';
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   788
			if (*link_path == '/')
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   789
				/* Start over for an absolute symlink. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   790
				new_path = resolved_path;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   791
			else
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   792
				/* Otherwise back up over this component. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   793
				while (*(--new_path) != '/')
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   794
					;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   795
			/* Safe sex check. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   796
			if (strlen(path) + n >= MAXPATHLEN) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   797
				errno = ENAMETOOLONG;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   798
				return NULL;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   799
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   800
			/* Insert symlink contents into path. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   801
			strcat(link_path, path);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   802
			strcpy(copy_path, link_path);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   803
			path = copy_path;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   804
		}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
#endif /* S_IFLNK */
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   806
		*new_path++ = '/';
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   807
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   808
	/* Delete trailing slash but don't whomp a lone slash. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   809
	if (new_path != resolved_path + 1 && new_path[-1] == '/')
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   810
		new_path--;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   811
	/* Make sure it's null terminated. */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   812
	*new_path = '\0';
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   813
	return resolved_path;
3496
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
# define HAS_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
#endif /* WANT_REALPATH && not HAS_REALPATH */
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
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
!UnixOperatingSystem class methodsFor:'documentation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
copyright
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
 COPYRIGHT (c) 1988 by Claus Gittinger
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   826
	      All Rights Reserved
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
 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
   829
 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
   830
 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
   831
 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
   832
 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
   833
 hereby transferred.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
documentation
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
    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
   840
    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
   841
    things available here in your applications 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
    - 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
   843
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   844
    (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
   845
     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
   846
     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
   847
     You decide - portability vs. functionality)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
    [Class variables:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   851
	HostName        <String>        remembered hostname
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   852
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   853
	DomainName      <String>        remembered domainname
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   854
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   855
	SlowFork        <Boolean>       if set, fork and popen are avoided;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   856
					(more or less obsolete now)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   857
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   858
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   859
	CurrentDirectory <String>       remembered currentDirectories path
3496
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
    [author:]
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   862
	Claus Gittinger
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
    [see also:]
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   865
	OSProcessStatus
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   866
	Filename Date Time
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   867
	ExternalStream FileStream PipeStream Socket
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   868
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   869
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   870
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
examples
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
  various queries
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   874
								[exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
    Transcript 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   876
	showCR:'hello ' , (OperatingSystem getLoginName)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   877
								[exEnd]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   878
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   879
								[exBegin]
3793
aff27e755ffd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3780
diff changeset
   880
    OperatingSystem isUNIXlike ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   881
	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
   882
    ] ifFalse:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   883
	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
   884
    ]
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   885
								[exEnd]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   886
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   887
								[exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
    Transcript 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   889
	showCR:'this machine is called ' , OperatingSystem getHostName
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   890
								[exEnd]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   891
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   892
								[exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   893
    Transcript 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   894
	showCR:('this machine is in the '
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   895
	       , OperatingSystem getDomainName
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   896
	       , ' domain')
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   897
								[exEnd]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   898
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   899
								[exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
    Transcript 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   901
	showCR:('this machine''s CPU is a '
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   902
	       , OperatingSystem getCPUType
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   903
	       )
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   904
								[exEnd]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   905
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   906
								[exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
    Transcript showCR:'executing ls command ...'.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
   908
    OperatingSystem executeCommand:'ls'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
    Transcript showCR:'... done.'.
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   910
								[exEnd]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
  locking a file 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
  (should be executed on two running smalltalks - not in two threads):
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   914
								[exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
    |f|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
    f := 'testFile' asFilename readWriteStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   919
    10 timesRepeat:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   920
	'about to lock ...' printCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   921
	[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   922
	  OperatingSystem 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   923
	    lockFD:(f fileDescriptor)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   924
	    shared:false
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   925
	    blocking:false
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   926
	] whileFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   927
	    'process ' print. OperatingSystem getProcessId print. ' is waiting' printCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   928
	    Delay waitForSeconds:1
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   929
	].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   930
	'LOCKED ...' printCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   931
	Delay waitForSeconds:10.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   932
	'unlock ...' printCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   933
	(OperatingSystem 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   934
	    unlockFD:(f fileDescriptor)) printCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   935
	Delay waitForSeconds:3.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
    ]
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   937
								[exBegin]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   938
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   939
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   940
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   941
!UnixOperatingSystem class methodsFor:'initialization'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   942
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   943
initialize
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
    "initialize the class"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
    ObjectMemory addDependent:self.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
    HostName := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
    DomainName := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
    LastErrorNumber := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
    PipeFailed := false.
4395
53122eb3ce70 clear ForkFailed flag; made it a classVar
Claus Gittinger <cg@exept.de>
parents: 4380
diff changeset
   951
    ForkFailed := false.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
    SlowFork := false.
3943
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   953
    CurrentDirectory := nil.
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   954
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   955
    "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
   956
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
update:something with:aParameter from:changedObject
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
    "catch image restart and flush some cached data"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
    something == #earlyRestart ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   962
	"
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   963
	 flush cached data/info
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   964
	"
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   965
	HostName := nil.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   966
	DomainName := nil.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   967
	LastErrorNumber := nil.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   968
	PipeFailed := false.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   969
	SlowFork := false.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   970
	ForkFailed := false.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
   971
	CurrentDirectory := nil.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   972
    ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   973
3943
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   974
    "Created: / 15.6.1996 / 15:22:37 / cg"
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   975
    "Modified: / 7.1.1997 / 19:36:11 / stefan"
318e1c4c609a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
   976
    "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
   977
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   978
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   979
!UnixOperatingSystem class methodsFor:'OS signal constants'!
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
sigABRT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
    "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
   983
     (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
   984
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   985
    ^ self signalNamed:#SIGABRT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   986
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
     OperatingSystem sigABRT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   989
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
!
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
sigALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   993
    "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
   994
     (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
   995
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   996
    ^ self signalNamed:#SIGALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
   997
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
     OperatingSystem sigALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1000
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1001
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
sigBREAK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1004
    "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
  1005
     This is an MSDOS specific signal"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1006
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1007
    ^ self signalNamed:#SIGBREAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1008
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
     OperatingSystem sigBREAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1011
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1012
!
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
sigBUS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1015
    "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
  1016
     (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
  1017
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1018
    ^ self signalNamed:#SIGBUS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1019
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
     OperatingSystem sigBUS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1022
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1023
!
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
sigCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
    "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
  1027
     (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
  1028
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1029
    ^ self signalNamed:#SIGCHLD
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1030
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
     OperatingSystem sigCHLD
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1033
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1034
!
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
sigCONT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1037
    "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
  1038
     (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
  1039
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1040
    ^ self signalNamed:#SIGCONT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1041
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
     OperatingSystem sigCONT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1044
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1045
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1046
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1047
sigDANGER
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1048
    "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
  1049
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1050
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1051
    ^ self signalNamed:#SIGDANGER
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1052
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
     OperatingSystem sigDANGER
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1055
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1056
!
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
sigEMT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1059
    "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
  1060
     (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
  1061
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1062
    ^ self signalNamed:#SIGEMT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1063
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
     OperatingSystem sigEMT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1066
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1067
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1068
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1069
sigFP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
    "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
  1071
     (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
  1072
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1073
    ^ self signalNamed:#SIGFPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1074
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
     OperatingSystem sigFP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1077
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1078
!
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
sigGRANT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1081
    "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
  1082
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1083
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1084
    ^ self signalNamed:#SIGGRANT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1085
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
     OperatingSystem sigGRANT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1088
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1089
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1090
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1091
sigHUP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1092
    "return the signal number for SIGHUP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1093
     (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
  1094
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1095
    ^ self signalNamed:#SIGHUP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1096
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1097
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1098
     OperatingSystem sigHUP
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1101
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1102
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1103
sigILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1104
    "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
  1105
     (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
  1106
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1107
    ^ self signalNamed:#SIGILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1108
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
     OperatingSystem sigILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1111
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1112
!
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
sigINT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1115
    "return the signal number for SIGINT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1116
     (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
  1117
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1118
    ^ self signalNamed:#SIGINT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1119
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
     OperatingSystem sigINT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1122
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1123
!
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
sigIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1126
    "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
  1127
     (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
  1128
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1129
    ^ self signalNamed:#SIGIO
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1130
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
     OperatingSystem sigIO
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1133
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1134
!
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
sigIOT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
    "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
  1138
     (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
  1139
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1140
    ^ self signalNamed:#SIGIOT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1141
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
     OperatingSystem sigIOT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1144
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1145
!
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
sigKILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1148
    "return the signal number for SIGKILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1149
     (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
  1150
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1151
    ^ self signalNamed:#SIGKILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1152
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
     OperatingSystem sigKILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1155
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1156
!
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
sigLOST
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1159
    "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
  1160
     (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
  1161
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1162
    ^ self signalNamed:#SIGLOST
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1163
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
     OperatingSystem sigLOST
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1166
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1167
!
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
sigMIGRATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1170
    "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
  1171
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1172
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1173
    ^ self signalNamed:#SIGMIGRATE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1174
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
     OperatingSystem sigMIGRATE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1177
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1178
!
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
sigMSG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1181
    "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
  1182
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1183
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1184
    ^ self signalNamed:#SIGMSG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1185
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
     OperatingSystem sigMSG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1188
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1189
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1190
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1191
sigPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1192
    "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
  1193
     (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
  1194
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1195
    ^ self signalNamed:#SIGPIPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1196
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1197
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1198
     OperatingSystem sigPIPE
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1201
!
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
sigPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1204
    "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
  1205
     (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
  1206
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1207
    ^ self signalNamed:#SIGPOLL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1208
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
     OperatingSystem sigPOLL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1211
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1213
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1214
sigPRE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1215
    "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
  1216
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1218
    ^ self signalNamed:#SIGPRE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1219
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
     OperatingSystem sigPRE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1222
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1223
!
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
sigPROF
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1226
    "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
  1227
     (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
  1228
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1229
    ^ self signalNamed:#SIGPROF
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1230
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
     OperatingSystem sigPROF
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1233
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1234
!
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
sigPWR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1237
    "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
  1238
     (not available on all systems)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1239
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1240
    ^ self signalNamed:#SIGPWR
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1241
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
     OperatingSystem sigPWR
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1244
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1245
!
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
sigQUIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1248
    "return the signal number for SIGQUIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1249
     (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
  1250
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1251
    ^ self signalNamed:#SIGQUIT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1252
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
     OperatingSystem sigQUIT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1255
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1256
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1257
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
sigRETRACT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
    "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
  1260
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1262
    ^ self signalNamed:#SIGRETRACT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1263
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1264
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1265
     OperatingSystem sigRETRACT
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1269
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1270
sigSAK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
    "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
  1272
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1273
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1274
    ^ self signalNamed:#SIGSAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1275
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1276
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1277
     OperatingSystem sigSAK
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1280
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1281
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1282
sigSEGV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1283
    "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
  1284
     (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
  1285
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1286
    ^ self signalNamed:#SIGSEGV
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1287
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1288
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1289
     OperatingSystem sigSEGV
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1292
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1293
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
sigSOUND
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1295
    "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
  1296
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1298
    ^ self signalNamed:#SIGSOUND
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1299
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1300
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1301
     OperatingSystem sigSOUND
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1304
!
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
sigSTOP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1307
    "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
  1308
     (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
  1309
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1310
    ^ self signalNamed:#SIGSTOP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1311
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
     OperatingSystem sigSTOP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1314
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1315
!
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
sigSYS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1318
    "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
  1319
     (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
  1320
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1321
    ^ self signalNamed:#SIGSYS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1322
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
     OperatingSystem sigSYS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1325
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1326
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1327
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1328
sigTERM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1329
    "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
  1330
     (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
  1331
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1332
    ^ self signalNamed:#SIGTERM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1333
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1334
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1335
     OperatingSystem sigTERM
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1338
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1339
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1340
sigTRAP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1341
    "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
  1342
     (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
  1343
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1344
    ^ self signalNamed:#SIGTRAP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1345
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
     OperatingSystem sigTRAP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1348
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
!
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
sigTSTP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1352
    "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
  1353
     (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
  1354
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1355
    ^ self signalNamed:#SIGTSTP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1356
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
     OperatingSystem sigTSTP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1359
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1360
!
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
sigTTIN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1363
    "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
  1364
     (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
  1365
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1366
    ^ self signalNamed:#SIGTTIN
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1367
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
     OperatingSystem sigTTIN
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1370
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1371
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1372
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1373
sigTTOU
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1374
    "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
  1375
     (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
  1376
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1377
    ^ self signalNamed:#SIGTTOU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1378
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
     OperatingSystem sigTTOU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1381
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1382
!
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
sigURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1385
    "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
  1386
     (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
  1387
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1388
    ^ self signalNamed:#SIGURG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1389
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
     OperatingSystem sigURG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1392
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1393
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1394
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1395
sigUSR1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1396
    "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
  1397
     (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
  1398
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1399
    ^ self signalNamed:#SIGUSR1
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1400
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
     OperatingSystem sigUSR1
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1403
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1404
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1405
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1406
sigUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1407
    "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
  1408
     (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
  1409
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1410
    ^ self signalNamed:#SIGUSR2
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1411
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
     OperatingSystem sigUSR2
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1414
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1415
!
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
sigVTALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
    "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
  1419
     (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
  1420
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1421
    ^ self signalNamed:#SIGVTALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1422
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
     OperatingSystem sigVTALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1425
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1426
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1427
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1428
sigWINCH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1429
    "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
  1430
     (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
  1431
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1432
    ^ self signalNamed:#SIGWINCH
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1433
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1434
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1435
     OperatingSystem sigWINCH
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1438
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1439
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
sigXCPU
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1441
    "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
  1442
     (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
  1443
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1444
    ^ self signalNamed:#SIGXCPU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1445
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1446
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1447
     OperatingSystem sigXCPU
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
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1450
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1451
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1452
sigXFSZ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1453
    "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
  1454
     (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
  1455
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1456
    ^ self signalNamed:#SIGXFSZ
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1457
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1458
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1459
     OperatingSystem sigXFSZ
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1460
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1461
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1462
!
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1463
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1464
signalNamed:signalName
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1465
    "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
  1466
     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
  1467
     (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
  1468
      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
  1469
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1470
%{  /* NOCONTEXT */
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1471
#ifdef SIGABRT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1472
    if (signalName == @symbol(SIGABRT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1473
	RETURN ( __MKSMALLINT(SIGABRT) );
5404
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 SIGALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1477
    if (signalName == @symbol(SIGALRM)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1478
	RETURN ( __MKSMALLINT(SIGALRM) );
5404
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 SIGBREAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1482
    if (signalName == @symbol(SIGBREAK)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1483
	RETURN ( __MKSMALLINT(SIGBREAK) );
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1484
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1485
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1486
#ifdef SIGBUS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1487
    if (signalName == @symbol(SIGBUS)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1488
	RETURN ( __MKSMALLINT(SIGBUS) );
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1489
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1490
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1491
#ifdef SIGCHLD
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1492
    if ((signalName == @symbol(SIGCHLD))
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1493
     || (signalName == @symbol(SIGCLD)) ) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1494
	RETURN ( __MKSMALLINT(SIGCHLD) );
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1495
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1496
#else
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1497
# if defined(SIGCLD)
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1498
    if ((signalName == @symbol(SIGCHLD))
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1499
     || (signalName == @symbol(SIGCLD)) ) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1500
	RETURN ( __MKSMALLINT(SIGCLD) );
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1501
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1502
# endif
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 SIGCONT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1505
    if (signalName == @symbol(SIGCONT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1506
	RETURN ( __MKSMALLINT(SIGCONT) );
5404
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 SIGDANGER
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1510
    if (signalName == @symbol(SIGDANGER)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1511
	RETURN ( __MKSMALLINT(SIGDANGER) );
5404
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 SIGEMT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1515
    if (signalName == @symbol(SIGEMT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1516
	RETURN ( __MKSMALLINT(SIGEMT) );
5404
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 SIGFPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1520
    if (signalName == @symbol(SIGFPE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1521
	RETURN ( __MKSMALLINT(SIGFPE) );
5404
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 SIGGRANT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1525
    if (signalName == @symbol(SIGGRANT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1526
	RETURN ( __MKSMALLINT(SIGGRANT) );
5404
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 SIGHUP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1530
    if (signalName == @symbol(SIGHUP)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1531
	RETURN ( __MKSMALLINT(SIGHUP) );
5404
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 SIGILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1535
    if (signalName == @symbol(SIGILL)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1536
	RETURN ( __MKSMALLINT(SIGILL) );
5404
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 SIGINT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1540
    if (signalName == @symbol(SIGINT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1541
	RETURN ( __MKSMALLINT(SIGINT) );
5404
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 SIGIO
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1545
    if (signalName == @symbol(SIGIO)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1546
	RETURN ( __MKSMALLINT(SIGIO) );
5404
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 SIGIOT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1550
    if (signalName == @symbol(SIGIOT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1551
	RETURN ( __MKSMALLINT(SIGIOT) );
5404
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 SIGKILL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1555
    if (signalName == @symbol(SIGKILL)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1556
	RETURN ( __MKSMALLINT(SIGKILL) );
5404
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 SIGLOST
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1560
    if (signalName == @symbol(SIGLOST)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1561
	RETURN ( __MKSMALLINT(SIGLOST) );
5404
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 SIGMIGRATE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1565
    if (signalName == @symbol(SIGMIGRATE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1566
	RETURN ( __MKSMALLINT(SIGMIGRATE) );
5404
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 SIGMSG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1570
    if (signalName == @symbol(SIGMSG)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1571
	RETURN ( __MKSMALLINT(SIGMSG) );
5404
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 SIGPIPE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1575
    if (signalName == @symbol(SIGPIPE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1576
	RETURN ( __MKSMALLINT(SIGPIPE) );
5404
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 SIGPOLL
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1580
    if (signalName == @symbol(SIGPOLL)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1581
	RETURN ( __MKSMALLINT(SIGPOLL) );
5404
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 SIGPRE
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1585
    if (signalName == @symbol(SIGPRE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1586
	RETURN ( __MKSMALLINT(SIGPRE) );
5404
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 SIGPROF
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1590
    if (signalName == @symbol(SIGPROF)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1591
	RETURN ( __MKSMALLINT(SIGPROF) );
5404
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 SIGPWR
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1595
    if (signalName == @symbol(SIGPWR)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1596
	RETURN ( __MKSMALLINT(SIGPWR) );
5404
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 SIGQUIT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1600
    if (signalName == @symbol(SIGQUIT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1601
	RETURN ( __MKSMALLINT(SIGQUIT) );
5404
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 SIGRETRACT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1605
    if (signalName == @symbol(SIGRETRACT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1606
	RETURN ( __MKSMALLINT(SIGRETRACT) );
5404
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 SIGSAK
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1610
    if (signalName == @symbol(SIGSAK)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1611
	RETURN ( __MKSMALLINT(SIGSAK) );
5404
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 SIGSEGV
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1615
    if (signalName == @symbol(SIGSEGV)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1616
	RETURN ( __MKSMALLINT(SIGSEGV) );
5404
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 SIGSOUND
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1620
    if (signalName == @symbol(SIGSOUND)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1621
	RETURN ( __MKSMALLINT(SIGSOUND) );
5404
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 SIGSTOP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1625
    if (signalName == @symbol(SIGSTOP)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1626
	RETURN ( __MKSMALLINT(SIGSTOP) );
5404
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 SIGSYS
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1630
    if (signalName == @symbol(SIGSYS)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1631
	RETURN ( __MKSMALLINT(SIGSYS) );
5404
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 SIGTERM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1635
    if (signalName == @symbol(SIGTERM)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1636
	RETURN ( __MKSMALLINT(SIGTERM) );
5404
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 SIGTRAP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1640
    if (signalName == @symbol(SIGTRAP)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1641
	RETURN ( __MKSMALLINT(SIGTRAP) );
5404
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 SIGTSTP
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1645
    if (signalName == @symbol(SIGTSTP)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1646
	RETURN ( __MKSMALLINT(SIGTSTP) );
5404
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 SIGTTIN
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1650
    if (signalName == @symbol(SIGTTIN)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1651
	RETURN ( __MKSMALLINT(SIGTTIN) );
5404
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 SIGTTOU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1655
    if (signalName == @symbol(SIGTTOU)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1656
	RETURN ( __MKSMALLINT(SIGTTOU) );
5404
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 SIGURG
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1660
    if (signalName == @symbol(SIGURG)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1661
	RETURN ( __MKSMALLINT(SIGURG) );
5404
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 SIGUSR1
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1665
    if (signalName == @symbol(SIGUSR1)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1666
	RETURN ( __MKSMALLINT(SIGUSR1) );
5404
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 SIGUSR2
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1670
    if (signalName == @symbol(SIGUSR2)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1671
	RETURN ( __MKSMALLINT(SIGUSR2) );
5404
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 SIGVTALRM
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1675
    if (signalName == @symbol(SIGVTALRM)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1676
	RETURN ( __MKSMALLINT(SIGVTALRM) );
5404
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 SIGWINCH
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1680
    if (signalName == @symbol(SIGWINCH)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1681
	RETURN ( __MKSMALLINT(SIGWINCH) );
5404
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
#ifdef SIGXCPU
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1685
    if (signalName == @symbol(SIGXCPU)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1686
	RETURN ( __MKSMALLINT(SIGXCPU) );
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
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1689
#ifdef SIGXFSZ
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1690
    if (signalName == @symbol(SIGXFSZ)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1691
	RETURN ( __MKSMALLINT(SIGXFSZ) );
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1692
    }
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1693
#endif
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1694
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1695
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1696
%}
5404
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1697
    "
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1698
     OperatingSystem signalNamed:#SIGABRT
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1699
     OperatingSystem signalNamed:#SIGCHLD
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1700
     OperatingSystem signalNamed:#SIGXFSZ
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1701
     OperatingSystem signalNamed:#SIGSOUND
633f3ccac244 reduced the number of primitives
Claus Gittinger <cg@exept.de>
parents: 5233
diff changeset
  1702
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1703
! !
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
!UnixOperatingSystem class methodsFor:'error messages'!
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
currentErrorNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1708
    "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
  1709
     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
  1710
     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
  1711
     request to the OS.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1712
     Use lastErrorNumber - currentErrorNumber is invalidated by
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1713
     many, many internal calls."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1714
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1715
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1716
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1717
     RETURN ( __MKSMALLINT(errno) );
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
     "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  1720
      OperatingSystem currentErrorNumber
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1724
errorNumberFor:aSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1725
    "given a symbolic error, return the numeric;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1727
     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
  1728
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1729
%{   /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1730
    OBJ sym = aSymbol;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1731
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1732
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
     * POSIX errnos - these should be defined
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
#ifdef EPERM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
    if (sym == @symbol(EPERM)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1737
	RETURN ( __MKSMALLINT(EPERM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1738
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1739
#endif
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
#ifdef ENOENT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1742
    if (sym == @symbol(ENOENT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1743
	RETURN ( __MKSMALLINT(ENOENT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1744
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1745
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1746
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1747
#ifdef ESRCH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1748
    if (sym == @symbol(ESRCH)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1749
	RETURN ( __MKSMALLINT(ESRCH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1750
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1751
#endif
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
#ifdef EINTR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1754
    if (sym == @symbol(EINTR)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1755
	RETURN ( __MKSMALLINT(EINTR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1756
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1757
#endif
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
#ifdef EIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1760
    if (sym == @symbol(EIO)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1761
	RETURN ( __MKSMALLINT(EIO) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1763
#endif
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
#ifdef ENXIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1766
    if (sym == @symbol(ENXIO)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1767
	RETURN ( __MKSMALLINT(ENXIO) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1768
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1769
#endif
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
#ifdef E2BIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1772
    if (sym == @symbol(E2BIG)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1773
	RETURN ( __MKSMALLINT(E2BIG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1774
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1775
#endif
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
#ifdef ENOEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1778
    if (sym == @symbol(ENOEXEC)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1779
	RETURN ( __MKSMALLINT(ENOEXEC) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1780
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1781
#endif
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
#ifdef EBADF
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1784
    if (sym == @symbol(EBADF)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1785
	RETURN ( __MKSMALLINT(EBADF) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1786
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1787
#endif
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
#ifdef ECHILD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1790
    if (sym == @symbol(ECHILD)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1791
	RETURN ( __MKSMALLINT(ECHILD) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1792
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1793
#endif
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
#if defined(EAGAIN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1796
    if (sym == @symbol(EAGAIN)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1797
	RETURN ( __MKSMALLINT(EAGAIN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1798
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1799
#endif
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
#ifdef ENOMEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1802
    if (sym == @symbol(ENOMEM)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1803
	RETURN ( __MKSMALLINT(ENOMEM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1804
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1805
#endif
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
#ifdef EACCES
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1808
    if (sym == @symbol(EACCES)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1809
	RETURN ( __MKSMALLINT(EACCES) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1810
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1811
#endif
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
#ifdef EFAULT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1814
    if (sym == @symbol(EFAULT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1815
	RETURN ( __MKSMALLINT(EFAULT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1816
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1817
#endif
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
#ifdef EBUSY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1820
    if (sym == @symbol(EBUSY)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1821
	RETURN ( __MKSMALLINT(EBUSY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1822
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1823
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1824
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1825
#ifdef EXDEV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1826
    if (sym == @symbol(EXDEV)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1827
	RETURN ( __MKSMALLINT(EXDEV) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1828
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1829
#endif
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
#ifdef ENODEV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1832
    if (sym == @symbol(ENODEV)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1833
	RETURN ( __MKSMALLINT(ENODEV) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1834
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1835
#endif
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
#ifdef ENOTDIR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1838
    if (sym == @symbol(ENOTDIR)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1839
	RETURN ( __MKSMALLINT(ENOTDIR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1840
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1841
#endif
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
#ifdef EISDIR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1844
    if (sym == @symbol(EISDIR)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1845
	RETURN ( __MKSMALLINT(EISDIR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1846
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1847
#endif
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
#ifdef EINVAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1850
    if (sym == @symbol(EINVAL)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1851
	RETURN ( __MKSMALLINT(EINVAL) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1852
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1853
#endif
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
#ifdef ENFILE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1856
    if (sym == @symbol(ENFILE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1857
	RETURN ( __MKSMALLINT(ENFILE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1858
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1859
#endif
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
#ifdef EMFILE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1862
    if (sym == @symbol(EMFILE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1863
	RETURN ( __MKSMALLINT(EMFILE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1864
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1865
#endif
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
#ifdef ENOTTY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1868
    if (sym == @symbol(ENOTTY)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1869
	RETURN ( __MKSMALLINT(ENOTTY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1870
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1871
#endif
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
#ifdef EFBIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1874
    if (sym == @symbol(EFBIG)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1875
	RETURN ( __MKSMALLINT(EFBIG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1876
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1877
#endif
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
#ifdef ENOSPC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1880
    if (sym == @symbol(ENOSPC)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1881
	RETURN ( __MKSMALLINT(ENOSPC) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1882
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1883
#endif
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
#ifdef ESPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1886
    if (sym == @symbol(ESPIPE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1887
	RETURN ( __MKSMALLINT(ESPIPE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1888
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1889
#endif
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
#ifdef EROFS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1892
    if (sym == @symbol(EROFS)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1893
	RETURN ( __MKSMALLINT(EROFS) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1894
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1895
#endif
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
#ifdef EMLINK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1898
    if (sym == @symbol(EMLINK)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1899
	RETURN ( __MKSMALLINT(EMLINK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1900
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1901
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1902
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1903
#ifdef EPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1904
    if (sym == @symbol(EPIPE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1905
	RETURN ( __MKSMALLINT(EPIPE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1906
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1907
#endif
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
#ifdef EDOM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1910
    if (sym == @symbol(EDOM)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1911
	RETURN ( __MKSMALLINT(EDOM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1912
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1913
#endif
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
#ifdef ERANGE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1916
    if (sym == @symbol(ERANGE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1917
	RETURN ( __MKSMALLINT(ERANGE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1918
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1919
#endif
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
#ifdef EDEADLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1922
    if (sym == @symbol(EDEADLK)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1923
	RETURN ( __MKSMALLINT(EDEADLK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1924
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1925
#endif
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
#ifdef ENAMETOOLONG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1928
    if (sym == @symbol(ENAMETOOLONG)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1929
	RETURN ( __MKSMALLINT(ENAMETOOLONG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1930
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1931
#endif
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
#ifdef ENOLCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1934
    if (sym == @symbol(ENOLCK)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1935
	RETURN ( __MKSMALLINT(ENOLCK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1936
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1937
#endif
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
#ifdef ENOSYS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1940
    if (sym == @symbol(ENOSYS)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1941
	RETURN ( __MKSMALLINT(ENOSYS) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1942
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1943
#endif
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
#ifdef ENOTEMPTY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1946
    if (sym == @symbol(ENOTEMPTY)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1947
	RETURN ( __MKSMALLINT(ENOTEMPTY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1948
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1949
#endif
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
#ifdef EEXIST
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1952
    if (sym == @symbol(EEXIST)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1953
	RETURN ( __MKSMALLINT(EEXIST) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1954
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1955
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1956
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1957
#ifdef EILSEQ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1958
    if (sym == @symbol(EILSEQ)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1959
	RETURN ( __MKSMALLINT(EILSEQ) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1960
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1961
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1962
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1963
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1964
     * XPG3 errnos - defined on most systems
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1965
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1966
#ifdef ENOTBLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1967
    if (sym == @symbol(ENOTBLK)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1968
	RETURN ( __MKSMALLINT(ENOTBLK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1969
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1970
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1971
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1972
#ifdef ETXTBSY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1973
    if (sym == @symbol(ETXTBSY)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1974
	RETURN ( __MKSMALLINT(ETXTBSY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1975
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1976
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1977
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1978
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1979
     * some others
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
#ifdef EWOULDBLOCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1982
    if (sym == @symbol(EWOULDBLOCK)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1983
	RETURN ( __MKSMALLINT(EWOULDBLOCK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1984
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1985
#endif
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
#ifdef ENOMSG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1988
    if (sym == @symbol(ENOMSG)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1989
	RETURN ( __MKSMALLINT(ENOMSG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1990
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1991
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1992
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1993
#ifdef ELOOP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1994
    if (sym == @symbol(ELOOP)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  1995
	RETURN ( __MKSMALLINT(ELOOP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1996
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1997
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1998
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1999
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2000
     * some stream errors
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2001
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2002
#ifdef ETIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2003
    if (sym == @symbol(ETIME)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2004
	RETURN ( __MKSMALLINT(ETIME) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2005
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2006
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2007
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2008
#ifdef ENOSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2009
    if (sym == @symbol(ENOSR)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2010
	RETURN ( __MKSMALLINT(ENOSR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2011
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2012
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2013
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2014
#ifdef ENOSTR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2015
    if (sym == @symbol(ENOSTR)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2016
	RETURN ( __MKSMALLINT(ENOSTR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2017
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2018
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2019
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2020
#ifdef ECOMM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2021
    if (sym == @symbol(ECOMM)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2022
	RETURN ( __MKSMALLINT(ECOMM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2023
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2024
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2025
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2026
#ifdef EPROTO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2027
    if (sym == @symbol(EPROTO)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2028
	RETURN ( __MKSMALLINT(EPROTO) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2029
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2030
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2031
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2032
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2033
     * nfs errors
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
#ifdef ESTALE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2036
    if (sym == @symbol(ESTALE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2037
	RETURN ( __MKSMALLINT(ESTALE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2038
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2039
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2041
#ifdef EREMOTE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2042
    if (sym == @symbol(EREMOTE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2043
	RETURN ( __MKSMALLINT(EREMOTE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2044
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2045
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2046
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2047
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2048
     * some networking errors
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2049
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2050
#ifdef EINPROGRESS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2051
    if (sym == @symbol(EINPROGRESS)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2052
	RETURN ( __MKSMALLINT(EINPROGRESS) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2053
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2054
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2055
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2056
#ifdef EALREADY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2057
    if (sym == @symbol(EALREADY)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2058
	RETURN ( __MKSMALLINT(EALREADY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2059
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2060
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2061
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2062
#ifdef ENOTSOCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2063
    if (sym == @symbol(ENOTSOCK)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2064
	RETURN ( __MKSMALLINT(ENOTSOCK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2065
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2066
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2067
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2068
#ifdef EDESTADDRREQ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2069
    if (sym == @symbol(EDESTADDRREQ)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2070
	RETURN ( __MKSMALLINT(EDESTADDRREQ) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2071
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2072
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2073
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2074
#ifdef EMSGSIZE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2075
    if (sym == @symbol(EMSGSIZE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2076
	RETURN ( __MKSMALLINT(EMSGSIZE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2077
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2078
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2079
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2080
#ifdef EPROTOTYPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2081
    if (sym == @symbol(EPROTOTYPE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2082
	RETURN ( __MKSMALLINT(EPROTOTYPE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2083
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2084
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2085
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2086
#ifdef ENOPROTOOPT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2087
    if (sym == @symbol(ENOPROTOOPT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2088
	RETURN ( __MKSMALLINT(ENOPROTOOPT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2089
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2090
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2091
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2092
#ifdef EPROTONOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2093
    if (sym == @symbol(EPROTONOSUPPORT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2094
	RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2095
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2096
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2097
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2098
#ifdef ESOCKTNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2099
    if (sym == @symbol(ESOCKTNOSUPPORT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2100
	RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2101
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2102
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2103
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2104
#ifdef EOPNOTSUPP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2105
    if (sym == @symbol(EOPNOTSUPP)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2106
	RETURN ( __MKSMALLINT(EOPNOTSUPP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2107
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2108
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2109
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2110
#ifdef EPFNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2111
    if (sym == @symbol(EPFNOSUPPORT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2112
	RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2113
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2114
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2115
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2116
#ifdef EAFNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2117
    if (sym == @symbol(EAFNOSUPPORT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2118
	RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2119
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2120
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2121
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2122
#ifdef EADDRINUSE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2123
    if (sym == @symbol(EADDRINUSE)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2124
	RETURN ( __MKSMALLINT(EADDRINUSE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2125
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2126
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2127
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2128
#ifdef EADDRNOTAVAIL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2129
    if (sym == @symbol(EADDRNOTAVAIL)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2130
	RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2131
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2132
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2133
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2134
#ifdef ETIMEDOUT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2135
    if (sym == @symbol(ETIMEDOUT)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2136
	RETURN ( __MKSMALLINT(ETIMEDOUT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2137
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2138
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2139
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2140
#ifdef ECONNREFUSED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2141
    if (sym == @symbol(ECONNREFUSED)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2142
	RETURN ( __MKSMALLINT(ECONNREFUSED) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2143
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2144
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2145
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2146
#ifdef ENETDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2147
    if (sym == @symbol(ENETDOWN)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2148
	RETURN ( __MKSMALLINT(ENETDOWN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2149
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2150
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2151
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2152
#ifdef ENETUNREACH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2153
    if (sym == @symbol(ENETUNREACH)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2154
	RETURN ( __MKSMALLINT(ENETUNREACH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2155
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2156
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2157
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2158
#ifdef ENETRESET
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2159
    if (sym == @symbol(ENETRESET)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2160
	RETURN ( __MKSMALLINT(ENETRESET) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2161
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2162
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2163
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2164
#ifdef ECONNABORTED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2165
    if (sym == @symbol(ECONNABORTED)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2166
	RETURN ( __MKSMALLINT(ECONNABORTED) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2167
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2168
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2169
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2170
#ifdef ECONNRESET
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2171
    if (sym == @symbol(ECONNRESET)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2172
	RETURN ( __MKSMALLINT(ECONNRESET) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2173
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2174
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2175
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2176
#ifdef EISCONN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2177
    if (sym == @symbol(EISCONN)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2178
	RETURN ( __MKSMALLINT(EISCONN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2179
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2180
#endif
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
#ifdef ENOTCONN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2183
    if (sym == @symbol(ENOTCONN)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2184
	RETURN ( __MKSMALLINT(ENOTCONN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2185
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2186
#endif
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
#ifdef ESHUTDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2189
    if (sym == @symbol(ESHUTDOWN)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2190
	RETURN ( __MKSMALLINT(ESHUTDOWN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2191
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2192
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2193
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2194
#ifdef EHOSTDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2195
    if (sym == @symbol(EHOSTDOWN)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2196
	RETURN ( __MKSMALLINT(EHOSTDOWN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2197
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2198
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2199
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2200
#ifdef EHOSTUNREACH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2201
    if (sym == @symbol(EHOSTUNREACH)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2202
	RETURN ( __MKSMALLINT(EHOSTUNREACH) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2203
    }
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2204
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2205
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2206
    ^ -1
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2209
errorSymbolAndTextForNumber:errNr
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2210
    "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
  2211
     (as returned by a system call). 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2212
     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
  2213
     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
  2214
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2215
    |sym text|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2216
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2217
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2218
    /* claus:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2219
     * 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
  2220
     * standard across unixes
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2221
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2222
    char *msg = "unknown error";
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2223
    char buffer[128];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2224
    OBJ eno = errNr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2225
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2226
    if (__isSmallInteger(eno)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2227
	switch (__intVal(eno)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2228
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2229
	     * POSIX errnos - these should be defined
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2230
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2231
#ifdef EPERM
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2232
	    case EPERM:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2233
		msg = "Operation not permitted";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2234
		sym = @symbol(EPERM);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2235
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2236
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2237
#ifdef ENOENT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2238
	    case ENOENT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2239
		msg = "No such file or directory";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2240
		sym = @symbol(ENOENT);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2241
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2242
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2243
#ifdef ESRCH
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2244
	    case ESRCH:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2245
		msg = "No such process";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2246
		sym = @symbol(ESRCH);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2247
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2248
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2249
#ifdef EINTR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2250
	    case EINTR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2251
		msg = "Interrupted system call";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2252
		sym = @symbol(EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2253
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2254
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2255
#ifdef EIO
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2256
	    case EIO:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2257
		msg = "I/O error";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2258
		sym = @symbol(EIO);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2259
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2260
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2261
#ifdef ENXIO
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2262
	    case ENXIO:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2263
		msg = "No such device or address";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2264
		sym = @symbol(ENXIO);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2265
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2266
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2267
#ifdef E2BIG
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2268
	    case E2BIG:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2269
		msg = "Arg list too long";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2270
		sym = @symbol(E2BIG);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2271
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2272
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2273
#ifdef ENOEXEC
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2274
	    case ENOEXEC:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2275
		msg = "Exec format error";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2276
		sym = @symbol(ENOEXEC);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2277
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2278
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2279
#ifdef EBADF
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2280
	    case EBADF:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2281
		msg = "Bad file number";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2282
		sym = @symbol(EBADF);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2283
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2284
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2285
#ifdef ECHILD
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2286
	    case ECHILD:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2287
		msg = "No child processes";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2288
		sym = @symbol(ECHILD);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2289
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2290
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2291
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2292
	    case EAGAIN:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2293
		msg = "Try again";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2294
		sym = @symbol(EAGAIN);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2295
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2296
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2297
#ifdef ENOMEM
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2298
	    case ENOMEM:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2299
		msg = "Out of memory";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2300
		sym = @symbol(ENOMEM);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2301
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2302
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2303
#ifdef EACCES
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2304
	    case EACCES:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2305
		msg = "Permission denied";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2306
		sym = @symbol(EACCES);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2307
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2308
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2309
#ifdef EFAULT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2310
	    case EFAULT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2311
		msg = "Bad address";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2312
		sym = @symbol(EFAULT);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2313
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2314
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2315
#ifdef EBUSY
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2316
	    case EBUSY:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2317
		msg = "Device or resource busy";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2318
		sym = @symbol(EBUSY);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2319
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2320
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2321
#ifdef EEXIST
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2322
	    case EEXIST:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2323
		msg = "File exists";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2324
		sym = @symbol(EEXIST);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2325
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2326
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2327
#ifdef EXDEV
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2328
	    case EXDEV:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2329
		msg = "Cross-device link";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2330
		sym = @symbol(EXDEV);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2331
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2332
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2333
#ifdef ENODEV
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2334
	    case ENODEV:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2335
		msg = "No such device";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2336
		sym = @symbol(ENODEV);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2337
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2338
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2339
#ifdef ENOTDIR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2340
	    case ENOTDIR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2341
		msg = "Not a directory";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2342
		sym = @symbol(ENOTDIR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2343
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2344
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2345
#ifdef EISDIR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2346
	    case EISDIR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2347
		msg = "Is a directory";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2348
		sym = @symbol(EISDIR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2349
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2350
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2351
#ifdef EINVAL
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2352
	    case EINVAL:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2353
		msg = "Invalid argument";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2354
		sym = @symbol(EINVAL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2355
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2356
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2357
#ifdef ENFILE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2358
	    case ENFILE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2359
		msg = "File table overflow";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2360
		sym = @symbol(ENFILE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2361
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2362
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2363
#ifdef EMFILE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2364
	    case EMFILE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2365
		msg = "Too many open files";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2366
		sym = @symbol(EMFILE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2367
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2368
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2369
#ifdef ENOTTY
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2370
	    case ENOTTY:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2371
		msg = "Not a typewriter";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2372
		sym = @symbol(ENOTTY);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2373
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2374
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2375
#ifdef EFBIG
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2376
	    case EFBIG:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2377
		msg = "File too large";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2378
		sym = @symbol(EFBIG);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2379
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2380
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2381
#ifdef ENOSPC
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2382
	    case ENOSPC:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2383
		msg = "No space left on device";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2384
		sym = @symbol(ENOSPC);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2385
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2386
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2387
#ifdef ESPIPE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2388
	    case ESPIPE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2389
		msg = "Illegal seek";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2390
		sym = @symbol(ESPIPE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2391
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2392
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2393
#ifdef EROFS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2394
	    case EROFS:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2395
		msg = "Read-only file system";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2396
		sym = @symbol(EROFS);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2397
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2398
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2399
#ifdef EMLINK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2400
	    case EMLINK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2401
		msg = "Too many links";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2402
		sym = @symbol(EMLINK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2403
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2404
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2405
#ifdef EPIPE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2406
	    case EPIPE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2407
		msg = "Broken pipe";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2408
		sym = @symbol(EPIPE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2409
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2410
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2411
#ifdef EDOM
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2412
	    case EDOM:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2413
		msg = "Math argument out of domain";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2414
		sym = @symbol(EDOM);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2415
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2416
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2417
#ifdef ERANGE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2418
	    case ERANGE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2419
		msg = "Math result not representable";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2420
		sym = @symbol(ERANGE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2421
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2422
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2423
#ifdef EDEADLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2424
# if EDEADLK != EWOULDBLOCK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2425
	    case EDEADLK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2426
		msg = "Resource deadlock would occur";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2427
		sym = @symbol(EDEADLK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2428
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2429
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2430
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2431
#ifdef ENAMETOOLONG
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2432
	    case ENAMETOOLONG:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2433
		msg = "File name too long";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2434
		sym = @symbol(ENAMETOOLONG);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2435
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2436
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2437
#ifdef ENOLCK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2438
	    case ENOLCK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2439
		msg = "No record locks available";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2440
		sym = @symbol(ENOLCK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2441
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2442
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2443
#ifdef ENOSYS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2444
	    case ENOSYS:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2445
		msg = "Function not implemented";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2446
		sym = @symbol(ENOSYS);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2447
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2448
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2449
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2450
	    case ENOTEMPTY:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2451
		msg = "Directory not empty";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2452
		sym = @symbol(ENOTEMPTY);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2453
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2454
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2455
#ifdef EILSEQ
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2456
	    case EILSEQ:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2457
		msg = "Illegal byte sequence";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2458
		sym = @symbol(EILSEQ);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2459
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2460
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2461
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2462
	     * XPG3 errnos - defined on most systems
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2463
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2464
#ifdef ENOTBLK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2465
	    case ENOTBLK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2466
		msg = "Block device required";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2467
		sym = @symbol(ENOTBLK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2468
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2469
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2470
#ifdef ETXTBSY
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2471
	    case ETXTBSY:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2472
		msg = "Text file busy";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2473
		sym = @symbol(ETXTBSY);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2474
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2475
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2476
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2477
	     * some others
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2478
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2479
#ifdef EWOULDBLOCK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2480
	    case EWOULDBLOCK:
3558
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  2481
# if defined(EAGAIN) && (EWOULDBLOCK == EAGAIN)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2482
		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
  2483
# else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2484
		msg = "Operation would block";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2485
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2486
		sym = @symbol(EWOULDBLOCK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2487
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2488
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2489
#ifdef ENOMSG
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2490
	    case ENOMSG:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2491
		msg = "No message of desired type";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2492
		sym = @symbol(ENOMSG);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2493
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2494
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2495
#ifdef ELOOP
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2496
	    case ELOOP:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2497
		msg = "Too many levels of symbolic links";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2498
		sym = @symbol(ELOOP);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2499
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2500
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2501
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2502
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2503
	     * some stream errors
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2504
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2505
#ifdef ETIME
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2506
	    case ETIME:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2507
		msg = "Timer expired";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2508
		sym = @symbol(ETIME);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2509
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2510
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2511
#ifdef ENOSR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2512
	    case ENOSR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2513
		msg = "Out of streams resources";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2514
		sym = @symbol(ENOSR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2515
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2516
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2517
#ifdef ENOSTR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2518
	    case ENOSTR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2519
		msg = "Device not a stream";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2520
		sym = @symbol(ENOSTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2521
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2522
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2523
#ifdef ECOMM
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2524
	    case ECOMM:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2525
		msg = "Communication error on send";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2526
		sym = @symbol(ECOMM);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2527
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2528
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2529
#ifdef EPROTO
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2530
	    case EPROTO:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2531
		msg = "Protocol error";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2532
		sym = @symbol(EPROTO);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2533
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2534
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2535
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2536
	     * nfs errors
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2537
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2538
#ifdef ESTALE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2539
	    case ESTALE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2540
		msg = "Stale NFS file handle";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2541
		sym = @symbol(ESTALE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2542
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2543
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2544
#ifdef EREMOTE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2545
	    case EREMOTE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2546
		msg = "Too many levels of remote in path";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2547
		sym = @symbol(EREMOTE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2548
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2549
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2550
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2551
	     * some networking errors
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2552
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2553
#ifdef EINPROGRESS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2554
	    case EINPROGRESS:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2555
		msg = "Operation now in progress";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2556
		sym = @symbol(EINPROGRESS);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2557
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2558
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2559
#ifdef EALREADY
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2560
	    case EALREADY:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2561
		msg = "Operation already in progress";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2562
		sym = @symbol(EALREADY);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2563
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2564
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2565
#ifdef ENOTSOCK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2566
	    case ENOTSOCK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2567
		msg = "Socket operation on non-socket";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2568
		sym = @symbol(ENOTSOCK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2569
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2570
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2571
#ifdef EDESTADDRREQ
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2572
	    case EDESTADDRREQ:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2573
		msg = "Destination address required";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2574
		sym = @symbol(EDESTADDRREQ);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2575
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2576
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2577
#ifdef EMSGSIZE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2578
	    case EMSGSIZE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2579
		msg = "Message too long";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2580
		sym = @symbol(EMSGSIZE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2581
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2582
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2583
#ifdef EPROTOTYPE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2584
	    case EPROTOTYPE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2585
		msg = "Protocol wrong type for socket";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2586
		sym = @symbol(EPROTOTYPE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2587
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2588
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2589
#ifdef ENOPROTOOPT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2590
	    case ENOPROTOOPT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2591
		msg = "Protocol not available";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2592
		sym = @symbol(ENOPROTOOPT);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2593
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2594
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2595
#ifdef EPROTONOSUPPORT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2596
	    case EPROTONOSUPPORT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2597
		msg = "Protocol not supported";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2598
		sym = @symbol(EPROTONOSUPPORT);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2599
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2600
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2601
#ifdef ESOCKTNOSUPPORT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2602
	    case ESOCKTNOSUPPORT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2603
		msg = "Socket type not supported";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2604
		sym = @symbol(ESOCKTNOSUPPORT);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2605
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2606
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2607
#ifdef EOPNOTSUPP
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2608
	    case EOPNOTSUPP:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2609
		msg = "Operation not supported on socket";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2610
		sym = @symbol(EOPNOTSUPP);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2611
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2612
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2613
#ifdef EPFNOSUPPORT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2614
	    case EPFNOSUPPORT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2615
		msg = "Protocol family not supported";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2616
		sym = @symbol(EPFNOSUPPORT);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2617
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2618
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2619
#ifdef EAFNOSUPPORT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2620
	    case EAFNOSUPPORT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2621
		msg = "Address family not supported by protocol family";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2622
		sym = @symbol(EAFNOSUPPORT);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2623
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2624
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2625
#ifdef EADDRINUSE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2626
	    case EADDRINUSE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2627
		msg = "Address already in use";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2628
		sym = @symbol(EADDRINUSE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2629
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2630
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2631
#ifdef EADDRNOTAVAIL
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2632
	    case EADDRNOTAVAIL:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2633
		msg = "Can\'t assign requested address";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2634
		sym = @symbol(EADDRNOTAVAIL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2635
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2636
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2637
#ifdef ETIMEDOUT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2638
	    case ETIMEDOUT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2639
		msg = "Connection timed out";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2640
		sym = @symbol(ETIMEDOUT);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2641
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2642
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2643
#ifdef ECONNREFUSED
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2644
	    case ECONNREFUSED:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2645
		msg = "Connection refused";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2646
		sym = @symbol(ECONNREFUSED);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2647
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2648
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2649
#ifdef ENETDOWN
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2650
	    case ENETDOWN:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2651
		msg = "Network is down";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2652
		sym = @symbol(ENETDOWN);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2653
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2654
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2655
#ifdef ENETUNREACH
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2656
	    case ENETUNREACH:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2657
		msg = "Network is unreachable";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2658
		sym = @symbol(ENETUNREACH);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2659
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2660
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2661
#ifdef ENETRESET
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2662
	    case ENETRESET:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2663
		msg = "Network dropped conn due to reset";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2664
		sym = @symbol(ENETRESET);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2665
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2666
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2667
#ifdef ECONNABORTED
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2668
	    case ECONNABORTED:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2669
		msg = "Software caused connection abort";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2670
		sym = @symbol(ECONNABORTED);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2671
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2672
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2673
#ifdef ECONNRESET
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2674
	    case ECONNRESET:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2675
		msg = "Connection reset by peer";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2676
		sym = @symbol(ECONNRESET);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2677
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2678
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2679
#ifdef EISCONN
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2680
	    case EISCONN:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2681
		msg = "Socket is already connected";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2682
		sym = @symbol(EISCONN);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2683
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2684
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2685
#ifdef ENOTCONN
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2686
	    case ENOTCONN:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2687
		msg = "Socket is not connected";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2688
		sym = @symbol(ENOTCONN);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2689
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2690
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2691
#ifdef ESHUTDOWN
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2692
	    case ESHUTDOWN:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2693
		msg = "Can't send after socket shutdown";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2694
		sym = @symbol(ESHUTDOWN);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2695
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2696
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2697
#ifdef EHOSTDOWN
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2698
	    case EHOSTDOWN:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2699
		msg = "Host is down";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2700
		sym = @symbol(EHOSTDOWN);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2701
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2702
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2703
#ifdef EHOSTUNREACH
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2704
	    case EHOSTUNREACH:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2705
		msg = "No route to host";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2706
		sym = @symbol(EHOSTUNREACH);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2707
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2708
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2709
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2710
	    default:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2711
		{
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2712
		    __BEGIN_PROTECT_REGISTERS__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2713
		    sprintf(buffer, "ErrorNr: %d", __intVal(eno));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2714
		    __END_PROTECT_REGISTERS__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2715
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2716
		msg = buffer;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2717
		sym = @symbol(ERROR_OTHER);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2718
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2719
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2720
	text = __MKSTRING(msg);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2721
    } else {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2722
	text = nil;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2723
	sym = nil;
3496
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2726
    ^ Array with:sym with:text
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2727
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2728
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  2729
     OperatingSystem errorSymbolAndTextForNumber:4
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2730
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2731
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2732
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2733
!UnixOperatingSystem class methodsFor:'executing OS commands'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2734
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2735
commandAndArgsForOSCommand:aCommandString
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2736
    "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
  2737
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2738
    |shell args|
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2739
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2740
    "/
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2741
    "/ '/bin/sh -c <command>'
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2742
    "/
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2743
    shell := '/bin/sh'.
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2744
    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
  2745
    ^ Array with:shell with:args
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2746
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2747
    "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
  2748
    "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
  2749
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2750
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2751
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
  2752
    "Internal lowLevel entry for combined fork & exec;
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2753
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2754
     If fork is false (chain a command):
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2755
	 execute the OS command specified by the argument, aCommandPath, with
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2756
	 arguments in argArray (no arguments, if nil).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2757
	 If successful, this method does not return and smalltalk is gone.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2758
	 If not successful, it does return.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2759
	 Normal use is with forkForCommand.
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2760
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2761
     If fork is true (subprocess command execution):
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2762
	fork a child to do the above.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2763
	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
  2764
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2765
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2766
	fdArray[1] = 15 -> use fd 15 as stdin.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2767
	If an element of the array is set to nil, the corresponding filedescriptor
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2768
	will be closed for the child.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2769
	fdArray[0] == StdIn for child
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2770
	fdArray[1] == StdOut for child
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2771
	fdArray[2] == StdErr for child
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2772
	on VMS, these must be channels as returned by createMailBox.
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2773
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2774
     closeFdArray contains descriptors that will be closed in the subprocess.
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2775
	closeDescriptors are ignored in the WIN32 & VMS versions.
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2776
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2777
     If newPgrp is true, the subprocess will be established in a new process group.
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2778
	The processgroup will be equal to id.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2779
	newPgrp is not used on WIN32 and VMS systems.
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
     env specifies environment variables which are passed differently from
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2782
     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
  2783
     key-value pairs for changed/added environment variables.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2784
     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
  2785
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2786
     Notice: this used to be two separate ST-methods; however, in order to use
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2787
	    vfork on some machines, it had to be merged into one, to avoid write
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2788
	    accesses to ST/X memory from the vforked-child.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2789
	    The code below only does read accesses."
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2790
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2791
    |envPairs argArray fdArray closeFdArray dirName|
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2792
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2793
    env notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2794
	envPairs := OrderedCollection new.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2795
	env keysAndValuesDo:[:key :val |
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2796
	    envPairs add:key; add:val
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2797
	].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2798
	envPairs := envPairs asArray.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2799
    ].
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2800
    argColl notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2801
	argArray := argColl asArray
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2802
    ].
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2803
    fdColl notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2804
	fdArray := fdColl asArray
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2805
    ].
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2806
    closeFdColl notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2807
	closeFdArray := closeFdColl asArray
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2808
    ].
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2809
    aDirectory notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2810
	dirName := aDirectory asFilename name
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  2811
    ].
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
%{  /* STACK: 16000 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2814
    char **argv;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2815
    int nargs, i, id;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2816
    OBJ arg;
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2817
    extern char **environ;
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  2818
    char **_env, **_nEnv;
3801
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2819
#ifndef __isArrayLike
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2820
# define __isArrayLike __isArray
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  2821
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2822
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2823
    if (__isString(aCommandPath) && 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2824
	((argArray == nil) || __isArrayLike(argArray)) &&
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2825
	((fdArray == nil) || __isArrayLike(fdArray)) &&
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2826
	((closeFdArray == nil) || __isArrayLike(closeFdArray))
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2827
    ) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2828
	nargs = argArray == nil ? 0 : __arraySize(argArray);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2829
	argv = (char **) malloc(sizeof(char *) * (nargs + 1));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2830
	if (argv) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2831
	    int nOldEnv, nNewEnv;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2832
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2833
	    for (i=0; i < nargs; i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2834
		arg = __ArrayInstPtr(argArray)->a_element[i];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2835
		if (__isString(arg)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2836
		    argv[i] = (char *) __stringVal(arg);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2837
		} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2838
		    argv[i] = "";
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2839
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2840
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2841
	    argv[i] = NULL;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2842
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2843
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2844
	     * number of new items in environment ..       
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2845
	     */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2846
	    nNewEnv = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2847
	    if ((envPairs != nil) && __isArrayLike(envPairs)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2848
		nNewEnv = __arraySize(envPairs) / 2;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2849
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2850
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2851
	    if (nNewEnv == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2852
		_nEnv = environ;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2853
	    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2854
		_env = environ;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2855
		/* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2856
		 * get size of environment
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2857
		 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2858
		nOldEnv = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2859
		if (_env) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2860
		    while (*_env) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2861
			nOldEnv++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2862
			_env++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2863
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2864
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2865
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2866
		/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2867
		 * generate a new environment
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2868
		 * I have not found a spec which defines if
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2869
		 * items at the end overwrite previous definitions,
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2870
		 * or if the first encountered definition is valid.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2871
		 * To be prepared for any case, simply add the new definitions
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2872
		 * at both ends - that should do it in any case.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2873
		 * Someone with more know-how may want to fix this.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2874
		 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2875
		_nEnv = (char **)malloc(sizeof(char *) * (nNewEnv + nOldEnv + nNewEnv + 1));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2876
		if (_nEnv) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2877
		    char **eO, **eN;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2878
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2879
		    eN = _nEnv;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2880
		    if (nNewEnv) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2881
			/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2882
			 * add new items at the front ...
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2883
			 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2884
			int i;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2885
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2886
			for (i=0; (i+1)<__arraySize(envPairs); i+=2) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2887
			    OBJ t;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2888
			    char *var, *val, *e;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2889
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2890
			    t = __ArrayInstPtr(envPairs)->a_element[i];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2891
			    if (__isString(t) || __isSymbol(t)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2892
				var = (char *)__stringVal(t);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2893
				t = __ArrayInstPtr(envPairs)->a_element[i+1];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2894
				if (__isString(t) || __isSymbol(t)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2895
				    val = (char *)__stringVal(t);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2896
				} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2897
				    val = NULL;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2898
				}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2899
				if (val != NULL) {                
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2900
				    e = (char *)malloc(strlen(var) + 1 + strlen(val) + 1);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2901
				    strcpy(e, var);               
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2902
				    strcat(e, "=");               
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2903
				    strcat(e, val);               
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2904
				} else {                          
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2905
				    e = (char *)malloc(strlen(var) + 1 + 1);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2906
				    strcpy(e, var);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2907
				    strcat(e, "=");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2908
				}   
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2909
				*eN++ = e;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2910
			    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2911
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2912
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2913
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2914
		    if (nOldEnv) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2915
			/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2916
			 * append old environment 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2917
			 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2918
			eO = environ;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2919
			while (*eN = *eO++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2920
			    eN++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2921
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2922
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2923
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2924
		    if (nNewEnv) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2925
			/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2926
			 * new items again at the end
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2927
			 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2928
			for (eO = _nEnv, i=0; i<nNewEnv; i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2929
			    *eN++ = *eO++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2930
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2931
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2932
			*eN = NULL;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2933
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2934
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2935
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2936
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2937
	    if (doFork == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2938
		/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2939
		 * fork a subprocess.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2940
		 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2941
		int nfd, nclose;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2942
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2943
		nfd = fdArray == nil ? 0 : __arraySize(fdArray);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2944
		nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray);
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2945
#ifdef HAS_VFORK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2946
		id = vfork();
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2947
#else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2948
		id = fork();
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2949
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2950
		if (id == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2951
		    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2952
		    ** In child.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2953
		    ** first: dup filedescriptors
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2954
		    */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2955
		    for (i = 0; i < nfd; i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2956
			OBJ fd;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2957
			int rslt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2958
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2959
			fd = __ArrayInstPtr(fdArray)->a_element[i];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2960
			if (__isSmallInteger(fd) && (__intVal(fd) != i)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2961
			    do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2962
				rslt = dup2(__intVal(fd), i);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2963
			    } while ((rslt < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2964
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2965
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2966
		    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2967
		    ** second: close unused filedescriptors
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2968
		    */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2969
		    for (i = 0; i < nfd; i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2970
			if (__ArrayInstPtr(fdArray)->a_element[i] == nil) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2971
			    close(i);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2972
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2973
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2974
		    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2975
		    ** third: close filedescriptors
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2976
		    */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2977
		    for (i = 0; i < nclose; i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2978
			OBJ fd;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2979
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2980
			fd = __ArrayInstPtr(closeFdArray)->a_element[i];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2981
			if (__isSmallInteger(fd)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2982
			    close(__intVal(fd));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2983
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2984
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2985
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2986
		    if (newPgrp == true) {
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2987
#ifndef NEXT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2988
			setsid();
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2989
#endif
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  2990
#if defined(TIOCSCTTY)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2991
			ioctl(0, TIOCSCTTY, 0) ;
3561
9a117ea69e2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3558
diff changeset
  2992
#endif
9a117ea69e2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3558
diff changeset
  2993
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  2994
#if defined(TIOCSPGRP)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2995
			{
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2996
			    int pgrp = getpid();
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2997
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2998
			    ioctl(0, TIOCSPGRP, (char *)&pgrp);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  2999
			}
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  3000
#endif
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3001
#if defined(_POSIX_JOB_CONTROL)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3002
			(void) setpgid(0, 0);
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3003
#else
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3004
# if defined(BSD) || defined(LINUX)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3005
			(void) setpgrp(0);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3006
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3007
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3008
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3009
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3010
		    if (dirName != nil) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3011
			chdir(__stringVal(dirName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3012
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3013
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3014
		    execve(__stringVal(aCommandPath), argv, _nEnv);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3015
		    /* should not be reached */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3016
		    _exit(127);                 /* POSIX 2 compatible exit value */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3017
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3018
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3019
	    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3020
		if (dirName != nil) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3021
		    chdir(__stringVal(dirName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3022
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3023
		/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3024
		 * no subprocess (i.e. transfer to another program)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3025
		 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3026
		execve(__stringVal(aCommandPath), argv, _nEnv);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3027
		/* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3028
		 * should not be reached
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3029
		 * (well, it is, if you pass a wrong command-path)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3030
		 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3031
		id = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3032
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3033
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3034
	    if (nNewEnv && (_nEnv != NULL)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3035
		/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3036
		 * free new environment stuff
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3037
		 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3038
		for (i=0; i<nNewEnv;i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3039
		    char *e = _nEnv[i];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3040
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3041
		    if (e) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3042
			free(e);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3043
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3044
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3045
		free(_nEnv);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3046
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3047
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3048
	    free(argv);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3049
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3050
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3051
	     * In parent: succes or failure
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3052
	     */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3053
	    if (id == -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3054
		RETURN (nil);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3055
	    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3056
		RETURN (__MKSMALLINT(id));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3057
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3058
	}
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3059
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3060
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3061
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3062
     path-argument not string
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3063
     or argArray not an array/nil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3064
     or malloc failed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3065
     or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3066
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3067
    ^ self primitiveFailed
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:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3074
	'I am the child'.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3075
	OperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3076
	'not reached'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3077
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3078
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3079
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3080
     |id|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3081
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3082
     id := OperatingSystem fork.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3083
     id == 0 ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3084
	'I am the child'.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3085
	OperatingSystem
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3086
	   exec:'/bin/sh'
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3087
	   withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3088
	'not reached'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3089
     ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3090
     id printNL.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3091
     (Delay forSeconds:3.5) wait.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3092
     'killing ...' printNL.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3093
     OperatingSystem sendSignal:(OperatingSystem sigTERM) to:id.
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3094
     OperatingSystem sendSignal:(OperatingSystem sigKILL) to:id
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3095
    "
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3096
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3097
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3098
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3099
executeCommand:aCommandString inDirectory:aDirectory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3100
    "much like #executeCommand:, but changes the current directory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3101
     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
  3102
     hardwiring any 'cd ..' command strings into your applictions."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3103
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3104
     ^ self
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3105
	executeCommand:aCommandString 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3106
	inputFrom:nil 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3107
	outputTo:nil 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3108
	errorTo:nil 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3109
	inDirectory:aDirectory asFilename name
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3110
	onError:[:status| false].
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3111
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3112
"/    | cmd |
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3113
"/
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3114
"/    "/ unix - prepend a 'cd' to the command
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3115
"/
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3116
"/    cmd := 'cd ' , aDirectory asFilename name, '; ' , aCommandString.
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  3117
"/    ^ self executeCommand:cmd
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3118
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3119
    "Modified: / 20.1.1998 / 17:03:03 / md"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3120
    "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
  3121
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3122
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3123
fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3124
    "fork a new (HEAVY-weight) unix process.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3125
     Not supported with MSDOS & VMS systems.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3126
     Dont confuse this with Block>>fork, which creates 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3127
     lightweight smalltalk processes. This method will return
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3128
     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
  3129
     unix-process-id) to the parent (original) process.
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
     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
  3132
     #startProcess: and #executCommand: for higher level interfaces."
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3135
    int pid;
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
    pid = fork();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3138
    RETURN ( __MKUINT(pid) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3139
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3140
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3141
    "/ not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3142
    "/
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
    ^ UnsupportedOperationSignal raise
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
     |id|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3148
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3149
     id := OperatingSystem fork.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3150
     id == 0 ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3151
	'I am the child process' printCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3152
	OperatingSystem exit
3496
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3155
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3156
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3157
getStatusOfProcess:aProcessId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3158
    "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
  3159
     This is required to avoid zombie processes."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3160
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3161
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3162
    int status;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3163
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3164
    if (__isSmallInteger(aProcessId)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3165
	pid_t pid = (pid_t)(__intVal(aProcessId));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3166
	{
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3167
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3168
# ifdef  NO_WAITPID
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3169
	    pid_t child;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3170
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3171
	    do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3172
		__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3173
		child = __wait (&status);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3174
		__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3175
		if (child < 0 && errno != EINTR) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3176
		    fprintf(stderr, "OS: child-wait errno=%d\n", errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3177
		    status = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3178
		    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3179
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3180
	    } while (child != pid);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3181
# else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3182
	    pid_t child;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3183
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3184
	    /* claus: the original did not care for EINTR here ... */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3185
	    do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3186
		__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3187
		child = __waitpid (pid, &status, 0);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3188
		__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3189
	    } while ((child != pid) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3190
	    if (child != pid) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3191
		fprintf(stderr, "OS: child-waitpid errno=%d\n", errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3192
		status = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3193
	    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3194
# endif /* NO_WAITPID */
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3195
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3196
	RETURN ( __MKSMALLINT(status));
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3197
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3198
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3199
    self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3201
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3202
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3203
pathOfCommand:aCommand
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3204
    "find where aCommand's executable file is;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3205
     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
  3206
     return nil."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3207
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3208
    |path f fExt|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3209
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3210
    aCommand asFilename isAbsolute ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3211
	^ aCommand
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3212
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3213
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3214
    path := self getEnvironment:'PATH'.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3215
    path notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3216
	(path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3217
	    path isEmpty ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3218
		f := aCommand asFilename
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3219
	    ] ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3220
		f := path asFilename construct:aCommand.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3221
	    ].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3222
	    self executableFileExtensions do:[:ext |
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3223
		ext notEmpty ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3224
		    fExt := (f pathName , ext) asFilename.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3225
		] ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3226
		    fExt := f.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3227
		].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3228
		fExt isExecutable ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3229
		    ^ fExt pathName
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3230
		].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3231
	    ].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3232
	].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3233
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3234
    ^ nil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3235
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3236
    "unix:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3237
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3238
     OperatingSystem pathOfCommand:'fooBar'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3239
     OperatingSystem pathOfCommand:'ls'    
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3240
     OperatingSystem pathOfCommand:'cvs'   
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3241
     OperatingSystem pathOfCommand:'stx'   
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3242
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3243
    "windows:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3244
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3245
     OperatingSystem pathOfCommand:'windbg'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3246
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3247
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3248
    "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
  3249
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3250
3928
c299502a62b9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  3251
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
  3252
    "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
  3253
     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
  3254
     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
  3255
     '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
  3256
     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
  3257
     each may be nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3258
     Return the processId if successful, nil otherwise.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3259
     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
  3260
     or #killProcess: to stop it."
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
    |in out err shellAndArgs rslt|
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3263
4753
214fc4e89e7a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4436
diff changeset
  3264
    aCommandString isNil ifTrue:[^ nil].
214fc4e89e7a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4436
diff changeset
  3265
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3266
    (in := anExternalInStream) isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3267
	in := '/dev/null' asFilename readStream
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3268
    ].
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3269
    (out := anExternalOutStream) isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3270
	out := '/dev/null' asFilename writeStream
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3271
    ].
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3272
    (err := anExternalErrStream) isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3273
	anExternalOutStream isNil ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3274
	    err := out
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3275
	] ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3276
	    err := '/dev/null' asFilename writeStream
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3277
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3278
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3279
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3280
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
4753
214fc4e89e7a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4436
diff changeset
  3281
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3282
    rslt := self
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3283
	exec:(shellAndArgs at:1)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3284
	withArguments:(shellAndArgs at:2)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3285
	fileDescriptors:(Array with:in fileDescriptor
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3286
			       with:out fileDescriptor
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3287
			       with:err fileDescriptor)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3288
	closeDescriptors:nil
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3289
	fork:true
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3290
	newPgrp:true "/ false
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3291
	inDirectory:dir.
4436
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3292
318297e533a6 use /dev/null as default out/err in startProcess.
Claus Gittinger <cg@exept.de>
parents: 4395
diff changeset
  3293
    ^ rslt
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3294
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3295
    "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
  3296
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3297
     OperatingSystem executeCommand:'ls -l > out'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3298
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3299
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3300
    "non-blocking (lower prio threads continue):
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3301
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3302
     |in out err pid sema|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3303
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3304
     in := 'out' asFilename readStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3305
     out := 'out2' asFilename writeStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3306
     err := 'err' asFilename writeStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3307
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3308
     sema := Semaphore new.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3309
     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
  3310
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3311
     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
  3312
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3313
     pid notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3314
	 Processor monitorPid:pid action:[:OSstatus | sema signal ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3315
     ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3316
     in close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3317
     out close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3318
     err close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3319
     sema wait.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3320
     Transcript showCR:'finished'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3321
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3322
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3323
    "Modified: / 21.3.1997 / 10:04:35 / dq"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3324
    "Modified: / 15.7.1997 / 16:03:51 / stefan"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3325
    "Modified: / 5.6.1998 / 19:03:51 / cg"
3928
c299502a62b9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3801
diff changeset
  3326
    "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
  3327
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3328
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3329
!UnixOperatingSystem class methodsFor:'file access'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3330
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3331
closeFd:anInteger
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3332
    "low level close of a filedescriptor"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3333
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
     if (__isSmallInteger(anInteger)) {
5203
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5157
diff changeset
  3336
	if (@global(ExternalStream:FileOpenTrace) == true) {
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5157
diff changeset
  3337
	    fprintf(stderr, "close [UnixOp] fd=%d\n", __intVal(anInteger));
a1a9869b2d24 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5157
diff changeset
  3338
	}
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3339
	close(__intVal(anInteger));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3340
	RETURN(self);
3496
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3343
     ^ self primitiveFailed.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3344
!
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
createDirectory:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3347
    "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
  3348
     path, or relative to the current directory.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3349
     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
  3350
     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
  3351
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3352
    "/ if it already exists this is ok
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3353
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3354
    (self isDirectory:aPathName) ifTrue:[^ true].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3355
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
    if (__isString(aPathName)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3358
	int ret;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3359
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3360
	ret = mkdir(__stringVal(aPathName), 0755);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3361
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3362
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3363
	    RETURN (false);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3364
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3365
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3366
      }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3367
%}.
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
"/    self isUNIXlike ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3370
"/      ^ self executeCommand:('mkdir 2>/dev/null ', newPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3371
"/    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3372
"/    ^ self executeCommand:('mkdir ', newPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3373
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3374
    self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3375
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3376
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3377
     OperatingSystem createDirectory:'foo'  
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3380
    "Modified: 20.12.1995 / 11:24:13 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3381
    "Modified: 29.6.1996 / 14:06:54 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3382
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3383
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3384
createHardLinkFrom:oldPath to:newPath
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3385
    "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
  3386
     Return true if successful, false if not."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3387
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3388
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3389
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3390
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3391
    if (__isString(oldPath) && __isString(newPath)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3392
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3393
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3394
	    ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3395
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3396
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3397
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3398
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3399
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3400
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3401
	RETURN (true);
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3402
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3403
%}.
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3404
    "/
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3405
    "/ bad argument(s) given
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3406
    "/
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3407
    ^ self primitiveFailed 
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3410
     OperatingSystem linkFile:'foo' to:'bar'
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3411
    "
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
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3414
createSymbolicLinkFrom:oldPath to:newPath
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3415
    "make a symbolic link for 'newPath' to the file 'oldPath'.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3416
     The link will be a soft (symbolic) link.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3417
     Return true if successful, false if not."
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3418
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3419
%{
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3420
#ifdef S_IFLNK
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3421
    int ret;
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3422
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3423
    if (__isString(oldPath) && __isString(newPath)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3424
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3425
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3426
	    ret = symlink((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3427
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3428
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3429
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3430
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3431
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3432
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3433
	RETURN (true);
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3434
    }
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3435
#endif
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3436
%}.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3437
    (oldPath isString not or:[newPath isString not]) ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3438
	"/
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3439
	"/ bad argument(s) given
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3440
	"/
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3441
	^ self primitiveFailed 
3496
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
    "/
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3445
    "/ 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
  3446
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3447
    ^ UnsupportedOperationSignal raise
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3448
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3449
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3450
     OperatingSystem symbolicLinkFile:'foo' to:'bar'
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3454
recursiveCopyDirectory:sourcePathName to:destination
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3455
    "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
  3456
     Return true if successful."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3457
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3458
    ^ 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
  3459
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3460
    "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
  3461
!
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
recursiveRemoveDirectory:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3464
    "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
  3465
     Return true if successful."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3466
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3467
    ^ self executeCommand:('rm -rf ' , fullPathName)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3468
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3469
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3470
     OperatingSystem recursiveCreateDirectory:'foo/bar/baz'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3471
     OperatingSystem recursiveRemoveDirectory:'foo'
3496
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
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3474
    "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
  3475
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3476
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3477
removeDirectory:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3478
    "remove the directory named 'fullPathName'. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3479
     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
  3480
     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
  3481
     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
  3482
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3483
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3484
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3485
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3486
    if (__isString(fullPathName)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3487
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3488
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3489
	    ret = rmdir((char *) __stringVal(fullPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3490
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3491
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3492
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3493
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3494
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3495
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3496
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3497
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3498
%}.
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
    "/ either not a string argument,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3501
    "/ or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3502
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3503
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3504
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3505
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3506
     OperatingSystem createDirectory:'foo'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3507
     OperatingSystem removeDirectory:'foo'
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3510
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3511
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3512
removeFile:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3513
    "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
  3514
     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
  3515
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3516
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3517
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3518
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3519
    if (__isString(fullPathName)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3520
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3521
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3522
	    ret = unlink((char *) __stringVal(fullPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3523
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3524
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3525
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3526
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3527
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3528
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3529
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3530
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3531
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3532
    ^ self primitiveFailed
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3535
renameFile:oldPath to:newPath
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3536
    "rename the file 'oldPath' to 'newPath'. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3537
     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
  3538
     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
  3539
     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
  3540
     any invalid names.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3541
     Returns true if successful, false if not"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3542
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3543
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3544
    int ret, eno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3545
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3546
    if (__isString(oldPath) && __isString(newPath)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3547
#if defined(HAS_RENAME)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3548
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3549
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3550
	    ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3551
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3552
	__END_INTERRUPTABLE__
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3553
#else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3554
	ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3555
	if (ret >= 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3556
	    ret = unlink((char *) __stringVal(oldPath));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3557
	    if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3558
		eno = errno;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3559
		unlink((char *) __stringVal(newPath));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3560
		errno = eno;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3561
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3562
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3563
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3564
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3565
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3566
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3567
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3568
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3569
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3570
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3571
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3572
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3573
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3574
     OperatingSystem renameFile:'foo' to:'bar'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3575
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3576
!
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
truncateFile:aPathName to:newSize
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3579
    "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
  3580
     This may not be supported on all architectures.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3581
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3582
     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
  3583
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3584
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3585
#ifdef HAS_TRUNCATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3586
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3587
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3588
    if (__isString(aPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3589
     && __isSmallInteger(newSize)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3590
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3591
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3592
	    ret = truncate((char *) __stringVal(aPathName), __intVal(newSize));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3593
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3594
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3595
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3596
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3597
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3598
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3599
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3600
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3601
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3602
# ifdef HAS_FTRUNCATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3603
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3604
    int fd;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3605
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3606
    if (__isString(aPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3607
     && __isSmallInteger(newSize)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3608
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3609
	    fd = open((char *) __stringVal(aPathName), 2);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3610
	} while (fd < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3611
	if (fd < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3612
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3613
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3614
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3615
        
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3616
	ret = ftruncate(fd, __intVal(newSize));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3617
	close(fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3618
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3619
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3620
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3621
	} 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3622
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3623
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3624
# endif /* using FTRUNCATE */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3625
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3626
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3627
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3628
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3629
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3630
!UnixOperatingSystem class methodsFor:'file access rights'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3631
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3632
accessMaskFor:aSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3633
    "return the access bits mask for numbers as returned by 
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3634
     OperatingSystem>>accessModeOf:
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3635
     and expected by OperatingSystem>>changeAccessModeOf:to:.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3636
     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
  3637
     (never hardcode 8rxxx into your code)."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3638
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3639
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3640
#   ifndef S_IRUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3641
    /* posix systems should define these ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3642
#    define S_IRUSR 0400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3643
#    define S_IWUSR 0200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3644
#    define S_IXUSR 0100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3645
#    define S_IRGRP 0040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3646
#    define S_IWGRP 0020
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3647
#    define S_IXGRP 0010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3648
#    define S_IROTH 0004
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3649
#    define S_IWOTH 0002
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3650
#    define S_IXOTH 0001
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3651
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3652
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3653
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3654
    if (aSymbol == @symbol(readUser)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3655
	RETURN ( __MKSMALLINT(S_IRUSR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3656
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3657
    if (aSymbol == @symbol(writeUser)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3658
	RETURN ( __MKSMALLINT(S_IWUSR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3659
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3660
    if (aSymbol == @symbol(executeUser)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3661
	RETURN ( __MKSMALLINT(S_IXUSR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3662
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3663
    if (aSymbol == @symbol(readGroup)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3664
	RETURN ( __MKSMALLINT(S_IRGRP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3665
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3666
    if (aSymbol == @symbol(writeGroup)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3667
	RETURN ( __MKSMALLINT(S_IWGRP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3668
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3669
    if (aSymbol == @symbol(executeGroup)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3670
	RETURN ( __MKSMALLINT(S_IXGRP) );
3496
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
    if (aSymbol == @symbol(readOthers)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3673
	RETURN ( __MKSMALLINT(S_IROTH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3674
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3675
    if (aSymbol == @symbol(writeOthers)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3676
	RETURN ( __MKSMALLINT(S_IWOTH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3677
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3678
    if (aSymbol == @symbol(executeOthers)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3679
	RETURN ( __MKSMALLINT(S_IXOTH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3680
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3681
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3682
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3683
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3684
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3685
     OperatingSystem accessMaskFor:#readUser
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3686
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3687
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3688
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3689
accessModeOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3690
    "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
  3691
     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
  3692
     Notice that the returned number is OS dependent - use the 
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3693
     modeMasks as returned by OperatingSystem>>accessMaskFor:"
3496
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3696
     this could have been implemented as:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3697
	(self infoOf:aPathName) at:#mode
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3698
     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
  3699
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3700
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3701
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3702
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3703
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3704
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3705
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3706
# ifdef TRACE_STAT_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3707
	printf("stat on '%s' for accessMode\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3708
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3709
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3710
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3711
	    ret = stat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3712
	} while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3713
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3714
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3715
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3716
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3717
	    RETURN ( nil );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3718
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3719
	RETURN ( __MKSMALLINT(buf.st_mode & 0777) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3720
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3721
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3722
   ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3723
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3724
   "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3725
    (OperatingSystem accessModeOf:'/') printStringRadix:8
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3726
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3727
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3728
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3729
changeAccessModeOf:aPathName to:modeBits
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3730
    "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
  3731
     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
  3732
     independent. Return true if changed, 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3733
     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
  3734
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3735
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3736
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3737
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3738
    if (__isString(aPathName) && __isSmallInteger(modeBits)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3739
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3740
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3741
	    ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3742
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3743
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3744
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3745
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3746
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3747
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3748
	RETURN ( true );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3749
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3750
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3751
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3752
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3753
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3754
!UnixOperatingSystem class methodsFor:'file locking'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3755
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3756
lockFD:aFileDescriptor shared:isSharedReadLock blocking:blockIfLocked
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3757
   "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
  3758
    (such as returned by ExternalStream>>fileDescriptor).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3759
    On some systems, only advisory locks are available -
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3760
    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
  3761
    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
  3762
    (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
  3763
    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
  3764
    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
  3765
    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
  3766
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3767
    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
  3768
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3769
    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
  3770
    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
  3771
    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
  3772
    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
  3773
    argument."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3774
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3775
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3776
    if (__isSmallInteger(aFileDescriptor)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3777
	int fd = __intVal(aFileDescriptor);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3778
	int lockArg;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3779
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3780
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3781
	 * claus: sigh - each one has a different interface ... 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3782
	 */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3783
#if defined(F_SETLK)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3784
	{
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3785
	    /* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3786
	     * new fcntl(SETLK) interface;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3787
	     * available on SYSV4 and Linux
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3788
	     */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3789
	    struct flock flock;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3790
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3791
	    if (isSharedReadLock == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3792
		flock.l_type = F_RDLCK;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3793
	    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3794
		flock.l_type = F_WRLCK;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3795
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3796
	    flock.l_whence = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3797
	    flock.l_start = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3798
	    flock.l_len = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3799
	    lockArg = F_SETLK;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3800
# if defined(F_SETLKW)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3801
	    if (blockIfLocked == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3802
		lockArg = F_SETLKW;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3803
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3804
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3805
	    if (fcntl(fd, lockArg, &flock) != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3806
		RETURN (true);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3807
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3808
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3809
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3810
#else /* no F_SETLK available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3811
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3812
# if defined(LOCK_EX) && defined(LOCK_UN)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3813
	/* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3814
	 * BSD 4.3 advisory locks
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3815
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3816
	lockArg = LOCK_EX;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3817
#  if defined(LOCK_SH)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3818
	if (isSharedReadLock == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3819
	    lockArg = LOCK_SH
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3820
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3821
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3822
#  if defined(LOCK_NB)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3823
	if (blockIfLocked == false) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3824
	    lockArg |= LOCK_NB;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3825
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3826
#  endif
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3827
	if (flock(fd, lockArg) != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3828
	    RETURN (true);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3829
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3830
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3831
# else /* no flock available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3832
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3833
#  if defined(F_LOCK) && defined(F_UNLOCK)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3834
	/* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3835
	 * SYSV3 advisory locks
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3836
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3837
	if (lockf(fd, F_LOCK, 0) != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3838
	    RETURN (true);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3839
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3840
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3841
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3842
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3843
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3844
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3845
    ^ false
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3848
supportsFileLinks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3849
    "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
  3850
     Typically, only unix returns true here."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3851
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3852
    ^ true
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3853
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3854
    "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
  3855
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3856
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3857
supportsFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3858
    "return true, if the OS supports file locking"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3859
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3860
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3861
#if defined(F_SETLK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3862
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3863
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3864
# if defined(LOCK_EX) && defined(LOCK_UN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3865
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3866
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3867
#  if defined(F_LOCK) && defined(F_UNLOCK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3868
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3869
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3870
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3871
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3872
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3873
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3874
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3875
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3876
     OperatingSystem supportsFileLocks
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3877
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3878
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3879
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3880
supportsNonBlockingFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3881
    "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
  3882
     (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
  3883
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3884
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3885
#if defined(F_SETLK) && defined(F_SETLKW)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3886
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3887
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3888
# 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
  3889
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3890
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3891
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3892
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3893
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3894
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3895
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3896
     OperatingSystem supportsNonBlockingFileLocks
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3897
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3898
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3899
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3900
supportsSharedLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3901
    "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
  3902
     file locking."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3903
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3904
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3905
#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
  3906
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3907
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3908
# 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
  3909
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3910
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3911
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3912
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3913
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3914
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3915
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  3916
     OperatingSystem supportsNonBlockingFileLocks
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3917
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3918
!
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
unlockFD:aFileDescriptor
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3921
    "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
  3922
     which was previously aquired by #lockFD:.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3923
     Return false, if the unlock failed 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3924
     (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
  3925
      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
  3926
     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
  3927
     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
  3928
     
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3929
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3930
    if (__isSmallInteger(aFileDescriptor)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3931
	int fd = __intVal(aFileDescriptor);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3932
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3933
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3934
	 * claus: sigh - each one has a different interface ...
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3935
	 */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3936
#if defined(F_SETLK)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3937
	{
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3938
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3939
	     * new fcntl(SETLK) interface;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3940
	     * available on SYSV4 and Linux
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3941
	     */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3942
	    struct flock flock;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3943
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3944
	    flock.l_type = F_UNLCK;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3945
	    flock.l_whence = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3946
	    flock.l_start = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3947
	    flock.l_len = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3948
	    if (fcntl(fd, F_SETLK, &flock) != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3949
		RETURN (true);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3950
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
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 F_SETLK 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(LOCK_EX) && defined(LOCK_UN)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3956
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3957
	 * BSD 4.3 advisory locks
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3958
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3959
	if (flock(fd, LOCK_UN) != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3960
	    RETURN (true);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3961
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3962
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3963
# else /* no flock available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3964
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3965
#  if defined(F_LOCK) && defined(F_UNLOCK)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3966
	/* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3967
	 * SYSV3 advisory locks
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3968
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3969
	if (lockf(fd, F_UNLOCK, 0) != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3970
	    RETURN (true);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  3971
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3972
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3973
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3974
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3975
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3976
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3977
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3978
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3979
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3980
!UnixOperatingSystem class methodsFor:'file queries'!
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
caseSensitiveFilenames
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3983
    "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
  3984
     On MSDOS, this will return false; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3985
     on a real OS, we return true."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3986
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3987
    ^ true
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3988
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3989
    "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
  3990
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3991
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3992
compressPath:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3993
    "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
  3994
     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
  3995
     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
  3996
     if realPath and popen failed."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3997
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3998
    |names n "{ Class: SmallInteger }" |
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
    names := pathName 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4001
		asCollectionOfSubstringsSeparatedBy:self fileSeparator.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4002
    names := names asOrderedCollection.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4003
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4004
     cut off initial double-slashes
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
    [names startsWith:#('' '')] whileTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4007
	names removeFirst.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4008
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4009
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4010
     cut off double-slashes at end
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4011
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4012
    [names endsWith:#('')] whileTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4013
	names removeLast.
3496
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4016
     cut off current-dir at beginning
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4017
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4018
    n := names size.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4019
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4020
	names removeFirst.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4021
	n := n - 1.
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4025
     cut off parent-dirs at end
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4026
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4027
    [(n > 2) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4028
     and:[(names endsWith:#('..'))
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4029
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4030
	names removeLast; removeLast.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4031
	n := n - 2.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4032
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4033
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4034
    ^ names asStringWith:self fileSeparator 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4035
		    from:1
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4036
		    to:n
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4037
		    compressTabs:false final:nil 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4038
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4039
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4040
     OperatingSystem compressPath:'./..'    
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4041
     OperatingSystem compressPath:'/foo/bar/baz/..'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4042
     OperatingSystem compressPath:'foo/bar/baz/..'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4043
     OperatingSystem compressPath:'foo/bar/baz/../'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4044
     OperatingSystem compressPath:'foo/bar/baz/..///' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4045
     OperatingSystem compressPath:'///foo/bar/baz/..///' 
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4048
    "Modified: 1.11.1996 / 20:13:48 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4049
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4050
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4051
fileSeparator
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4052
    "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
  4053
     This character differs for MSDOS and other systems,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4054
     (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
  4055
      preparation for the future)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4056
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4057
    ^ $/
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4058
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4059
    "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
  4060
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4061
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4062
getDiskInfoOf:aDirectoryPath
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4063
    "return some disk info. 
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4064
     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
  4065
     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
  4066
     On unix, the information returned is (at least):
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4067
	freeBytes
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4068
	totalBytes
4262
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  4069
    "
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  4070
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  4071
    |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
  4072
     fileSystemIdx sizeIdx usedIdx availIdx capacityIdx mountIdx|
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4073
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4074
    p := PipeStream readingFrom:('df -k ' , aDirectoryPath).
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4075
    p isNil ifTrue:[^ nil].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4076
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4077
    [
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4078
	outputText := p contentsOfEntireFile.
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4079
    ] valueNowOrOnUnwindDo:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4080
	p close.
4223
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4081
    ].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4082
"/ Transcript showCR:outputText asString.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4083
    outputText isNil ifTrue:[^ nil].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4084
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4085
    outputText := outputText asCollectionOfLines.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4086
    outputText size < 2 ifTrue:[^ nil].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4087
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4088
    keys := (outputText at:1) asLowercase asCollectionOfWords.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4089
    values := (outputText at:2) asCollectionOfWords.
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
    "/ 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
  4092
    "/ on some rude Unix versions ...
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4093
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4094
    fileSystemIdx := 1.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4095
    sizeIdx := 2.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4096
    usedIdx := 3.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4097
    availIdx := 4.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4098
    capacityIdx := 5.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4099
    mountIdx := 6.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4100
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4101
    values size < 6 ifTrue:[^ nil].
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4102
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4103
    info := IdentityDictionary new.
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:capacityIdx) onError:nil.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4106
    n notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4107
	info at:#percentUsed put:n
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:availIdx) onError:nil.
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4111
    n notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4112
	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
  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
    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
  4116
    n notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4117
	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
  4118
    ].
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
    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
  4121
    n notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4122
	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
  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
    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
  4126
    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
  4127
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4128
    ^ info
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4129
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4130
    "
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4131
     OperatingSystem getDiskInfoOf:'/'
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4132
     OperatingSystem getDiskInfoOf:'.'
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4133
    "
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4134
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4135
    "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
  4136
!
46fd62477cb2 added a portable interface to the df-command
Claus Gittinger <cg@exept.de>
parents: 4201
diff changeset
  4137
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4138
getDriveList
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4139
    "return a list of volumes in the system. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4140
     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
  4141
     - 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
  4142
     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
  4143
     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
  4144
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
    "/ default: retrurn array filled with
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4147
    "/ root, home and current directories.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4148
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4149
    ^ Array 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4150
	with:'/'
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4151
	with:(self getHomeDirectory)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4152
	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
  4153
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4154
    "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
  4155
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4156
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4157
getMountedVolumes
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4158
    "return info about mounted volumes. 
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4159
     The amount of information returned depends upon the OS, and is
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4160
     not guaranteed to be consistent across architectures.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4161
     On unix, the information returned is (at least):
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4162
	mountPoint - mount point
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4163
	fileSystem - device or NFS-remotePath
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4164
    "
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4165
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4166
    |p outputText keys values info infoEntry|
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4167
4933
bfa38904104e use df -k
Claus Gittinger <cg@exept.de>
parents: 4923
diff changeset
  4168
    p := PipeStream readingFrom:('df -k').
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4169
    p isNil ifTrue:[^ nil].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4170
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4171
    [
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4172
	outputText := p contentsOfEntireFile.
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4173
    ] valueNowOrOnUnwindDo:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4174
	p close.
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4175
    ].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4176
"/ Transcript showCR:outputText asString.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4177
    outputText isNil ifTrue:[^ nil].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4178
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4179
    outputText := outputText asCollectionOfLines.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4180
    outputText size < 2 ifTrue:[^ nil].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4181
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4182
    keys := (outputText at:1) asLowercase asCollectionOfWords.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4183
    "/ we may have to validate the following column indices
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4184
    "/ on some rude Unix versions ...
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4185
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4186
    info := OrderedCollection new.
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4187
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4188
    outputText from:2 do:[:line |
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4189
	values := line asCollectionOfWords.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4190
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4191
	values size >= 2 ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4192
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4193
	    infoEntry := IdentityDictionary new.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4194
	    infoEntry at:#mountPoint put:(values last).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4195
	    infoEntry at:#fileSystem put:(values first).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4196
	    info add:infoEntry.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4197
	]
4853
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4198
    ].
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4199
    ^ info
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4200
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4201
    "
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4202
     OperatingSystem getMountedVolumes
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4203
    "
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4204
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4205
    "Modified: / 22.5.1999 / 00:32:13 / cg"
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4206
!
3f5ed291c362 added getMountedVolumes
ca
parents: 4753
diff changeset
  4207
4201
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4208
getNullDevice
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4209
    "return the name of the OS's null device"
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4210
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4211
    ^ '/dev/null'
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4212
!
591bf7d022d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4115
diff changeset
  4213
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4214
infoOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4215
    "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
  4216
     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
  4217
     the returned object) is:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4218
	 type            - a symbol giving the files type
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4219
	 mode            - numeric access mode 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4220
	 uid             - owners user id
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4221
	 gid             - owners group id
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4222
	 size            - files size
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4223
	 id              - files number (i.e. inode number)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4224
	 accessed        - last access time (as Timestamp)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4225
	 modified        - last modification time (as Timestamp)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4226
	 statusChanged   - last status change time (as Timestamp)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4227
	 alternativeName     - (windows only:) the MSDOS name of the file
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4228
	 recordFormatNumeric - (VMS only:) numeric value of the recordFormat
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4229
	 recordFormat        - (VMS only:) symbolic value of the recordFormat
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4230
	 recordAttributes    - (VMS only:) recordAttributes
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4231
	 fixedHeaderSize     - (VMS only:) fixed header size in a variable record format
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4232
	 recordSize          - (VMS only:) record size.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4233
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4234
     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
  4235
     all of the information.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4236
     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
  4237
     For symbolic links (if supported by the OS), 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4238
     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
  4239
     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
  4240
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4241
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4242
    |info type mode uid gid size id 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4243
     atime mtime ctime 
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  4244
     aOStime mOStime cOStime|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4245
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4246
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4247
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4248
    unsigned INT ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4249
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4250
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4251
# ifdef TRACE_STAT_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4252
	printf("stat on '%s' for info\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4253
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4254
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4255
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4256
	    ret = stat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4257
	} while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4258
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4259
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4260
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4261
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4262
	    RETURN ( nil );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4263
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4264
	switch (buf.st_mode & S_IFMT) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4265
	    case S_IFDIR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4266
		type = @symbol(directory);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4267
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4268
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4269
	    case S_IFREG:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4270
		type = @symbol(regular);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4271
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4272
# ifdef S_IFCHR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4273
	    case S_IFCHR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4274
		type = @symbol(characterSpecial);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4275
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4276
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4277
# ifdef S_IFBLK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4278
	    case S_IFBLK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4279
		type = @symbol(blockSpecial);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4280
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4281
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4282
# ifdef S_IFMPC
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4283
	    case S_IFMPC:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4284
		type = @symbol(multiplexedCharacterSpecial);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4285
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4286
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4287
# ifdef S_IFMPB
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4288
	    case S_IFMPB:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4289
		type = @symbol(multiplexedBlockSpecial);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4290
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4291
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4292
# ifdef S_IFLNK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4293
	    case S_IFLNK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4294
		type = @symbol(symbolicLink);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4295
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4296
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4297
# ifdef S_IFSOCK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4298
	    case S_IFSOCK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4299
		type = @symbol(socket);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4300
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4301
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4302
# ifdef S_IFIFO
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4303
	    case S_IFIFO:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4304
		type = @symbol(fifo);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4305
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4306
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4307
	    default:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4308
		type = @symbol(unknown);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4309
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4310
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4311
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4312
	ino = buf.st_ino;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4313
	id = __MKUINT(ino);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4314
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4315
	mode = __MKSMALLINT(buf.st_mode & 0777);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4316
	uid = __MKSMALLINT(buf.st_uid);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4317
	gid = __MKSMALLINT(buf.st_gid);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4318
	size = __MKUINT(buf.st_size);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4319
	aOStime = __MKUINT(buf.st_atime);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4320
	mOStime = __MKUINT(buf.st_mtime);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4321
	cOStime = __MKUINT(buf.st_ctime);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4322
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4323
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4324
    mode notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4325
	atime := AbsoluteTime fromOSTime:(aOStime * 1000).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4326
	mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4327
	ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4328
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4329
	info := FileStatusInfo
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4330
		    type:type 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4331
		    mode:mode 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4332
		    uid:uid 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4333
		    gid:gid 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4334
		    size:size 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4335
		    id:id 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4336
		    accessed:atime 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4337
		    modified:mtime 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4338
		    statusChanged:ctime
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4339
		    path:nil.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4340
	^ info
3496
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
   ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4343
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4344
   "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4345
    OperatingSystem infoOf:'/'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4346
    (OperatingSystem infoOf:'/') uid
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4347
    (OperatingSystem infoOf:'/') accessed
3496
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
!
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
isDirectory:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4352
    "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
  4353
     (i.e. exists and is a directory).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4354
     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
  4355
     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
  4356
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4357
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4358
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4359
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4360
    if (__isString(aPathName)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4361
	struct stat buf;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4362
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4363
# ifdef TRACE_STAT_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4364
	printf("stat on '%s' for isDirectory\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4365
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4366
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4367
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4368
	    ret = stat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4369
	} while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4370
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4371
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4372
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4373
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4374
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4375
	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
  4376
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4377
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4378
    ^ self primitiveFailed
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
    "an alternative implementation would be:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4381
	^ (self infoOf:aPathName) type == #directory
3496
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4384
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4385
isExecutable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4386
    "return true, if the given file is executable.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4387
     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
  4388
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4389
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4390
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4391
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4392
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4393
# ifdef TRACE_ACCESS_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4394
	printf("access on '%s' for executable\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4395
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4396
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4397
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4398
	    ret = access(__stringVal(aPathName), X_OK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4399
	} while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4400
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4401
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4402
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4403
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4404
	RETURN ( ((ret == 0) ? true : false) );
3496
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4407
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4408
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4409
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4410
isReadable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4411
    "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
  4412
     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
  4413
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4414
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4415
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4416
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4417
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4418
# ifdef TRACE_ACCESS_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4419
	printf("access on '%s' for readable\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4420
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4421
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4422
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4423
	    ret = access(__stringVal(aPathName), R_OK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4424
	} while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4425
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4426
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4427
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4428
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4429
	RETURN ( ((ret == 0) ? true : false) );
3496
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4432
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4433
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4434
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4435
isSymbolicLink:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4436
    "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
  4437
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4438
    ^ (self linkInfoOf:aPathName) notNil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4439
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4440
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4441
     OperatingSystem isSymbolicLink:'Make.proto'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4442
     OperatingSystem isSymbolicLink:'Makefile' 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4443
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4446
isValidPath:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4447
    "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
  4448
     (i.e. the file or directory exists)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4449
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4450
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4451
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4452
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4453
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4454
    if (__isString(aPathName) || __isSymbol(aPathName) ) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4455
# ifdef TRACE_STAT_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4456
	printf("stat on '%s' for isValidPath\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4457
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4458
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4459
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4460
	    ret = stat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4461
	} while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4462
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4463
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4464
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4465
	    RETURN (false);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4466
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4467
	RETURN ( ret ? false : true );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4468
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4469
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4470
    ^ self primitiveFailed
5407
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  4471
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  4472
"/ alternative:
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  4473
"/        ^ (self infoOf:aPathName) notNil
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  4474
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4475
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4476
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4477
isWritable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4478
    "return true, if the given file is writable.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4479
     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
  4480
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4481
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4482
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4483
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4484
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4485
# ifdef TRACE_ACCESS_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4486
	printf("access on '%s' for writable\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4487
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4488
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4489
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4490
	    ret = access(__stringVal(aPathName), W_OK);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4491
	} while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4492
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4493
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4494
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4495
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4496
	RETURN ( ((ret == 0) ? true : false) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4497
    }
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4500
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4501
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4502
linkInfoOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4503
    "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
  4504
     IFF aPathName is a symbolic link. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4505
     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
  4506
     (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
  4507
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4508
     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
  4509
     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
  4510
     in case of a symbolic link."
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
    |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
  4513
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4514
%{  /* STACK: 1200 */
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  4515
#if defined(S_IFLNK)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4516
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4517
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4518
    char pathBuffer[1024];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4519
    unsigned INT ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4520
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4521
    if (__isString(aPathName)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4522
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4523
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4524
	    ret = lstat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4525
	} while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4526
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4527
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4528
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4529
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4530
	    RETURN ( nil );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4531
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4532
	switch (buf.st_mode & S_IFMT) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4533
	    default:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4534
		RETURN ( nil ); /* not a symbolic link */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4535
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4536
	    case S_IFLNK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4537
		type = @symbol(symbolicLink);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4538
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4539
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4540
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4541
	ino = buf.st_ino;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4542
	id = __MKUINT(ino);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4543
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4544
	mode = __MKSMALLINT(buf.st_mode & 0777);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4545
	uid = __MKSMALLINT(buf.st_uid);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4546
	gid = __MKSMALLINT(buf.st_gid);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4547
	size = __MKUINT(buf.st_size);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4548
	atime = __MKUINT(buf.st_atime);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4549
	mtime = __MKUINT(buf.st_mtime);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4550
	ctime = __MKUINT(buf.st_ctime);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4551
	if ((ret = readlink((char *) __stringVal(aPathName), pathBuffer, sizeof(pathBuffer))) < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4552
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4553
	    RETURN ( nil );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4554
	} 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4555
	pathBuffer[ret] = '\0';  /* readlink does not 0-terminate */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4556
	path = __MKSTRING(pathBuffer);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4557
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4558
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4559
    RETURN ( nil );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4560
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4561
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4562
    mode notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4563
	info := IdentityDictionary new.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4564
	^ FileStatusInfo
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4565
	    type:type 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4566
	    mode:mode 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4567
	    uid:uid 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4568
	    gid:gid 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4569
	    size:size 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4570
	    id:id 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4571
	    accessed:(AbsoluteTime fromOSTime:(atime * 1000)) 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4572
	    modified:(AbsoluteTime fromOSTime:(mtime * 1000)) 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4573
	    statusChanged:(AbsoluteTime fromOSTime:(ctime * 1000))
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4574
	    path:path
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
   ^ self primitiveFailed
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
   "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4579
    OperatingSystem infoOf:'Make.proto'  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4580
    OperatingSystem linkInfoOf:'Make.proto' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4581
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4582
    OperatingSystem infoOf:'resources/motif.style'   
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4583
    OperatingSystem linkInfoOf:'resources/motif.style' 
3496
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
parentDirectoryName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4588
    "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
  4589
     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
  4590
     for other systems.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4591
     (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
  4592
      preparation for the future)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4593
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4594
    ^ '..'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4595
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4596
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4597
pathNameOf:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4598
    "return the pathName of the argument, aPathString,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4599
     - 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
  4600
     This method needs the path to be valid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4601
     (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
  4602
     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
  4603
     from what you expect."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4604
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4605
    |p path command|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4606
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4607
    "some systems have a convenient function for this ..."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4608
    path := self primPathNameOf:pathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4609
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4610
    path isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4611
	(self isValidPath:pathName) ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4612
	    p := pathName.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4613
	    [(p size > 1)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4614
	     and:[p endsWith:(self fileSeparator)]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4615
	    ] whileTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4616
		p := p copyWithoutLast:1.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4617
	    ].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4618
	    ^ p
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4619
	].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4620
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4621
	(SlowFork==true or:[PipeFailed==true]) ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4622
	    PipeStream openErrorSignal handle:[:ex |
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4623
		PipeFailed := true.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4624
		'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4625
		ex return.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4626
	    ] do:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4627
		"have to fall back ..."
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4628
		command := 'cd "' , pathName , '"; pwd'.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4629
		p := PipeStream readingFrom:command.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4630
	    ].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4631
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4632
	    (p isNil or:[p atEnd]) ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4633
		('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4634
	    ] ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4635
		path := p nextLine.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4636
		p close.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4637
	    ]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4638
	].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4639
	path isNil ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4640
	    "/
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4641
	    "/ return the original - there is nothing else can we do
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4642
	    "/
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4643
	    path := pathName
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4644
	].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4645
	(SlowFork==true or:[ForkFailed==true]) ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4646
	    path := self compressPath:path
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4647
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4648
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4649
    ^ path.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4650
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4651
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4652
     OperatingSystem pathNameOf:'.'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4653
     OperatingSystem pathNameOf:'../smalltalk/../smalltalk'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4654
     OperatingSystem pathNameOf:'../../..'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4655
     OperatingSystem pathNameOf:'..'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4656
     OperatingSystem pathNameOf:'/tmp////' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4657
     OperatingSystem pathNameOf:'/foo/bar' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4658
     OperatingSystem pathNameOf:'/foo/bar/'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4659
     OperatingSystem pathNameOf:'/foo/bar//'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4660
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4661
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4662
    "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
  4663
    "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
  4664
!
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
primIdOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4667
    "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
  4668
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  4669
%{
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4670
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4671
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4672
    unsigned INT ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4673
    OBJ retVal;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4674
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4675
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4676
# ifdef TRACE_STAT_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4677
	printf("stat on '%s' for id\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4678
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4679
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4680
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4681
	    ret = stat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4682
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4683
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4684
	if (ret >= 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4685
	    ino = buf.st_ino;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4686
	    retVal = __MKUINT(ino);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4687
	    RETURN (retVal);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4688
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4689
	@global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4690
	RETURN (nil);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4691
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4692
    RETURN (nil);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4693
%}.
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
5492
11d7a1839cfe rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5488
diff changeset
  4696
primInfoOf:aPathName
11d7a1839cfe rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5488
diff changeset
  4697
   "for rel5 only"
11d7a1839cfe rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5488
diff changeset
  4698
11d7a1839cfe rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5488
diff changeset
  4699
   ^ self primitiveFailed
11d7a1839cfe rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5488
diff changeset
  4700
11d7a1839cfe rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5488
diff changeset
  4701
11d7a1839cfe rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5488
diff changeset
  4702
!
11d7a1839cfe rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5488
diff changeset
  4703
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4704
primPathNameOf:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4705
    "return the pathName of the argument, aPathString,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4706
     - 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
  4707
     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
  4708
     realPath library function.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4709
     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
  4710
     from what you expect."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4711
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4712
    |path|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4713
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4714
%{  /* STACK: 16000 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4715
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4716
    if (__isString(pathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4717
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4718
#ifdef HAS_GETCWD
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4719
	if (strcmp(__stringVal(pathName), ".") == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4720
	    char nameBuffer[MAXPATHLEN + 1];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4721
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4722
	    if (@global(CurrentDirectory) == nil) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4723
		if (getcwd(nameBuffer, MAXPATHLEN)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4724
		    OBJ d;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4725
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4726
		    @global(CurrentDirectory) = d = __MKSTRING(nameBuffer);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4727
		    __GSTORE(d);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4728
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4729
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4730
	    RETURN (@global(CurrentDirectory));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4731
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4732
#endif /* HAS_GETCWD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4733
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4734
#ifdef HAS_REALPATH
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4735
	{
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4736
	    char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4737
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4738
	    if (realpath(__stringVal(pathName), nameBuffer)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4739
		RETURN ( __MKSTRING(nameBuffer) );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4740
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4741
	    RETURN ( nil );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4742
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4743
#endif /* ! HAS_REALPATH */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4744
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4745
%}.
5451
2e21cd54b656 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5448
diff changeset
  4746
    ^ nil
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4747
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4748
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4749
timeOfLastAccess:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4750
    "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
  4751
     For nonexistent files, nil is returned."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4752
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4753
    "could be implemented as:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4754
	(self infoOf:aPathName) accessed 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4755
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4756
    |osSeconds i|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4757
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4758
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4759
    time_t mtime;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4760
    int ret;
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
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4763
# ifdef TRACE_STAT_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4764
	printf("stat on '%s' for timeOfLastAccess\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4765
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4766
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4767
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4768
	    ret = stat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4769
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4770
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4771
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4772
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4773
	    RETURN (nil);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4774
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4775
	osSeconds = __MKUINT(buf.st_atime);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4776
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4777
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4778
    osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4779
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4780
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4781
    i notNil ifTrue:[^ i accessed].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4782
    ^ nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4783
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4784
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4785
     OperatingSystem timeOfLastAccess:'/'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4786
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4787
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4788
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4789
timeOfLastChange:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4790
    "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
  4791
     For nonexistent files, nil is returned."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4792
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4793
    "could be implemented as:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4794
	(self infoOf:aPathName) modified
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4795
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4796
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4797
    |osSeconds i|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4798
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4799
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4800
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4801
    time_t mtime;
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
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4804
# ifdef TRACE_STAT_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4805
	printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4806
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4807
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4808
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4809
	    ret = stat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4810
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4811
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4812
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4813
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4814
	    RETURN ( nil );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4815
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4816
	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
  4817
    }
3496
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
    osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4820
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4821
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4822
    i notNil ifTrue:[^ i modified].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4823
    ^ nil.
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4826
     OperatingSystem timeOfLastChange:'/'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4827
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4830
typeOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4831
    "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
  4832
     nil is returned.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4833
     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
  4834
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4835
    |i|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4836
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4837
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4838
     this could have been implemented as:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4839
	(self infoOf:aPathName) type 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4840
     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
  4841
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4842
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4843
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4844
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4845
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4846
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4847
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4848
# ifdef TRACE_STAT_CALLS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4849
	printf("stat on '%s' for type\n", __stringVal(aPathName));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4850
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4851
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4852
	do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4853
	    ret = stat((char *) __stringVal(aPathName), &buf);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4854
	} while (ret < 0 && errno == EINTR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4855
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4856
	if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4857
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4858
	    RETURN ( nil );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4859
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4860
	switch (buf.st_mode & S_IFMT) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4861
	    case S_IFDIR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4862
		RETURN ( @symbol(directory) );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4863
	    case S_IFREG:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4864
		RETURN ( @symbol(regular) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4865
# ifdef S_IFCHR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4866
	    case S_IFCHR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4867
		RETURN ( @symbol(characterSpecial) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4868
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4869
# ifdef S_IFBLK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4870
	    case S_IFBLK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4871
		RETURN ( @symbol(blockSpecial) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4872
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4873
# ifdef S_IFLNK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4874
	    case S_IFLNK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4875
		RETURN ( @symbol(symbolicLink) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4876
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4877
# ifdef S_IFSOCK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4878
	    case S_IFSOCK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4879
		RETURN ( @symbol(socket) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4880
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4881
# ifdef S_IFIFO
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4882
	    case S_IFIFO:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4883
		RETURN ( @symbol(fifo) );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4884
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4885
	    default:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4886
		RETURN ( @symbol(unknown) );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4887
	}
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4888
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4889
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4890
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4891
    i notNil ifTrue:[^ i type].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4892
    ^ nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4893
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4894
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4895
     OperatingSystem typeOf:'/'   
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4896
     OperatingSystem typeOf:'.'   
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4897
     OperatingSystem typeOf:'Make.proto' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4898
     OperatingSystem typeOf:'resources/motif.style' 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4899
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4900
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4901
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4902
volumeNameOf:aPathString
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4903
    "return the volumeName of the argument, aPath
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4904
     - thats the name of the volume where aPath is.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4905
     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
  4906
     this always returns an empty string."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4907
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4908
    ^ ''
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4909
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4910
    "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
  4911
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4912
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4913
!UnixOperatingSystem class methodsFor:'interrupts & signals'!
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
defaultSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4916
    "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
  4917
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4918
     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
  4919
     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
  4920
     default for SIGQUIT (^ \) is to dump core.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4921
     Also, NOTICE that signal numbers are not portable between unix
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4922
     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
  4923
     a signal."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4924
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4925
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4926
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4927
    if (__isSmallInteger(signalNumber)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4928
#ifdef SIG_DFL
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4929
	signal(__intVal(signalNumber), SIG_DFL);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4930
	RETURN (self);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4931
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4932
    }
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4935
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4936
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4937
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4938
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4939
    "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
  4940
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4941
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4942
     OperatingSystem defaultSignal:(OperatingSystem sigINT).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4943
     1 to:1000000 do:[:i| ].
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4944
     OperatingSystem enableSignal:(OperatingSystem sigINT).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4945
     'normal ^C handling again.' printNewline
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4946
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4947
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4948
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4949
disableIOInterruptsOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4950
    "turn off IO interrupts for a filedescriptor"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4951
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4952
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4953
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4954
    int ret, flags, f;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4955
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4956
#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
  4957
    if (__isSmallInteger(fd)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4958
	f = __intVal(fd);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4959
# if defined(SYSV4)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4960
	ret = ioctl(f, I_SETSIG, 0);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4961
# else /*! SYSV4*/
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4962
	flags = fcntl(f, F_GETFL, 0);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4963
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4964
	 * if already clear, there is no need for this syscall ...
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4965
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4966
	if (flags & FASYNC) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4967
	    ret = fcntl(f, F_SETFL, flags & ~FASYNC);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4968
	    if (ret >= 0) ret = flags;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4969
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4970
	    ret = flags;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4971
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4972
# endif /* !SYSV4 */
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4973
	RETURN ( __MKSMALLINT(ret) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4974
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4975
#endif
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4978
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4979
     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
  4980
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4981
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4982
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4983
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4984
disableSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4985
    "disable (Unix-) signal processing for signalNumber.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4986
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4987
     WARNING: for some signals, it is no good idea to disable
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4988
     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
  4989
     handling.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4990
     Also, NOTICE that signal numbers are not portable between unix
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  4991
     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
  4992
     a signal.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4993
     Use only for fully debugged stand alone applications."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4994
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4995
%{  /* NOCONTEXT */
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
    if (__isSmallInteger(signalNumber)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4998
	int sigNo = __intVal(signalNumber);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  4999
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5000
	if (sigNo == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5001
	    RETURN (self);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5002
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5003
#ifdef SIG_IGN
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5004
	signal(sigNo, SIG_IGN);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5005
	RETURN (self);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5006
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5007
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5008
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5009
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5010
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5011
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5012
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5013
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5014
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5015
     'now, ^C is totally ignored ...' printNewline.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5016
     OperatingSystem disableSignal:(OperatingSystem sigINT).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5017
     1 to:1000000 do:[:i| ].
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5018
     OperatingSystem enableSignal:(OperatingSystem sigINT).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5019
     '^C handled again.' printNewline
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5020
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5021
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5022
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5023
disableTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5024
    "disable timer interrupts.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5025
     WARNING: 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5026
	the system will not operate correctly with timer interrupts
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5027
	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
  5028
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5029
%{  /* NOCONTEXT */
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
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5032
    struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5033
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5034
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5035
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5036
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5037
    dt.it_value.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5038
    setitimer(ITIMER_REAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5039
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5040
#else
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
# if defined(USE_SLOW_ALARM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5043
#  if defined(SIGALRM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5044
    alarm(0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5045
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5046
#  endif /* SIGALRM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5047
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5048
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5049
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5050
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5051
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5052
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5053
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5054
enableChildSignalInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5055
    "enable childSignal interrupts 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5056
     (SIGCHLD, if the architecture supports it).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5057
     After enabling, these signals will send the message 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5058
     'childSignalInterrupt' to the ChildSignalInterruptHandler object."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5059
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5060
    self enableSignal:(self sigCHLD)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5061
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5062
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5063
enableIOInterruptsOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5064
    "turn on IO interrupts for a filedescriptor"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5065
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5066
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5067
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5068
    int ret, flags, f;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5069
#ifndef __signalIoInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5070
    extern void __signalIoInterrupt();
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
    static int firstCall = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5073
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5074
#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
  5075
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5076
 * SIGIO/SIGPOLL - data available for I/O
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5077
 * (used to wake up waiting processes)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5078
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5079
#ifdef SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5080
# define THESIGNAL SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5081
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5082
# ifdef SIGPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5083
#  define THESIGNAL SIGPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5084
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5085
#  ifdef SIGURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5086
#   define THESIGNAL SIGURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5087
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5088
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5089
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5090
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5091
    if (__isSmallInteger(fd)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5092
	if (firstCall) {
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5093
#ifdef HAS_SIGACTION
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5094
	    struct sigaction act;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5095
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5096
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5097
	     * Do not add SA_RESTART here. A signal can cause a
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5098
	     * thread switch, another thread can do a garbage collect
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5099
	     * and restarted system calls may write into old
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5100
	     * (collected) addresses.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5101
	     */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5102
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5103
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5104
	    sigemptyset(&act.sa_mask);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5105
	    act.sa_handler = __signalIoInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5106
	    sigaction(THESIGNAL, &act, 0);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5107
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5108
# ifdef HAS_SIGVEC
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5109
	    struct sigvec vec;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5110
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5111
	    vec.sv_flags = SV_INTERRUPT;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5112
	    sigemptyset(&vec.sv_mask);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5113
	    vec.sv_handler = __signalIoInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5114
	    sigvec(THESIGNAL, &vec, NULL);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5115
# else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5116
	    signal(THESIGNAL, __signalIoInterrupt);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5117
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5118
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5119
	    firstCall = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5120
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5121
#undef THESIGNAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5122
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5123
	f = __intVal(fd);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5124
# if defined(SYSV4)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5125
	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
  5126
# else /*! SYSV4*/
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5127
	flags = fcntl(f, F_GETFL, 0);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5128
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5129
	 * if already set, there is no need for this syscall ...
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5130
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5131
	if (flags & FASYNC) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5132
	    ret = flags;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5133
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5134
	    ret = fcntl(f, F_SETFL, flags | FASYNC);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5135
	    if (ret >= 0) ret = flags;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5136
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5137
# endif /*!SYSV4*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5138
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5139
#if defined(F_SETOWN) || defined(FIOSETOWN)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5140
	{
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5141
	    int pid;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5142
	    int ok;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5143
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5144
	    pid = getpid();
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5145
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5146
# if defined(F_SETOWN)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5147
	    ok = fcntl(f, F_SETOWN, pid);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5148
	    /* 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
  5149
# else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5150
	    ok = ioctl(f, FIOSETOWN, &pid);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5151
	    /* printf("FIOSETOWN returns %d (%d)\n", ret, errno); */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5152
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5153
	    if (ok < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5154
		ret = ok;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5155
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5156
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5157
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5158
	RETURN ( __MKUINT(ret) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5159
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5160
#endif
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5163
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5164
     or if the system does not support SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5165
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5166
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5167
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5168
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5169
enableSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5170
    "enable (Unix-)signal processing for signalNumber.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5171
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5172
     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
  5173
     (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
  5174
     sends #signalInterrupt:.
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
     NOTICE that signal numbers are not portable between unix
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5177
     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
  5178
     a signal."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5179
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5180
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5181
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5182
#ifdef NSIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5183
# define SIG_LIMIT NSIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5184
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5185
# ifdef SIGUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5186
#  define SIG_LIMIT SIGUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5187
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5188
#  ifdef SIGUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5189
#   define SIG_LIMIT SIGUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5190
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5191
# endif
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5194
#if defined(SIGPOLL) && !defined(SIGIO)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5195
# define SIGIO SIGPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5196
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5197
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5198
#ifdef SIGCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5199
# define CHILD_SIGNAL   SIGCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5200
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5201
# ifdef SIGCLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5202
#  define CHILD_SIGNAL  SIGCLD
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5205
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5206
    int sigNr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5207
#if defined(SIGINT) || defined(SIGQUIT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5208
# ifndef __signalUserInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5209
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5210
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5211
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5212
#ifdef SIGFPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5213
# ifndef __signalFpExceptionInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5214
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5215
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5216
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5217
#ifdef SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5218
# ifndef __signalIoInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5219
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5220
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5221
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5222
#ifdef CHILD_SIGNAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5223
# ifndef __signalChildInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5224
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5225
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5226
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5227
#ifdef SIGPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5228
# ifndef __signalPIPEInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5229
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5230
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5231
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5232
#ifdef SIGBUS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5233
# ifndef __signalBUSInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5234
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5235
# endif
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
#ifdef SIGSEGV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5238
# ifndef __signalSEGVInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5239
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5240
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5241
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5242
#if defined(SIGILL) || defined(SIGEMT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5243
# ifndef __signalTrapInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5244
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5245
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5246
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5247
#ifdef SIGALRM
4105
dd93ca0dc062 removed leftOver obsolete win32 code;
Claus Gittinger <cg@exept.de>
parents: 4102
diff changeset
  5248
# ifndef __signalTimerInterrupt
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5249
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5250
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5251
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5252
#ifndef __signalInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5253
    extern void __signalInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5254
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5255
    void (*handler)(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5256
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5257
    if (__isSmallInteger(signalNumber)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5258
     && ((sigNr = __intVal(signalNumber)) >= 0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5259
#ifdef SIG_LIMIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5260
     &&  (sigNr <= SIG_LIMIT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5261
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5262
    ) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5263
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5264
	 * standard signals are forced into standard handlers
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5265
	 * - all others go into general signalInterrupt
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5266
	 */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5267
#if defined(SIGPOLL) && defined(SIGIO)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5268
	if (sigNr == SIGPOLL)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5269
	    sigNr = SIGIO;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5270
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5271
	switch (sigNr) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5272
	    case 0:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5273
		/* enabling a non-supported signal */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5274
		RETURN (self);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5275
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5276
#ifdef SIGBREAK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5277
	    case SIGBREAK:
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5278
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5279
#ifdef SIGINT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5280
	    case SIGINT:
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 SIGQUIT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5283
	    case SIGQUIT:
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5284
#endif
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  5285
#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGBREAK)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5286
		handler = __signalUserInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5287
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5288
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5289
#ifdef SIGFPE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5290
	    case SIGFPE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5291
		handler = __signalFpExceptionInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5292
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5293
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5294
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5295
#ifdef SIGPIPE
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5296
	    case SIGPIPE:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5297
		handler = __signalPIPEInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5298
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5299
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5300
#ifdef SIGBUS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5301
	    case SIGBUS:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5302
		handler = __signalBUSInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5303
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5304
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5305
#ifdef SIGSEGV
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5306
	    case SIGSEGV:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5307
		handler = __signalSEGVInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5308
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5309
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5310
#ifdef SIGILL
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5311
	    case SIGILL:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5312
		handler = __signalTrapInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5313
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5314
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5315
#ifdef SIGEMT
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5316
	    case SIGEMT:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5317
		handler = __signalTrapInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5318
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5319
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5320
#ifdef SIGIO
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5321
	    case SIGIO:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5322
		handler = __signalIoInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5323
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5324
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5325
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5326
#ifdef CHILD_SIGNAL
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5327
	    case CHILD_SIGNAL:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5328
		handler = __signalChildInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5329
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5330
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5331
#ifdef SIGALRM
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5332
	    case SIGALRM:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5333
		handler = __signalTimerInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5334
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5335
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5336
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5337
	    default:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5338
		handler = __signalInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5339
		break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5340
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5341
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5342
	{
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5343
#ifdef HAS_SIGACTION
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5344
	    struct sigaction act;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5345
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5346
	    /*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5347
	     * Do not add SA_RESTART here. A signal can cause a
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5348
	     * thread switch, another thread can do a garbage collect
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5349
	     * and restarted system calls may write into old
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5350
	     * (collected) addresses.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5351
	     */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5352
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5353
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5354
	    sigemptyset(&act.sa_mask);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5355
	    act.sa_handler = handler;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5356
	    sigaction(sigNr, &act, 0);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5357
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5358
# ifdef HAS_SIGVEC
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5359
	    struct sigvec vec;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5360
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5361
	    vec.sv_flags = SV_INTERRUPT;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5362
	    sigemptyset(&vec.sv_mask);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5363
	    vec.sv_handler = handler;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5364
	    sigvec(sigNr, &vec, NULL);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5365
# else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5366
	    (void) signal(sigNr, handler);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5367
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5368
#endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5369
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5370
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5371
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5372
	 * maybe, we should ret the old enable-status
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5373
	 * as boolean here ...
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5374
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5375
	RETURN (self);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5376
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5377
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5378
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5379
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5380
     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
  5381
     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
  5382
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5383
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5384
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5385
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5386
enableTimer:milliSeconds
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5387
    "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
  5388
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5389
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5390
    int millis;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5391
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5392
    millis = __intVal(milliSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5393
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5394
#ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5395
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5396
	static int firstCall = 1;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5397
# ifndef __signalTimerInterrupt
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5398
	extern void __signalTimerInterrupt(SIGHANDLER_ARG);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5399
# endif
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5400
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5401
	if (firstCall) {
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5402
# ifdef HAS_SIGACTION
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5403
	    struct sigaction act;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5404
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5405
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5406
	    sigemptyset(&act.sa_mask);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5407
	    act.sa_handler = __signalTimerInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5408
	    sigaction(SIGALRM, &act, 0);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5409
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5410
#  ifdef HAS_SIGVEC
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5411
	    struct sigvec vec;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5412
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5413
	    vec.sv_flags = SV_INTERRUPT;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5414
	    sigemptyset(&vec.sv_mask);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5415
	    vec.sv_handler = __signalTimerInterrupt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5416
	    sigvec(SIGALRM, &vec, NULL);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5417
#  else /* neither SIGACTION nor SIGVEC */
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5418
	    signal(SIGALRM, __signalTimerInterrupt);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5419
#  endif /* stupid system  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5420
# endif
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5421
	    firstCall = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5422
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5423
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5424
#endif /* SIGALRM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5425
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5426
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5427
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5428
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5429
	struct itimerval dt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5430
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5431
	dt.it_interval.tv_sec = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5432
	dt.it_interval.tv_usec = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5433
	dt.it_value.tv_sec = millis / 1000;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5434
	dt.it_value.tv_usec = (millis % 1000) * 1000;  
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5435
	setitimer(ITIMER_REAL, &dt, 0);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5436
	RETURN (true);
3496
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
#else /* no ITIMER_REAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5439
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5440
# ifdef USE_SLOW_ALARM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5441
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5442
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5443
	 * last fallback - use alarm (which only gives 1 second resolution).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5444
	 * If the system does not support any of the above, you have to life
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5445
	 * with this. The consequence is that pressing CTRL-C processing and
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5446
	 * thread switching will take place much delayed.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5447
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5448
	alarm(1);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5449
	RETURN(true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5450
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5451
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5452
#endif /* ITIMER_REAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5453
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5454
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5455
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5456
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5457
killProcess:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5458
    "kill a unix process.
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5459
     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
  5460
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5461
     WARNING: in order to avoid zombie processes (on unix),
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5462
	      you may have to fetch the processes exitstatus with
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5463
	      OperatingSystem>>getStatusOfProcess:aProcessId."
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5464
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5465
    self sendSignal:(self sigKILL) to:processId.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5466
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5467
    "Modified: / 10.6.1998 / 11:59:12 / cg"
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5468
!
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5469
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5470
killProcessGroup:processGroupId
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5471
    "kill a unix process group.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5472
     The process has a no chance to do some cleanup.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5473
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5474
     WARNING: in order to avoid zombie processes (on unix),
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5475
	      you may have to fetch the processes exitstatus with
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5476
	      OperatingSystem>>getStatusOfProcess:aProcessId."
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5477
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5478
    self sendSignal:(self sigKILL) to:(processGroupId negated).
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5479
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5480
    "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
  5481
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5482
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5483
sendSignal:signalNumber to:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5484
    "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
  5485
     Returns false if any error occurred, true otherwise.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5486
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5487
     Do not confuse UNIX signals with Smalltalk-Signals.
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
     WARNING: in order to avoid zombie processes (on unix),
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5490
	      you may have to fetch the processes exitstatus with
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5491
	      OperatingSystem>>getStatusOfProcess:aProcessId
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5492
	      if the signal terminates that process."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5493
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5494
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5495
    if (__bothSmallInteger(signalNumber, processId)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5496
	if (kill(__intVal(processId), __intVal(signalNumber)) < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5497
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5498
	    RETURN ( false );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5499
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5500
	RETURN ( true );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5501
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5502
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5503
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5504
    "/ either invalid argument (non-integers)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5505
    "/ or not supported by OS
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5508
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5509
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5510
startSpyTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5511
    "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
  5512
     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
  5513
     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
  5514
     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
  5515
     (which is of course less correct).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5516
     OBSOLETE: the new messageTally runs as a high prio process, not using 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5517
	       spy interrupts."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5518
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5519
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5520
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5521
#ifndef __spyInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5522
    extern void __spyInterrupt();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5523
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5524
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5525
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5526
    struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5527
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5528
# ifdef SIGVTALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5529
    signal(SIGVTALRM, __spyInterrupt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5530
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5531
#  ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5532
    signal(SIGALRM, __spyInterrupt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5533
#  else
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
     * mhmh - system has neither SIGBTALRM nor SIGALRM ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5536
     * what should we do here ?
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5537
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5538
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5539
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5540
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5541
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5542
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5543
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5544
    dt.it_value.tv_usec = 1000;   /* 1000 Hz */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5545
    setitimer(ITIMER_VIRTUAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5546
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5547
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5548
#endif /* ITIMER_VIRTUAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5549
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5550
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5551
!
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
stopSpyTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5554
    "stop spy timing - disable spy timer.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5555
     OBSOLETE: the new messageTally runs as a high prio process, not using 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5556
	       spy interrupts."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5557
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5558
%{  /* NOCONTEXT */
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
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5561
    struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5562
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5563
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5564
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5565
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5566
    dt.it_value.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5567
    setitimer(ITIMER_VIRTUAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5568
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5569
#endif /* ITIMER_VIRTUAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5570
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5571
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5572
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5573
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5574
terminateProcess:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5575
    "terminate a unix process.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5576
     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
  5577
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5578
     WARNING: in order to avoid zombie processes (on unix),
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5579
	      you may have to fetch the processes exitstatus with
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5580
	      OperatingSystem>>getStatusOfProcess:aProcessId."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5581
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5582
    self sendSignal:(self sigTERM) to:processId.
3496
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
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5585
    "Modified: / 27.1.1998 / 20:05:47 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5586
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5587
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5588
terminateProcessGroup:processGroupId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5589
    "terminate a unix process group.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5590
     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
  5591
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5592
     WARNING: in order to avoid zombie processes (on unix),
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5593
	      you may have to fetch the processes exitstatus with
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5594
	      OperatingSystem>>getStatusOfProcess:aProcessId."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5595
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5596
    self sendSignal:(self sigTERM) to:(processGroupId negated).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5597
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5598
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5599
    "Created: / 23.4.1996 / 16:40:34 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5600
    "Modified: / 27.1.1998 / 20:05:59 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5601
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5602
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5603
!UnixOperatingSystem class methodsFor:'ipc support - UNIX'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5604
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5605
makePTYPair
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5606
    "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
  5607
     nil on failure.
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5608
     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
  5609
     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
  5610
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5611
    |fdS fdM|    
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5612
                
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5613
%{       
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5614
    /*
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5615
     * Find a pseudo tty to use and open both sides.
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5616
     *  _fdM receives the master file descriptor while _fdS
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5617
     *  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
  5618
     *  needed in daemons such as rlogind and telnetd.
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5619
     */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5620
3536
adad0d12c9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3534
diff changeset
  5621
#ifdef IRIX5
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5622
    int _fdM, _fdS;
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5623
    char *line;
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5624
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5625
    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
  5626
    if ((line != 0) && (_fdM >= 0)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5627
	_fdS = open(line, O_RDWR);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5628
	if (_fdS < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5629
	    (void)close(_fdM);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5630
	    _fdS = _fdM = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5631
	}
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5632
    } else {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5633
	_fdM -1;
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5634
    }
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5635
    if ((_fdM >= 0) && (_fdS >= 0)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5636
	 fdM = __MKSMALLINT(_fdM);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5637
	 fdS = __MKSMALLINT(_fdS);
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5638
    }
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5639
#   define NO_PTY_TEMPL
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5640
#endif /* IRIX5 */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5641
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5642
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5643
#ifdef LINUX
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5644
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5645
#   define PT_INDEX      5
3550
6c3824d07eac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
  5646
#   define PTY_1_CHARS  "pqrstuabcdevwxyz"
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5647
#   define PTY_2_CHARS  "0123456789abcdef"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5648
#endif /* LINUX */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5649
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5650
#ifdef solaris
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5651
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5652
#   define PT_INDEX      5
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5653
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5654
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5655
#endif /* solaris */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5656
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5657
#ifdef aix
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5658
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5659
#   define PT_INDEX      5
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5660
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5661
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5662
#endif /* aix */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5663
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5664
#ifdef next3
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5665
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5666
#   define PT_INDEX      5
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5667
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5668
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5669
#endif /* next3 */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5670
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5671
#ifdef hpux
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5672
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5673
#   define PT_INDEX      5
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5674
#   define PTY_1_CHARS  "pqrs"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5675
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5676
#endif /* hpux */
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5677
4262
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5678
#if defined(__osf__)
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5679
#   define PTY_TEMPL    "/dev/ptyXX"
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5680
#   define PT_INDEX      5
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5681
#   define PTY_1_CHARS  "pq"
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5682
#   define PTY_2_CHARS  "0123456789abcdef"
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5683
#endif /* osf1 */
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5684
95ab0ee1a0d8 pty code for osf1
Claus Gittinger <cg@exept.de>
parents: 4259
diff changeset
  5685
#if defined(BSD) && !defined(PTY_TEMPL)
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5686
#   define PTY_TEMPL    "/dev/ptyXX"
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5687
#   define PT_INDEX      5
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5688
#   define PTY_1_CHARS  "p"
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5689
#   define PTY_2_CHARS  "0123456789abcdefghijklmnopqrstuv"
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5690
#endif /* BSD */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5691
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5692
#ifdef NO_PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5693
# undef PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5694
#endif
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5695
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5696
#ifdef PTY_TEMPL
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5697
#   include <grp.h>
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5698
3981
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5699
# ifdef OLD /* mhmh - suse linux6 places line into rodata ??? */
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5700
    static char line[] = PTY_TEMPL;
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5701
# else
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5702
    char line[128];
3981
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5703
# endif
3575
39723f691a0e hp-cc does not recognize const keyword
Claus Gittinger <cg@exept.de>
parents: 3571
diff changeset
  5704
    register CONST char *cp1, *cp2;
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5705
    int len, _fdM = -1, _fdS = -1, ttygid;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5706
    struct group *gr;
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5707
3981
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5708
# ifdef OLD
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5709
    len = sizeof(PTY_TEMPL) - 1;
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5710
# else
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5711
    strcpy(line, PTY_TEMPL);
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5712
    len = strlen(line);
3981
c2582f877635 renamed __new() to __STX___new()
Claus Gittinger <cg@exept.de>
parents: 3970
diff changeset
  5713
# endif
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  5714
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5715
    if ((gr = getgrnam("tty")) != NULL)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5716
	ttygid = gr->gr_gid;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5717
    else
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5718
	ttygid = -1;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5719
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5720
    for (cp1 = PTY_1_CHARS; *cp1; cp1++) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5721
	line[len-2] = * cp1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5722
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5723
	for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5724
	    line[PT_INDEX] = 'p';
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5725
	    line[len-1] = *cp2;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5726
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5727
	    if ((_fdM = open(line, O_RDWR, 0)) < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5728
		if (errno == ENOENT) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5729
		    _fdM = _fdS = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5730
		    goto getOutOfHere; /* out of ptys */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5731
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5732
	    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5733
		line[PT_INDEX] = 't';
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5734
		(void) chown( line, getuid(), ttygid );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5735
		(void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5736
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5737
		if( (_fdS = open(line, O_RDWR, 0)) >= 0 ) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5738
		    goto getOutOfHere;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5739
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5740
		(void) close( _fdM );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5741
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5742
	}
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5743
    }
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5744
  getOutOfHere: ;
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5745
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5746
    if ((_fdM >= 0) && (_fdS >= 0)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5747
	 fdM = __MKSMALLINT(_fdM);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5748
	 fdS = __MKSMALLINT(_fdS);
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5749
    }
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5750
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5751
#endif /* PTY_TEMPL */
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5752
#undef NO_PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5753
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5754
%}.
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5755
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5756
    fdM notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5757
	^ Array with:fdM with:fdS.
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5758
    ].
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5759
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5760
    ^ nil
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5761
!
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5762
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5763
makePipe
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5764
    "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
  5765
     nil on failure.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5766
     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
  5767
     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
  5768
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5769
    |fd1 fd2|    
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5770
                
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5771
%{       
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5772
     int fds[2];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5773
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5774
     if (pipe(fds) < 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5775
	@global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5776
	RETURN ( nil );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5777
     }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5778
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5779
     fd1 = __MKSMALLINT(fds[0]);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5780
     fd2 = __MKSMALLINT(fds[1]);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5781
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5782
    fd1 notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5783
	^ Array with:fd1 with:fd2.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5784
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5785
    ^ nil
3556
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
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5788
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
  5789
    "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
  5790
%{
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5791
#ifdef TIOCSWINSZ
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5792
    struct winsize wsize;
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5793
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5794
    if (__isSmallInteger(fd)
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5795
     && __isSmallInteger(w)
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5796
     && __isSmallInteger(h)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5797
	wsize.ws_row = (unsigned short)__intVal(h);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5798
	wsize.ws_col = (unsigned short)__intVal(w);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5799
	if (ioctl(__intVal(fd), TIOCSWINSZ, (char *)&wsize) >= 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5800
	    RETURN (true);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5801
	}
3556
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5802
    }
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5803
#endif
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5804
%}.
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  5805
    ^ false
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5806
! !
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
!UnixOperatingSystem class methodsFor:'misc'!
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
closePid:pid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5811
    "free pid resource"
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5812
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5813
    ^ true.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5814
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5815
    "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
  5816
    "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
  5817
    "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
  5818
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5819
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5820
slowFork:aBoolean
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5821
    "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
  5822
     Only used internally on SYSV3 systems"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5823
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5824
    SlowFork := aBoolean
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5825
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5826
    "Modified: 22.4.1996 / 13:13:09 / cg"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5829
!UnixOperatingSystem class methodsFor:'os queries'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5830
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5831
executableFileExtensions
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5832
    "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
  5833
     Only req'd for msdos like systems ..."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5834
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5835
    ^ #('')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5836
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5837
    "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
  5838
    "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
  5839
!
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
getDomainName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5842
    "return the domain this host is in.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5843
     Notice:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5844
	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
  5845
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5846
    |name idx hostName|
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
    DomainName notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5849
	^ DomainName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5850
    ].
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  5851
    name := self primGetDomainName.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5852
    name isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5853
	"/ fallBack
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5854
	name := self getEnvironment:'DOMAIN'.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5855
	name isNil ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5856
	    name := self getCommandOutputFrom:'domainname'
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5857
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5858
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5859
    name isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5860
	"/ sometimes, we can extract the domainName from the hostName ...
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5861
	hostName := self getHostName.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5862
	hostName notNil ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5863
	    idx := hostName indexOf:$..
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5864
	    idx ~~ 0 ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5865
		name := hostName copyFrom:idx+1.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5866
	    ]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5867
	]. 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5868
	name isNil ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5869
	    'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5870
	    name := 'unknown'.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5871
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5872
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5873
    DomainName := name.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5874
    ^ name
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5875
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5876
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5877
     OperatingSystem getDomainName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5878
    "
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
    "Modified: 26.4.1996 / 10:04:54 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5881
!
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
getEnvironment:aStringOrSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5884
    "get an environment string"
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5887
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5888
    char *env;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5889
    extern char *getenv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5890
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5891
    if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5892
	env =  getenv(__stringVal(aStringOrSymbol));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5893
	if (env) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5894
	    RETURN ( __MKSTRING(env) );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5895
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5896
	RETURN ( nil );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5897
    }
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5898
%}.
5407
d6729266a95b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5404
diff changeset
  5899
    ^ self primitiveFailed
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5900
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5901
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5902
     OperatingSystem getEnvironment:'LANG'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5903
     OperatingSystem getEnvironment:'LOGIN'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5904
     OperatingSystem getEnvironment:'HOME'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5905
     OperatingSystem getEnvironment:'NNTPSERVER'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5906
     OperatingSystem getEnvironment:'MAIL'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5907
     OperatingSystem getEnvironment:'PATH'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5908
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5909
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5910
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5911
getHostName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5912
    "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
  5913
     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
  5914
     Notice:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5915
	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
  5916
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5917
    |name idx|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5918
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5919
    HostName notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5920
	^ HostName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5921
    ].
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  5922
    name := self primGetHostName.
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  5923
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5924
    name isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5925
	"/ fallBack
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5926
	name := self getEnvironment:'HOST'.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5927
	name isNil ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5928
	    name := self getCommandOutputFrom:'hostname'
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5929
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5930
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5931
    name isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5932
	'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5933
	name := 'unknown'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5934
    ] ifFalse:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5935
	"/ on some systems, the hostname already contains the domain.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5936
	"/ decompose it here.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5937
	idx := name indexOf:$..
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5938
	idx ~~ 0 ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5939
	    DomainName := name copyFrom:(idx+1).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5940
	    name := name copyTo:(idx-1).
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5941
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5942
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5943
    HostName := name.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5944
    ^ name
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5945
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5946
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  5947
     OperatingSystem getHostName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5948
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5949
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5950
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5951
getLocaleInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5952
    "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
  5953
     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
  5954
     Possible fields are:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5955
	decimalPoint                    <String>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5956
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5957
	thousandsSep                    <String>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5958
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5959
	internationalCurrencySymbol     <String>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5960
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5961
	currencySymbol                  <String>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5962
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5963
	monetaryDecimalPoint            <String>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5964
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5965
	monetaryThousandsSeparator      <String>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5966
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5967
	positiveSign                    <String>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5968
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5969
	negativeSign                    <String>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5970
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5971
	internationalFractionalDigits   <Integer>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5972
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5973
	fractionalDigits                <Integer>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5974
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5975
	positiveSignPrecedesCurrencySymbol      <Boolean>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5976
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5977
	negativeSignPrecedesCurrencySymbol      <Boolean>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5978
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5979
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5980
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5981
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5982
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5983
	positiveSignPosition                            <Symbol>
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5984
							one of: #parenthesesAround, 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5985
								#signPrecedes, 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5986
								#signSuceeds, 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5987
								#signPrecedesCurrencySymbol,
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5988
								#signSuceedsCurrencySymbol
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5989
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  5990
	negativeSignPosition                            <like above>
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5991
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5992
     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
  5993
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5994
     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
  5995
     it should be used by applications as required.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5996
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5997
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5998
    |info val|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5999
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6000
    LocaleInfo notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6001
	"/ return the internal info; useful on systems which do not
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6002
	"/ support this.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6003
	^ LocaleInfo
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6004
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6005
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6006
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6007
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6008
    char *decimalPoint;         /* something like "." (US) or "," (german) */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6009
    char *thousandsSep;         /* something like "," (US) or "." (german) */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6010
    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
  6011
    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
  6012
    char *monDecimalPoint;      /* money: decimal point */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6013
    char *monThousandsSep;      /* money: thousands sep */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6014
    char *positiveSign;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6015
    char *negativeSign;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6016
    int   intFractDigits;       /* money: international digits after decPoint */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6017
    int   fractDigits;          /* money: local digits after decPoint */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6018
    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
  6019
    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
  6020
    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
  6021
    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
  6022
    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
  6023
    int   csNegSignPosition;    /*        1: sign precedes the value & currency symbol */
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6024
				/*        2: sign succeeds the value & currency symbol */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6025
				/*        3: sign immediately precedes the currency symbol */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6026
				/*        4: sign immediately suceeds the currency symbol */
3496
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
#if defined(HAS_LOCALECONV)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6029
    struct lconv *conf;
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
    conf = localeconv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6032
    if (conf) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6033
	decimalPoint = conf->decimal_point;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6034
	thousandsSep = conf->thousands_sep;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6035
	intCurrencySymbol = conf->int_curr_symbol;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6036
	currencySymbol = conf->currency_symbol;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6037
	monDecimalPoint = conf->mon_decimal_point;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6038
	monThousandsSep = conf->mon_thousands_sep;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6039
	positiveSign = conf->positive_sign;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6040
	negativeSign = conf->negative_sign;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6041
	intFractDigits = conf->int_frac_digits;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6042
	fractDigits = conf->frac_digits;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6043
	csPosPrecedes = conf->p_cs_precedes; 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6044
	csNegPrecedes = conf->n_cs_precedes; 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6045
	csPosSepBySpace = conf->p_sep_by_space; 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6046
	csNegSepBySpace = conf->n_sep_by_space; 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6047
	csPosSignPosition = conf->p_sign_posn;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6048
	csNegSignPosition = conf->n_sign_posn;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6049
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6050
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6051
    decimalPoint = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6052
    thousandsSep = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6053
    intCurrencySymbol = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6054
    currencySymbol = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6055
    monDecimalPoint = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6056
    monThousandsSep = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6057
    positiveSign =  (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6058
    negativeSign =(char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6059
    intFractDigits = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6060
    fractDigits = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6061
    csPosPrecedes = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6062
    csNegPrecedes = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6063
    csPosSepBySpace = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6064
    csNegSepBySpace = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6065
    csPosSignPosition = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6066
    csNegSignPosition = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6067
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6068
    if (decimalPoint) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6069
	val = __MKSTRING(decimalPoint);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6070
	__AT_PUT_(info, @symbol(decimalPoint), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6071
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6072
    if (thousandsSep) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6073
	val = __MKSTRING(thousandsSep);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6074
	__AT_PUT_(info, @symbol(thousandsSeparator), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6075
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6076
    if (intCurrencySymbol) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6077
	val = __MKSTRING(intCurrencySymbol);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6078
	__AT_PUT_(info, @symbol(internationCurrencySymbol), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6079
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6080
    if (currencySymbol) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6081
	val = __MKSTRING(currencySymbol);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6082
	__AT_PUT_(info, @symbol(currencySymbol), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6083
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6084
    if (monDecimalPoint) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6085
	val = __MKSTRING(monDecimalPoint);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6086
	__AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6087
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6088
    if (monThousandsSep) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6089
	val = __MKSTRING(monThousandsSep);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6090
	__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6091
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6092
    if (positiveSign) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6093
	val = __MKSTRING(positiveSign);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6094
	__AT_PUT_(info, @symbol(positiveSign), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6095
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6096
    if (negativeSign) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6097
	val = __MKSTRING(negativeSign);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6098
	__AT_PUT_(info, @symbol(negativeSign), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6099
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6100
    if (intFractDigits >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6101
	__AT_PUT_(info, @symbol(internationalFractionalDigits),  __MKSMALLINT(intFractDigits));
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 (fractDigits >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6104
	__AT_PUT_(info, @symbol(fractionalDigits),  __MKSMALLINT(fractDigits));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6105
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6106
    if (csPosPrecedes >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6107
	if (csPosPrecedes == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6108
	    val = false;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6109
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6110
	    val = true;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6111
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6112
	__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6113
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6114
    if (csNegPrecedes >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6115
	if (csNegPrecedes == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6116
	    val = false;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6117
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6118
	    val = true;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6119
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6120
	__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6121
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6122
    if (csPosSepBySpace >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6123
	if (csPosSepBySpace == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6124
	    val = false;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6125
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6126
	    val = true;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6127
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6128
	__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6129
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6130
    if (csNegSepBySpace >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6131
	if (csNegSepBySpace == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6132
	    val = false;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6133
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6134
	    val = true;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6135
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6136
	__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6137
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6138
    switch (csPosSignPosition) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6139
	case 0:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6140
	    val = @symbol(parenthesesAround);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6141
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6142
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6143
	case 1:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6144
	    val = @symbol(signPrecedes);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6145
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6146
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6147
	case 2:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6148
	    val = @symbol(signSuceeds);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6149
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6150
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6151
	case 3:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6152
	    val = @symbol(signPrecedesCurrencySymbol);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6153
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6154
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6155
	case 4:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6156
	    val = @symbol(signSuceedsCurrencySymbol);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6157
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6158
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6159
	default:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6160
	    val = nil;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6161
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6162
    if (val != nil) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6163
	__AT_PUT_(info, @symbol(positiveSignPosition), val);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6164
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6165
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6166
    switch (csNegSignPosition) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6167
	case 0:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6168
	    val = @symbol(parenthesesAround);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6169
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6170
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6171
	case 1:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6172
	    val = @symbol(signPrecedes);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6173
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6174
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6175
	case 2:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6176
	    val = @symbol(signSuceeds);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6177
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6178
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6179
	case 3:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6180
	    val = @symbol(signPrecedesCurrencySymbol);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6181
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6182
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6183
	case 4:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6184
	    val = @symbol(signSuceedsCurrencySymbol);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6185
	    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6186
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6187
	default:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6188
	    val = nil;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6189
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6190
    if (val != nil) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6191
	__AT_PUT_(info, @symbol(negativeSignPosition), val);
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6194
    ^ info
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6197
     OperatingSystem getLocaleInfo
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6198
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6199
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6200
    "Created: 23.12.1995 / 14:19:20 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6201
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6202
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6203
getProcessId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6204
    "return the (unix-)processId"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6205
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6206
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6207
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6208
    int pid = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6209
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6210
    pid = getpid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6211
    RETURN ( __MKSMALLINT(pid) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6212
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6213
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6214
     OperatingSystem getProcessId
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6215
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6216
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6217
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6218
getSystemID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6219
    "if supported by the OS, return the systemID;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6220
     a unique per machine identification.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6221
     WARNING:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6222
	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
  6223
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6224
%{  /* NO_CONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6225
#if defined(IRIX5) && !defined(HAS_GETHOSTID)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6226
    char idBuffer[MAXSYSIDSIZE];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6227
    int retVal;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6228
    OBJ arr;
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
    if ((retVal = syssgi(SGI_SYSID, idBuffer)) == 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6231
	arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6232
	bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6233
	RETURN (arr);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6234
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6235
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6236
#if defined(HAS_GETHOSTID)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6237
    int runningId;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6238
    OBJ arr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6239
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6240
    runningId = gethostid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6241
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6242
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6243
    RETURN (arr);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6244
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6245
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6246
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6247
	char buffer[128];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6248
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6249
	buffer[0] = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6250
	if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6251
	    buffer[127] = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6252
	    if (strlen(buffer) > 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6253
		RETURN(__MKSTRING(buffer));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6254
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6255
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6256
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6257
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6258
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6259
    ^ 'unknown'
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6262
     OperatingSystem getSystemID
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6263
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6264
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6265
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6266
getSystemInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6267
    "return info on the system weare running on.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6268
     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
  6269
     otherwise, some simulated info is returned.
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
     WARNING:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6272
       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
  6273
       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
  6274
       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
  6275
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6276
       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
  6277
       information. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6278
       (in case of system/version specific OS errors, conditional workarounds and patches
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6279
	may be based upon this info).
4020
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6280
       Also, applications could enable/disable buffering or otherwise reduce
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6281
       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
  6282
       Your application may make use of available information for tuning,
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6283
       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
  6284
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6285
     The returned info may (or may not) contain:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6286
	#system -> some operating system identification (irix, Linux, nt, win32s ...) 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6287
	#version -> OS version (some os version identification)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6288
	#release -> OS release (3.5, 1.2.1 ...)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6289
	#node   -> some host identification (hostname)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6290
	#domain  -> domain name (hosts domain)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6291
	#machine -> type of CPU (i586, mips ...)
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6292
     
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6293
     those are currently returned on some machines (no warranty)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6294
     linux:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6295
	#totalRam         -> total amount of memory available
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6296
	#sharedRam        -> amount of memory which is shared among processes
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6297
			     (i.e. shared code)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6298
	#bufferRam        -> amount used for buffers
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6299
	#swapSize         -> total size of swap space
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6300
	#freeSwap         -> free amount in swapSpace
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6301
	#extendedInstructions -> extended instruction set info
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6302
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6303
     osf:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6304
	#physicalRam      -> total amount of physical memory
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6305
	#cpuType          -> type of cpu (more detailed than machine)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6306
	#numberOfCPUs     -> number of cpus in box
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6307
        
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6308
     solaris:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6309
	#physicalRam      -> total amount of physical memory
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6310
	#availableRam     -> total available amount of physical memory (i.e. unused ram)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6311
	#freeRam          -> amount of free memory
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6312
	#numberOfCPUs     -> number of cpus in box (online CPUS)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6313
	[#dCacheSize]     -> bytes in data cache (only available on some solaris versions)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6314
	[#iCacheSize]     -> bytes in data cache (only available on some solaris versions)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6315
	[#instructionSets]-> instruction sets available (only available on some solaris versions)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6316
	[#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
  6317
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6318
     hpux:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6319
	#physicalRam      -> total amount of physical memory in box
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6320
	#activeRealMemory -> ? - read pstat documentation
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6321
	#activeVirtualRam -> ? - read pstat documentation
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6322
	#freeMemory       -> ? - read pstat documentation
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6323
	#realMemory       -> ? (amount of memory left to user programs)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6324
	#virtualRam       -> ? - read pstat documentation
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6325
    "
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6326
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6327
    |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
  6328
     physicalRam availableRam totalRam sharedRam bufferRam swapSize freeSwap
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6329
     numberOfCPUs pageSize physicalPages availablePages dCacheSize iCacheSize
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6330
     virtualRam activeVirtualRam realMemory activeRealMemory freeMemory
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6331
     instructionSets extendedInstructions platform|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6332
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6333
%{  /* STACK: 4096 */
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6334
#ifdef LINUX
3696
a0c77f9bdbc7 oops - a.out linux has no sysinfo
Claus Gittinger <cg@exept.de>
parents: 3692
diff changeset
  6335
# 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
  6336
    /* 
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6337
     * additional info available ...
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6338
     */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6339
    struct sysinfo infoBuffer;
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6340
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6341
    if (sysinfo(&infoBuffer) >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6342
	totalRam   = __MKUINT(infoBuffer.totalram);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6343
	sharedRam = __MKUINT(infoBuffer.sharedram);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6344
	bufferRam = __MKUINT(infoBuffer.bufferram);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6345
	swapSize  = __MKUINT(infoBuffer.totalswap);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6346
	freeSwap  = __MKUINT(infoBuffer.freeswap);
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6347
    }
3696
a0c77f9bdbc7 oops - a.out linux has no sysinfo
Claus Gittinger <cg@exept.de>
parents: 3692
diff changeset
  6348
# endif
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6349
#endif /* LINUX */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6350
4088
622551d3c0d7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4084
diff changeset
  6351
#if defined(hpux) && !defined(__GNUC__)
4020
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6352
# include <sys/pstat.h>
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6353
    struct pst_static stat_buf;
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6354
    struct pst_dynamic dynam_buf;
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6355
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6356
    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
  6357
    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
  6358
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6359
    physicalRam        = __MKUINT(stat_buf.physical_memory/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6360
    virtualRam         = __MKUINT(dynam_buf.psd_vm/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6361
    activeVirtualRam   = __MKUINT(dynam_buf.psd_avm/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6362
    realMemory         = __MKUINT(dynam_buf.psd_rm/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6363
    activeRealMemory   = __MKUINT(dynam_buf.psd_arm/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6364
    freeMemory         = __MKUINT(dynam_buf.psd_free/256*1024*1024);
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6365
#endif
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6366
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6367
#if defined(HAS_UNAME)
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6368
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6369
	struct utsname ubuff;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6370
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6371
	if (uname(&ubuff) >= 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6372
	    sys  = __MKSTRING(ubuff.sysname);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6373
	    node = __MKSTRING(ubuff.nodename);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6374
	    rel  = __MKSTRING(ubuff.release);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6375
	    ver  = __MKSTRING(ubuff.version);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6376
	    mach = __MKSTRING(ubuff.machine);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6377
# ifdef HAS_UTS_DOMAINNAME
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6378
	    dom  = __MKSTRING(ubuff.domainname);
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6379
# endif /* no HAS_UTS_DOMAINNAME */
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6380
	}
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6381
    }
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6382
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6383
#else /* no UNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6384
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6385
    /*
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6386
     * use fallBack code below
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6387
     */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6388
#endif /* no UNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6389
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6390
#if defined(HAS_SYSINFO)
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6391
# if defined(SI_ARCHITECTURE)
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6392
    if (arch == nil) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6393
	char buffer[128];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6394
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6395
	if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6396
	    arch = __MKSTRING(buffer);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6397
	}
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6398
    }
4923
1cacdcfc82c9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4922
diff changeset
  6399
# endif /* SI_ARCHITECTURE */
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6400
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6401
# if defined(SI_ISALIST)
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6402
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6403
	char buffer[128];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6404
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6405
	if (sysinfo(SI_ISALIST, buffer, sizeof(buffer))) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6406
	    instructionSets = __MKSTRING(buffer);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6407
	}
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6408
    }
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6409
# endif /* SI_ISALIST */
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6410
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6411
# if defined(SI_PLATFORM)
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6412
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6413
	char buffer[128];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6414
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6415
	if (sysinfo(SI_PLATFORM, buffer, sizeof(buffer))) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6416
	    platform = __MKSTRING(buffer);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6417
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6418
    }
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6419
# endif /* SI_PLATFORM */
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6420
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6421
# if defined(SI_RELEASE)
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6422
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6423
	char buffer[128];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6424
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6425
	if (sysinfo(SI_RELEASE, buffer, sizeof(buffer))) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6426
	    rel = __MKSTRING(buffer);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6427
	}
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6428
    }
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  6429
# endif /* SI_RELEASE */
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6430
#endif /* HAS_SYSINFO */
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6431
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6432
#if defined(HAS_GETDOMAINNAME)
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6433
    if (dom == nil) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6434
	char buffer[128];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6435
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6436
	if (getdomainname(buffer, sizeof(buffer)) == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6437
	    dom = __MKSTRING(buffer);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6438
	}
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6439
    }
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6440
#endif /* HAS_GETDOMAINNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6441
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6442
#if defined(HAS_SYSCONF)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6443
# ifdef _SC_NPROCESSORS_ONLN
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6444
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6445
	long val;
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6446
 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6447
	val = sysconf(_SC_NPROCESSORS_ONLN);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6448
	if (val > 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6449
	    numberOfCPUs = __MKINT(val);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6450
	}
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6451
    }
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6452
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6453
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6454
# if defined(_SC_PAGESIZE)
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6455
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6456
	long val;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6457
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6458
	val = sysconf(_SC_PAGESIZE);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6459
	if (val != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6460
	    pageSize = __MKUINT(val);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6461
	}
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6462
    }
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6463
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6464
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6465
# if defined(_SC_PHYS_PAGES)
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6466
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6467
	long val;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6468
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6469
	val = sysconf(_SC_PHYS_PAGES);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6470
	if (val != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6471
	    physicalPages = __MKUINT(val);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6472
	}
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6473
    }
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6474
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6475
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6476
# if defined(_SC_AVPHYS_PAGES)
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6477
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6478
	long val;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6479
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6480
	val = sysconf(_SC_AVPHYS_PAGES);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6481
	if (val != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6482
	    availablePages = __MKUINT(val);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6483
	}
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6484
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6485
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6486
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6487
# if defined(_SC_ICACHE_SZ)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6488
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6489
	long val;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6490
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6491
	val = sysconf(_SC_ICACHE_SZ);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6492
	if (val != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6493
	    iCacheSize = __MKUINT(val);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6494
	}
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6495
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6496
# endif
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6497
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6498
# if defined(_SC_DCACHE_SZ)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6499
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6500
	long val;
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6501
 
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6502
	val = sysconf(_SC_DCACHE_SZ);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6503
	if (val != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6504
	    dCacheSize = __MKUINT(val);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6505
	}
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6506
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6507
# endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6508
#endif /* HAS_SYSCONF */
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6509
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6510
#if defined(HAS_GETSYSINFO)
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6511
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6512
	INT index;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6513
	int retInt32 = 0;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6514
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6515
# if defined(GSI_CPU)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6516
	index = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6517
	if (getsysinfo(GSI_CPU, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6518
	    switch (retInt32) {
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6519
#  ifdef VAX_780
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6520
		case VAX_780:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6521
		    cpuType = __MKSTRING("VAX_780");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6522
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6523
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6524
#  ifdef VAX_750
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6525
		case VAX_750:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6526
		    cpuType = __MKSTRING("VAX_750");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6527
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6528
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6529
#  ifdef VAX_730
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6530
		case VAX_730:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6531
		    cpuType = __MKSTRING("VAX_730");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6532
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6533
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6534
#  ifdef VAX_8600
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6535
		case VAX_8600:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6536
		    cpuType = __MKSTRING("VAX_8600");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6537
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6538
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6539
#  ifdef VAX_8200
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6540
		case VAX_8200:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6541
		    cpuType = __MKSTRING("VAX_8200");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6542
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6543
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6544
#  ifdef VAX_8800
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6545
		case VAX_8800:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6546
		    cpuType = __MKSTRING("VAX_8800");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6547
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6548
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6549
#  ifdef MVAX_I
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6550
		case MVAX_I:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6551
		    cpuType = __MKSTRING("MVAX_I");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6552
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6553
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6554
#  ifdef MVAX_II
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6555
		case MVAX_II:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6556
		    cpuType = __MKSTRING("MVAX_II");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6557
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6558
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6559
#  ifdef V_VAX
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6560
		case V_VAX:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6561
		    cpuType = __MKSTRING("V_VAX");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6562
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6563
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6564
#  ifdef VAX_3600
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6565
		case VAX_3600:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6566
		    cpuType = __MKSTRING("VAX_3600");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6567
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6568
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6569
#  ifdef VAX_6200
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6570
		case VAX_6200:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6571
		    cpuType = __MKSTRING("VAX_6200");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6572
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6573
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6574
#  ifdef VAX_3400
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6575
		case VAX_3400:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6576
		    cpuType = __MKSTRING("VAX_3400");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6577
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6578
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6579
#  ifdef C_VAXSTAR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6580
		case C_VAXSTAR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6581
		    cpuType = __MKSTRING("C_VAXSTAR");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6582
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6583
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6584
#  ifdef VAX_60
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6585
		case VAX_60:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6586
		    cpuType = __MKSTRING("VAX_60");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6587
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6588
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6589
#  ifdef VAX_3900
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6590
		case VAX_3900:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6591
		    cpuType = __MKSTRING("VAX_3900");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6592
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6593
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6594
#  ifdef DS_3100
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6595
		case DS_3100:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6596
		    cpuType = __MKSTRING("DS_3100");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6597
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6598
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6599
#  ifdef VAX_8820
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6600
		case VAX_8820:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6601
		    cpuType = __MKSTRING("VAX_8820");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6602
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6603
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6604
#  ifdef DS_5400
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6605
		case DS_5400:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6606
		    cpuType = __MKSTRING("DS_5400");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6607
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6608
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6609
#  ifdef DS_5800
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6610
		case DS_5800:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6611
		    cpuType = __MKSTRING("DS_5800");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6612
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6613
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6614
#  ifdef DS_5000
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6615
		case DS_5000:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6616
		    cpuType = __MKSTRING("DS_5000");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6617
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6618
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6619
#  ifdef DS_CMAX
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6620
		case DS_CMAX:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6621
		    cpuType = __MKSTRING("DS_CMAX");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6622
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6623
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6624
#  ifdef VAX_6400
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6625
		case VAX_6400:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6626
		    cpuType = __MKSTRING("VAX_6400");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6627
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6628
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6629
#  ifdef VAXSTAR
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6630
		case VAXSTAR:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6631
		    cpuType = __MKSTRING("VAXSTAR");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6632
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6633
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6634
#  ifdef DS_5500
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6635
		case DS_5500:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6636
		    cpuType = __MKSTRING("DS_5500");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6637
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6638
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6639
#  ifdef DS_5100
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6640
		case DS_5100:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6641
		    cpuType = __MKSTRING("DS_5100");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6642
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6643
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6644
#  ifdef VAX_9000
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6645
		case VAX_9000:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6646
		    cpuType = __MKSTRING("VAX_9000");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6647
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6648
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6649
#  ifdef DS_500_100
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6650
		case DS_500_100:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6651
		    cpuType = __MKSTRING("DS_500_100");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6652
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6653
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6654
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6655
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6656
#  ifdef ALPHA_ADU
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6657
		case ALPHA_ADU:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6658
		    cpuType = __MKSTRING("ALPHA_ADU");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6659
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6660
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6661
#  ifdef DEC_4000
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6662
		case DEC_4000:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6663
		    cpuType = __MKSTRING("DEC_4000");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6664
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6665
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6666
#  ifdef DEC_3000_500
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6667
		case DEC_3000_500:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6668
		    cpuType = __MKSTRING("DEC_3000_500");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6669
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6670
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6671
#  ifdef DEC_7000
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6672
		case DEC_7000:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6673
		    cpuType = __MKSTRING("DEC_7000");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6674
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6675
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6676
#  ifdef DS_5000_300
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6677
		case DS_5000_300:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6678
		    cpuType = __MKSTRING("DS_5000_300");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6679
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6680
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6681
#  ifdef DEC_3000_300
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6682
		case DEC_3000_300:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6683
		    cpuType = __MKSTRING("DEC_3000_300");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6684
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6685
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6686
#  ifdef DEC_2000_300
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6687
		case DEC_2000_300:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6688
		    cpuType = __MKSTRING("DEC_2000_300");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6689
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6690
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6691
#  ifdef DEC_2100_A500
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6692
		case DEC_2100_A500:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6693
		    cpuType = __MKSTRING("DEC_2100_A500");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6694
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6695
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6696
#  ifdef DEC_2100_A50
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6697
		case DEC_2100_A50:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6698
		    cpuType = __MKSTRING("DEC_2100_A50");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6699
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6700
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6701
#  ifdef ALPHA_KN20AA
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6702
		case ALPHA_KN20AA:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6703
		    cpuType = __MKSTRING("ALPHA_KN20AA");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6704
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6705
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6706
#  ifdef DEC_21000
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6707
		case DEC_21000:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6708
		    cpuType = __MKSTRING("DEC_21000");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6709
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6710
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6711
#  ifdef DEC_AXPVME_64
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6712
		case DEC_AXPVME_64:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6713
		    cpuType = __MKSTRING("DEC_AXPVME_64");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6714
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6715
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6716
#  ifdef DEC_2100_C500
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6717
		case DEC_2100_C500:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6718
		    cpuType = __MKSTRING("DEC_2100_C500");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6719
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6720
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6721
#  ifdef DEC_AXPPCI_33
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6722
		case DEC_AXPPCI_33:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6723
		    cpuType = __MKSTRING("DEC_AXPPCI_33");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6724
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6725
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6726
#  ifdef DEC_1000
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6727
		case DEC_1000:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6728
		    cpuType = __MKSTRING("DEC_1000");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6729
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6730
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6731
#  ifdef EB64_PLUS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6732
		case EB64_PLUS:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6733
		    cpuType = __MKSTRING("EB64_PLUS");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6734
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6735
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6736
#  ifdef LCA_EB66
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6737
		case LCA_EB66:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6738
		    cpuType = __MKSTRING("LCA_EB66");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6739
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6740
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6741
#  ifdef ALPHA_EB164
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6742
		case ALPHA_EB164:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6743
		    cpuType = __MKSTRING("ALPHA_EB164");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6744
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6745
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6746
#  ifdef DEC_EV45_PBP
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6747
		case DEC_EV45_PBP:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6748
		    cpuType = __MKSTRING("DEC_EV45_PBP");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6749
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6750
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6751
#  ifdef DEC_1000A
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6752
		case DEC_1000A:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6753
		    cpuType = __MKSTRING("DEC_1000A");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6754
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6755
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6756
#  ifdef DEC_4100
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6757
		case DEC_4100:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6758
		    cpuType = __MKSTRING("DEC_4100");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6759
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6760
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6761
#  ifdef DEC_ALPHAVME_224
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6762
		case DEC_ALPHAVME_224:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6763
		    cpuType = __MKSTRING("DEC_ALPHAVME_224");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6764
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6765
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6766
#  ifdef DEC_1000_5
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6767
		case DEC_1000_5:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6768
		    cpuType = __MKSTRING("DEC_1000_5");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6769
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6770
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6771
#  ifdef DEC_1000A_5
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6772
		case DEC_1000A_5:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6773
		    cpuType = __MKSTRING("DEC_1000A_5");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6774
		    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6775
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6776
#  ifdef DEC_EV56_PBP
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6777
		case DEC_EV56_PBP:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6778
		    cpuType = __MKSTRING("DEC_EV56_PBP");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6779
		    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6780
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6781
#  ifdef ALPHABOOK
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6782
		case ALPHABOOK:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6783
		    cpuType = __MKSTRING("ALPHABOOK");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6784
		    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6785
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6786
#  ifdef DEC_ALPHAVME_320
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6787
		case DEC_ALPHAVME_320:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6788
		    cpuType = __MKSTRING("DEC_ALPHAVME_320");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6789
		    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6790
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6791
#  ifdef DEC_550
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6792
		case DEC_550:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6793
		    cpuType = __MKSTRING("DEC_550");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6794
		    break;
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6795
#  endif
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6796
#  ifdef DEC_6600
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6797
		case DEC_6600:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6798
		    cpuType = __MKSTRING("DEC_6600");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6799
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6800
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6801
#  ifdef UNKN_SYSTEM
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6802
		case UNKN_SYSTEM:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6803
		    cpuType = __MKSTRING("UNKN_SYSTEM");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6804
		    break;
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6805
#  endif
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6806
		default:
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6807
		    cpuType = __MKSTRING("OTHER_DEC_SYSTEM");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6808
		    break;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6809
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6810
	}
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6811
# endif /* GSI_CPU */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6812
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6813
# if defined(GSI_CPU_INFO)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6814
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6815
	 * stupid: OSF1 pre V4.0 has no mhz, but V4.0 has it.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6816
	 * use the GSI_PLATFORM_NAME as a hint - it is only defined in
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6817
	 * V4.0 and higher ... (sigh)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6818
	 */
4258
4c1f909de78e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  6819
#  if defined GSI_PLATFORM_NAME
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6820
	{
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6821
	    struct cpu_info cpuInfo;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6822
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6823
	    index = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6824
	    if (getsysinfo(GSI_CPU_INFO, &cpuInfo, sizeof(cpuInfo), &index, NULL) > 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6825
		cpuSpeed   = __MKUINT(cpuInfo.mhz);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6826
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6827
	}
4258
4c1f909de78e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4228
diff changeset
  6828
#  endif
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6829
# endif /* GSI_CPU_INFO */
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6830
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6831
# if defined(GSI_CPUS_IN_BOX)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6832
	index = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6833
	if (getsysinfo(GSI_CPUS_IN_BOX, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6834
	    numberOfCPUs   = __MKUINT(retInt32);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6835
	}
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6836
# endif /* GSI_CPUS_IN_BOX */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6837
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6838
# if defined(GSI_PHYSMEM)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6839
	index = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6840
	if (getsysinfo(GSI_PHYSMEM, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6841
	    INT bytes = retInt32 * 1024;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6842
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6843
	    physicalRam   = __MKUINT(bytes);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6844
	}
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6845
# endif /* GSI_PHYSMEM */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6846
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6847
# if defined(GSI_PLATFORM_NAME) && (!defined(HAS_SYSINFO) || !defined(SI_PLATFORM))
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6848
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6849
	char buffer[128];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6850
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6851
	index = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6852
	if (getsysinfo(GSI_PLATFORM_NAME, buffer, sizeof(buffer), &index, NULL) > 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6853
	    platform = __MKSTRING(buffer);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6854
	}
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6855
    }
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6856
# endif /* GSI_PLATFORM_NAME */
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6857
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6858
    }
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6859
#endif /* HAS_GETSYSINFO */
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6860
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6861
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6862
	extern OBJ __getInstructionSetInfo();
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6863
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6864
	extendedInstructions = __getInstructionSetInfo();
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6865
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6866
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6867
    sys isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6868
	sys := self getSystemType.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6869
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6870
    node isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6871
	node := self getHostName.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6872
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6873
    dom isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6874
	dom := self getDomainName.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6875
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6876
    mach isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6877
	mach := self getCPUType.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6878
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6879
    arch isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6880
	arch := sys.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6881
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6882
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6883
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6884
    info at:#system put:sys.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6885
    info at:#node put:node.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6886
    rel notNil ifTrue:[info at:#release put:rel].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6887
    ver notNil ifTrue:[info at:#version put:ver].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6888
    mach notNil ifTrue:[info at:#machine put:mach].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6889
    arch notNil ifTrue:[info at:#architecture put:arch].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6890
    dom notNil ifTrue:[info at:#domain put:dom].
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6891
    (pageSize notNil and:[physicalPages notNil]) ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6892
	physicalRam := pageSize * physicalPages. "/ done here - could be largeInt.
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6893
    ].
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6894
    physicalRam notNil ifTrue:[info at:#physicalRam put:physicalRam].
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6895
    (pageSize notNil and:[availablePages notNil]) ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6896
	availableRam := pageSize * availablePages. "/ done here - could be largeInt.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6897
	availableRam notNil ifTrue:[info at:#availableRam put:availableRam].
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6898
    ].
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6899
    totalRam notNil ifTrue:[info at:#totalRam put:totalRam].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6900
    sharedRam notNil ifTrue:[info at:#sharedRam put:sharedRam].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6901
    bufferRam notNil ifTrue:[info at:#bufferRam put:bufferRam].
4020
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6902
    virtualRam notNil ifTrue:[info at:#virtualRam put:virtualRam].
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6903
    activeVirtualRam notNil ifTrue:[info at:#activeVirtualRam put:activeVirtualRam].
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6904
    realMemory notNil ifTrue:[info at:#realMemory put:realMemory].
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6905
    activeRealMemory notNil ifTrue:[info at:#activeRealMemory put:activeRealMemory].
e73a3c919ac0 more memory info for hpux
Claus Gittinger <cg@exept.de>
parents: 4018
diff changeset
  6906
    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
  6907
    swapSize notNil ifTrue:[info at:#swapSize put:swapSize].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6908
    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
  6909
    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
  6910
    cpuType notNil ifTrue:[info at:#cpuType put:cpuType].
4101
f3d1a13c64b0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4088
diff changeset
  6911
    cpuSpeed notNil ifTrue:[info at:#cpuSpeed put:cpuSpeed].
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6912
    dCacheSize notNil ifTrue:[info at:#dCacheSize put:dCacheSize].
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6913
    iCacheSize notNil ifTrue:[info at:#iCacheSize put:iCacheSize].
4084
797fd09b7808 more systemInfo (solaris only)
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  6914
    instructionSets notNil ifTrue:[info at:#instructionSets put:instructionSets].
4922
6877d20bc7b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 4882
diff changeset
  6915
    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
  6916
    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
  6917
    info at:#osType put:(self getOSType).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6918
    ^ info
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6919
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6920
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6921
     OperatingSystem getSystemInfo
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6922
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6923
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6924
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6925
getSystemType
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6926
    "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
  6927
     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
  6928
     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
  6929
     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
  6930
     here ... 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6931
     (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
  6932
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6933
    |sys|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6934
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6935
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6936
#   ifdef NEXT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6937
#    define SYS_STRING "next"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6938
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6939
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6940
#   ifdef IRIS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6941
#    define SYS_STRING "iris"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6942
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6943
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6944
#   ifdef SYS_STRING
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6945
     sys = __MKSTRING(SYS_STRING);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6946
#    undef SYS_STRING
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6947
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6948
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6949
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6950
    sys isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6951
	^ self getOSType
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6952
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6953
    ^ sys
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  6956
     OperatingSystem getSystemType
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6957
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6958
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6959
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6960
isBSDlike
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6961
    "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
  6962
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6963
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6964
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6965
#if defined(BSD) || defined(MACH) || defined(SYSV4)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6966
    RETURN ( true );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6967
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6968
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6969
    ^ false
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6972
isUNIXlike
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6973
    "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
  6974
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6975
    ^ true
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  6976
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  6977
    "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
  6978
!
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
maxFileNameLength
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6981
    "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
  6982
     CAVEAT:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6983
	 Actually, the following is somewhat wrong - some systems
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6984
	 support different sizes, depending on the volume.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6985
	 We return a somewhat conservative number here.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6986
	 Another entry, to query for volume specific max
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  6987
	 will be added in the future."
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
%{  /* NOCONTEXT */
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
    /*
5460
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  6992
     * TODO: new systems provide a query function for this ... use it
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6993
     */
5460
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  6994
#   if defined(MAXFILENAMELEN)
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  6995
      RETURN ( __MKSMALLINT(MAXFILENAMELEN) );
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  6996
#   else
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  6997
#    if defined(BSD) || defined(SYSV4) || defined(LONGFILENAMES)
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  6998
      RETURN ( __MKSMALLINT(255) );
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  6999
#    endif
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7000
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7001
#    ifdef realIX
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7002
       RETURN ( __MKSMALLINT(127) );
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7003
#    endif
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7004
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7005
#    ifdef SYSV
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7006
       RETURN ( __MKSMALLINT(14) );
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7007
#    endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7008
#   endif
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
    "unix default"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7011
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7012
    ^ 14
5460
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7013
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7014
    "
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7015
     OperatingSystem maxFileNameLength
bf02ab313db2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5451
diff changeset
  7016
    "
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7017
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7018
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7019
maxPathLength
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7020
    "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
  7021
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7022
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7023
    RETURN ( __MKSMALLINT(MAXPATHLEN) );
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7026
     OperatingSystem maxPathLength   
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7027
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7028
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7029
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7030
pathSeparator
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7031
    "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
  7032
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7033
    ^ $:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7034
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7035
    "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
  7036
    "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
  7037
!
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
platformName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7040
    "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
  7041
     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
  7042
     #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
  7043
     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
  7044
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7045
    ^ #unix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7046
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7047
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7048
     OperatingSystem platformName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7049
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7050
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7051
    "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
  7052
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7053
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7054
primGetDomainName
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7055
    "return the domain this host is in.
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7056
     Notice:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7057
	not all systems support this; on some, nil is returned."
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7058
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7059
%{  /* STACK: 2048 */
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7060
#if defined(HAS_GETDOMAINNAME)
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7061
    char buffer[128];
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7062
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7063
    if (getdomainname(buffer, sizeof(buffer)) == 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7064
	RETURN (__MKSTRING(buffer));
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7065
    }
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7066
#else
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7067
# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME)
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7068
    struct utsname ubuff;
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7069
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7070
    if (uname(&ubuff) >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7071
	RETURN (__MKSTRING(ubuff.domainname));
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7072
    }
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7073
# else
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7074
#  if defined(HAS_SYSINFO) && defined(SI_SRPC_DOMAIN)
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7075
    char buffer[256];
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7076
    int ret;
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7077
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7078
    if ((ret = sysinfo(SI_SRPC_DOMAIN, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7079
	RETURN (__MKSTRING(buffer));
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7080
    }
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7081
#  endif
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7082
# endif
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7083
#endif
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7084
%}.
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7085
    ^ nil
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7086
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7087
    "
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7088
     OperatingSystem primGetDomainName
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7089
    "
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7090
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7091
    "Modified: 26.4.1996 / 10:04:54 / stefan"
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7092
!
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7093
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7094
primGetHostName
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7095
    "return the hostname we are running on - if there is
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7096
     a HOST environment variable, we are much faster here ...
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7097
     Notice:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7098
	not all systems support this; on some, nil is returned."
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7099
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7100
%{  /* STACK: 2048 */
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7101
#if defined(HAS_GETHOSTNAME)
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7102
    char buffer[256];
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7103
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7104
    if (gethostname(buffer, sizeof(buffer)) == 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7105
	RETURN (__MKSTRING(buffer));
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7106
    }
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7107
#else
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7108
# if defined(HAS_UNAME)
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7109
    struct utsname ubuff;
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7110
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7111
    if (uname(&ubuff) >= 0) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7112
	RETURN (__MKSTRING(ubuff.nodename));
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7113
    }
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7114
# else
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7115
#  if defined(HAS_SYSINFO) && defined(SI_HOSTNAME)
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7116
    char buffer[256];
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7117
    int ret;
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7118
 
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7119
    if ((ret = sysinfo(SI_HOSTNAME, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7120
	RETURN (__MKSTRING(buffer));
5444
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7121
    }
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7122
#  endif
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7123
# endif
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7124
#endif
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7125
%}.
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7126
    ^ nil 
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7127
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7128
    "
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7129
     OperatingSystem getHostName
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7130
    "
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7131
!
5cbb37147eeb rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5438
diff changeset
  7132
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7133
setLocaleInfo:anInfoDictionary
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7134
    "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
  7135
     (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
  7136
     See description of fields in #getLocaleInfo.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7137
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7138
     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
  7139
     it should be used by applications as required."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7140
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7141
    LocaleInfo := anInfoDictionary
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7142
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7143
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7144
     |d|
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
     d := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7147
     d at:#decimalPoint                 put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7148
     d at:#thousandsSeparator           put:','         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7149
     d at:#currencySymbol               put:'USD'       .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7150
     d at:#monetaryDecimalPoint         put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7151
     d at:#monetaryThousandsSeparator   put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7152
     d at:#fractionalDigits             put:2           .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7153
     d at:#positiveSign                 put:'+'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7154
     d at:#negativeSign                 put:'-'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7155
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7156
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7157
     OperatingSystem setLocaleInfo:d
3496
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7160
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7161
supportsChildInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7162
    "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
  7163
     through interrupts (i.e. SIGCHILD)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7164
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7165
%{  /* NOCONTEXT */
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  7166
#if defined(SIGCHLD) || defined(SIGCLD)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7167
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7168
#endif
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
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7171
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7172
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7173
     OperatingSystem supportsChildInterrupts 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7174
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7175
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7176
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7177
supportsIOInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7178
    "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
  7179
     (i.e. SIGPOLL/SIGIO).
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
     Currently, this mechanism does not work on all
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7182
     systems ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7183
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7184
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7185
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7186
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7187
  /* positive defines here
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7188
   *  - irix5.2 does not work
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7189
   */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7190
#if defined(LINUX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7191
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7192
# if defined(SIGIO) || defined(SIGPOLL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7193
#  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
  7194
#   if defined(F_SETOWN) || defined(FIOSETOWN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7195
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7196
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7197
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7198
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7199
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7200
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7201
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7202
#endif /* machines where it works */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7203
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7204
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7205
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7206
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7207
     OperatingSystem supportsIOInterrupts 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7208
    "
4934
6579e2e2ad7f solaris 5.6 DOES support IO-interrupts.
Claus Gittinger <cg@exept.de>
parents: 4933
diff changeset
  7209
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7210
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7211
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7212
supportsNonBlockingIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7213
    "return true, if the OS supports nonblocking IO."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7214
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7215
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7216
#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
  7217
       RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7218
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7219
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7220
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7221
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7222
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7223
     OperatingSystem supportsNonBlockingIO  
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7224
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7225
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7226
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7227
supportsSelect
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7228
    "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
  7229
     filedescriptors via select.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7230
     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
  7231
     intervals for I/O becoming ready."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7232
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7233
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7234
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7235
#if defined(sco)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7236
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7237
     * 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
  7238
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7239
    RETURN(false);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7240
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7241
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7242
    ^ true
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7243
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7244
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7245
     OperatingSystem supportsSelect 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7246
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7247
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7248
!
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7249
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7250
supportsSymbolicLinks
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7251
    "return true, if the OS supports symbolic (soft) links;
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7252
     most UNIX'es do; many other OS's do not."
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7253
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7254
%{  /* NOCONTEXT */
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7255
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7256
#ifdef S_IFLNK
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7257
    /*
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7258
     * assume yes - if that is defined.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7259
     */
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7260
    RETURN(true);
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7261
#endif
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7262
%}.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7263
    ^ false
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7264
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7265
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7266
     OperatingSystem supportsSymbolicLinks 
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7267
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7268
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7269
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7270
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7271
!UnixOperatingSystem class methodsFor:'path queries'!
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7272
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7273
defaultSystemPath
5647
ad054a02bc88 only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  7274
    "add additional directories to the systemPath 
ad054a02bc88 only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  7275
     (but only, if the major version is the same)"
ad054a02bc88 only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  7276
ad054a02bc88 only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  7277
    |sysPath majorVersionNr minorVersionNr releaseFile s v|
ad054a02bc88 only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  7278
ad054a02bc88 only add common dirs to the systemPath, IFF the
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  7279
    majorVersionNr := Smalltalk majorVersionNr.
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7280
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7281
    sysPath := super defaultSystemPath.
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7282
    #(
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7283
	'/usr/local/lib/smalltalk'
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7284
	'/usr/lib/smalltalk'
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7285
	'/lib/smalltalk'
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7286
	'/opt/smalltalk'
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7287
    ) do:[:d |
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7288
	(d asFilename isDirectory) ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7289
	    "/ try to guess a gnu-smalltalk; skip it
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7290
	    (d asFilename construct:'initialize.st') exists ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7291
		releaseFile := d asFilename construct:'RELEASE'.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7292
		releaseFile exists ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7293
		    s := releaseFile readStream.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7294
		    s notNil ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7295
			v := Integer readFrom:s onError:-1.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7296
			s close.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7297
			v == majorVersionNr ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7298
			    sysPath add:d
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7299
			] ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7300
			    ('UnixOperatingSystem [info]: ignore files in ' , d asFilename pathName , ' (RELEASE mismatch)') infoPrintCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7301
			]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7302
		    ] ifFalse:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7303
			('UnixOperatingSystem [info]: ignore files in ' , d asFilename pathName , ' (RELEASE missing)') infoPrintCR.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7304
		    ]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7305
		]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7306
	    ]
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7307
	]
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7308
    ].
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7309
    ^ sysPath
5035
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
  7310
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
  7311
    "
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
  7312
     OperatingSystem defaultSystemPath
e80199cc4f50 comment
Claus Gittinger <cg@exept.de>
parents: 4935
diff changeset
  7313
    "
4018
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7314
! !
b4bb0f43d6a7 changed execute-in-dir
Claus Gittinger <cg@exept.de>
parents: 4001
diff changeset
  7315
3558
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7316
!UnixOperatingSystem class methodsFor:'private'!
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7317
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7318
osProcessStatusClass
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7319
    ^ OSProcessStatus
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7320
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7321
    "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
  7322
! !
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7323
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7324
!UnixOperatingSystem class methodsFor:'shared memory access'!
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
shmAttach:id address:addr flags:flags
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7327
    "low level entry to shmat()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7328
     Not supported on all operatingSystems"
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7331
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7332
    void *address, *shmaddr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7333
    int shmflg, shmid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7334
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7335
    if (__isSmallInteger(addr)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7336
     && __bothSmallInteger(flags, id)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7337
	shmaddr = (void *) __intVal(addr);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7338
	shmflg = __intVal(flags);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7339
	shmid = __intVal(id);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7340
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7341
	address = shmat(shmid, shmaddr, shmflg);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7342
	if (address != (void *)-1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7343
	    RETURN (__MKEXTERNALBYTES(addr));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7344
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7345
	@global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7346
	RETURN (nil);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7347
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7348
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7349
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7350
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7351
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7352
    "Modified: 22.4.1996 / 13:15:12 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7353
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7354
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7355
shmDetach:addr
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7356
    "low level entry to shmdt()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7357
     Not supported on all operatingSystems"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7358
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7359
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7360
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7361
    void *shmaddr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7362
    int rslt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7363
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7364
    if (__isSmallInteger(addr)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7365
	shmaddr = (void *) __intVal(addr);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7366
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7367
	rslt = shmdt(shmaddr);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7368
	if (rslt != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7369
	    RETURN (true);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7370
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7371
	@global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7372
	RETURN (false);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7373
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7374
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7375
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7376
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7377
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7378
    "Modified: 22.4.1996 / 13:15:03 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7379
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7380
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7381
shmGet:key size:size flags:flags
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7382
    "low level entry to shmget()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7383
     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
  7384
     - use the provided wrapper class SharedExternalBytes instead."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7385
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7386
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7387
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7388
    if (__bothSmallInteger(key, size)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7389
     && __isSmallInteger(flags)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7390
	int rslt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7391
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7392
	rslt = shmget(__intVal(key), __intVal(size), __intVal(flags));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7393
	if (rslt != -1) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7394
	    RETURN (__MKSMALLINT(rslt));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7395
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7396
	@global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7397
	RETURN (nil);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7398
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7399
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7400
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7401
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7402
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7403
    "Modified: 22.4.1996 / 13:14:46 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7404
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7405
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7406
!UnixOperatingSystem class methodsFor:'time and date'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7407
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7408
computeDatePartsOf:osTime for:aBlock
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7409
    "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
  7410
     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
  7411
     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
  7412
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7413
    |year month day osSeconds i|
3496
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
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7416
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7417
    struct tm* tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7418
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7419
    TIME_T tt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7420
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7421
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7422
    tt = (TIME_T)t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7423
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7424
    tmPtr = localtime(&tt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7425
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7426
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7427
    day = __MKSMALLINT(tmPtr->tm_mday);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7428
%}.
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7429
    year isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7430
	i := self computeTimeAndDateFrom:osTime.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7431
	year := i at:1.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7432
	month := i at:2.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7433
	day := i at:3.
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7434
    ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7435
    aBlock value:year value:month value:day
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7438
     OperatingSystem computeDatePartsOf:0 for:[:y :m :d |
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7439
	y printCR. m printCR. d printCR
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7440
     ]
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
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7444
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
  7445
    "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
  7446
     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
  7447
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7448
    |osSeconds|
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7449
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7450
%{
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7451
    struct tm tm;
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7452
    TIME_T t;
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7453
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7454
    if (__bothSmallInteger(y, m) 
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7455
     && __bothSmallInteger(d, h)
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7456
     && __bothSmallInteger(min, s)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7457
	tm.tm_hour = __intVal(h);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7458
	tm.tm_min = __intVal(min);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7459
	tm.tm_sec = __intVal(s);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7460
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7461
	tm.tm_year = __intVal(y) - 1900;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7462
	tm.tm_mon = __intVal(m) - 1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7463
	tm.tm_mday = __intVal(d);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7464
	tm.tm_isdst = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7465
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7466
	t = mktime(&tm);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7467
	osSeconds = __MKUINT((INT)t+TIMEZONE(&tm));
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7468
    }
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7469
%}.
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7470
    osSeconds notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7471
	^ osSeconds * 1000 + millis
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7472
    ].    
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7473
    ^ self primitiveFailed
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7474
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7475
    "
5639
2e750f87b419 Fix UTC Time handling when daylight saving time applies.
Stefan Vogel <sv@exept.de>
parents: 5625
diff changeset
  7476
     OperatingSystem computeOSTimeFromUTCYear:1970 month:1 day:1 hour:0 minute:0 second:0 millisecond:0
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7477
     OperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
5639
2e750f87b419 Fix UTC Time handling when daylight saving time applies.
Stefan Vogel <sv@exept.de>
parents: 5625
diff changeset
  7478
     OperatingSystem computeOSTimeFromUTCYear:2000 month:7 day:1 hour:0 minute:0 second:0 millisecond:0
2e750f87b419 Fix UTC Time handling when daylight saving time applies.
Stefan Vogel <sv@exept.de>
parents: 5625
diff changeset
  7479
     OperatingSystem computeOSTimeFromYear:2000 month:7 day:1 hour:0 minute:0 seconds:0 millis:0
2e750f87b419 Fix UTC Time handling when daylight saving time applies.
Stefan Vogel <sv@exept.de>
parents: 5625
diff changeset
  7480
    "
4380
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7481
!
9f168c6f4beb New method to set UTC time.
Stefan Vogel <sv@exept.de>
parents: 4285
diff changeset
  7482
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7483
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
  7484
    "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
  7485
     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
  7486
     any daylight saving adjustings."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7487
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7488
    |osSeconds|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7489
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7490
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7491
    struct tm tm;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7492
    TIME_T t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7493
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7494
    if (__bothSmallInteger(y, m) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7495
     && __bothSmallInteger(d, h)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7496
     && __bothSmallInteger(min, s)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7497
	tm.tm_hour = __intVal(h);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7498
	tm.tm_min = __intVal(min);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7499
	tm.tm_sec = __intVal(s);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7500
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7501
	tm.tm_year = __intVal(y) - 1900;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7502
	tm.tm_mon = __intVal(m) - 1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7503
	tm.tm_mday = __intVal(d);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7504
	tm.tm_isdst = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7505
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7506
	t = mktime(&tm);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7507
	osSeconds = __MKUINT((INT)t);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7508
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7509
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7510
    osSeconds notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7511
	^ osSeconds * 1000 + millis
3496
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7514
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7515
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7516
     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
  7517
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7518
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7521
computeTimeAndDateFrom:osTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7522
    "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
  7523
     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
  7524
     offset to UTC, daylight savings time flag, milliseconds,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7525
     dayInYear (1..) and dayInWeek (1..).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7526
     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
  7527
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7528
    |millis osSeconds ret|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7529
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7530
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7531
    osSeconds := osTime // 1000.
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7532
    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
  7533
    ret at:9 put:millis.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7534
    ^ ret
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7535
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7536
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7537
     OperatingSystem computeTimeAndDateFrom:0
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7538
     OperatingSystem computeTimeAndDateFrom:1011
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7539
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7540
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7541
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7542
computeTimePartsOf:osTime for:aBlock
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7543
    "compute hours, minutes, seconds and milliseconds from the local osTime 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7544
     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
  7545
     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
  7546
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7547
    |hours minutes seconds millis osSeconds i|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7548
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7549
    i := self computeTimeAndDateFrom:osTime.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7550
    hours := i at:4.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7551
    minutes := i at:5.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7552
    seconds := i at:6.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7553
    millis := i at:9.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7554
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7555
"/    osSeconds := osTime // 1000.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7556
"/    millis := osTime \\ 1000.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7557
"/%{
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7558
"/    struct tm *tmPtr;
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7559
"/    INT t;
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7560
"/    TIME_T tt;
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7561
"/
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7562
"/    t = __longIntVal(osSeconds);
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7563
"/    tt = (TIME_T)t;
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7564
"/
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7565
"/    tmPtr = localtime(&tt);
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7566
"/    hours = __MKSMALLINT(tmPtr->tm_hour);
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7567
"/    minutes = __MKSMALLINT(tmPtr->tm_min);
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7568
"/    seconds = __MKSMALLINT(tmPtr->tm_sec);
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7569
"/%}.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7570
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7571
    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
  7572
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7573
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7574
     OperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7575
	Transcript show:h; space; show:m; space; show:s; space; showCR:milli.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7576
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7577
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7580
computeUTCTimeAndDateFrom:osTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7581
    "given an OS-dependent time in osTime, return an Array
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7582
     containing:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7583
	(full-) year, 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7584
	month,                          (1..)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7585
	day,                            (1..)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7586
	hour,                           (0..23)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7587
	minute                          (0..59)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7588
	seconds,                        (0..59)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7589
	offset to UTC,                  (seconds)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7590
	daylight savings time flag, 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7591
	milliseconds,                   (0..999)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7592
	dayInYear                       (1..)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7593
	dayInWeek                       (1..).
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7594
     Conversion is to utc."
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7595
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7596
    |millis osSeconds ret|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7597
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7598
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7599
    osSeconds := osTime // 1000.
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7600
    ret := self fillTimeAndDateFromUTCSeconds:osSeconds into:(Array new:11).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7601
    ret at:9 put:millis.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7602
    ^ ret
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7603
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7604
    "
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7605
     OperatingSystem computeUTCTimeAndDateFrom:0     
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7606
     OperatingSystem computeUTCTimeAndDateFrom:1011
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7607
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7608
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7609
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7610
computeUTCTimePartsOf:osTime for:aBlock
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7611
    "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
  7612
     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
  7613
     Conversion is to UTC."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7614
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7615
    |hours minutes seconds millis osSeconds|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7616
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7617
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7618
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7619
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7620
    struct tm *tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7621
    long t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7622
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7623
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7624
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7625
    tmPtr = gmtime(&t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7626
    hours = __MKSMALLINT(tmPtr->tm_hour);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7627
    minutes = __MKSMALLINT(tmPtr->tm_min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7628
    seconds = __MKSMALLINT(tmPtr->tm_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7629
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7630
    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
  7631
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7632
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7633
     OperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli |
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7634
	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
  7635
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7636
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7637
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7638
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7639
fillTimeAndDateFromSeconds:osSeconds into:timeArray
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7640
    "fill the array with os-time components.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7641
     An internal helper"
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7642
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7643
    ^ self fillTimeAndDateFromSeconds:osSeconds isLocal:true into:timeArray
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7644
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7645
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7646
fillTimeAndDateFromSeconds:osSeconds isLocal:isLocalTime into:timeArray
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7647
    "fill the array with os-time components.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7648
     An internal helper"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7649
5855
dead3acb2abf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5854
diff changeset
  7650
    |low hi year month day hours minutes seconds utcOffset 
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7651
     dst yDay wDay |
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
%{
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7654
    struct tm *tmPtr;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7655
    INT t;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7656
    TIME_T tt;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7657
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7658
    t = __longIntVal(osSeconds);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7659
    tt = (TIME_T)t;
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7660
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7661
    if (isLocalTime == true) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7662
	tmPtr = localtime(&tt);
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7663
    } else {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7664
	tmPtr = gmtime(&tt);
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7665
    }
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7666
    hours = __MKSMALLINT(tmPtr->tm_hour);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7667
    minutes = __MKSMALLINT(tmPtr->tm_min);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7668
    seconds = __MKSMALLINT(tmPtr->tm_sec);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7669
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7670
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7671
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7672
    day = __MKSMALLINT(tmPtr->tm_mday);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7673
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7674
    yDay = __MKSMALLINT(tmPtr->tm_yday+1);
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7675
    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
5656
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
  7676
    utcOffset = __MKSMALLINT(TIMEZONE(tmPtr));
dbc52ea02716 Fix UTC Time w.r.t. Daylight saving time.
Stefan Vogel <sv@exept.de>
parents: 5649
diff changeset
  7677
    dst = (tmPtr->tm_isdst == 0 ? false : true);
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7678
%}.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7679
    "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
  7680
    timeArray at:1 put:year.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7681
    timeArray at:2 put:month.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7682
    timeArray at:3 put:day.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7683
    timeArray at:4 put:hours.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7684
    timeArray at:5 put:minutes.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7685
    timeArray at:6 put:seconds.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7686
    timeArray at:7 put:utcOffset.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7687
    timeArray at:8 put:dst.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7688
    timeArray at:9 put:nil.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7689
    timeArray at:10 put:yDay.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7690
    timeArray at:11 put:wDay.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7691
    ^ timeArray
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7692
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7693
    "
5855
dead3acb2abf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5854
diff changeset
  7694
     OperatingSystem fillTimeAndDateFromSeconds:0 isLocal:false into:(Array new:11)
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7695
    "
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7696
!
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7697
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7698
fillTimeAndDateFromUTCSeconds:osSeconds into:timeArray
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7699
    "fill the array with os-time components.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7700
     An internal helper"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7701
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7702
    ^ self fillTimeAndDateFromSeconds:osSeconds isLocal:false into:timeArray
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7703
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7704
    "
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7705
     OperatingSystem fillTimeAndDateFromUTCSeconds:0 into:(Array new:11)
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7706
    "
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7707
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  7708
3692
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7709
getMicrosecondTime
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7710
    "This returns the microsecond timers value - if available. 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7711
     On some machines, times with this precision may not be available,
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7712
     on those, the returned value may be rounded towards some internal
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7713
     clock resolution value."
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7714
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7715
    |seconds millis micros|
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7716
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7717
%{
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7718
    long _seconds = 0;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7719
    long _millis = 0;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7720
    long _micros = 0;
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
#if !defined(HAS_GETTIMEOFDAY)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7723
# if defined(HAS_FTIME)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7724
    struct timeb timebuffer;
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
    ftime(&timebuffer);
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7727
     _seconds = timebuffer.time;
3692
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7728
    _millis = timebuffer.millitm;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7729
#   define HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7730
# endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7731
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7732
# ifndef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7733
#  if defined(SYSV) && defined(HZ)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7734
    /* 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7735
     * sys5 time - in ticks
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7736
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7737
    long ticks;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7738
    struct tms tb;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7739
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7740
    ticks = times(&tb);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7741
    _seconds = ticks / HZ;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7742
    ticks -= (_seconds * HZ);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7743
    _millis = ticks * 1000 / HZ;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7744
#   define HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7745
#  endif /* old SYSV stuff */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7746
# endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7747
#endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7748
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7749
#ifndef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7750
    /* assume HAS_GETTIMEOFDAY 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7751
     * - will result in a linkage error
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7752
     * if not fixed.
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7753
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7754
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7755
    /*
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7756
     * bsd time
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7757
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7758
    struct timeval tb;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7759
    /* struct timezone tzb; */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7760
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7761
    gettimeofday(&tb, NULL /* &tzb */);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7762
    _seconds = tb.tv_sec;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7763
    _micros = tb.tv_usec;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7764
    if (_micros >= (1000*1000)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7765
	printf("oops\n");
3692
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7766
    }
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7767
#endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7768
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7769
#undef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7770
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7771
    seconds = __MKINT(_seconds);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7772
    millis = __MKINT(_millis);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7773
    micros = __MKINT(_micros);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7774
%}.
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7775
    ^ (((seconds * 1000) + millis) * 1000) + micros
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7776
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7777
    "
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7778
     Transcript showCR:(OperatingSystem getMicrosecondTime).
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7779
     Transcript showCR:(OperatingSystem getMicrosecondTime).
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7780
    "
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7781
!
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7782
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7783
getMillisecondTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7784
    "This returns the millisecond timers value. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7785
     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
  7786
     LargeInteger arithmetic when doing timeouts and delays.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7787
     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
  7788
     short relative time deltas.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7789
     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
  7790
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7791
     BAD DESIGN:
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7792
	This should be changed to return some instance of RelativeTime,
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7793
	and these computations moved there.
3496
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
     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
  7796
     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
  7797
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7798
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7799
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7800
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7801
    long t = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7802
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7803
#if !defined(HAS_GETTIMEOFDAY)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7804
# if defined(HAS_FTIME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7805
    struct timeb timebuffer;
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
    ftime(&timebuffer);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7808
    t = (timebuffer.time * 1000) + timebuffer.millitm;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7809
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7810
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7811
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7812
# ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7813
#  if defined(SYSV) && defined(HZ)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7814
    /* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7815
     * sys5 time
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
    long ticks;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7818
    struct tms tb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7819
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7820
    ticks = times(&tb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7821
    t = (ticks * 1000) / HZ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7822
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7823
#  endif /* old SYSV stuff */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7824
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7825
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7826
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7827
#ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7828
    /* assume HAS_GETTIMEOFDAY 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7829
     * - will result in a linkage error
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7830
     * if not fixed.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7831
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7832
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7833
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7834
     * bsd time
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
    struct timeval tb;
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7837
    /* struct timezone tzb; */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7838
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7839
    gettimeofday(&tb, NULL /* &tzb */);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7840
    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
  7841
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7842
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7843
#undef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7844
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7845
    RETURN ( __MKSMALLINT(t & 0x1FFFFFFF) );
5438
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7846
%}.
00e3c22156c3 added fallback st-code (for rel5 migration)
Claus Gittinger <cg@exept.de>
parents: 5407
diff changeset
  7847
    self primitiveFailed
3496
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
getOSTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7851
    "This returns the OS time.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7852
     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
  7853
     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
  7854
     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
  7855
     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
  7856
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7857
     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
  7858
     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
  7859
     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
  7860
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7861
5488
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7862
    |time seconds millis|
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7863
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7864
    time := self primGetOSTime.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7865
    time isArray ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7866
	seconds := time at:1.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7867
	millis := time at:2.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7868
	time := (seconds * 1000) + millis
5488
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7869
    ].
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7870
    ^ time
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7871
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7872
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7873
     OperatingSystem getOSTime printCR.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7874
     Delay waitForSeconds:0.2.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7875
     OperatingSystem getOSTime printCR.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7876
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7877
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7878
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7879
millisecondDelay:millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7880
    "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
  7881
     arrives.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7882
     All lower priority threads will also sleep for the duration, 
5233
e6756175b631 comments
Claus Gittinger <cg@exept.de>
parents: 5203
diff changeset
  7883
     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
  7884
     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
  7885
     (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
  7886
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7887
    |now then delta|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7888
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7889
    now := UnixOperatingSystem getMillisecondTime.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7890
    then := UnixOperatingSystem millisecondTimeAdd:now and:millis.
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
    [UnixOperatingSystem millisecondTime:then isAfter:now] whileTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7893
	delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7894
	self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7895
	now := UnixOperatingSystem getMillisecondTime.
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7898
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  7899
     OperatingSystem millisecondDelay:2000
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7900
    "
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7901
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7902
    "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
  7903
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7904
5488
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7905
primGetOSTime
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7906
    "This returns the OS time.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7907
     The base of the returned value is not consistent across
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7908
     different OS's - some return the number of millis since jan, 1st 1970;
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7909
     others since 1900. The Time classes are prepared for this, and 
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7910
     converts as appropriate (by using my fromOSTime: conversion methods).
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7911
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7912
     Dont use this method in application code since it is an internal (private)
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7913
     interface. For compatibility with ST-80, use Time>>millisecondClockValue.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7914
     or use instances of Time, Date or AbsoluteTime to work with.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7915
    "
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7916
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7917
    |seconds millis|
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7918
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7919
%{
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7920
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7921
    long t;
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7922
    long _secs, _millis;
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7923
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7924
#if !defined(HAS_GETTIMEOFDAY) 
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7925
# if defined(HAS_FTIME)
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7926
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7927
	struct timeb timebuffer;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7928
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7929
	ftime(&timebuffer);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7930
	_secs = timebuffer.time;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7931
	_millis = timebuffer.millitm;
5488
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7932
    }
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7933
#   define HAVE_TIME
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7934
# endif /* HAS_FTIME */
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7935
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7936
# ifndef HAVE_TIME
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7937
#  if defined(SYSV) && defined(HZ)
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7938
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7939
	/* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7940
	 * sys5 time; we have to fake the information
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7941
	 * the returned value is inexact.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7942
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7943
	long ticks;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7944
	struct tms tb;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7945
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7946
	_secs = time(0);   /* seconds since 1970 ... */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7947
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7948
	ticks = times(&tb);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7949
	t = (ticks * 1000) / HZ;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7950
	t = t % 1000;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7951
	_millis = __MKSMALLINT(t);
5488
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7952
    }
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7953
#   define HAVE_TIME
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7954
#  endif /* OLD SYSV stuff */
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7955
# endif
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7956
#endif /* no HAS_GETTIMEOFDAY */
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7957
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7958
#ifndef HAVE_TIME
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7959
    /*
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7960
     * use HAS_GETTIMEOFDAY even if HAS_GETTIMEOFDAY is undefined here.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7961
     * Will result in a linkage error if not fixed and neither ftime() nor time() is used.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7962
     */
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7963
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7964
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7965
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7966
	 * bsd time
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7967
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7968
	struct timeval tb;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7969
	/* struct timezone tzb; */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7970
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7971
	gettimeofday(&tb, NULL /* &tzb */);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7972
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7973
	_secs = tb.tv_sec;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7974
	_millis = tb.tv_usec / 1000;
5488
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7975
    }
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7976
#endif
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7977
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7978
    /* 
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7979
     * mhmh long-long stuff seems not to work correctly 
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7980
     * on all machines (sparc)
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7981
     * being conservative here ...
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7982
     */
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7983
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7984
#if defined(__GNUC__) && (__GNUC__ >= 2) && defined(i386) && defined(LINUX)
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7985
# define HAS_LONGLONG
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7986
#endif
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7987
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7988
#ifdef alpha64
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7989
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7990
	unsigned INT _lsecs, _lmillis, rslt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7991
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7992
	_lsecs = (INT)_secs;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7993
	_lmillis = (INT)_millis;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7994
	rslt = _lsecs * 1000 + _lmillis;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  7995
	RETURN (__MKUINT(rslt));
5488
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7996
    }
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7997
#else
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7998
# ifdef HAS_LONGLONG
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  7999
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8000
	unsigned long long _lsecs, _lmillis, rslt;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8001
	unsigned low, hi;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8002
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8003
	_lsecs = (long long)_secs;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8004
	_lmillis = (long long)_millis;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8005
	rslt = _lsecs * 1000 + _lmillis;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8006
	low = rslt & 0xFFFFFFFF;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8007
	hi = rslt >> 32;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8008
	RETURN (__MKLARGEINT64(1, low, hi));
5488
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8009
    }
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8010
# else
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8011
    seconds = __MKUINT(_secs);
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8012
    millis = __MKUINT(_millis);
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8013
    RETURN (__ARRAY_WITH2(seconds, millis));
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8014
# endif /* long long */
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8015
#endif /* alpha64 */
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8016
%}.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8017
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8018
    "
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8019
     OperatingSystem primGetOSTime printCR.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8020
     Delay waitForSeconds:0.2.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8021
     OperatingSystem primGetOSTime printCR.
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8022
    "
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8023
!
5d8def710e78 rel5 migration
Claus Gittinger <cg@exept.de>
parents: 5485
diff changeset
  8024
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8025
sleep:numberOfSeconds
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8026
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8027
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8028
    "cease ANY action for some time. This suspends the whole smalltalk
5233
e6756175b631 comments
Claus Gittinger <cg@exept.de>
parents: 5203
diff changeset
  8029
     (unix-) process for some time if running threadless;
e6756175b631 comments
Claus Gittinger <cg@exept.de>
parents: 5203
diff changeset
  8030
     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
  8031
     only block until the next clock tick and return with the next
5233
e6756175b631 comments
Claus Gittinger <cg@exept.de>
parents: 5203
diff changeset
  8032
     timer interrupt.
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8033
     Use either OperatingSystem>>millisecondDelay: (which makes all
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8034
     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
  8035
     only the calling thread sleep)."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8036
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8037
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8038
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8039
    if (__isSmallInteger(numberOfSeconds)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8040
	sleep(__intVal(numberOfSeconds));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8041
	RETURN ( self );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8042
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8043
%}.
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
     argument not integer
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8048
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8049
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8050
     OperatingSystem sleep:2
3496
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
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8053
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8054
!UnixOperatingSystem class methodsFor:'users & groups'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8055
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8056
getEffectiveGroupID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8057
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8058
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8059
    "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
  8060
     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
  8061
     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
  8062
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8063
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8064
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8065
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8066
    uid = getegid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8067
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8068
%}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8069
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8070
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8071
     OperatingSystem getEffectiveGroupID
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
getEffectiveUserID
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 current users (thats you) effective numeric user id.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8079
     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
  8080
     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
  8081
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8082
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8083
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8084
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8085
    uid = geteuid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8086
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8087
%}
3496
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8090
     OperatingSystem getEffectiveUserID
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8091
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8094
getFullUserNameFromID:userID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8095
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8096
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8097
    "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
  8098
     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
  8099
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8100
    |info gecos|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8101
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8102
    info := self userInfoOf:userID.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8103
    (info notNil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8104
    and:[info includesKey:#gecos]) ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8105
	gecos := info at:#gecos.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8106
	(gecos includes:$,) ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8107
	    ^ gecos copyTo:(gecos indexOf:$,) - 1
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8108
	].
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8109
	^ gecos
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8110
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8111
    ^ self getUserNameFromID:userID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8112
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8113
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8114
     OperatingSystem getFullUserNameFromID:0 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8115
     OperatingSystem getFullUserNameFromID:(OperatingSystem getUserID)  
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8116
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8117
     OperatingSystem getUserNameFromID:(OperatingSystem getUserID)  
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8118
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8119
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8120
    "Modified: 15.7.1996 / 12:44:21 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8121
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8122
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8123
getGroupID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8124
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8125
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8126
    "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
  8127
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8128
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8129
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8130
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8131
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8132
    uid = getgid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8133
    RETURN ( __MKSMALLINT(uid) );
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
    ^ 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
  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 getGroupID
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
getGroupNameFromID:aNumber
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 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
  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
    struct group *g;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8149
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8150
    if (__isSmallInteger(aNumber)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8151
	g = getgrgid(__intVal(aNumber));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8152
	if (g) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8153
	    RETURN ( __MKSTRING(g->gr_name) );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8154
	}
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8155
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8156
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8157
    ^ '???'
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8160
     OperatingSystem getGroupNameFromID:0
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8161
     OperatingSystem getGroupNameFromID:10
3496
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8164
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8165
getHomeDirectory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8166
    "{ Pragma: +optSpace }"
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
    "return the name of the users home directory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8169
     (i.e. yours)"
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
    ^ UnixOperatingSystem getEnvironment:'HOME'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8172
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8173
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8174
     OperatingSystem getHomeDirectory
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8175
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8176
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8177
    "Modified: 24.1.1997 / 11:32:13 / cg"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8180
getLoginName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8181
    "{ Pragma: +optSpace }"
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
    "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
  8184
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8185
%{  /* NOCONTEXT */
3970
22ea3856e87e egcs workaround
Claus Gittinger <cg@exept.de>
parents: 3956
diff changeset
  8186
    static char cachedName[128];
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8187
    static firstCall = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8188
    extern char *getenv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8189
    extern char *getlogin();
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
    char *name = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8192
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8193
    if (firstCall) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8194
	name = getlogin();
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8195
	if (! name || (name[0] == 0)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8196
	    name = getenv("LOGNAME");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8197
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8198
	if (name && (strlen(name) < sizeof(cachedName))) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8199
	    strcpy(cachedName, name);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8200
	    firstCall = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8201
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8202
    } else {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8203
	name = cachedName;
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8204
    }
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8205
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8206
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8207
     * try a few common environment variables ...
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
    if (! name || (name[0] == 0) ) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8210
	name = getenv("LOGIN");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8211
	if (! name || (name[0] == 0) ) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8212
	    name = getenv("LOGNAME");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8213
	    if (! name || (name[0] == 0) ) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8214
		name = getenv("USER");
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8215
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8216
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8217
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8218
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8219
     * nope - I really font know who you are.
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 (! name || (name[0] == 0) ) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8222
	name = "you";
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8223
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8224
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8225
    RETURN ( __MKSTRING(name) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8226
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8227
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8228
     OperatingSystem getLoginName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8229
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8230
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8231
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8232
getUserID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8233
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8234
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8235
    "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
  8236
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8237
%{  /* NOCONTEXT */
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
    int uid;
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
    uid = getuid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8242
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8243
%}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8244
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8245
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8246
     OperatingSystem getUserID
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8247
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8248
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8249
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8250
getUserNameFromID:aNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8251
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8252
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8253
    "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
  8254
     This is the login name, not the fullName."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8255
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8256
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8257
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8258
# ifndef NO_PWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8259
    struct passwd *p;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8260
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8261
    if (__isSmallInteger(aNumber)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8262
	p = getpwuid(__intVal(aNumber));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8263
	if (p) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8264
	    RETURN ( __MKSTRING(p->pw_name) );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8265
	}
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8266
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8267
#endif /* unix-like */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8268
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8269
    aNumber == self getUserID ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8270
	^ self getLoginName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8271
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8272
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8273
    ^ '? (' , aNumber printString , ')'
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
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8276
     OperatingSystem getUserNameFromID:0
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8277
     OperatingSystem getUserNameFromID:100
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8278
     OperatingSystem getUserNameFromID:9991 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8279
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8280
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8281
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8282
userInfoOf:aNameOrID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8283
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8284
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8285
    "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
  8286
     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
  8287
     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
  8288
     DOS systems return nothing; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8289
     non-SYSV4 systems have no age/comment.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8290
     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
  8291
     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
  8292
     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
  8293
     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
  8294
     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
  8295
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8296
    |info name passw uid gid age comment
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8297
     gecos dir shell|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8298
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8299
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8300
# ifndef NO_PWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8301
    struct passwd *buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8302
    int ret;
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
    if (__isString(aNameOrID)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8305
	buf = getpwnam(__stringVal(aNameOrID));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8306
    } else if (__isSmallInteger(aNameOrID)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8307
	buf = getpwuid(__intVal(aNameOrID));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8308
    } else {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8309
	buf = (struct passwd *)0;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8310
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8311
    if (buf) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8312
	name = __MKSTRING(buf->pw_name);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8313
#  ifndef NO_PWD_PASSWD
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8314
	passw = __MKSTRING(buf->pw_passwd);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8315
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8316
#  ifdef SYSV4
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8317
	age = __MKSTRING(buf->pw_age);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8318
	comment = __MKSTRING(buf->pw_comment);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8319
#  endif
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8320
	dir = __MKSTRING(buf->pw_dir);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8321
#  ifndef NO_PWD_GECOS
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8322
	gecos = __MKSTRING(buf->pw_gecos);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8323
#  endif
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8324
	shell = __MKSTRING(buf->pw_shell);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8325
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8326
	uid = __MKSMALLINT(buf->pw_uid);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8327
	gid = __MKSMALLINT(buf->pw_gid);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8328
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8329
# endif /* has PWD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8330
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8331
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8332
    name isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8333
	aNameOrID == self getUserID ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8334
	    name := self getLoginName
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8335
	].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8336
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8337
    name notNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8338
	info at:#name put:name.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8339
    ] ifFalse:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8340
	info at:#name put:'unknown'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8341
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8342
    passw notNil ifTrue:[info at:#passwd put:passw].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8343
    age notNil ifTrue:[info at:#age put:age].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8344
    comment notNil ifTrue:[info at:#comment put:comment].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8345
    gecos notNil ifTrue:[info at:#gecos put:gecos].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8346
    shell notNil ifTrue:[info at:#shell put:shell].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8347
    dir isNil ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8348
	aNameOrID == self getUserID ifTrue:[
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8349
	    dir := self getHomeDirectory
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8350
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8351
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8352
    dir notNil ifTrue:[info at:#dir put:dir].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8353
    uid notNil ifTrue:[info at:#uid put:uid].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8354
    gid  notNil ifTrue:[info at:#gid put:gid].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8355
    ^ info
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8356
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8357
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8358
     OperatingSystem userInfoOf:'root'
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8359
     OperatingSystem userInfoOf:1
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8360
     OperatingSystem userInfoOf:'claus' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8361
     OperatingSystem userInfoOf:'fooBar' 
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8362
     OperatingSystem userInfoOf:(OperatingSystem getUserID)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8363
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8364
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8365
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8366
!UnixOperatingSystem class methodsFor:'waiting for events'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8367
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8368
blockingChildProcessWait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8369
     "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
  8370
      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
  8371
      a subprocesses status (to avoid blocking)."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8372
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8373
%{ /*NOCONTEXT*/
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8374
#if defined(HAS_WAITPID) || defined(HAS_WAIT3)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8375
    RETURN(false);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8376
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8377
    RETURN(true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8378
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8379
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8380
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8381
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8382
childProcessWait:blocking pid:pidToWait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8383
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8384
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8385
    "get status changes from child processes.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8386
     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
  8387
     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
  8388
     otherwise we return immediately.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8389
     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
  8390
     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
  8391
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8392
    |pid status code core|
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
    int p;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8395
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8396
#if defined(HAS_WAITPID)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8397
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8398
    int s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8399
#   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
  8400
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8401
#else
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8402
# if defined(HAS_WAIT3)
3496
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
    union wait s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8405
#   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
  8406
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8407
# 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
  8408
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8409
    int s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8410
#   define __WAIT      wait(&s)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8411
#   define __BLOCKING_WAIT__ 1
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
    if (blocking != true) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8414
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8415
	 * We do not support nonBlocking waits, so signal an error
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8416
	 * Sorry about the goto, but with all these ifdefs ...
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8417
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8418
	goto done;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8419
    }
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8420
# endif /*!HAS_WAIT3*/
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8421
#endif  /*!HAS_WAITPID*/
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8422
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8423
#if !defined(WIFEXITED)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8424
# define WIFEXITED(stat)      (((int)((stat)&0377))==0)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8425
# 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
  8426
# 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
  8427
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8428
# define WEXITSTATUS(stat)    ((int)(((stat)>>8)&0377))
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8429
# define WTERMSIG(stat)       (((int)((stat)&0377))&0177)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8430
# define WSTOPSIG(stat)       ((int)(((stat)>>8)&0377))
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8431
#endif /*!WIFEXITED*/
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8432
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8433
#if !defined(WCOREDUMP)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8434
   /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8435
    * 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
  8436
    */
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8437
# if defined(HAS_WAIT3)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8438
#  define WCOREDUMP(status)    (((union __wait*)&(status))->__w_coredump)
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8439
# else
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8440
#  define WCOREDUMP(status)    ((int)(((status)>>8)&0200))
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8441
# endif
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8442
#endif /*!WCOREDUMP*/
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8443
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8444
#if __BLOCKING_WAIT__
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8445
    __BEGIN_INTERRUPTABLE__
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8446
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8447
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8448
    do {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8449
	p = __WAIT;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8450
    } while (p == -1 && errno == EINTR);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8451
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8452
#if __BLOCKING_WAIT__
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8453
    __END_INTERRUPTABLE__
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8454
#  undef __BLOCKING_WAIT__
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8455
#endif
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8456
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8457
#undef __WAIT
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8458
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8459
    if (p == 0)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8460
	RETURN(nil)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8461
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8462
    if (p == -1) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8463
	if (errno == ECHILD)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8464
	    RETURN(nil);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8465
    } else {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8466
	pid = __MKSMALLINT(p);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8467
	if (WIFEXITED(s)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8468
	    status = @symbol(exit);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8469
	    code = __MKSMALLINT(WEXITSTATUS(s));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8470
	    core = WCOREDUMP(s) ? true : false;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8471
	} else if (WIFSIGNALED(s)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8472
	    status = @symbol(signal);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8473
	    code = __MKSMALLINT(WTERMSIG(s));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8474
	} else if (WIFSTOPPED(s)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8475
	    status = @symbol(stop);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8476
	    code = __MKSMALLINT(WSTOPSIG(s));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8477
	}
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8478
#if defined(WIFCONTINUED)
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8479
	else if (WIFCONTINUED(s)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8480
	    status = @symbol(continue);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8481
	} 
3930
22edc626ba1b removed VMS stuff
Claus Gittinger <cg@exept.de>
parents: 3928
diff changeset
  8482
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8483
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8484
done: ;
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8487
    (status isNil or:[pid isNil]) ifTrue:[
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8488
	^ self primitiveFailed
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8489
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8490
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8491
"/ 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
  8492
"/ show:' code: '; show:code; show:' core:'; showCR:core.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8493
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8494
    ^ 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
  8495
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8496
    "
3795
fbdfe2dd4e77 comments
Claus Gittinger <cg@exept.de>
parents: 3793
diff changeset
  8497
     OperatingSystem childProcessWait:false
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8498
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8499
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8500
    "Created: 5.1.1996 / 16:39:14 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8501
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8502
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8503
numAvailableForReadOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8504
    "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
  8505
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8506
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8507
#ifdef NOTDEF   /* does not work ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8508
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8509
     * 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
  8510
     */
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8511
# if defined(FIONREAD)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8512
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8513
	int n;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8514
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8515
	if (__isSmallInteger(fd)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8516
	    if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8517
		RETURN (__MKINT(n));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8518
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8519
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8520
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8521
# endif /* FIONREAD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8522
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8523
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8524
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8525
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8526
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8527
readCheck:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8528
    "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
  8529
     (i.e. read is possible without blocking).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8530
     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
  8531
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8532
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8533
#ifdef NOTDEF   /* does not work ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8534
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8535
     * 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
  8536
     */
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8537
# if defined(FIONREAD)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8538
    {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8539
	int n;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8540
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8541
	if (__isSmallInteger(fd)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8542
	    if (n = ioctl(__intVal(fd), FIONREAD)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8543
		printf("FIONREAD returns %d\n", n);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8544
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8545
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8546
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8547
# endif /* FIONREAD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8548
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8549
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8550
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8551
    ^ super readCheck:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8552
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8553
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8554
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8555
    "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
  8556
     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
  8557
     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
  8558
     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
  8559
     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
  8560
     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
  8561
     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
  8562
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8563
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8564
    fd_set rset, wset, eset;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8565
    struct timeval wt, et;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8566
    int f, maxF, i, lX, bX;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8567
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8568
    OBJ fd, retFd;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8569
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8570
    int count;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8571
    int numFds = 0;
3801
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  8572
#ifndef __isArrayLike
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  8573
# define __isArrayLike __isArray
b4b3d6a6e48f oops - isArrayLike is not yet defined
Claus Gittinger <cg@exept.de>
parents: 3795
diff changeset
  8574
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8575
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8576
    if (__isSmallInteger(millis)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8577
	FD_ZERO(&rset);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8578
	FD_ZERO(&wset);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8579
	FD_ZERO(&eset);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8580
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8581
	maxF = -1;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8582
	if (__isNonNilObject(readFdArray)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8583
	    if (! __isArrayLike(readFdArray)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8584
		goto fail;    
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8585
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8586
	    count = __arraySize(readFdArray);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8587
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8588
	    for (i=0; i<count;i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8589
		fd = __ArrayInstPtr(readFdArray)->a_element[i];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8590
		if (fd != nil) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8591
		    if (! __isSmallInteger(fd)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8592
			if (@global(InfoPrinting) == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8593
			    fprintf(stderr, "[OS] warning: funny read-fd (0x%x) given to select\n", fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8594
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8595
		    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8596
			f = __intVal(fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8597
			if ((unsigned)f < FD_SETSIZE) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8598
			    FD_SET(f, &rset);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8599
			    if (f > maxF) maxF = f;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8600
			    numFds++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8601
			} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8602
			    if (@global(InfoPrinting) == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8603
				fprintf(stderr, "[OS] warning: huge read-fd (0x%x) given to select\n", fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8604
			    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8605
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8606
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8607
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8608
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8609
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8610
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8611
	if (__isNonNilObject(writeFdArray)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8612
	    if (! __isArrayLike(writeFdArray)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8613
		goto fail;    
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8614
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8615
	    count = __arraySize(writeFdArray);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8616
	    for (i=0; i<count;i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8617
		fd = __ArrayInstPtr(writeFdArray)->a_element[i];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8618
		if (fd != nil) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8619
		    if (! __isSmallInteger(fd)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8620
			if (@global(InfoPrinting) == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8621
			    fprintf(stderr, "[OS] warning: funny write-fd (0x%x) given to select\n", fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8622
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8623
		    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8624
			f = __intVal(fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8625
			if ((unsigned)f < FD_SETSIZE) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8626
			    FD_SET(f, &wset);       
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8627
			    if (f > maxF) maxF = f;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8628
			    numFds++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8629
			} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8630
			    if (@global(InfoPrinting) == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8631
				fprintf(stderr, "[OS] warning: huge write-fd (0x%x) given to select\n", fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8632
			    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8633
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8634
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8635
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8636
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8637
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8638
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8639
	if (__isNonNilObject(exceptFdArray)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8640
	    if (! __isArrayLike(exceptFdArray)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8641
		goto fail;    
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8642
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8643
	    count = __arraySize(exceptFdArray);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8644
	    for (i=0; i<count;i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8645
		fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8646
		if (fd != nil) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8647
		    if (! __isSmallInteger(fd)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8648
			if (@global(InfoPrinting) == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8649
			    fprintf(stderr, "[OS] warning: funny except-fd (0x%x) given to select\n", fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8650
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8651
		    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8652
			f = __intVal(fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8653
			if ((unsigned)f < FD_SETSIZE) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8654
			    FD_SET(f, &eset);       
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8655
			    if (f > maxF) maxF = f;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8656
			    numFds++;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8657
			} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8658
			    if (@global(InfoPrinting) == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8659
				fprintf(stderr, "[OS] warning: huge except-fd (0x%x) given to select\n", fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8660
			    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8661
			}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8662
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8663
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8664
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8665
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8666
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8667
	t = __intVal(millis);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8668
	if (t) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8669
	    wt.tv_sec = t / 1000;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8670
	    wt.tv_usec = (t % 1000) * 1000;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8671
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8672
	    wt.tv_sec = wt.tv_usec = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8673
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8674
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8675
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8676
	 * make certain, that interrupt gets us out of the select
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8677
	 * However, we must then care for moved objects.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8678
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8679
	__BEGIN_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8680
	errno = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8681
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8682
	if (t == 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8683
	    /* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8684
	     * if there is no timeout time, we can stay here interruptable.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8685
	     */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8686
	    do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8687
		ret = select(maxF+1, &rset, &wset, &eset, &wt);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8688
	    } while ((ret < 0) && (errno == EINTR));
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8689
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8690
	    do {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8691
		ret = select(maxF+1, &rset, &wset, &eset, &wt);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8692
		/* 
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8693
		 * for now: dont loop; if we did, we had to adjust the vt-timeval;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8694
		 * could otherwise stay in this loop forever ...
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8695
		 * Premature ret (before the time expired) must be handled by the caller.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8696
		 * A good solution is to update the wt-timeval and redo the select.
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8697
		 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8698
	    } while (0 /* (ret < 0) && (errno == EINTR) */ );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8699
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8700
	__END_INTERRUPTABLE__
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8701
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8702
	if (ret > 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8703
	    for (i=0; i <= maxF; i++) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8704
		if (FD_ISSET(i, &rset)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8705
		 || FD_ISSET(i, &wset)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8706
		 || FD_ISSET(i, &eset)) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8707
		    RETURN ( __MKSMALLINT(i) );
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8708
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8709
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8710
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8711
	    if (ret < 0) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8712
		if (errno == EINTR) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8713
		    errno = 0;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8714
		    @global(LastErrorNumber) = nil;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8715
		} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8716
		    if (@global(InfoPrinting) == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8717
			fprintf(stderr, "OS [info]: select errno = %d\n", errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8718
		    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8719
		    @global(LastErrorNumber) = __MKSMALLINT(errno);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8720
		}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8721
	    } else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8722
		@global(LastErrorNumber) = nil;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8723
	    }
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8724
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8725
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8726
	/*
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8727
	 * Return nil (means time expired or interrupted)
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8728
	 */
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8729
	RETURN ( nil );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8730
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8731
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8732
fail: ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8733
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8734
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8735
     timeout argument not integer,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8736
     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
  8737
     or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8738
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8739
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8740
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8741
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8742
setBlocking:aBoolean on:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8743
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8744
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8745
    "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
  8746
     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
  8747
     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
  8748
     nil."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8749
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8750
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8751
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8752
    int ret, flags;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8753
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8754
#if defined(F_GETFL) && defined(F_SETFL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8755
# if defined(FNDELAY)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8756
    if (__isSmallInteger(fd)) {
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8757
	int f = __intVal(fd);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8758
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8759
	flags = fcntl(f, F_GETFL, 0);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8760
	if (aBoolean == true) {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8761
	    ret = fcntl(f, F_SETFL, flags & ~FNDELAY);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8762
	} else {
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8763
	    ret = fcntl(f, F_SETFL, flags | FNDELAY);
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8764
	}
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8765
	if (ret >= 0) ret = flags;
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8766
	RETURN ( __MKSMALLINT(ret) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8767
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8768
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8769
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8770
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8771
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8772
     fd argument not integer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8773
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8774
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8775
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8776
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8777
!UnixOperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8778
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8779
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8780
    ^ self basicNew
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8781
	type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP 
5854
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8782
! !
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8783
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8784
!UnixOperatingSystem::FileStatusInfo methodsFor:'accessing'!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8785
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8786
accessed
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8787
    "return accessed"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8788
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8789
    ^ accessed
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8790
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8791
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8792
alternativeName
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8793
    "return the files other name (DOS name on windows).
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8794
     Nil if there is no other name"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8795
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8796
    ^ nil
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8797
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8798
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8799
fixedHeaderSize
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8800
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8801
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8802
    ^ nil
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8803
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8804
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8805
gid
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8806
    "return gid"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8807
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8808
    ^ gid
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8809
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8810
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8811
id
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8812
    "return id"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8813
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8814
    ^ id
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8815
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8816
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8817
mode
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8818
    "return mode"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8819
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8820
    ^ mode
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8821
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8822
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8823
modified
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8824
    "return modified"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8825
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8826
    ^ modified
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8827
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8828
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8829
path
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8830
    "for symbolic links only: return the path where the symbolic link points to"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8831
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8832
    ^ path
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8833
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8834
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8835
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8836
recordAttributes
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8837
    "return the recordAttributes (VMS only; nil everywhere else)"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8838
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8839
    ^ nil
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8840
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8841
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8842
recordFormat
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8843
    "return the recordFormat (VMS only; nil everywhere else)"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8844
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8845
    ^ nil
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8846
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8847
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8848
recordFormatNumeric
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8849
    "return the recordFormat as numeric (VMS only; nil everywhere else)"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8850
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8851
    ^ nil
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8852
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8853
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8854
recordSize
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8855
    "return the recordSize (VMS only; nil everywhere else)"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8856
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8857
    ^ nil
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8858
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8859
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8860
size
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8861
    "return size"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8862
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8863
    ^ size
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8864
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8865
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8866
statusChanged
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8867
    "return statusChanged"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8868
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8869
    ^ statusChanged
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8870
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8871
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8872
type
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8873
    "return type"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8874
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8875
    ^ type
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8876
!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8877
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8878
uid
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8879
    "return uid"
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8880
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8881
    ^ uid
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8882
! !
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8883
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8884
!UnixOperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8885
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8886
at:key
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8887
    "backward compatibility access: in previous releases, IdentityDictionaries
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8888
     were used to hold my information. Allow access via key messages.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8889
     This method will vanish - use the proper access protocol."
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8890
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8891
    ^ self perform:key
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8892
! !
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8893
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8894
!UnixOperatingSystem::FileStatusInfo methodsFor:'private accessing'!
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8895
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8896
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8897
    type := t.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8898
    mode := m.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8899
    uid := u.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8900
    gid := g.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8901
    size := s.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8902
    id := i.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8903
    accessed := aT.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8904
    modified := mT.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8905
    statusChanged := sT.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8906
    path := lP.
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8907
! !
b451c2eda355 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5656
diff changeset
  8908
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8909
!UnixOperatingSystem::OSProcessStatus class methodsFor:'documentation'!
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
documentation
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
    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
  8914
    operating system processes (these are no smalltalk processes!!).
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
    [Instance variables:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8917
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8918
	pid     <Integer>       OS-Process identifier
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8919
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8920
	status  <Symbol>        either #exit #signal #stop #continue
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8921
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8922
	code    <Integer>       either exitcode or signalnumber
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8923
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8924
	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
  8925
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
    [author:]
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8928
	Stefan Vogel
3496
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
    [see also:]
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  8931
	OperatingSystem
3496
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
! !
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
!UnixOperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8936
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8937
pid:pid status:status code:code core:core
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8938
    "private interface for UnixOperatingSystem"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8939
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8940
    ^ 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
  8941
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8942
    "Created: 28.12.1995 / 14:16:14 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8943
    "Modified: 30.4.1996 / 18:25:00 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8944
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8945
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8946
processCreationFailure
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8947
    "private interface for UnixOperatingSystem"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8948
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8949
    ^ 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
  8950
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8951
    "Created: 28.12.1995 / 14:35:29 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8952
    "Modified: 30.4.1996 / 18:25:05 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8953
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8954
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8955
!UnixOperatingSystem::OSProcessStatus methodsFor:'accessing'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8956
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8957
code
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8958
    "return the exitcode / signalNumber"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8959
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8960
    ^ code
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8961
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8962
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8963
    "Modified: 30.4.1996 / 18:26:23 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8964
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8965
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8966
core
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8967
    "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
  8968
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8969
    ^ core == true
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8970
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8971
    "Modified: 28.12.1995 / 14:14:38 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8972
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8973
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8974
pid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8975
    "return the pid"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8976
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8977
    ^ pid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8978
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8979
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8980
    "Modified: 30.4.1996 / 18:26:30 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8981
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8982
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8983
status
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8984
    "return status as a Symbol;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8985
     one of #exit #signal #stop #continue"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8986
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8987
    ^ status
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8988
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8989
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8990
    "Modified: 30.4.1996 / 18:26:54 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8991
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8992
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8993
!UnixOperatingSystem::OSProcessStatus methodsFor:'initialization'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8994
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8995
pid:newPid status:newStatus code:newCode core:newCore
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8996
    pid := newPid.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8997
    status := newStatus.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8998
    code := newCode.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8999
    core := newCore.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9000
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9001
    "Created: 28.12.1995 / 14:18:22 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9002
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9003
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9004
!UnixOperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9005
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9006
code:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9007
    "set the exitCode"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9008
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9009
    code := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9011
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9012
    "Modified: 30.4.1996 / 18:25:18 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9013
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9014
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9015
core:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9016
    "set core"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9017
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9018
    core := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9019
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9020
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9021
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9022
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9023
pid:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9024
    "set pid"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9025
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9026
    pid := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9027
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9028
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9029
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9030
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9031
status:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9032
    "set status"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9033
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9034
    status := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9035
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9036
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9037
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9038
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9039
!UnixOperatingSystem::OSProcessStatus methodsFor:'queries'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9041
couldNotExecute
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9042
    "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
  9043
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9044
    ^ status == #exit and:[code = 127].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9045
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9046
    "Created: 28.12.1995 / 15:43:17 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9047
    "Modified: 30.4.1996 / 18:27:03 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9048
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9049
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9050
stillAlive
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9051
    "true if process is still alive"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9052
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9053
    ^ status == #stop or:[status == #continue]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9054
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9055
    "Created: 28.12.1995 / 14:27:26 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9056
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9057
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9058
success
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9059
    "true if process terminated successfully"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9060
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9061
    ^ status == #exit and:[code = 0]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9062
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9063
    "Created: 28.12.1995 / 14:13:05 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9064
    "Modified: 28.12.1995 / 14:13:41 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9065
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9066
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9067
!UnixOperatingSystem class methodsFor:'documentation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9068
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9069
version
6050
af9ae36d6fdb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5886
diff changeset
  9070
    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.101 2001-09-26 15:35:16 cg Exp $'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9071
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9072
UnixOperatingSystem initialize!