UnixOperatingSystem.st
author Claus Gittinger <cg@exept.de>
Tue, 25 Aug 1998 15:43:22 +0200
changeset 3780 7d735472f937
parent 3773 54dd6a5fd72a
child 3793 aff27e755ffd
permissions -rw-r--r--
removed some WIN32 stuff
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
	      All Rights Reserved
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
AbstractOperatingSystem subclass:#UnixOperatingSystem
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
	instanceVariableNames:''
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	classVariableNames:'HostName DomainName SlowFork CurrentDirectory'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	poolDictionaries:''
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	category:'OS-Unix'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
Object subclass:#FileStatusInfo
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
    21
	instanceVariableNames:'type mode uid gid size id accessed modified statusChanged path'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	classVariableNames:''
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
	poolDictionaries:''
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
	privateIn:UnixOperatingSystem
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
Object subclass:#OSProcessStatus
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
	instanceVariableNames:'pid status code core'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
	classVariableNames:''
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
	poolDictionaries:''
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
	privateIn:UnixOperatingSystem
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
!UnixOperatingSystem primitiveDefinitions!
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
#define UNIX_LIKE       /* assumption: a real operatingSystem */
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(MSWINDOWS) || defined(OS2) || defined(MSDOS) || defined(WIN32)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
# ifndef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
#  define MSDOS_LIKE
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
# undef UNIX_LIKE       /* oops - we were too optimistic - no OS */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
# ifdef i386
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
#  ifndef _X86_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
#   define _X86_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
#endif /* any MS-non-OS */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
#if defined(transputer)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
# undef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
# undef UNIX_LIKE       /* oops - we were too optimistic - no OS */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
#if defined(_AIX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
# ifndef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
#  define WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
# ifndef WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
#  define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
#endif
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
#ifdef LINUX
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
  /* use inline string macros */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
# define __STRINGDEFS__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
# include <linuxIntern.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
# ifndef WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
#  define WANT_SYSTEM
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
# define WANT_SHM
3544
a654f7ac3a6e solaris has no setenv / unsetenv
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
    74
# define HAS_SETENV
a654f7ac3a6e solaris has no setenv / unsetenv
Claus Gittinger <cg@exept.de>
parents: 3543
diff changeset
    75
# define HAS_UNSETENV
3496
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 IRIX5
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 ultrix
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 hpux
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
#ifdef solaris
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
#if defined(SYSV4) && defined(i386) /* e.g. unixware */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
# define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
#ifdef __VMS__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
# undef __new
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
# undef HAS_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
# undef HAS_WAIT3
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
# undef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
# undef HAS_USLEEP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
# define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
# define NO_SETITIMER
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
# define NO_GRP_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
# define HAS_REMOVE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
# ifdef __openVMS__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
#  ifndef _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
#   include <unistd.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
#   define _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
# endif
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
   * req'd for additional fileInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
   */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
# include <rms.h> /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
# include <fabdef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
  /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
   * req'd for subprocess support
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
   */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
# include <iodef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
# include <ssdef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
# include <syidef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
# include <clidef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
# include <stsdef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
# include <dvidef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
# include <nam.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
# include <descrip.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
# include <lib$routines.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
# include <starlet.h>
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
# define xxxUSE_SLOW_ALARM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
# define USE_AST_TIMER
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
/* VMS variable length string */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
struct Vstring {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
  short length;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
  char body[NAM$C_MAXRSS+1];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
};
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
/* VMS typeahead-ask struct */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
struct typahdask {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    short typcnt;       /* chars in buffer */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    char firstChar;     /* first character */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    char reserve1;      /* secret */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    long reserve2;      /* secret */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
};
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
/* VMS I/O status block */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
struct IOSB {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
  short status, count;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
  long devinfo;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
};
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
/* VMS Item List 3 structure */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
struct itm$list3 {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
  short buflen;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
  short itemcode;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
  void *buffer;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
  size_t *retlen;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
};
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
/* ST/X maintained per-process information */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
struct procInfo {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    long  returnStatus; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
    long  pid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    char  eventFlag;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
    char  finished;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
    struct procInfo *nextProc;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
};
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
 * move this to alphaIntern.h ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
# if __VMS_VER < 70000000
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
#  define NO_PWD
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
# define NO_PWD_PASSWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
# define NO_PWD_GECOS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
#endif /* __VMS__ */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
 * notice: although many systems' include files
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
 * already block against multiple inclusion, some
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
 * do not. Therefore, this is done here again.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
 * (it does not hurt)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
 */ 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
#ifdef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
# ifndef NO_SYS_PARAM_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
#  include <sys/param.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
#  define _SYS_PARAM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
# include <errno.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
# define _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
# include <sys/stat.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
# define _SYS_STAT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
#endif /* WANT_REALPATH */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
extern int shmctl(), shmget(), shmdt();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
extern char * shmat();
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
# include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
# define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
# include <sys/ipc.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
# define _SYS_IPC_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
# include <sys/shm.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
# define _SYS_SHM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
#endif /* WANT_SHM */
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
#ifdef IRIX5
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
# include <sys/syssgi.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
#ifdef transputer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
# define unlink(f)      ((remove(f) == 0) ? 0 : -1)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
#else /* not transputer */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
# ifndef _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
#  include <signal.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
#  define _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
# ifdef SYSV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
#  ifndef _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
#   include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
#   define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
#  ifndef _SYS_PARAM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
#   ifndef NO_SYS_PARAM_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
#    include <sys/param.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
#    define _SYS_PARAM_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
#  ifndef _SYS_TIMES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
#   include <sys/times.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
#   define _SYS_TIMES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
#  ifndef _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
#   include <sys/file.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
#   define _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
#  if ! defined(sco3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
#   ifndef _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
#    include <unistd.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
#    define _UNISTD_H_INCLUDED_
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
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
#  if defined(isc3_2) || defined(sco3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
#   ifndef _SYS_TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
#    include <sys/time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
#    define _SYS_TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   278
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
#  if !defined(isc3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
#   if defined(PCS) && defined(mips)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
#    include "/usr/include/bsd/sys/time.h"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   283
#    include "/usr/include/sys/time.h"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   284
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   285
#    ifndef _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   286
#     include <time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
#     define _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
#    endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
#  if defined(isc3_2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
#   include <sys/bsdtypes.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   296
# else /* not SYSV */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   297
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
#  ifdef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
#   ifndef _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
#    include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   302
#    define _SYS_TYPES_H_INCLUDED_
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 _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
#    include <time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   307
#    define _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   308
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   309
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   310
#   ifndef _SYS_TIMEB_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   311
#    include <sys/timeb.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
#    define _SYS_TIMEB_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
#  else /* not MSDOS_like */
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 _SYS_TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
#    include <sys/time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
#    define _SYS_TIME_H_INCLUDED_
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
#   ifndef _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
#    include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
#    define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
#  endif /* not MSDOS */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
# endif /* not SYSV */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
# ifdef aix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
#  ifndef _TIME_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
#   include <time.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
#   define _TIME_H_INCLUDED_
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
#  ifndef _SYS_SELECT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
#   include <sys/select.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
#   define _SYS_SELECT_H_INCLUDED_
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
# endif /* aix */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   343
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   344
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
# ifndef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   347
#  ifndef _PWD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   348
#   include <pwd.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   349
#   define _PWD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   350
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   351
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
#  ifndef NO_GRP_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
#   ifndef _GRP_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
#    include <grp.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
#    define _GRP_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
# endif /* not MSDOS */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
# ifndef _SYS_STAT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
#  include <sys/stat.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
#  define _SYS_STAT_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
# ifndef _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
#  ifndef WIN32
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
#   include <sys/file.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   369
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   370
#  define _SYS_FILE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   371
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   372
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   373
# ifndef _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   374
#  include <errno.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   375
#  define _ERRNO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   376
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   377
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   378
# ifndef _STDIO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   379
#  include <stdio.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   380
#  define _STDIO_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   381
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   382
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   383
# ifndef _FCNTL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   384
#  include <fcntl.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   385
#  define _FCNTL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   386
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
# ifndef _IOCTL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
#  ifndef WIN32
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
#   include <sys/ioctl.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
#   define _IOCTL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
# ifdef WIN32
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
/*#  define PROCESSDEBUGWIN32*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
#  define xxUSE_TimerProc
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
#  undef INT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
#  undef Array
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
#  undef Number
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
#  undef Method
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
#  undef Point
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
#  undef Rectangle
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
#  undef Block
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   406
#  undef String
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
#  undef Message
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
#  undef Object
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
#  undef Context
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
/* #  include <windows.h> /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   412
#  include <stdarg.h> /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
#  include <windef.h> /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   414
#  include <winbase.h> /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   415
#  include <wingdi.h> /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   416
#  include <winuser.h> /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   417
#  include <winsock.h> /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
#  ifdef __DEF_Array
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
#   define Array __DEF_Array
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
#  ifdef __DEF_Number
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   423
#   define Number __DEF_Number
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   424
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
#  ifdef __DEF_Method
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
#   define Method __DEF_Method
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
#  ifdef __DEF_Point
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
#   define Point __DEF_Point
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
#  ifdef __DEF_Block
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
#   define Block __DEF_Block
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   433
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   434
#  ifdef __DEF_String
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   435
#   define String __DEF_String
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   436
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   437
#  ifdef __DEF_Message
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   438
#   define Message __DEF_Message
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   439
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
#  ifdef __DEF_Object
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   441
#   define Object __DEF_Object
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   442
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   443
#  ifdef __DEF_Context
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   444
#   define Context __DEF_Context
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   445
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   446
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   447
#  define INT int
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   448
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   449
#  define stat _stat
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   450
#  define WIN32_ERR(x)  ((x) | 0x01000000)      /* tag GetLastError codes */
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   451
                                                /* as opposed to Posix errors */
3496
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
typedef int (*intf)(int);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   454
BOOL __signalUserInterruptWIN32(DWORD sig);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   455
# endif /* WIN32 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   458
# if defined(LINUX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
#  define HAS_LOCALECONV
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   462
# if defined (HAS_LOCALECONV)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   463
#  ifndef _LOCALE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   464
#   include <locale.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   465
#   define _LOCALE_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   466
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   467
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   468
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   469
/* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   470
 * posix systems should define these ... 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
 * but on some (older) systems, they are not.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
# ifndef S_IXUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   474
#  ifdef S_IEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   475
#   define S_IXUSR S_IEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
#   define S_IXGRP (S_IEXEC>>3)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
#   define S_IXOTH (S_IEXEC>>6)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
# endif
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
# ifndef S_IXUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
#  define S_IXUSR 0100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   483
#  define S_IXGRP 0010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   484
#  define S_IXOTH 0001
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
# ifndef S_IRUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
#  define S_IRUSR 0400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
#  define S_IRGRP 0040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
#  define S_IROTH 0004
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   492
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   493
# ifndef S_IWUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
#  define S_IWUSR 0200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
#  define S_IWGRP 0020
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
#  define S_IWOTH 0002
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
# endif
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
# ifndef MAXPATHLEN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   500
#  ifndef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   501
#   ifndef NO_SYS_PARAM_H
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   502
#    include <sys/param.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   503
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   504
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   505
#  ifndef MAXPATHLEN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   506
#   ifdef FILENAME_MAX  /* i.e. MSDOS_LIKE */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   507
#    define MAXPATHLEN FILENAME_MAX
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   508
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
#    ifdef MAX_PATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   510
#     define MAXPATHLEN MAX_PATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   511
#    else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   512
#     define MAXPATHLEN 1024
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   513
#    endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   516
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   517
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
# if defined(HAS_UNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
#  include <sys/utsname.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
# if defined(SYSV4)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
#  include <stropts.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   525
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   526
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
 * NeXT has no pid_t
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
 * and no sigemptyset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
# ifdef NEXT3
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   531
   typedef int pid_t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   532
#  define sigemptyset(set)      ((*(set) = 0L), 0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   533
#  define HAS_GETDOMAINNAME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   534
#  define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   535
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   536
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   537
# ifdef sunos
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   538
#  undef NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   539
#  undef HAS_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   540
#  define HAS_WAIT3
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   541
#  define HAS_SIGACTION
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   542
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   543
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   544
# ifdef _AIX
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   545
#  undef HAS_WAIT3
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
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   548
# if defined(alpha) && defined(__osf__)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   549
#  ifndef HAS_GETSYSTEMINFO
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   550
#   define HAS_GETSYSTEMINFO
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   551
#  endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   552
# endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   553
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   554
# if defined(solaris)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   555
#  ifndef HAS_SYSCONF
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   556
#   define HAS_SYSCONF
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   557
#  endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   558
# endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   559
3496
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
 * some (BSD ?) have no timezone global,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   562
 * but provide the info in struct timezone.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   563
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   564
# if defined(ultrix) || defined(sunos) || defined(NEXT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   565
#  define HAS_NO_TIMEZONE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   566
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   567
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   568
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   569
 * 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
   570
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   571
# ifndef SA_RESTART
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   572
#  define SA_RESTART    0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   573
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   574
# ifndef SA_SIGINFO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   575
#  define SA_SIGINFO    0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   576
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   577
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   578
# if defined(HAS_WAITPID) || defined(HAS_WAIT3)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   579
#  include <sys/wait.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   580
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   581
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   582
# if defined(HAS_SYSINFO)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   583
#  include <sys/systeminfo.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   584
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   585
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   586
# ifdef LINUX
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   587
#  include <linux/kernel.h>
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   588
#  include <linux/sys.h>
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   589
# endif
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
   590
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   591
#if defined(HAS_GETSYSTEMINFO)
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   592
# include <sys/sysinfo.h>
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   593
# include <machine/hal_sysinfo.h>
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   594
# include <machine/hal/cpuconf.h>
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   595
#endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   596
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   597
# if defined(HAS_SYSCONF)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   598
#  ifndef _UNISTD_H_INCLUDED_
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   599
#   include <unistd.h>
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   600
#   define _UNISTD_H_INCLUDED_
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   601
#  endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
   602
# endif
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
   603
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   604
#endif /* not transputer */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   605
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   606
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   607
 * 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
   608
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   609
#ifndef errno
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   610
 extern errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   611
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   612
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   613
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   614
 * some (old ?) systems do not define this ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   615
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   616
#if !defined(R_OK) && !defined(_AIX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   617
# define R_OK    4       /* Test for Read permission */ 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   618
# define W_OK    2       /* Test for Write permission */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   619
# define X_OK    1       /* Test for eXecute permission */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   620
# 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
   621
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   622
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   623
#ifdef WIN32
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   624
# define SIGHANDLER_ARG int
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   625
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   626
# define SIGHANDLER_ARG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   627
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   628
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   629
#ifdef sunos
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   630
# define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   631
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   632
#ifdef NEXT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   633
# define NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   634
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   635
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   636
#ifdef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   637
#define _HANDLEVal(o)        (HANDLE)(__externalAddressVal(o))
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   638
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   639
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   640
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   641
 * 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
   642
 * explicit add of those we know to have ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   643
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   644
#ifdef __osf__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   645
# define TIME_T time_t
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   646
# define OFF_T  off_t
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   647
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   648
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   649
#ifndef TIME_T
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   650
# define TIME_T long
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   651
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   652
#ifndef OFF_T
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   653
# define OFF_T  long
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   654
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   655
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   656
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   657
 * where is the timezone info ?
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   658
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   659
#if defined(HAS_NO_TIMEZONE)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   660
# if defined(HAS_NO_TM_GMTOFF)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
#  define TIMEZONE(tmPtr)       0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
#  define TIMEZONE(tmPtr)       ((tmPtr)->tm_gmtoff)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   664
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   665
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
# ifdef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
#   define TIMEZONE(tmPtr)      0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
#  define TIMEZONE(tmPtr)       timezone
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   671
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   672
3595
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   673
#ifndef CONST
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   674
# ifdef __GNUC__
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   675
#  define CONST const
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   676
# else
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   677
#  define CONST /* nothing */
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   678
# endif
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   679
#endif
5fbfb33cd373 oops - not all compilers support const
Claus Gittinger <cg@exept.de>
parents: 3575
diff changeset
   680
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
%}
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
!UnixOperatingSystem primitiveVariables!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   686
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   687
#ifdef __VMS__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
static struct procInfo *procInfoHead = (struct procInfo *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
static struct procInfo *procInfoFree = (struct procInfo *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
static unsigned char procEventFlag = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   692
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   693
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   694
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   695
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   696
!UnixOperatingSystem primitiveFunctions!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   697
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   698
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   699
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   700
 * 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
   701
 * 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
   702
 * (LINUX is one of them)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
 * 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
   704
 * UnixOperatingSystem>>executeCommand, you ought to define WANT_SYSTEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   705
 * 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
   706
 *
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
 * 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
   708
 * 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
   709
 * (i.e. it is RT safe)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   710
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   711
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   712
#if defined(WANT_SYSTEM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   713
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   714
/* # define DPRINTF(x)     printf x */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   715
# define DPRINTF(x)     /* nothing */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   716
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   717
# ifndef _STDDEF_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   718
#  include <stddef.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   719
#  define _STDDEF_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   720
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   721
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   722
# ifndef _STDLIB_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   723
#  include <stdlib.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   724
#  define _STDLIB_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   725
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   726
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   727
# ifndef _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   728
#  include <unistd.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   729
#  define _UNISTD_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   730
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   731
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   732
# ifndef _SYS_WAIT_H_INCLUDED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   733
#  include <sys/wait.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   734
#  define _SYS_WAIT_H_INCLUDED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   735
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   736
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   737
# ifndef _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   738
#  include <signal.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   739
#  define _SIGNAL_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   740
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   741
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   742
# ifndef _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   743
#  include <sys/types.h>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   744
#  define _SYS_TYPES_H_INCLUDED_
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   745
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   746
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   747
# 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
   748
#  define       __environ       environ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   749
#  if !defined(LINUX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   750
#   define      __sigemptyset   sigemptyset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   751
#   define      __sigaction     sigaction
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   752
#   define      __sigaddset     sigaddset
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   753
#   define      __sigprocmask   sigprocmask
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   754
#   define      __execve        execve
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   755
#   define      __wait          wait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   756
#   define      __waitpid       waitpid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   757
#   if defined(HAS_VFORK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   758
#    define     FORK            vfork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   759
#   else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   760
#    define     FORK            fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   761
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   762
#  endif /* ! LINUX */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   763
   extern char **environ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   764
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   765
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   766
# 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
   767
# define        SHELL_NAME      "sh"            /* Name to give it.  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   768
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   769
# ifndef        FORK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   770
#  define       FORK    __fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   771
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   772
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   773
static int
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   774
mySystem(line)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   775
    register CONST char *line;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   776
{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   777
    int status, save;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
    pid_t pid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
    struct sigaction sa, intr, quit;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
    sigset_t block, omask;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
    if (line == NULL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   783
	return -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   785
    sa.sa_handler = SIG_IGN;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   786
    sa.sa_flags = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   787
    __sigemptyset (&sa.sa_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   788
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   789
    if (__sigaction (SIGINT, &sa, &intr) < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   790
	DPRINTF(("1: errno=%d\n", errno));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   791
	return -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   792
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   793
    if (__sigaction (SIGQUIT, &sa, &quit) < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   794
	save = errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   795
	(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   796
	errno = save;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   797
	DPRINTF(("2: errno=%d\n", errno));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   798
	return -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   799
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   800
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   801
    __sigemptyset (&block);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   802
    __sigaddset (&block, SIGCHLD);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   803
    save = errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   804
    if (__sigprocmask(SIG_BLOCK, &block, &omask) < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   805
	if (errno == ENOSYS)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   806
	    errno = save;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   807
	else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   808
	    save = errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   809
	    (void) __sigaction(SIGINT, &intr, (struct sigaction *) NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   810
	    (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   811
	    errno = save;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   812
	    DPRINTF(("3: errno=%d\n", errno));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   813
	    return -1;
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
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   816
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   817
    pid = FORK ();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   818
    if (pid == (pid_t) 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   819
	/* Child side.  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   820
	CONST char *new_argv[4];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   821
	new_argv[0] = SHELL_NAME;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   822
	new_argv[1] = "-c";
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   823
	new_argv[2] = line;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   824
	new_argv[3] = NULL;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   825
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   826
	/* Restore the signals.  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   827
	(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   828
	(void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   829
	(void) __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   830
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   831
	/* Exec the shell.  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   832
	(void) __execve (SHELL_PATH, (char *CONST *) new_argv, __environ);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   833
	_exit (127);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   834
    } else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   835
	if (pid < (pid_t) 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   836
	    /* The fork failed.  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   837
	    DPRINTF(("4: errno=%d\n", errno));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   838
	    status = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   839
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   840
	    /* Parent side.  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   841
#ifdef  NO_WAITPID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   842
	    pid_t child;
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
	    do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   845
		__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   846
		child = __wait (&status);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   847
		__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   848
		if (child < 0 && errno != EINTR) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   849
		    DPRINTF(("5: errno=%d\n", errno));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   850
		    status = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   851
		    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   852
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   853
	    } while (child != pid);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   854
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   855
	    pid_t child;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   856
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   857
	    /* claus: the original did not care for EINTR here ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   858
	    do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   859
		__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   860
		child = __waitpid (pid, &status, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   861
		__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   862
	    } while ((child != pid) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   863
	    if (child != pid) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   864
		DPRINTF(("6: errno=%d\n", errno));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   865
		status = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   866
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   867
#endif /* NO_WAITPID */
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
    save = errno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   871
    if ((__sigaction (SIGINT, &intr, (struct sigaction *) NULL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   872
     | __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   873
     | __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL)) != 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   874
	if (errno == ENOSYS) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   875
	    errno = save;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   876
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   877
	    status = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   878
	    DPRINTF(("7: errno=%d\n", errno));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   879
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   880
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   881
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   882
    return status;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   883
}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   884
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   885
# define __wait wait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   886
#endif /* WANT_SYSTEM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   887
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   888
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   889
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   890
 * some systems do not have realpath();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   891
 * the alternative of reading from a 'pwp'-pipe
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   892
 * 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
   893
 * 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
   894
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   895
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   896
#if defined(HAS_REALPATH)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   897
# undef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   898
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   899
#if !defined(HAS_GETWD) && !defined(HAS_GETCWD)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   900
# undef WANT_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   901
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   902
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   903
#if defined(WANT_REALPATH)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   904
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   905
# ifndef NULL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   906
#  define NULL (char *)0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   907
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   908
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   909
# define MAX_READLINKS 32
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   910
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   911
# ifndef MAXPATHLEN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   912
#  define MAXPATHLEN     1024
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   913
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   914
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   915
static
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   916
char *realpath(path, resolved_path)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   917
char *path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   918
char resolved_path [];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   919
{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   920
	char copy_path[MAXPATHLEN];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   921
	char link_path[MAXPATHLEN];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   922
	char *new_path = resolved_path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   923
	char *max_path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   924
	int readlinks = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   925
	int n;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   926
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   927
	/* Make a copy of the source path since we may need to modify it. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   928
	strcpy(copy_path, path);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   929
	path = copy_path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   930
	max_path = copy_path + MAXPATHLEN - 2;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   931
	/* If it's a relative pathname use getwd for starters. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   932
	if (*path != '/') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   933
#ifdef HAS_GETCWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   934
		new_path = getcwd(new_path, MAXPATHLEN - 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   935
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   936
		new_path = getwd(new_path);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   937
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   938
		if (new_path == NULL) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   939
		    return(NULL);
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
		new_path += strlen(new_path);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   942
		if (new_path[-1] != '/')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   943
			*new_path++ = '/';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   944
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   945
	else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   946
		*new_path++ = '/';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   947
		path++;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   948
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   949
	/* Expand each slash-separated pathname component. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   950
	while (*path != '\0') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   951
		/* Ignore stray "/". */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   952
		if (*path == '/') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   953
			path++;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   954
			continue;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   955
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   956
		if (*path == '.') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   957
			/* Ignore ".". */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   958
			if (path[1] == '\0' || path[1] == '/') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   959
				path++;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   960
				continue;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   961
			}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   962
			if (path[1] == '.') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   963
				if (path[2] == '\0' || path[2] == '/') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   964
					path += 2;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   965
					/* Ignore ".." at root. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   966
					if (new_path == resolved_path + 1)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   967
						continue;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   968
					/* Handle ".." by backing up. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   969
					while ((--new_path)[-1] != '/')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   970
						;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   971
					continue;
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
			}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   974
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   975
		/* Safely copy the next pathname component. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   976
		while (*path != '\0' && *path != '/') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   977
			if (path > max_path) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   978
				errno = ENAMETOOLONG;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   979
				return NULL;
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
			*new_path++ = *path++;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   982
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   983
#ifdef S_IFLNK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   984
		/* Protect against infinite loops. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   985
		if (readlinks++ > MAX_READLINKS) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   986
			errno = ELOOP;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   987
			return NULL;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   988
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   989
		/* See if latest pathname component is a symlink. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   990
		*new_path = '\0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   991
		n = readlink(resolved_path, link_path, MAXPATHLEN - 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   992
		if (n < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   993
			/* EINVAL means the file exists but isn't a symlink. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   994
			if (errno != EINVAL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   995
				return NULL;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   996
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   997
		else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   998
			/* Note: readlink doesn't add the null byte. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   999
			link_path[n] = '\0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1000
			if (*link_path == '/')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1001
				/* Start over for an absolute symlink. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1002
				new_path = resolved_path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1003
			else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1004
				/* Otherwise back up over this component. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1005
				while (*(--new_path) != '/')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1006
					;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1007
			/* Safe sex check. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1008
			if (strlen(path) + n >= MAXPATHLEN) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1009
				errno = ENAMETOOLONG;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1010
				return NULL;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1011
			}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1012
			/* Insert symlink contents into path. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1013
			strcat(link_path, path);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1014
			strcpy(copy_path, link_path);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1015
			path = copy_path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1016
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1017
#endif /* S_IFLNK */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1018
		*new_path++ = '/';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1019
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1020
	/* Delete trailing slash but don't whomp a lone slash. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1021
	if (new_path != resolved_path + 1 && new_path[-1] == '/')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1022
		new_path--;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1023
	/* Make sure it's null terminated. */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1024
	*new_path = '\0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1025
	return resolved_path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1026
}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1027
# define HAS_REALPATH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1028
#endif /* WANT_REALPATH && not HAS_REALPATH */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1029
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1030
#ifdef __VMS__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1031
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1032
/* #define TRACE_STAT_CALLS /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1033
/* #define TRACE_ACCESS_CALLS /* */
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
 * a stat which retries with appended '.DIR' in case of
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1037
 * failure.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1038
 * This allows to stat a directory.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1039
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1040
int
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1041
__vms_stat__(path, buffP)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1042
    char *path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1043
    struct stat *buffP;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1044
{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1045
	int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1046
	int retry = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1047
	char t[MAXPATHLEN+1+5+2];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1048
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1049
# ifdef TRACE_STAT_CALLS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1050
	printf("===> stat('%s')\n", path);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1051
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1052
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1053
	    ret = stat(path, buffP);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1054
	} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1055
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1056
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1057
	    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1058
	     * try with appended ';0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1059
	     * but only, if it has no version
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1060
	     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1061
	    if (strchr(path, ';') == NULL) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1062
		strncpy(t, path, MAXPATHLEN);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1063
		t[MAXPATHLEN] = '\0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1064
		strcat(t, ";0");
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1065
# ifdef TRACE_STAT_CALLS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1066
		printf("===> stat('%s') - retry\n", t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1067
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1068
		do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1069
		    ret = stat(t, buffP);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1070
		} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1071
		if (ret >= 0) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1072
		    return ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1073
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1074
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1075
	    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1076
	     * try with appended '.DIR';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1077
	     * but only, if it has no extension.
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
	    if (strchr(path, '.') == NULL) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1080
		strncpy(t, path, MAXPATHLEN);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1081
		t[MAXPATHLEN] = '\0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1082
		strcat(t, ".DIR;0");
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1083
		retry = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1084
	    } else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1085
		/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1086
		 * try with appended 'DIR';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1087
		 * but only, if it ends with '.'.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1088
		 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1089
		if (path[strlen(path)-1] == '.') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1090
		    strncpy(t, path, MAXPATHLEN);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1091
		    t[MAXPATHLEN] = '\0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1092
		    strcat(t, "DIR;0");
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1093
		    retry = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1094
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1095
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1096
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1097
	    if (retry) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1098
# ifdef TRACE_STAT_CALLS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1099
		printf("===> stat('%s') - retry\n", t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1100
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1101
		do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1102
		    ret = stat(t, buffP);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1103
		} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1104
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1105
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1106
	return ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1107
}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1108
# define stat(__path__, __buffP__)      __vms_stat__(__path__, __buffP__)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1109
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1110
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1111
 * same for access
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
int 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1114
__vms_access__(path, mode)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1115
    char *path;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1116
    int mode;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1117
{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1118
	int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1119
	int retry = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1120
	char t[MAXPATHLEN+1+5];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1121
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1122
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1123
	    ret = access(path, mode);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1124
	} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1125
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1126
	    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1127
	     * try with appended '.DIR';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1128
	     * but only, if it has no extension.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1129
	     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1130
	    if (strchr(path, '.') == NULL) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1131
		strncpy(t, path, MAXPATHLEN);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1132
		t[MAXPATHLEN] = '\0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1133
		strcat(t, ".DIR");
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1134
		retry = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1135
	    } else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1136
		if (path[strlen(path)-1] == '.') {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1137
		    strncpy(t, path, MAXPATHLEN);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1138
		    t[MAXPATHLEN] = '\0';
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1139
		    strcat(t, "DIR");
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1140
		    retry = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1141
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1142
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1143
	    if (retry) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1144
		do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1145
		    ret = access(t, mode);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1146
		} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1147
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1148
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1149
	return ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1150
}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1151
# define access(__path__, __mode__)     __vms_access__(__path__, __mode__)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1152
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1153
/* #define WAITDEBUG /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1154
/* #define PROCESSDEBUG /* */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1155
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1156
void
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1157
__vms_ASTChildWithInfo(pInfo) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1158
    struct procInfo *pInfo;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1159
{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1160
#ifdef WAITDEBUG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1161
	printf("__vms_ASTChildWithInfo pI=%x\n", pInfo);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1162
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1163
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1164
	pInfo->finished = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1165
	__vmsASTChild();        /* this signals an ST/X interrupt */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1166
}
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
int
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1169
__vms_waitPid(pidToWait, pStatus, pPid)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1170
    int pidToWait;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1171
    long *pStatus, *pPid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1172
{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1173
    extern struct procInfo *procInfoHead, *procInfoFree;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1174
    struct procInfo *pInfo, *prevInfo;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1175
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1176
    prevInfo = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1177
#ifdef WAITDEBUG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1178
    printf("__vms_waitPid ...\r\n", pInfo);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1179
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1180
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1181
    for (pInfo = procInfoHead; pInfo; pInfo = pInfo->nextProc) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1182
#ifdef WAITDEBUG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1183
	printf("__vms_waitPid pI=%x\r\n", pInfo);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1184
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1185
	if (pInfo->finished) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1186
#ifdef WAITDEBUG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1187
	    printf("  finished\n");
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1188
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1189
	    if ((pidToWait == -1)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1190
	     || (pInfo->pid == pidToWait)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1191
#ifdef WAITDEBUG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1192
		printf("  pid is %d\n", pInfo->pid);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1193
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1194
		if ((pInfo->returnStatus & STS$M_SUCCESS) != STS$M_SUCCESS)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1195
		    *pStatus = pInfo->returnStatus;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1196
		else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1197
		    *pStatus = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1198
#ifdef WAITDEBUG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1199
		printf("  status is %d (returning %d)\n", pInfo->returnStatus, *pStatus);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1200
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1201
		*pPid = pInfo->pid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1202
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1203
		/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1204
		 * link this infoBlock back to the freeList
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1205
		 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1206
		if (prevInfo) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1207
		    prevInfo->nextProc = pInfo->nextProc;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1208
		} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1209
		    procInfoHead = pInfo->nextProc;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1210
		}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1211
		pInfo->nextProc = procInfoFree;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1212
		procInfoFree = pInfo;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1213
		return 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1214
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1215
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1216
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1217
#ifdef WAITDEBUG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1218
    printf("no child\r\n");
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1219
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1220
    return 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1221
}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1222
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1223
#endif /* __VMS__ */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1224
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1225
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1226
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1227
!UnixOperatingSystem class methodsFor:'documentation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1228
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1229
copyright
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1230
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1231
 COPYRIGHT (c) 1988 by Claus Gittinger
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1232
	      All Rights Reserved
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1233
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1234
 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
  1235
 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
  1236
 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
  1237
 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
  1238
 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
  1239
 hereby transferred.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1240
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1241
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1242
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1243
documentation
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1244
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1245
    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
  1246
    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
  1247
    things available here in your applications 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1248
    - 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
  1249
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1250
    (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
  1251
     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
  1252
     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
  1253
     You decide - portability vs. functionality)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1254
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1255
    [Class variables:]
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
	HostName        <String>        remembered hostname
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1258
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1259
	DomainName      <String>        remembered domainname
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1260
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1261
	SlowFork        <Boolean>       if set, fork and popen are avoided;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1262
					(more or less obsolete now)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1263
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1264
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1265
	CurrentDirectory <String>       remembered currentDirectories path
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1266
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1267
    [author:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1268
	Claus Gittinger
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
    [see also:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1271
	OSProcessStatus
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1272
	Filename Date Time
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1273
	ExternalStream FileStream PipeStream Socket
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1274
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1275
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1276
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1277
examples
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1278
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1279
  various queries
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1280
								[exBegin]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1281
    Transcript 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1282
	showCR:'hello ' , (UnixOperatingSystem getLoginName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1283
								[exEnd]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1284
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1285
								[exBegin]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1286
    UnixOperatingSystem isUNIXlike ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1287
	Transcript showCR:'this is some UNIX-like OS'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1288
    ] ifFalse:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1289
	Transcript showCR:'this OS is not UNIX-like'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1290
    ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1291
								[exEnd]
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
								[exBegin]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1294
    Transcript 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1295
	showCR:'this machine is called ' , UnixOperatingSystem getHostName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1296
								[exEnd]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1297
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1298
								[exBegin]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1299
    Transcript 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1300
	showCR:('this machine is in the '
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1301
	       , UnixOperatingSystem getDomainName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1302
	       , ' domain')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1303
								[exEnd]
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
								[exBegin]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1306
    Transcript 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1307
	showCR:('this machine''s CPU is a '
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1308
	       , UnixOperatingSystem getCPUType
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1309
	       )
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1310
								[exEnd]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1311
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1312
								[exBegin]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1313
    Transcript showCR:'executing ls command ...'.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1314
    UnixOperatingSystem executeCommand:'ls'.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1315
    Transcript showCR:'... done.'.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1316
								[exEnd]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1317
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1318
  locking a file 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1319
  (should be executed on two running smalltalks - not in two threads):
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1320
								[exBegin]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1321
    |f|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1322
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1323
    f := 'testFile' asFilename readWriteStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1324
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1325
    10 timesRepeat:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1326
	'about to lock ...' printCR.
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
	  UnixOperatingSystem 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1329
	    lockFD:(f fileDescriptor)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1330
	    shared:false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1331
	    blocking:false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1332
	] whileFalse:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1333
	    'process ' print. UnixOperatingSystem getProcessId print. ' is waiting' printCR.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1334
	    Delay waitForSeconds:1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1335
	].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1336
	'LOCKED ...' printCR.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1337
	Delay waitForSeconds:10.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1338
	'unlock ...' printCR.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1339
	(UnixOperatingSystem 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1340
	    unlockFD:(f fileDescriptor)) printCR.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1341
	Delay waitForSeconds:3.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1342
    ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1343
								[exBegin]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1344
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1345
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1346
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1347
!UnixOperatingSystem class methodsFor:'initialization'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1348
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1349
initialize
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1350
    "initialize the class"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1351
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1352
    ObjectMemory addDependent:self.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1353
    HostName := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1354
    DomainName := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1355
    LastErrorNumber := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1356
    PipeFailed := false.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1357
    SlowFork := false.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1358
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1359
    "Modified: 13.9.1997 / 10:47:32 / cg"
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
update:something with:aParameter from:changedObject
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1363
    "catch image restart and flush some cached data"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1364
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1365
    something == #earlyRestart ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1366
	"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1367
	 flush cached data
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1368
	"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1369
	HostName := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1370
	DomainName := nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1371
	LastErrorNumber := nil.
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  1372
	PipeFailed := false.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1373
	SlowFork := false.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1374
    ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1375
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1376
    "Modified: 22.4.1996 / 13:10:43 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1377
    "Created: 15.6.1996 / 15:22:37 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1378
    "Modified: 7.1.1997 / 19:36:11 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1379
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1380
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1381
!UnixOperatingSystem class methodsFor:'OS signal constants'!
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
sigABRT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1384
    "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
  1385
     (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
  1386
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1387
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1388
#ifdef SIGABRT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1389
    RETURN ( __MKSMALLINT(SIGABRT) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1390
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1391
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1392
#endif
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1396
sigALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1397
    "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
  1398
     (the numeric value is not the same across unix-systems)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1399
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1400
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1401
#ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1402
    RETURN ( __MKSMALLINT(SIGALRM) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1403
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1404
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1405
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1406
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1407
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1408
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1409
sigBREAK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1410
    "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
  1411
     This is an MSDOS specific signal"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1412
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1413
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1414
#ifdef SIGBREAK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1415
    RETURN ( __MKSMALLINT(SIGBREAK) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1416
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1417
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1418
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1419
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1420
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1421
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1422
sigBUS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1423
    "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
  1424
     (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
  1425
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1426
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1427
#ifdef SIGBUS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1428
    RETURN ( __MKSMALLINT(SIGBUS) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1429
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1430
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1431
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1432
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1433
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1434
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1435
sigCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1436
    "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
  1437
     (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
  1438
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1439
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1440
#if defined(SIGCHLD)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1441
    RETURN ( __MKSMALLINT(SIGCHLD) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1442
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1443
# if  defined(SIGCLD)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1444
    RETURN ( __MKSMALLINT(SIGCLD) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1445
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1446
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1447
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1448
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1449
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1450
!
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
sigCONT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1453
    "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
  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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1456
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1457
#if defined(SIGCONT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1458
    RETURN ( __MKSMALLINT(SIGCONT) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1459
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1460
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1461
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1462
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1463
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1464
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1465
sigDANGER
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1466
    "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
  1467
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1468
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1469
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1470
#if defined(SIGDANGER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1471
    RETURN ( __MKSMALLINT(SIGDANGER) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1472
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1473
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1474
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1475
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1476
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1477
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1478
sigEMT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1479
    "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
  1480
     (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
  1481
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1482
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1483
#ifdef SIGEMT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1484
    RETURN ( __MKSMALLINT(SIGEMT) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1485
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1486
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1487
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1488
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1489
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1490
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1491
sigFP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1492
    "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
  1493
     (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
  1494
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1495
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1496
#ifdef SIGFPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1497
    RETURN ( __MKSMALLINT(SIGFPE) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1498
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1499
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1500
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1501
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1502
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1503
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1504
sigGRANT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1505
    "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
  1506
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1507
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1508
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1509
#if defined(SIGGRANT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1510
    RETURN ( __MKSMALLINT(SIGGRANT) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1511
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1512
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1513
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1514
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1515
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1516
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1517
sigHUP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1518
    "return the signal number for SIGHUP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1519
     (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
  1520
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1521
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1522
#ifdef SIGHUP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1523
    RETURN ( __MKSMALLINT(SIGHUP) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1524
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1525
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1526
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1527
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1528
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1529
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1530
sigILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1531
    "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
  1532
     (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
  1533
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1534
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1535
#ifdef SIGILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1536
    RETURN ( __MKSMALLINT(SIGILL) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1537
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1538
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1539
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1540
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1541
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1542
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1543
sigINT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1544
    "return the signal number for SIGINT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1545
     (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
  1546
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1547
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1548
#ifdef SIGINT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1549
    RETURN ( __MKSMALLINT(SIGINT) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1550
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1551
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1552
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1553
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1554
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1555
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1556
sigIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1557
    "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
  1558
     (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
  1559
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1560
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1561
#if defined(SIGIO)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1562
    RETURN ( __MKSMALLINT(SIGIO) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1563
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1564
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1565
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1566
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1567
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1568
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1569
sigIOT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1570
    "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
  1571
     (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
  1572
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1573
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1574
#ifdef SIGIOT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1575
    RETURN ( __MKSMALLINT(SIGIOT) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1576
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1577
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1578
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1579
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1580
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1581
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1582
sigKILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1583
    "return the signal number for SIGKILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1584
     (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
  1585
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1586
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1587
#ifdef SIGKILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1588
    RETURN ( __MKSMALLINT(SIGKILL) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1589
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1590
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1591
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1592
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1593
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1594
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1595
sigLOST
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1596
    "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
  1597
     (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
  1598
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1599
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1600
#if defined(SIGLOST)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1601
    RETURN ( __MKSMALLINT(SIGLOST) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1602
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1603
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1604
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1605
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1606
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1607
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1608
sigMIGRATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1609
    "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
  1610
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1611
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1612
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1613
#if defined(SIGMIGRATE)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1614
    RETURN ( __MKSMALLINT(SIGMIGRATE) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1615
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1616
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1617
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1618
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1619
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1620
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1621
sigMSG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1622
    "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
  1623
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1624
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1625
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1626
#if defined(SIGMSG)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1627
    RETURN ( __MKSMALLINT(SIGMSG) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1628
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1629
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1630
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1631
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1632
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1633
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1634
sigPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1635
    "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
  1636
     (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
  1637
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1638
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1639
#ifdef SIGPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1640
    RETURN ( __MKSMALLINT(SIGPIPE) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1641
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1642
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1643
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1644
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1645
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1646
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1647
sigPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1648
    "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
  1649
     (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
  1650
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1651
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1652
#if defined(SIGPOLL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1653
    RETURN ( __MKSMALLINT(SIGPOLL) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1654
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1655
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1656
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1657
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1658
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1659
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1660
sigPRE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1661
    "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
  1662
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1663
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1664
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1665
#if defined(SIGPRE)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1666
    RETURN ( __MKSMALLINT(SIGPRE) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1667
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1668
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1669
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1670
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1671
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1672
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1673
sigPROF
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1674
    "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
  1675
     (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
  1676
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1677
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1678
#if defined(SIGPROF)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1679
    RETURN ( __MKSMALLINT(SIGPROF) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1680
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1681
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1682
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1683
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1684
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1685
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1686
sigPWR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1687
    "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
  1688
     (not available on all systems)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1689
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1690
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1691
#if defined(SIGPWR)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1692
    RETURN ( __MKSMALLINT(SIGPWR) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1693
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1694
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1695
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1696
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1697
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1698
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1699
sigQUIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1700
    "return the signal number for SIGQUIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1701
     (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
  1702
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1703
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1704
#ifdef SIGQUIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1705
    RETURN ( __MKSMALLINT(SIGQUIT) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1706
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1707
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1708
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1709
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1710
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1711
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1712
sigRETRACT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1713
    "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
  1714
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1715
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1716
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1717
#if defined(SIGRETRACT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1718
    RETURN ( __MKSMALLINT(SIGRETRACT) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1719
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1720
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1721
#endif
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1725
sigSAK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1726
    "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
  1727
     (seems to be an AIX special)"
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
#if defined(SIGSAK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1731
    RETURN ( __MKSMALLINT(SIGSAK) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1732
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1733
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1734
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1735
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1736
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1737
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1738
sigSEGV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1739
    "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
  1740
     (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
  1741
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1742
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1743
#ifdef SIGSEGV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1744
    RETURN ( __MKSMALLINT(SIGSEGV) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1745
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1746
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1747
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1748
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1749
!
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
sigSOUND
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1752
    "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
  1753
     (seems to be an AIX special)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1754
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1755
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1756
#if defined(SIGSOUND)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1757
    RETURN ( __MKSMALLINT(SIGSOUND) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1758
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1759
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1760
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1761
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1762
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1763
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1764
sigSTOP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1765
    "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
  1766
     (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
  1767
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1768
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1769
#if defined(SIGSTOP)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1770
    RETURN ( __MKSMALLINT(SIGSTOP) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1771
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1772
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1773
#endif
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
!
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
sigSYS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1778
    "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
  1779
     (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
  1780
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1781
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1782
#ifdef SIGSYS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1783
    RETURN ( __MKSMALLINT(SIGSYS) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1784
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1785
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1786
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1787
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1788
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1789
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1790
sigTERM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1791
    "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
  1792
     (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
  1793
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1794
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1795
#ifdef SIGTERM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1796
    RETURN ( __MKSMALLINT(SIGTERM) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1797
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1798
    RETURN ( __MKSMALLINT(0) );
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1802
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1803
sigTRAP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1804
    "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
  1805
     (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
  1806
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1807
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1808
#ifdef SIGTRAP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1809
    RETURN ( __MKSMALLINT(SIGTRAP) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1810
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1811
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1812
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1813
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1814
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1815
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1816
sigTSTP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1817
    "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
  1818
     (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
  1819
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1820
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1821
#if defined(SIGTSTP)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1822
    RETURN ( __MKSMALLINT(SIGTSTP) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1823
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1824
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1825
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1826
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1827
!
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
sigTTIN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1830
    "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
  1831
     (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
  1832
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1833
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1834
#if defined(SIGTTIN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1835
    RETURN ( __MKSMALLINT(SIGTTIN) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1836
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1837
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1838
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1839
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1840
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1841
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1842
sigTTOU
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1843
    "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
  1844
     (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
  1845
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1846
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1847
#if defined(SIGTTOU)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1848
    RETURN ( __MKSMALLINT(SIGTTOU) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1849
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1850
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1851
#endif
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
!
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
sigURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1856
    "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
  1857
     (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
  1858
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1859
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1860
#if defined(SIGURG)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1861
    RETURN ( __MKSMALLINT(SIGURG) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1862
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1863
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1864
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1865
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1866
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1867
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1868
sigUSR1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1869
    "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
  1870
     (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
  1871
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1872
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1873
#if defined(SIGUSR1)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1874
    RETURN ( __MKSMALLINT(SIGUSR1) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1875
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1876
    RETURN ( __MKSMALLINT(0) );
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1880
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1881
sigUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1882
    "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
  1883
     (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
  1884
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1885
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1886
#if defined(SIGUSR2)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1887
    RETURN ( __MKSMALLINT(SIGUSR2) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1888
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1889
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1890
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1891
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1892
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1893
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1894
sigVTALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1895
    "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
  1896
     (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
  1897
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1898
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1899
#if defined(SIGVTALRM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1900
    RETURN ( __MKSMALLINT(SIGVTALRM) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1901
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1902
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1903
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1904
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1905
!
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
sigWINCH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1908
    "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
  1909
     (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
  1910
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1911
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1912
#if defined(SIGWINCH)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1913
    RETURN ( __MKSMALLINT(SIGWINCH) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1914
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1915
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1916
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1917
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1918
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1919
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1920
sigXCPU
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1921
    "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
  1922
     (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
  1923
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1924
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1925
#if defined(SIGXCPU)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1926
    RETURN ( __MKSMALLINT(SIGXCPU) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1927
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1928
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1929
#endif
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
!
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
sigXFSZ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1934
    "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
  1935
     (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
  1936
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1937
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1938
#if defined(SIGXFSZ)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1939
    RETURN ( __MKSMALLINT(SIGXFSZ) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1940
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1941
    RETURN ( __MKSMALLINT(0) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1942
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1943
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1944
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1945
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1946
!UnixOperatingSystem class methodsFor:'error messages'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1947
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1948
currentErrorNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1949
    "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
  1950
     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
  1951
     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
  1952
     request to the OS.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1953
     Use lastErrorNumber - currentErrorNumber is invalidated by
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1954
     many, many internal calls."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1955
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1956
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1957
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1958
     RETURN ( __MKSMALLINT(errno) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1959
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1960
     "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1961
      UnixOperatingSystem currentErrorNumber
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1965
errorNumberFor:aSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1966
    "given a symbolic error, return the numeric;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1967
     (i.e. errorNumberFor:#EBADF returns EBADF's value).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1968
     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
  1969
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1970
%{   /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1971
    OBJ sym = aSymbol;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1972
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1973
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1974
     * POSIX errnos - these should be defined
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
#ifdef EPERM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1977
    if (sym == @symbol(EPERM)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  1978
	RETURN ( __MKSMALLINT(EPERM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1979
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1980
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1981
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1982
#ifdef ENOENT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1983
    if (sym == @symbol(ENOENT)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  1984
	RETURN ( __MKSMALLINT(ENOENT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1985
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1986
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1987
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1988
#ifdef ESRCH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1989
    if (sym == @symbol(ESRCH)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  1990
	RETURN ( __MKSMALLINT(ESRCH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1991
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1992
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1993
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1994
#ifdef EINTR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1995
    if (sym == @symbol(EINTR)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  1996
	RETURN ( __MKSMALLINT(EINTR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1997
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  1998
#endif
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
#ifdef EIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2001
    if (sym == @symbol(EIO)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2002
	RETURN ( __MKSMALLINT(EIO) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2003
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2004
#endif
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
#ifdef ENXIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2007
    if (sym == @symbol(ENXIO)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2008
	RETURN ( __MKSMALLINT(ENXIO) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2009
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2010
#endif
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
#ifdef E2BIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2013
    if (sym == @symbol(E2BIG)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2014
	RETURN ( __MKSMALLINT(E2BIG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2015
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2016
#endif
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
#ifdef ENOEXEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2019
    if (sym == @symbol(ENOEXEC)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2020
	RETURN ( __MKSMALLINT(ENOEXEC) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2021
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2022
#endif
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
#ifdef EBADF
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2025
    if (sym == @symbol(EBADF)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2026
	RETURN ( __MKSMALLINT(EBADF) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2027
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2028
#endif
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
#ifdef ECHILD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2031
    if (sym == @symbol(ECHILD)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2032
	RETURN ( __MKSMALLINT(ECHILD) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2033
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2034
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2035
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2036
#if defined(EAGAIN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2037
    if (sym == @symbol(EAGAIN)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2038
	RETURN ( __MKSMALLINT(EAGAIN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2039
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2040
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2041
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2042
#ifdef ENOMEM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2043
    if (sym == @symbol(ENOMEM)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2044
	RETURN ( __MKSMALLINT(ENOMEM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2045
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2046
#endif
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
#ifdef EACCES
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2049
    if (sym == @symbol(EACCES)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2050
	RETURN ( __MKSMALLINT(EACCES) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2051
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2052
#endif
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
#ifdef EFAULT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2055
    if (sym == @symbol(EFAULT)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2056
	RETURN ( __MKSMALLINT(EFAULT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2057
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2058
#endif
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
#ifdef EBUSY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2061
    if (sym == @symbol(EBUSY)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2062
	RETURN ( __MKSMALLINT(EBUSY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2063
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2064
#endif
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
#ifdef EXDEV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2067
    if (sym == @symbol(EXDEV)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2068
	RETURN ( __MKSMALLINT(EXDEV) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2069
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2070
#endif
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
#ifdef ENODEV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2073
    if (sym == @symbol(ENODEV)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2074
	RETURN ( __MKSMALLINT(ENODEV) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2075
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2076
#endif
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
#ifdef ENOTDIR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2079
    if (sym == @symbol(ENOTDIR)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2080
	RETURN ( __MKSMALLINT(ENOTDIR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2081
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2082
#endif
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
#ifdef EISDIR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2085
    if (sym == @symbol(EISDIR)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2086
	RETURN ( __MKSMALLINT(EISDIR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2087
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2088
#endif
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
#ifdef EINVAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2091
    if (sym == @symbol(EINVAL)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2092
	RETURN ( __MKSMALLINT(EINVAL) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2093
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2094
#endif
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
#ifdef ENFILE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2097
    if (sym == @symbol(ENFILE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2098
	RETURN ( __MKSMALLINT(ENFILE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2099
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2100
#endif
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
#ifdef EMFILE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2103
    if (sym == @symbol(EMFILE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2104
	RETURN ( __MKSMALLINT(EMFILE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2105
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2106
#endif
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
#ifdef ENOTTY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2109
    if (sym == @symbol(ENOTTY)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2110
	RETURN ( __MKSMALLINT(ENOTTY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2111
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2112
#endif
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
#ifdef EFBIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2115
    if (sym == @symbol(EFBIG)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2116
	RETURN ( __MKSMALLINT(EFBIG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2117
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2118
#endif
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
#ifdef ENOSPC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2121
    if (sym == @symbol(ENOSPC)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2122
	RETURN ( __MKSMALLINT(ENOSPC) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2123
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2124
#endif
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
#ifdef ESPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2127
    if (sym == @symbol(ESPIPE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2128
	RETURN ( __MKSMALLINT(ESPIPE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2129
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2130
#endif
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
#ifdef EROFS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2133
    if (sym == @symbol(EROFS)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2134
	RETURN ( __MKSMALLINT(EROFS) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2135
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2136
#endif
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
#ifdef EMLINK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2139
    if (sym == @symbol(EMLINK)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2140
	RETURN ( __MKSMALLINT(EMLINK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2141
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2142
#endif
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
#ifdef EPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2145
    if (sym == @symbol(EPIPE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2146
	RETURN ( __MKSMALLINT(EPIPE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2147
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2148
#endif
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
#ifdef EDOM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2151
    if (sym == @symbol(EDOM)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2152
	RETURN ( __MKSMALLINT(EDOM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2153
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2154
#endif
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
#ifdef ERANGE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2157
    if (sym == @symbol(ERANGE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2158
	RETURN ( __MKSMALLINT(ERANGE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2159
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2160
#endif
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
#ifdef EDEADLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2163
    if (sym == @symbol(EDEADLK)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2164
	RETURN ( __MKSMALLINT(EDEADLK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2165
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2166
#endif
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
#ifdef ENAMETOOLONG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2169
    if (sym == @symbol(ENAMETOOLONG)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2170
	RETURN ( __MKSMALLINT(ENAMETOOLONG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2171
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2172
#endif
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
#ifdef ENOLCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2175
    if (sym == @symbol(ENOLCK)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2176
	RETURN ( __MKSMALLINT(ENOLCK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2177
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2178
#endif
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
#ifdef ENOSYS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2181
    if (sym == @symbol(ENOSYS)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2182
	RETURN ( __MKSMALLINT(ENOSYS) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2183
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2184
#endif
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
#ifdef ENOTEMPTY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2187
    if (sym == @symbol(ENOTEMPTY)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2188
	RETURN ( __MKSMALLINT(ENOTEMPTY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2189
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2190
#endif
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
#ifdef EEXIST
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2193
    if (sym == @symbol(EEXIST)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2194
	RETURN ( __MKSMALLINT(EEXIST) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2195
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2196
#endif
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
#ifdef EILSEQ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2199
    if (sym == @symbol(EILSEQ)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2200
	RETURN ( __MKSMALLINT(EILSEQ) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2201
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2202
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2203
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2204
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2205
     * XPG3 errnos - defined on most systems
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2206
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2207
#ifdef ENOTBLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2208
    if (sym == @symbol(ENOTBLK)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2209
	RETURN ( __MKSMALLINT(ENOTBLK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2210
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2211
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2212
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2213
#ifdef ETXTBSY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2214
    if (sym == @symbol(ETXTBSY)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2215
	RETURN ( __MKSMALLINT(ETXTBSY) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2218
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2219
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2220
     * some others
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
#ifdef EWOULDBLOCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2223
    if (sym == @symbol(EWOULDBLOCK)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2224
	RETURN ( __MKSMALLINT(EWOULDBLOCK) );
3496
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2227
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2228
#ifdef ENOMSG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2229
    if (sym == @symbol(ENOMSG)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2230
	RETURN ( __MKSMALLINT(ENOMSG) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2231
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2232
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2233
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2234
#ifdef ELOOP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2235
    if (sym == @symbol(ELOOP)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2236
	RETURN ( __MKSMALLINT(ELOOP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2237
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2238
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2239
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2240
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2241
     * some stream errors
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2242
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2243
#ifdef ETIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2244
    if (sym == @symbol(ETIME)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2245
	RETURN ( __MKSMALLINT(ETIME) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2246
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2247
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2248
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2249
#ifdef ENOSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2250
    if (sym == @symbol(ENOSR)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2251
	RETURN ( __MKSMALLINT(ENOSR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2252
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2253
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2254
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2255
#ifdef ENOSTR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2256
    if (sym == @symbol(ENOSTR)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2257
	RETURN ( __MKSMALLINT(ENOSTR) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2258
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2259
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2260
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2261
#ifdef ECOMM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2262
    if (sym == @symbol(ECOMM)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2263
	RETURN ( __MKSMALLINT(ECOMM) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2264
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2265
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2266
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2267
#ifdef EPROTO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2268
    if (sym == @symbol(EPROTO)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2269
	RETURN ( __MKSMALLINT(EPROTO) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2270
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2271
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2272
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2273
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2274
     * nfs errors
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2275
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2276
#ifdef ESTALE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2277
    if (sym == @symbol(ESTALE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2278
	RETURN ( __MKSMALLINT(ESTALE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2279
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2280
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2281
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2282
#ifdef EREMOTE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2283
    if (sym == @symbol(EREMOTE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2284
	RETURN ( __MKSMALLINT(EREMOTE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2285
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2286
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2287
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2288
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2289
     * some networking errors
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2290
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2291
#ifdef EINPROGRESS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2292
    if (sym == @symbol(EINPROGRESS)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2293
	RETURN ( __MKSMALLINT(EINPROGRESS) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2294
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2295
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2296
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2297
#ifdef EALREADY
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2298
    if (sym == @symbol(EALREADY)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2299
	RETURN ( __MKSMALLINT(EALREADY) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2300
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2301
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2302
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2303
#ifdef ENOTSOCK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2304
    if (sym == @symbol(ENOTSOCK)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2305
	RETURN ( __MKSMALLINT(ENOTSOCK) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2306
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2307
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2308
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2309
#ifdef EDESTADDRREQ
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2310
    if (sym == @symbol(EDESTADDRREQ)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2311
	RETURN ( __MKSMALLINT(EDESTADDRREQ) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2312
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2313
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2314
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2315
#ifdef EMSGSIZE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2316
    if (sym == @symbol(EMSGSIZE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2317
	RETURN ( __MKSMALLINT(EMSGSIZE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2318
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2319
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2320
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2321
#ifdef EPROTOTYPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2322
    if (sym == @symbol(EPROTOTYPE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2323
	RETURN ( __MKSMALLINT(EPROTOTYPE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2324
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2325
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2326
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2327
#ifdef ENOPROTOOPT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2328
    if (sym == @symbol(ENOPROTOOPT)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2329
	RETURN ( __MKSMALLINT(ENOPROTOOPT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2330
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2331
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2332
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2333
#ifdef EPROTONOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2334
    if (sym == @symbol(EPROTONOSUPPORT)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2335
	RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2336
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2337
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2338
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2339
#ifdef ESOCKTNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2340
    if (sym == @symbol(ESOCKTNOSUPPORT)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2341
	RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2342
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2343
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2344
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2345
#ifdef EOPNOTSUPP
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2346
    if (sym == @symbol(EOPNOTSUPP)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2347
	RETURN ( __MKSMALLINT(EOPNOTSUPP) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2348
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2349
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2350
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2351
#ifdef EPFNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2352
    if (sym == @symbol(EPFNOSUPPORT)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2353
	RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2354
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2355
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2356
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2357
#ifdef EAFNOSUPPORT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2358
    if (sym == @symbol(EAFNOSUPPORT)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2359
	RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2360
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2361
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2362
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2363
#ifdef EADDRINUSE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2364
    if (sym == @symbol(EADDRINUSE)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2365
	RETURN ( __MKSMALLINT(EADDRINUSE) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2366
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2367
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2368
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2369
#ifdef EADDRNOTAVAIL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2370
    if (sym == @symbol(EADDRNOTAVAIL)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2371
	RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2372
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2373
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2374
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2375
#ifdef ETIMEDOUT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2376
    if (sym == @symbol(ETIMEDOUT)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2377
	RETURN ( __MKSMALLINT(ETIMEDOUT) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2378
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2379
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2380
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2381
#ifdef ECONNREFUSED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2382
    if (sym == @symbol(ECONNREFUSED)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2383
	RETURN ( __MKSMALLINT(ECONNREFUSED) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2384
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2385
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2386
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2387
#ifdef ENETDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2388
    if (sym == @symbol(ENETDOWN)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2389
	RETURN ( __MKSMALLINT(ENETDOWN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2390
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2391
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2392
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2393
#ifdef ENETUNREACH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2394
    if (sym == @symbol(ENETUNREACH)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2395
	RETURN ( __MKSMALLINT(ENETUNREACH) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2396
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2397
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2398
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2399
#ifdef ENETRESET
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2400
    if (sym == @symbol(ENETRESET)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2401
	RETURN ( __MKSMALLINT(ENETRESET) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2402
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2403
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2404
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2405
#ifdef ECONNABORTED
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2406
    if (sym == @symbol(ECONNABORTED)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2407
	RETURN ( __MKSMALLINT(ECONNABORTED) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2408
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2409
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2410
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2411
#ifdef ECONNRESET
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2412
    if (sym == @symbol(ECONNRESET)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2413
	RETURN ( __MKSMALLINT(ECONNRESET) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2414
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2415
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2416
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2417
#ifdef EISCONN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2418
    if (sym == @symbol(EISCONN)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2419
	RETURN ( __MKSMALLINT(EISCONN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2420
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2421
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2422
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2423
#ifdef ENOTCONN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2424
    if (sym == @symbol(ENOTCONN)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2425
	RETURN ( __MKSMALLINT(ENOTCONN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2426
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2427
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2428
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2429
#ifdef ESHUTDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2430
    if (sym == @symbol(ESHUTDOWN)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2431
	RETURN ( __MKSMALLINT(ESHUTDOWN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2432
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2433
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2434
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2435
#ifdef EHOSTDOWN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2436
    if (sym == @symbol(EHOSTDOWN)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2437
	RETURN ( __MKSMALLINT(EHOSTDOWN) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2438
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2439
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2440
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2441
#ifdef EHOSTUNREACH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2442
    if (sym == @symbol(EHOSTUNREACH)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  2443
	RETURN ( __MKSMALLINT(EHOSTUNREACH) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2444
    }
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2445
#endif
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2446
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2447
    ^ -1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2448
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2449
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2450
errorSymbolAndTextForNumber:errNr
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2451
    "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
  2452
     (as returned by a system call). 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2453
     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
  2454
     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
  2455
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2456
    |sym text|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2457
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2458
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2459
    /* claus:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2460
     * 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
  2461
     * standard across unixes
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2462
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2463
    char *msg = "unknown error";
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2464
    char buffer[128];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2465
    OBJ eno = errNr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2466
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2467
    if (__isSmallInteger(eno)) {
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2468
	switch (__intVal(eno)) {
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2469
	    /*
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2470
	     * POSIX errnos - these should be defined
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2471
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2472
#ifdef EPERM
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2473
	    case EPERM:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2474
		msg = "Operation not permitted";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2475
		sym = @symbol(EPERM);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2476
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2477
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2478
#ifdef ENOENT
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2479
	    case ENOENT:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2480
		msg = "No such file or directory";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2481
		sym = @symbol(ENOENT);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2482
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2483
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2484
#ifdef ESRCH
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2485
	    case ESRCH:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2486
		msg = "No such process";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2487
		sym = @symbol(ESRCH);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2488
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2489
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2490
#ifdef EINTR
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2491
	    case EINTR:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2492
		msg = "Interrupted system call";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2493
		sym = @symbol(EINTR);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2494
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2495
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2496
#ifdef EIO
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2497
	    case EIO:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2498
		msg = "I/O error";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2499
		sym = @symbol(EIO);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2500
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2501
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2502
#ifdef ENXIO
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2503
	    case ENXIO:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2504
		msg = "No such device or address";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2505
		sym = @symbol(ENXIO);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2506
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2507
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2508
#ifdef E2BIG
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2509
	    case E2BIG:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2510
		msg = "Arg list too long";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2511
		sym = @symbol(E2BIG);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2512
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2513
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2514
#ifdef ENOEXEC
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2515
	    case ENOEXEC:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2516
		msg = "Exec format error";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2517
		sym = @symbol(ENOEXEC);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2518
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2519
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2520
#ifdef EBADF
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2521
	    case EBADF:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2522
		msg = "Bad file number";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2523
		sym = @symbol(EBADF);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2524
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2525
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2526
#ifdef ECHILD
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2527
	    case ECHILD:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2528
		msg = "No child processes";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2529
		sym = @symbol(ECHILD);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2530
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2531
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2532
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2533
	    case EAGAIN:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2534
		msg = "Try again";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2535
		sym = @symbol(EAGAIN);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2536
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2537
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2538
#ifdef ENOMEM
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2539
	    case ENOMEM:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2540
		msg = "Out of memory";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2541
		sym = @symbol(ENOMEM);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
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 EACCES
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2545
	    case EACCES:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2546
		msg = "Permission denied";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2547
		sym = @symbol(EACCES);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2548
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2549
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2550
#ifdef EFAULT
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2551
	    case EFAULT:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2552
		msg = "Bad address";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2553
		sym = @symbol(EFAULT);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2554
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2555
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2556
#ifdef EBUSY
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2557
	    case EBUSY:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2558
		msg = "Device or resource busy";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2559
		sym = @symbol(EBUSY);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2560
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2561
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2562
#ifdef EEXIST
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2563
	    case EEXIST:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2564
		msg = "File exists";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2565
		sym = @symbol(EEXIST);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2566
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2567
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2568
#ifdef EXDEV
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2569
	    case EXDEV:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2570
		msg = "Cross-device link";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2571
		sym = @symbol(EXDEV);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2572
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2573
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2574
#ifdef ENODEV
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2575
	    case ENODEV:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2576
		msg = "No such device";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2577
		sym = @symbol(ENODEV);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2578
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2579
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2580
#ifdef ENOTDIR
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2581
	    case ENOTDIR:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2582
		msg = "Not a directory";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2583
		sym = @symbol(ENOTDIR);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2584
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2585
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2586
#ifdef EISDIR
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2587
	    case EISDIR:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2588
		msg = "Is a directory";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2589
		sym = @symbol(EISDIR);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2590
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2591
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2592
#ifdef EINVAL
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2593
	    case EINVAL:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2594
		msg = "Invalid argument";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2595
		sym = @symbol(EINVAL);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2596
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2597
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2598
#ifdef ENFILE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2599
	    case ENFILE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2600
		msg = "File table overflow";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2601
		sym = @symbol(ENFILE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2602
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2603
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2604
#ifdef EMFILE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2605
	    case EMFILE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2606
		msg = "Too many open files";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2607
		sym = @symbol(EMFILE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2608
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2609
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2610
#ifdef ENOTTY
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2611
	    case ENOTTY:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2612
		msg = "Not a typewriter";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2613
		sym = @symbol(ENOTTY);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2614
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2615
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2616
#ifdef EFBIG
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2617
	    case EFBIG:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2618
		msg = "File too large";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2619
		sym = @symbol(EFBIG);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2620
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2621
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2622
#ifdef ENOSPC
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2623
	    case ENOSPC:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2624
		msg = "No space left on device";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2625
		sym = @symbol(ENOSPC);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2626
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2627
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2628
#ifdef ESPIPE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2629
	    case ESPIPE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2630
		msg = "Illegal seek";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2631
		sym = @symbol(ESPIPE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2632
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2633
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2634
#ifdef EROFS
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2635
	    case EROFS:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2636
		msg = "Read-only file system";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2637
		sym = @symbol(EROFS);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2638
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2639
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2640
#ifdef EMLINK
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2641
	    case EMLINK:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2642
		msg = "Too many links";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2643
		sym = @symbol(EMLINK);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2644
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2645
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2646
#ifdef EPIPE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2647
	    case EPIPE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2648
		msg = "Broken pipe";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2649
		sym = @symbol(EPIPE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2650
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2651
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2652
#ifdef EDOM
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2653
	    case EDOM:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2654
		msg = "Math argument out of domain";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2655
		sym = @symbol(EDOM);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2656
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2657
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2658
#ifdef ERANGE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2659
	    case ERANGE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2660
		msg = "Math result not representable";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2661
		sym = @symbol(ERANGE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2662
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2663
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2664
#ifdef EDEADLK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2665
# if EDEADLK != EWOULDBLOCK
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2666
	    case EDEADLK:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2667
		msg = "Resource deadlock would occur";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2668
		sym = @symbol(EDEADLK);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2669
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2670
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2671
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2672
#ifdef ENAMETOOLONG
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2673
	    case ENAMETOOLONG:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2674
		msg = "File name too long";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2675
		sym = @symbol(ENAMETOOLONG);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2676
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2677
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2678
#ifdef ENOLCK
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2679
	    case ENOLCK:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2680
		msg = "No record locks available";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2681
		sym = @symbol(ENOLCK);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2682
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2683
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2684
#ifdef ENOSYS
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2685
	    case ENOSYS:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2686
		msg = "Function not implemented";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2687
		sym = @symbol(ENOSYS);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2688
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2689
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2690
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2691
	    case ENOTEMPTY:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2692
		msg = "Directory not empty";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2693
		sym = @symbol(ENOTEMPTY);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2694
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2695
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2696
#ifdef EILSEQ
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2697
	    case EILSEQ:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2698
		msg = "Illegal byte sequence";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2699
		sym = @symbol(EILSEQ);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2700
		break;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2701
#endif
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2702
	    /*
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2703
	     * XPG3 errnos - defined on most systems
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2704
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2705
#ifdef ENOTBLK
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2706
	    case ENOTBLK:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2707
		msg = "Block device required";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2708
		sym = @symbol(ENOTBLK);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2709
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2710
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2711
#ifdef ETXTBSY
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2712
	    case ETXTBSY:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2713
		msg = "Text file busy";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2714
		sym = @symbol(ETXTBSY);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2715
		break;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2716
#endif
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2717
	    /*
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2718
	     * some others
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2719
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2720
#ifdef EWOULDBLOCK
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2721
	    case EWOULDBLOCK:
3558
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  2722
# if defined(EAGAIN) && (EWOULDBLOCK == EAGAIN)
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2723
		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
  2724
# else
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2725
		msg = "Operation would block";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2726
# endif
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2727
		sym = @symbol(EWOULDBLOCK);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2728
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2729
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2730
#ifdef ENOMSG
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2731
	    case ENOMSG:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2732
		msg = "No message of desired type";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2733
		sym = @symbol(ENOMSG);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2734
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2735
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2736
#ifdef ELOOP
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2737
	    case ELOOP:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2738
		msg = "Too many levels of symbolic links";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2739
		sym = @symbol(ELOOP);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2740
		break;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2741
#endif
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2742
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2743
	    /*
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2744
	     * some stream errors
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2745
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2746
#ifdef ETIME
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2747
	    case ETIME:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2748
		msg = "Timer expired";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2749
		sym = @symbol(ETIME);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2750
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2751
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2752
#ifdef ENOSR
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2753
	    case ENOSR:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2754
		msg = "Out of streams resources";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2755
		sym = @symbol(ENOSR);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2756
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2757
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2758
#ifdef ENOSTR
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2759
	    case ENOSTR:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2760
		msg = "Device not a stream";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2761
		sym = @symbol(ENOSTR);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2762
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2763
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2764
#ifdef ECOMM
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2765
	    case ECOMM:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2766
		msg = "Communication error on send";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2767
		sym = @symbol(ECOMM);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2768
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2769
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2770
#ifdef EPROTO
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2771
	    case EPROTO:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2772
		msg = "Protocol error";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2773
		sym = @symbol(EPROTO);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2774
		break;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2775
#endif
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2776
	    /*
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2777
	     * nfs errors
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2778
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2779
#ifdef ESTALE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2780
	    case ESTALE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2781
		msg = "Stale NFS file handle";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2782
		sym = @symbol(ESTALE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2783
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2784
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2785
#ifdef EREMOTE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2786
	    case EREMOTE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2787
		msg = "Too many levels of remote in path";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2788
		sym = @symbol(EREMOTE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2789
		break;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2790
#endif
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2791
	    /*
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2792
	     * some networking errors
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2793
	     */
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2794
#ifdef EINPROGRESS
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2795
	    case EINPROGRESS:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2796
		msg = "Operation now in progress";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2797
		sym = @symbol(EINPROGRESS);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2798
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2799
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2800
#ifdef EALREADY
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2801
	    case EALREADY:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2802
		msg = "Operation already in progress";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2803
		sym = @symbol(EALREADY);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2804
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2805
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2806
#ifdef ENOTSOCK
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2807
	    case ENOTSOCK:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2808
		msg = "Socket operation on non-socket";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2809
		sym = @symbol(ENOTSOCK);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2810
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2811
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2812
#ifdef EDESTADDRREQ
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2813
	    case EDESTADDRREQ:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2814
		msg = "Destination address required";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2815
		sym = @symbol(EDESTADDRREQ);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2816
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2817
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2818
#ifdef EMSGSIZE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2819
	    case EMSGSIZE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2820
		msg = "Message too long";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2821
		sym = @symbol(EMSGSIZE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2822
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2823
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2824
#ifdef EPROTOTYPE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2825
	    case EPROTOTYPE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2826
		msg = "Protocol wrong type for socket";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2827
		sym = @symbol(EPROTOTYPE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2828
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2829
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2830
#ifdef ENOPROTOOPT
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2831
	    case ENOPROTOOPT:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2832
		msg = "Protocol not available";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2833
		sym = @symbol(ENOPROTOOPT);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2834
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2835
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2836
#ifdef EPROTONOSUPPORT
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2837
	    case EPROTONOSUPPORT:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2838
		msg = "Protocol not supported";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2839
		sym = @symbol(EPROTONOSUPPORT);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2840
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2841
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2842
#ifdef ESOCKTNOSUPPORT
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2843
	    case ESOCKTNOSUPPORT:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2844
		msg = "Socket type not supported";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2845
		sym = @symbol(ESOCKTNOSUPPORT);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2846
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2847
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2848
#ifdef EOPNOTSUPP
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2849
	    case EOPNOTSUPP:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2850
		msg = "Operation not supported on socket";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2851
		sym = @symbol(EOPNOTSUPP);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2852
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2853
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2854
#ifdef EPFNOSUPPORT
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2855
	    case EPFNOSUPPORT:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2856
		msg = "Protocol family not supported";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2857
		sym = @symbol(EPFNOSUPPORT);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2858
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2859
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2860
#ifdef EAFNOSUPPORT
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2861
	    case EAFNOSUPPORT:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2862
		msg = "Address family not supported by protocol family";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2863
		sym = @symbol(EAFNOSUPPORT);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2864
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2865
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2866
#ifdef EADDRINUSE
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2867
	    case EADDRINUSE:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2868
		msg = "Address already in use";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2869
		sym = @symbol(EADDRINUSE);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2870
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2871
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2872
#ifdef EADDRNOTAVAIL
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2873
	    case EADDRNOTAVAIL:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2874
		msg = "Can\'t assign requested address";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2875
		sym = @symbol(EADDRNOTAVAIL);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2876
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2877
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2878
#ifdef ETIMEDOUT
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2879
	    case ETIMEDOUT:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2880
		msg = "Connection timed out";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2881
		sym = @symbol(ETIMEDOUT);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2882
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2883
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2884
#ifdef ECONNREFUSED
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2885
	    case ECONNREFUSED:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2886
		msg = "Connection refused";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2887
		sym = @symbol(ECONNREFUSED);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2888
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2889
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2890
#ifdef ENETDOWN
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2891
	    case ENETDOWN:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2892
		msg = "Network is down";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2893
		sym = @symbol(ENETDOWN);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2894
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2895
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2896
#ifdef ENETUNREACH
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2897
	    case ENETUNREACH:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2898
		msg = "Network is unreachable";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2899
		sym = @symbol(ENETUNREACH);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2900
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2901
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2902
#ifdef ENETRESET
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2903
	    case ENETRESET:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2904
		msg = "Network dropped conn due to reset";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2905
		sym = @symbol(ENETRESET);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2906
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2907
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2908
#ifdef ECONNABORTED
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2909
	    case ECONNABORTED:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2910
		msg = "Software caused connection abort";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2911
		sym = @symbol(ECONNABORTED);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2912
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2913
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2914
#ifdef ECONNRESET
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2915
	    case ECONNRESET:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2916
		msg = "Connection reset by peer";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2917
		sym = @symbol(ECONNRESET);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2918
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2919
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2920
#ifdef EISCONN
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2921
	    case EISCONN:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2922
		msg = "Socket is already connected";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2923
		sym = @symbol(EISCONN);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2924
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2925
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2926
#ifdef ENOTCONN
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2927
	    case ENOTCONN:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2928
		msg = "Socket is not connected";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2929
		sym = @symbol(ENOTCONN);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2930
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2931
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2932
#ifdef ESHUTDOWN
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2933
	    case ESHUTDOWN:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2934
		msg = "Can't send after socket shutdown";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2935
		sym = @symbol(ESHUTDOWN);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2936
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2937
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2938
#ifdef EHOSTDOWN
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2939
	    case EHOSTDOWN:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2940
		msg = "Host is down";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2941
		sym = @symbol(EHOSTDOWN);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2942
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2943
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2944
#ifdef EHOSTUNREACH
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2945
	    case EHOSTUNREACH:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2946
		msg = "No route to host";
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2947
		sym = @symbol(EHOSTUNREACH);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2948
		break;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2949
#endif
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2950
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2951
	    default:
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2952
		{
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2953
		    __BEGIN_PROTECT_REGISTERS__
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2954
		    sprintf(buffer, "ErrorNr: %d", __intVal(eno));
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2955
		    __END_PROTECT_REGISTERS__
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2956
		}
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2957
		msg = buffer;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2958
		sym = @symbol(ERROR_OTHER);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2959
		break;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2960
	}
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2961
	text = __MKSTRING(msg);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2962
    } else {
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2963
	text = nil;
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  2964
	sym = nil;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2965
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2966
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2967
    ^ Array with:sym with:text
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2968
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2969
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2970
     UnixOperatingSystem errorSymbolAndTextForNumber:4
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2971
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2972
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2973
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2974
!UnixOperatingSystem class methodsFor:'executing OS commands'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2975
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2976
commandAndArgsForOSCommand:aCommandString
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2977
    "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
  2978
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2979
    |shell args|
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2980
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2981
    "/
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2982
    "/ '/bin/sh -c <command>'
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2983
    "/
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2984
    shell := '/bin/sh'.
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2985
    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
  2986
    ^ Array with:shell with:args
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2987
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  2988
    "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
  2989
    "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
  2990
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2991
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  2992
exec:aCommandPath withArguments:argColl environment:env fileDescriptors:fdColl closeDescriptors:closeFdColl fork:doFork newPgrp:newPgrp 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2993
    "Internal lowLevel entry for combined fork & exec;
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  2994
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  2995
     If fork is false (chain a command):
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2996
         execute the OS command specified by the argument, aCommandPath, with
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2997
         arguments in argArray (no arguments, if nil).
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2998
         If successful, this method does not return and smalltalk is gone.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  2999
         If not successful, it does return.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3000
         Normal use is with forkForCommand.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3001
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3002
     If fork is true (subprocess command execution):
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3003
        fork a child to do the above.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3004
        The process id of the child process is returned; nil if the fork failed.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3005
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3006
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3007
        fdArray[1] = 15 -> use fd 15 as stdin.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3008
        If an element of the array is set to nil, the corresponding filedescriptor
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3009
        will be closed for the child.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3010
        fdArray[0] == StdIn for child
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3011
        fdArray[1] == StdOut for child
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3012
        fdArray[2] == StdErr for child
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3013
        on VMS, these must be channels as returned by createMailBox.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3014
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3015
     closeFdArray contains descriptors that will be closed in the subprocess.
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3016
        closeDescriptors are ignored in the WIN32 & VMS versions.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3017
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3018
     If newPgrp is true, the subprocess will be established in a new process group.
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3019
        The processgroup will be equal to id.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3020
        newPgrp is not used on WIN32 and VMS systems.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3021
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3022
     env specifies environment variables which are passed differently from
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3023
     the current environment. If non-nil, it must be a dictionary providing
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3024
     key-value pairs for changed/added environment variables.
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3025
     To pass a variable as empty (i.e. unset), pass a nil value.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3026
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3027
     Notice: this used to be two separate ST-methods; however, in order to use
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3028
            vfork on some machines, it had to be merged into one, to avoid write
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3029
            accesses to ST/X memory from the vforked-child.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3030
            The code below only does read accesses."
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3031
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3032
    ^ self
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3033
        exec:aCommandPath 
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3034
        withArguments:argColl 
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3035
        environment:env 
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3036
        fileDescriptors:fdColl 
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3037
        closeDescriptors:closeFdColl 
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3038
        fork:doFork
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3039
        newPgrp:newPgrp 
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3040
        inDirectory:nil
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3041
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3042
    "
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3043
     |id|
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3044
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3045
     id := UnixOperatingSystem fork.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3046
     id == 0 ifTrue:[
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3047
        'I am the child'.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3048
        UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3049
        'not reached'.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3050
     ]
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3051
    "
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3052
    "
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3053
     |id|
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3054
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3055
     id := UnixOperatingSystem fork.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3056
     id == 0 ifTrue:[
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3057
        'I am the child'.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3058
        UnixOperatingSystem
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3059
           exec:'/bin/sh'
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3060
           withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3061
        'not reached'.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3062
     ].
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3063
     id printNL.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3064
     (Delay forSeconds:3.5) wait.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3065
     'killing ...' printNL.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3066
     UnixOperatingSystem sendSignal:(UnixOperatingSystem sigTERM) to:id.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3067
     UnixOperatingSystem sendSignal:(UnixOperatingSystem sigKILL) to:id
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3068
    "
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3069
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3070
    "Modified: / 20.7.1998 / 18:24:54 / cg"
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3071
!
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3072
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3073
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
  3074
    "Internal lowLevel entry for combined fork & exec;
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3075
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3076
     If fork is false (chain a command):
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3077
         execute the OS command specified by the argument, aCommandPath, with
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3078
         arguments in argArray (no arguments, if nil).
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3079
         If successful, this method does not return and smalltalk is gone.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3080
         If not successful, it does return.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3081
         Normal use is with forkForCommand.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3082
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3083
     If fork is true (subprocess command execution):
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3084
        fork a child to do the above.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3085
        The process id of the child process is returned; nil if the fork failed.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3086
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3087
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3088
        fdArray[1] = 15 -> use fd 15 as stdin.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3089
        If an element of the array is set to nil, the corresponding filedescriptor
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3090
        will be closed for the child.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3091
        fdArray[0] == StdIn for child
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3092
        fdArray[1] == StdOut for child
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3093
        fdArray[2] == StdErr for child
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3094
        on VMS, these must be channels as returned by createMailBox.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3095
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3096
     closeFdArray contains descriptors that will be closed in the subprocess.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3097
        closeDescriptors are ignored in the WIN32 & VMS versions.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3098
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3099
     If newPgrp is true, the subprocess will be established in a new process group.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3100
        The processgroup will be equal to id.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3101
        newPgrp is not used on WIN32 and VMS systems.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3102
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3103
     env specifies environment variables which are passed differently from
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3104
     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
  3105
     key-value pairs for changed/added environment variables.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3106
     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
  3107
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3108
     Notice: this used to be two separate ST-methods; however, in order to use
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3109
            vfork on some machines, it had to be merged into one, to avoid write
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3110
            accesses to ST/X memory from the vforked-child.
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3111
            The code below only does read accesses."
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3112
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3113
    |envPairs argArray fdArray closeFdArray dirName|
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3114
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3115
    env notNil ifTrue:[
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3116
        envPairs := OrderedCollection new.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3117
        env keysAndValuesDo:[:key :val |
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3118
            envPairs add:key; add:val
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3119
        ].
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3120
        envPairs := envPairs asArray.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3121
    ].
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  3122
    argColl notNil ifTrue:[
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3123
        argArray := argColl asArray
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  3124
    ].
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  3125
    fdColl notNil ifTrue:[
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3126
        fdArray := fdColl asArray
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  3127
    ].
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  3128
    closeFdColl notNil ifTrue:[
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3129
        closeFdArray := closeFdColl asArray
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3130
    ].
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3131
    aDirectory notNil ifTrue:[
3773
54dd6a5fd72a no need for full pathName in exec*inDirectory: methods.
Claus Gittinger <cg@exept.de>
parents: 3759
diff changeset
  3132
        dirName := aDirectory asFilename name
3625
c74e6fa0647e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3595
diff changeset
  3133
    ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3134
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3135
%{  /* STACK: 16000 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3136
    char **argv;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3137
    int nargs, i, id;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3138
    OBJ arg;
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3139
    extern char **environ;
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3140
    char **_env, **_nEnv;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3141
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3142
    if (__isString(aCommandPath) && 
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3143
        ((argArray == nil) || __isArray(argArray)) &&
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3144
        ((fdArray == nil) || __isArray(fdArray)) &&
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3145
        ((closeFdArray == nil) || __isArray(closeFdArray))
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3146
    ) {
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3147
        nargs = argArray == nil ? 0 : __arraySize(argArray);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3148
        argv = (char **) malloc(sizeof(char *) * (nargs + 1));
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3149
        if (argv) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3150
            int nOldEnv, nNewEnv;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3151
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3152
            for (i=0; i < nargs; i++) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3153
                arg = __ArrayInstPtr(argArray)->a_element[i];
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3154
                if (__isString(arg)) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3155
                    argv[i] = (char *) __stringVal(arg);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3156
                } else {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3157
                    argv[i] = "";
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3158
                }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3159
            }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3160
            argv[i] = NULL;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3161
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3162
            /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3163
             * number of new items in environment ..       
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3164
             */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3165
            nNewEnv = 0;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3166
            if ((envPairs != nil) && __isArray(envPairs)) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3167
                nNewEnv = __arraySize(envPairs) / 2;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3168
            }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3169
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3170
            if (nNewEnv == 0) {
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3171
                _nEnv = environ;
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3172
            } else {
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3173
                _env = environ;
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3174
                /* 
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3175
                 * get size of environment
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3176
                 */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3177
                nOldEnv = 0;
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3178
                if (_env) {
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3179
                    while (*_env) {
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3180
                        nOldEnv++;
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3181
                        _env++;
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3182
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3183
                }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3184
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3185
                /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3186
                 * generate a new environment
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3187
                 * I have not found a spec which defines if
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3188
                 * items at the end overwrite previous definitions,
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3189
                 * or if the first encountered definition is valid.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3190
                 * To be prepared for any case, simply add the new definitions
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3191
                 * at both ends - that should do it in any case.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3192
                 * Someone with more know-how may want to fix this.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3193
                 */
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3194
                _nEnv = (char **)malloc(sizeof(char *) * (nNewEnv + nOldEnv + nNewEnv + 1));
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3195
                if (_nEnv) {
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3196
                    char **eO, **eN;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3197
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3198
                    eN = _nEnv;
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3199
                    if (nNewEnv) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3200
                        /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3201
                         * add new items at the front ...
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3202
                         */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3203
                        int i;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3204
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3205
                        for (i=0; (i+1)<__arraySize(envPairs); i+=2) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3206
                            OBJ t;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3207
                            char *var, *val, *e;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3208
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3209
                            t = __ArrayInstPtr(envPairs)->a_element[i];
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3210
                            if (__isString(t) || __isSymbol(t)) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3211
                                var = (char *)__stringVal(t);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3212
                                t = __ArrayInstPtr(envPairs)->a_element[i+1];
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3213
                                if (__isString(t) || __isSymbol(t)) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3214
                                    val = (char *)__stringVal(t);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3215
                                } else {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3216
                                    val = NULL;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3217
                                }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3218
                                if (val != NULL) {                
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3219
                                    e = (char *)malloc(strlen(var) + 1 + strlen(val) + 1);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3220
                                    strcpy(e, var);               
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3221
                                    strcat(e, "=");               
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3222
                                    strcat(e, val);               
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3223
                                } else {                          
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3224
                                    e = (char *)malloc(strlen(var) + 1 + 1);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3225
                                    strcpy(e, var);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3226
                                    strcat(e, "=");
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3227
                                }   
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3228
                                *eN++ = e;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3229
                            }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3230
                        }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3231
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3232
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3233
                    if (nOldEnv) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3234
                        /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3235
                         * append old environment 
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3236
                         */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3237
                        eO = environ;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3238
                        while (*eN = *eO++) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3239
                            eN++;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3240
                        }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3241
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3242
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3243
                    if (nNewEnv) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3244
                        /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3245
                         * new items again at the end
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3246
                         */
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3247
                        for (eO = _nEnv, i=0; i<nNewEnv; i++) {
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3248
                            *eN++ = *eO++;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3249
                        }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3250
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3251
                        *eN = NULL;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3252
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3253
                }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3254
            }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3255
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3256
            if (doFork == true) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3257
                /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3258
                 * fork a subprocess.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3259
                 */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3260
                int nfd, nclose;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3261
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3262
                nfd = fdArray == nil ? 0 : __arraySize(fdArray);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3263
                nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray);
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3264
#ifdef HAS_VFORK
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3265
                id = vfork();
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3266
#else
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3267
                id = fork();
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3268
#endif
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3269
                if (id == 0) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3270
                    /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3271
                    ** In child.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3272
                    ** first: dup filedescriptors
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3273
                    */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3274
                    for (i = 0; i < nfd; i++) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3275
                        OBJ fd;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3276
                        int rslt;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3277
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3278
                        fd = __ArrayInstPtr(fdArray)->a_element[i];
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3279
                        if (__isSmallInteger(fd) && (__intVal(fd) != i)) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3280
                            do {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3281
                                rslt = dup2(__intVal(fd), i);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3282
                            } while ((rslt < 0) && (errno == EINTR));
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3283
                        }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3284
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3285
                    /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3286
                    ** second: close unused filedescriptors
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3287
                    */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3288
                    for (i = 0; i < nfd; i++) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3289
                        if (__ArrayInstPtr(fdArray)->a_element[i] == nil) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3290
                            close(i);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3291
                        }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3292
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3293
                    /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3294
                    ** third: close filedescriptors
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3295
                    */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3296
                    for (i = 0; i < nclose; i++) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3297
                        OBJ fd;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3298
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3299
                        fd = __ArrayInstPtr(closeFdArray)->a_element[i];
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3300
                        if (__isSmallInteger(fd)) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3301
                            close(__intVal(fd));
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3302
                        }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3303
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3304
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3305
                    if (newPgrp == true) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3306
#ifndef NEXT
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3307
                        setsid();
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3308
#endif
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  3309
#if defined(TIOCSCTTY)
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3310
                        ioctl(0, TIOCSCTTY, 0) ;
3561
9a117ea69e2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3558
diff changeset
  3311
#endif
9a117ea69e2f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3558
diff changeset
  3312
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  3313
#if defined(TIOCSPGRP)
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3314
                        {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3315
                            int pgrp = getpid();
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3316
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3317
                            ioctl(0, TIOCSPGRP, (char *)&pgrp);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3318
                        }
3555
211885c31b61 correctly setup pgrocess group (for terminalView)
Claus Gittinger <cg@exept.de>
parents: 3550
diff changeset
  3319
#endif
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3320
#if defined(_POSIX_JOB_CONTROL)
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3321
                        (void) setpgid(0, 0);
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3322
#else
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3323
# if defined(BSD) || defined(LINUX)
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3324
                        (void) setpgrp(0);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3325
# endif
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3326
#endif
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3327
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3328
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3329
                    if (dirName != nil) {
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3330
                        chdir(__stringVal(dirName));
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3331
                    }
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3332
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3333
                    execve(__stringVal(aCommandPath), argv, _nEnv);
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3334
                    /* should not be reached */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3335
                    _exit(127);                 /* POSIX 2 compatible exit value */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3336
                }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3337
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3338
            } else {
3663
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3339
                if (dirName != nil) {
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3340
                    chdir(__stringVal(dirName));
b5d8643a7ed1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3625
diff changeset
  3341
                }
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3342
                /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3343
                 * no subprocess (i.e. transfer to another program)
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3344
                 */
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3345
                execve(__stringVal(aCommandPath), argv, _nEnv);
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3346
                /* 
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3347
                 * should not be reached
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3348
                 * (well, it is, if you pass a wrong command-path)
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3349
                 */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3350
                id = -1;
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3351
            }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3352
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3353
            if (nNewEnv && (_nEnv != NULL)) {
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3354
                /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3355
                 * free new environment stuff
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3356
                 */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3357
                for (i=0; i<nNewEnv;i++) {
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3358
                    char *e = _nEnv[i];
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3359
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3360
                    if (e) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3361
                        free(e);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3362
                    }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3363
                }
3571
9090dc66a427 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3564
diff changeset
  3364
                free(_nEnv);
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3365
            }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3366
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3367
            free(argv);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3368
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3369
            /*
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3370
             * In parent: succes or failure
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3371
             */
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3372
            if (id == -1) {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3373
                RETURN (nil);
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3374
            } else {
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3375
                RETURN (__MKSMALLINT(id));
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3376
            }
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3377
        }
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3378
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3379
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3380
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3381
     path-argument not string
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3382
     or argArray not an array/nil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3383
     or malloc failed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3384
     or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3385
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3386
    ^ self primitiveFailed
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
     |id|
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
     id := UnixOperatingSystem fork.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3392
     id == 0 ifTrue:[
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3393
        'I am the child'.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3394
        UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3395
        'not reached'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3396
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3397
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3398
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3399
     |id|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3401
     id := UnixOperatingSystem fork.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3402
     id == 0 ifTrue:[
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3403
        'I am the child'.
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3404
        UnixOperatingSystem
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3405
           exec:'/bin/sh'
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3406
           withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3407
        'not reached'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3408
     ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3409
     id printNL.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3410
     (Delay forSeconds:3.5) wait.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3411
     'killing ...' printNL.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3412
     UnixOperatingSystem sendSignal:(UnixOperatingSystem sigTERM) to:id.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3413
     UnixOperatingSystem sendSignal:(UnixOperatingSystem sigKILL) to:id
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3414
    "
3564
eefdb0c79055 made environment code independent of setenv/putenv
Claus Gittinger <cg@exept.de>
parents: 3563
diff changeset
  3415
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3416
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3417
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3418
exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3419
    "Internal lowLevel entry for combined fork & exec;
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3420
     If fork is false (chain a command):
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3421
	 execute the OS command specified by the argument, aCommandPath, with
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3422
	 arguments in argArray (no arguments, if nil).
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3423
	 If successful, this method does not return and smalltalk is gone.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3424
	 If not successful, it does return.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3425
	 Normal use is with forkForCommand.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3426
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3427
     If fork is true (subprocess command execution):
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3428
	fork a child to do the above.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3429
	The process id of the child process is returned; nil if the fork failed.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3430
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3431
     fdArray contains the filedescriptors, to be used for the child (if fork is true).
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3432
	fdArray[1] = 15 -> use fd 15 as stdin.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3433
	If an element of the array is set to nil, the corresponding filedescriptor
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3434
	will be closed for the child.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3435
	fdArray[0] == StdIn for child
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3436
	fdArray[1] == StdOut for child
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3437
	fdArray[2] == StdErr for child
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3438
	on VMS, these must be channels as returned by createMailBox.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3439
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3440
     closeFdArray contains descriptors that will be closed in the subprocess.
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3441
	closeDescriptors are ignored in the WIN32 & VMS versions.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3442
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3443
     NOTE that in WIN32 the fds are HANDLES!!
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3444
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3445
     If newPgrp is true, the subprocess will be established in a new process group.
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3446
	The processgroup will be equal to id.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3447
	newPgrp is not used on WIN32 and VMS systems.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3448
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3449
     Notice: this used to be two separate ST-methods; however, in order to use
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3450
	    vfork on some machines, it had to be merged into one, to avoid write
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3451
	    accesses to ST/X memory from the vforked-child.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3452
	    The code below only does read accesses."
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3453
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3454
    ^ self
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3455
	exec:aCommandPath 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3456
	withArguments:argArray
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3457
	environment:nil 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3458
	fileDescriptors:fdArray 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3459
	closeDescriptors:closeFdArray
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3460
	fork:doFork 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3461
	newPgrp:newPgrp
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3462
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3463
    "
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3464
     |id|
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3465
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3466
     id := UnixOperatingSystem fork.
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3467
     id == 0 ifTrue:[
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3468
	'I am the child'.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3469
	UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3470
	'not reached'.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3471
     ]
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3472
    "
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3473
    "
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3474
     |id|
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3475
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3476
     id := UnixOperatingSystem fork.
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3477
     id == 0 ifTrue:[
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3478
	'I am the child'.
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3479
	UnixOperatingSystem
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3480
	   exec:'/bin/sh'
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3481
	   withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3482
	'not reached'.
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3483
     ].
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3484
     id printNL.
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3485
     (Delay forSeconds:3.5) wait.
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3486
     'killing ...' printNL.
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3487
     UnixOperatingSystem sendSignal:(UnixOperatingSystem sigTERM) to:id.
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3488
     UnixOperatingSystem sendSignal:(UnixOperatingSystem sigKILL) to:id
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3489
    "
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3490
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3491
    "Modified: / 10.6.1998 / 16:09:59 / cg"
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3492
!
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3493
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3494
exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp inDirectory:aDirectory
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3495
    "Internal lowLevel entry for combined fork & exec for WIN32.
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3496
     Not needed with Unix"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3497
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3498
    ^ self
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3499
	exec:aCommandPath 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3500
	withArguments:argArray 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3501
	environment:nil
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3502
	fileDescriptors:fdArray
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3503
	closeDescriptors:closeFdArray 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3504
	fork:doFork 
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3505
	newPgrp:newPgrp
3543
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3506
acd4a449d96b allow passing environment variables with the exec.
Claus Gittinger <cg@exept.de>
parents: 3542
diff changeset
  3507
    "Modified: / 10.6.1998 / 16:10:29 / cg"
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  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
executeCommand:aCommandString inDirectory:aDirectory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3511
    "much like #executeCommand:, but changes the current directory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3512
     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
  3513
     hardwiring any 'cd ..' command strings into your applictions."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3514
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  3515
    | cmd |
3496
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
    "/ unix - prepend a 'cd' to the command
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3518
3773
54dd6a5fd72a no need for full pathName in exec*inDirectory: methods.
Claus Gittinger <cg@exept.de>
parents: 3759
diff changeset
  3519
    cmd := 'cd ' , aDirectory asFilename name, '; ' , aCommandString.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3520
    ^ self executeCommand:cmd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3521
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3522
    "Modified: / 20.1.1998 / 17:03:03 / md"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3523
    "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
  3524
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3525
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3526
fork
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3527
    "fork a new (HEAVY-weight) unix process.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3528
     Not supported with MSDOS & VMS systems.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3529
     Dont confuse this with Block>>fork, which creates 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3530
     lightweight smalltalk processes. This method will return
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3531
     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
  3532
     unix-process-id) to the parent (original) process.
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
     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
  3535
     #startProcess: and #executCommand: for higher level interfaces."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3536
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3537
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3538
    int pid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3539
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3540
    pid = fork();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3541
    RETURN ( __MKUINT(pid) );
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
    "/ not supported by OS
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3547
    ^ UnsupportedOperationSignal raise
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3548
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3549
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3550
     |id|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3551
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3552
     id := UnixOperatingSystem fork.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3553
     id == 0 ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3554
	'I am the child process' printCR.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3555
	UnixOperatingSystem exit
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3556
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3557
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3558
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3559
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3560
getStatusOfProcess:aProcessId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3561
    "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
  3562
     This is required to avoid zombie processes."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3563
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3564
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3565
    int status;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3566
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3567
    if (__isSmallInteger(aProcessId)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3568
	pid_t pid = (pid_t)(__intVal(aProcessId));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3569
	{
3496
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
# ifdef  NO_WAITPID
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3572
	    pid_t child;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3573
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3574
	    do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3575
		__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3576
		child = __wait (&status);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3577
		__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3578
		if (child < 0 && errno != EINTR) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3579
		    fprintf(stderr, "OS: child-wait errno=%d\n", errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3580
		    status = -1;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3581
		    break;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3582
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3583
	    } while (child != pid);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3584
# else
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3585
	    pid_t child;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3586
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3587
	    /* claus: the original did not care for EINTR here ... */
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3588
	    do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3589
		__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3590
		child = __waitpid (pid, &status, 0);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3591
		__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3592
	    } while ((child != pid) && (errno == EINTR));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3593
	    if (child != pid) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3594
		fprintf(stderr, "OS: child-waitpid errno=%d\n", errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3595
		status = -1;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3596
	    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3597
# endif /* NO_WAITPID */
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3598
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3599
	RETURN ( __MKSMALLINT(status));
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3600
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3601
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3602
    self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3603
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3604
!
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
pathOfCommand:aCommand
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3607
    "find where aCommand's executable file is;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3608
     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
  3609
     return nil."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3610
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3611
    |path f fExt|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3612
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3613
    aCommand asFilename isAbsolute ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3614
	^ aCommand
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3615
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3616
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3617
    path := self getEnvironment:'PATH'.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3618
    path notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3619
	(path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3620
	    path isEmpty ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3621
		f := aCommand asFilename
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3622
	    ] ifFalse:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3623
		f := path asFilename construct:aCommand.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3624
	    ].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3625
	    self executableFileExtensions do:[:ext |
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3626
		ext notEmpty ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3627
		    fExt := (f pathName , ext) asFilename.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3628
		] ifFalse:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3629
		    fExt := f.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3630
		].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3631
		fExt isExecutable ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3632
		    ^ fExt pathName
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3633
		].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3634
	    ].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3635
	].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3636
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3637
    ^ nil
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
    "unix:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3640
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3641
     UnixOperatingSystem pathOfCommand:'fooBar'  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3642
     UnixOperatingSystem pathOfCommand:'ls'    
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3643
     UnixOperatingSystem pathOfCommand:'cvs'   
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3644
     UnixOperatingSystem pathOfCommand:'stx'   
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3645
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3646
    "windows:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3647
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3648
     UnixOperatingSystem pathOfCommand:'windbg'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3649
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3650
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3651
    "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
  3652
!
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
startProcess:aCommandString inputFrom:anExternalInStream outputTo:anExternalOutStream errorTo:anExternalErrStream
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3655
    "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
  3656
     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
  3657
     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
  3658
     '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
  3659
     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
  3660
     each may be nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3661
     Return the processId if successful, nil otherwise.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3662
     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
  3663
     or #killProcess: to stop it."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3664
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3665
    |in out err shellAndArgs|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3666
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3667
    anExternalInStream notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3668
	in := anExternalInStream fileDescriptor.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3669
    ] ifFalse:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3670
	in := '/dev/null' asFilename readStream fileDescriptor
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
    anExternalOutStream notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3673
	out := anExternalOutStream fileDescriptor.
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
    anExternalErrStream notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3676
	err := anExternalErrStream fileDescriptor.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3677
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3678
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3679
    shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3680
    ^ self
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3681
	exec:(shellAndArgs at:1)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3682
	withArguments:(shellAndArgs at:2)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3683
	fileDescriptors:(Array with:in with:out with:err)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3684
	closeDescriptors:nil
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3685
	fork:true
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3686
	newPgrp:false.
3496
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
    "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
  3689
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3690
     UnixOperatingSystem executeCommand:'ls -l > out'.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3691
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3692
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3693
    "non-blocking (lower prio threads continue):
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
     |in out err pid sema|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3696
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3697
     in := 'out' asFilename readStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3698
     out := 'out2' asFilename writeStream.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3699
     err := 'err' asFilename writeStream.
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
     sema := Semaphore new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3702
     pid := UnixOperatingSystem startProcess:'sleep 10; grep drw' inputFrom:in outputTo:out errorTo:err.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3703
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3704
     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
  3705
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3706
     pid notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3707
	 Processor monitorPid:pid action:[:OSstatus | sema signal ].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3708
     ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3709
     in close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3710
     out close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3711
     err close.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3712
     sema wait.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3713
     Transcript showCR:'finished'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3714
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3715
3515
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3716
    "Created: / 29.2.1996 / 12:31:29 / cg"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3717
    "Modified: / 21.3.1997 / 10:04:35 / dq"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3718
    "Modified: / 15.7.1997 / 16:03:51 / stefan"
e7ff23b98a83 removed more win32 / vms stuff
Claus Gittinger <cg@exept.de>
parents: 3512
diff changeset
  3719
    "Modified: / 5.6.1998 / 19:03:51 / cg"
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  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
!UnixOperatingSystem class methodsFor:'file access'!
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
closeFd:anInteger
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3725
    "low level close of a filedescriptor"
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
     if (__isSmallInteger(anInteger)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3729
	close(__intVal(anInteger));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3730
	RETURN(self);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3731
     }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3732
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3733
     ^ self primitiveFailed.
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
createDirectory:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3737
    "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
  3738
     path, or relative to the current directory.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3739
     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
  3740
     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
  3741
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3742
    "/ if it already exists this is ok
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3743
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3744
    (self isDirectory:aPathName) ifTrue:[^ true].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3745
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3746
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3747
    if (__isString(aPathName)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3748
	int ret;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3749
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3750
	ret = mkdir(__stringVal(aPathName), 0755);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3751
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3752
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3753
	    RETURN (false);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3754
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3755
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3756
      }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3757
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3758
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3759
"/    self isUNIXlike ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3760
"/      ^ self executeCommand:('mkdir 2>/dev/null ', newPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3761
"/    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3762
"/    ^ self executeCommand:('mkdir ', newPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3763
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3764
    self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3765
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3766
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3767
     UnixOperatingSystem createDirectory:'foo'  
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3770
    "Modified: 20.12.1995 / 11:24:13 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3771
    "Modified: 29.6.1996 / 14:06:54 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3772
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3773
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3774
createHardLinkFrom:oldPath to:newPath
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3775
    "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
  3776
     Return true if successful, false if not."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3777
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3778
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3779
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3780
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3781
    if (__isString(oldPath) && __isString(newPath)) {
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3782
        __BEGIN_INTERRUPTABLE__
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3783
        do {
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3784
            ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3785
        } while (ret < 0 && errno == EINTR);
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3786
        __END_INTERRUPTABLE__
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3787
        if (ret < 0) {
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3788
            @global(LastErrorNumber) = __MKSMALLINT(errno);
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3789
            RETURN ( false );
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3790
        }
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3791
        RETURN (true);
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3792
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3793
%}.
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3794
    "/
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3795
    "/ bad argument(s) given
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3796
    "/
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3797
    ^ self primitiveFailed 
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3798
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3799
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3800
     UnixOperatingSystem linkFile:'foo' to:'bar'
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3801
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3802
!
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3803
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3804
createSymbolicLinkFrom:oldPath to:newPath
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3805
    "make a symbolic link for 'newPath' to the file 'oldPath'.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3806
     The link will be a soft (symbolic) link.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3807
     Return true if successful, false if not."
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3808
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3809
%{
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3810
#ifdef S_IFLNK
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3811
    int ret;
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3812
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3813
    if (__isString(oldPath) && __isString(newPath)) {
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3814
        __BEGIN_INTERRUPTABLE__
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3815
        do {
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3816
            ret = symlink((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3817
        } while (ret < 0 && errno == EINTR);
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3818
        __END_INTERRUPTABLE__
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3819
        if (ret < 0) {
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3820
            @global(LastErrorNumber) = __MKSMALLINT(errno);
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3821
            RETURN ( false );
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3822
        }
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3823
        RETURN (true);
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3824
    }
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3825
#endif
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3826
%}.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3827
    (oldPath isString not or:[newPath isString not]) ifTrue:[
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3828
        "/
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3829
        "/ bad argument(s) given
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3830
        "/
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3831
        ^ self primitiveFailed 
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3834
    "/
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3835
    "/ 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
  3836
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3837
    ^ UnsupportedOperationSignal raise
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3838
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3839
    "
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  3840
     UnixOperatingSystem symbolicLinkFile:'foo' to:'bar'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3841
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3842
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3843
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3844
recursiveCopyDirectory:sourcePathName to:destination
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3845
    "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
  3846
     Return true if successful."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3847
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3848
    ^ 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
  3849
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3850
    "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
  3851
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3852
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3853
recursiveRemoveDirectory:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3854
    "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
  3855
     Return true if successful."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3856
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3857
    ^ self executeCommand:('rm -rf ' , fullPathName)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3858
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
     UnixOperatingSystem recursiveCreateDirectory:'foo/bar/baz'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3861
     UnixOperatingSystem recursiveRemoveDirectory:'foo'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3862
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3863
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  3864
    "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
  3865
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3866
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3867
removeDirectory:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3868
    "remove the directory named 'fullPathName'. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3869
     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
  3870
     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
  3871
     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
  3872
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3873
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3874
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3875
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3876
    if (__isString(fullPathName)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3877
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3878
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3879
	    ret = rmdir((char *) __stringVal(fullPathName));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3880
	} while (ret < 0 && errno == EINTR);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3881
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3882
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3883
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3884
	    RETURN ( false );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3885
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3886
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3887
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3888
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3889
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3890
    "/ either not a string argument,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3891
    "/ or not supported by OS
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
    ^ self primitiveFailed
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3896
     UnixOperatingSystem createDirectory:'foo'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3897
     UnixOperatingSystem removeDirectory:'foo'
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3901
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3902
removeFile:fullPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3903
    "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
  3904
     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
  3905
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3906
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3907
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3908
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3909
    if (__isString(fullPathName)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3910
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3911
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3912
	    ret = unlink((char *) __stringVal(fullPathName));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3913
	} while (ret < 0 && errno == EINTR);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3914
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3915
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3916
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3917
	    RETURN ( false );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3918
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3919
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3920
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3921
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3922
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3923
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3924
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3925
renameFile:oldPath to:newPath
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3926
    "rename the file 'oldPath' to 'newPath'. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3927
     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
  3928
     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
  3929
     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
  3930
     any invalid names.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3931
     Returns true if successful, false if not"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3932
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3933
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3934
    int ret, eno;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3935
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3936
    if (__isString(oldPath) && __isString(newPath)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3937
#if defined(HAS_RENAME)
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3938
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3939
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3940
	    ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3941
	} while (ret < 0 && errno == EINTR);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3942
	__END_INTERRUPTABLE__
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3943
#else
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3944
	ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3945
	if (ret >= 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3946
	    ret = unlink((char *) __stringVal(oldPath));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3947
	    if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3948
		eno = errno;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3949
		unlink((char *) __stringVal(newPath));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3950
		errno = eno;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3951
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3952
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3953
#endif
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3954
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3955
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3956
	    RETURN ( false );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3957
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  3958
	RETURN (true);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3959
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3960
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3961
    ^ self primitiveFailed
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3964
     UnixOperatingSystem renameFile:'foo' to:'bar'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3965
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3966
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3967
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3968
truncateFile:aPathName to:newSize
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3969
    "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
  3970
     This may not be supported on all architectures.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3971
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3972
     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
  3973
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3974
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3975
#ifdef HAS_TRUNCATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3976
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3977
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3978
    if (__isString(aPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3979
     && __isSmallInteger(newSize)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3980
	__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3981
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3982
	    ret = truncate((char *) __stringVal(aPathName), __intVal(newSize));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3983
	} while (ret < 0 && errno == EINTR);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3984
	__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3985
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3986
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3987
	    RETURN ( false );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3988
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3989
	RETURN (true);
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
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3992
# ifdef HAS_FTRUNCATE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3993
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3994
    int fd;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3995
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3996
    if (__isString(aPathName)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3997
     && __isSmallInteger(newSize)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3998
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  3999
	    fd = open((char *) __stringVal(aPathName), 2);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4000
	} while (fd < 0 && errno == EINTR);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4001
	if (fd < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4002
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4003
	    RETURN ( false );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4004
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4005
        
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4006
	ret = ftruncate(fd, __intVal(newSize));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4007
	close(fd);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4008
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4009
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4010
	    RETURN ( false );
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
	RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4013
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4014
# endif /* using FTRUNCATE */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4015
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4016
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4017
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4018
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4019
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4020
!UnixOperatingSystem class methodsFor:'file access rights'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4021
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4022
accessMaskFor:aSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4023
    "return the access bits mask for numbers as returned by 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4024
     UnixOperatingSystem>>accessModeOf:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4025
     and expected by UnixOperatingSystem>>changeAccessModeOf:to:.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4026
     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
  4027
     (never hardcode 8rxxx into your code)."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4028
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4029
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4030
#   ifndef S_IRUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4031
    /* posix systems should define these ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4032
#    define S_IRUSR 0400
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4033
#    define S_IWUSR 0200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4034
#    define S_IXUSR 0100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4035
#    define S_IRGRP 0040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4036
#    define S_IWGRP 0020
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4037
#    define S_IXGRP 0010
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4038
#    define S_IROTH 0004
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4039
#    define S_IWOTH 0002
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4040
#    define S_IXOTH 0001
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4041
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4042
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4043
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4044
    if (aSymbol == @symbol(readUser)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4045
	RETURN ( __MKSMALLINT(S_IRUSR) );
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
    if (aSymbol == @symbol(writeUser)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4048
	RETURN ( __MKSMALLINT(S_IWUSR) );
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
    if (aSymbol == @symbol(executeUser)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4051
	RETURN ( __MKSMALLINT(S_IXUSR) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4052
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4053
    if (aSymbol == @symbol(readGroup)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4054
	RETURN ( __MKSMALLINT(S_IRGRP) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4055
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4056
    if (aSymbol == @symbol(writeGroup)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4057
	RETURN ( __MKSMALLINT(S_IWGRP) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4058
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4059
    if (aSymbol == @symbol(executeGroup)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4060
	RETURN ( __MKSMALLINT(S_IXGRP) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4061
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4062
    if (aSymbol == @symbol(readOthers)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4063
	RETURN ( __MKSMALLINT(S_IROTH) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4064
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4065
    if (aSymbol == @symbol(writeOthers)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4066
	RETURN ( __MKSMALLINT(S_IWOTH) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4067
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4068
    if (aSymbol == @symbol(executeOthers)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4069
	RETURN ( __MKSMALLINT(S_IXOTH) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4070
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4071
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4072
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4073
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4074
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4075
     UnixOperatingSystem accessMaskFor:#readUser
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4076
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4077
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4078
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4079
accessModeOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4080
    "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
  4081
     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
  4082
     Notice that the returned number is OS dependent - use the 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4083
     modeMasks as returned by UnixOperatingSystem>>accessMaskFor:"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4084
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4085
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4086
     this could have been implemented as:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4087
	(self infoOf:aPathName) at:#mode
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4088
     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
  4089
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4090
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4091
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4092
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4093
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4094
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4095
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4096
# ifdef TRACE_STAT_CALLS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4097
	printf("stat on '%s' for accessMode\n", __stringVal(aPathName));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4098
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4099
	__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4100
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4101
	    ret = stat((char *) __stringVal(aPathName), &buf);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4102
	} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4103
	__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4104
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4105
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4106
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4107
	    RETURN ( nil );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4108
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4109
	RETURN ( __MKSMALLINT(buf.st_mode & 0777) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4110
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4111
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4112
   ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4113
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4114
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4115
    (UnixOperatingSystem accessModeOf:'/') printStringRadix:8
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4116
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4117
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4118
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4119
changeAccessModeOf:aPathName to:modeBits
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4120
    "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
  4121
     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
  4122
     independent. Return true if changed, 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4123
     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
  4124
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4125
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4126
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4127
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4128
    if (__isString(aPathName) && __isSmallInteger(modeBits)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4129
	__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4130
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4131
	    ret = chmod((char *)__stringVal(aPathName), __intVal(modeBits));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4132
	} while (ret < 0 && errno == EINTR);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4133
	__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4134
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4135
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4136
	    RETURN ( false );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4137
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4138
	RETURN ( true );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4139
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4140
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4141
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4142
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4143
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4144
!UnixOperatingSystem class methodsFor:'file locking'!
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
lockFD:aFileDescriptor shared:isSharedReadLock blocking:blockIfLocked
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4147
   "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
  4148
    (such as returned by ExternalStream>>fileDescriptor).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4149
    On some systems, only advisory locks are available -
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4150
    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
  4151
    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
  4152
    (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
  4153
    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
  4154
    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
  4155
    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
  4156
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4157
    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
  4158
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4159
    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
  4160
    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
  4161
    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
  4162
    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
  4163
    argument."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4164
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4165
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4166
    if (__isSmallInteger(aFileDescriptor)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4167
	int fd = __intVal(aFileDescriptor);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4168
	int lockArg;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4169
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4170
	/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4171
	 * claus: sigh - each one has a different interface ... 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4172
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4173
#if defined(F_SETLK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4174
	{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4175
	    /* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4176
	     * new fcntl(SETLK) interface;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4177
	     * available on SYSV4 and Linux
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4178
	     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4179
	    struct flock flock;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4180
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4181
	    if (isSharedReadLock == true) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4182
		flock.l_type = F_RDLCK;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4183
	    } else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4184
		flock.l_type = F_WRLCK;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4185
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4186
	    flock.l_whence = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4187
	    flock.l_start = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4188
	    flock.l_len = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4189
	    lockArg = F_SETLK;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4190
# if defined(F_SETLKW)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4191
	    if (blockIfLocked == true) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4192
		lockArg = F_SETLKW;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4193
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4194
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4195
	    if (fcntl(fd, lockArg, &flock) != -1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4196
		RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4197
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4198
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4199
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4200
#else /* no F_SETLK available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4201
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4202
# if defined(LOCK_EX) && defined(LOCK_UN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4203
	/* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4204
	 * BSD 4.3 advisory locks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4205
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4206
	lockArg = LOCK_EX;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4207
#  if defined(LOCK_SH)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4208
	if (isSharedReadLock == true) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4209
	    lockArg = LOCK_SH
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4210
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4211
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4212
#  if defined(LOCK_NB)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4213
	if (blockIfLocked == false) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4214
	    lockArg |= LOCK_NB;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4215
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4216
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4217
	if (flock(fd, lockArg) != -1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4218
	    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4219
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4220
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4221
# else /* no flock available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4222
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4223
#  if defined(F_LOCK) && defined(F_UNLOCK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4224
	/* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4225
	 * SYSV3 advisory locks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4226
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4227
	if (lockf(fd, F_LOCK, 0) != -1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4228
	    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4229
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4230
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4231
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4232
#endif
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4235
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4236
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4237
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4238
supportsFileLinks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4239
    "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
  4240
     Typically, only unix returns true here."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4241
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4242
    ^ true
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4243
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4244
    "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
  4245
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4246
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4247
supportsFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4248
    "return true, if the OS supports file locking"
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
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4251
#if defined(F_SETLK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4252
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4253
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4254
# if defined(LOCK_EX) && defined(LOCK_UN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4255
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4256
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4257
#  if defined(F_LOCK) && defined(F_UNLOCK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4258
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4259
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4260
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4261
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4262
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4263
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4264
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4265
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4266
     UnixOperatingSystem supportsFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4267
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4268
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4269
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4270
supportsNonBlockingFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4271
    "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
  4272
     (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
  4273
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4274
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4275
#if defined(F_SETLK) && defined(F_SETLKW)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4276
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4277
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4278
# 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
  4279
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4280
# endif
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4283
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4284
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4285
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4286
     UnixOperatingSystem supportsNonBlockingFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4287
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4288
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4289
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4290
supportsSharedLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4291
    "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
  4292
     file locking."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4293
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4294
%{ /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4295
#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
  4296
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4297
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4298
# 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
  4299
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4300
# endif
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4303
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4304
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4305
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4306
     UnixOperatingSystem supportsNonBlockingFileLocks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4307
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4308
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4309
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4310
unlockFD:aFileDescriptor
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4311
    "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
  4312
     which was previously aquired by #lockFD:.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4313
     Return false, if the unlock failed 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4314
     (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
  4315
      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
  4316
     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
  4317
     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
  4318
     
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4319
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4320
    if (__isSmallInteger(aFileDescriptor)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4321
	int fd = __intVal(aFileDescriptor);
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
	 * claus: sigh - each one has a different interface ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4325
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4326
#if defined(F_SETLK)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4327
	{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4328
	    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4329
	     * new fcntl(SETLK) interface;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4330
	     * available on SYSV4 and Linux
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4331
	     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4332
	    struct flock flock;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4333
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4334
	    flock.l_type = F_UNLCK;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4335
	    flock.l_whence = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4336
	    flock.l_start = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4337
	    flock.l_len = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4338
	    if (fcntl(fd, F_SETLK, &flock) != -1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4339
		RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4340
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4341
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4342
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4343
#else /* no F_SETLK available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4344
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4345
# if defined(LOCK_EX) && defined(LOCK_UN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4346
	/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4347
	 * BSD 4.3 advisory locks
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
	if (flock(fd, LOCK_UN) != -1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4350
	    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4351
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4352
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4353
# else /* no flock available */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4354
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4355
#  if defined(F_LOCK) && defined(F_UNLOCK)
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
	 * SYSV3 advisory locks
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4358
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4359
	if (lockf(fd, F_UNLOCK, 0) != -1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4360
	    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4361
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4362
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4363
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4364
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4365
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4366
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4367
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4368
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4369
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4370
!UnixOperatingSystem class methodsFor:'file queries'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4371
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4372
caseSensitiveFilenames
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4373
    "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
  4374
     On MSDOS, this will return false; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4375
     on a real OS, we return true."
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
    ^ true
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4378
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4379
    "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
  4380
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4381
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4382
compressPath:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4383
    "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
  4384
     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
  4385
     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
  4386
     if realPath and popen failed."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4387
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4388
    |names n "{ Class: SmallInteger }" |
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
    names := pathName 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4391
		asCollectionOfSubstringsSeparatedBy:self fileSeparator.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4392
    names := names asOrderedCollection.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4393
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4394
     cut off initial double-slashes
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4395
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4396
    [names startsWith:#('' '')] whileTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4397
	names removeFirst.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4398
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4399
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4400
     cut off double-slashes at end
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4401
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4402
    [names endsWith:#('')] whileTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4403
	names removeLast.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4404
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4405
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4406
     cut off current-dir at beginning
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4407
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4408
    n := names size.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4409
    [(n >= 2) and:[names startsWith:#('.')]] whileTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4410
	names removeFirst.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4411
	n := n - 1.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4412
    ].
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
     cut off parent-dirs at end
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
    [(n > 2) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4418
     and:[(names endsWith:#('..'))
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4419
     and:[((names at:(n - 1)) startsWith:'.') not ]]] whileTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4420
	names removeLast; removeLast.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4421
	n := n - 2.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4422
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4423
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4424
    ^ names asStringWith:self fileSeparator 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4425
		    from:1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4426
		    to:n
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4427
		    compressTabs:false final:nil 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4428
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4429
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4430
     UnixOperatingSystem compressPath:'./..'    
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4431
     UnixOperatingSystem compressPath:'/foo/bar/baz/..'  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4432
     UnixOperatingSystem compressPath:'foo/bar/baz/..'  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4433
     UnixOperatingSystem compressPath:'foo/bar/baz/../'  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4434
     UnixOperatingSystem compressPath:'foo/bar/baz/..///' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4435
     UnixOperatingSystem compressPath:'///foo/bar/baz/..///' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4436
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4437
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4438
    "Modified: 1.11.1996 / 20:13:48 / cg"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4441
fileSeparator
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4442
    "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
  4443
     This character differs for MSDOS and other systems,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4444
     (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
  4445
      preparation for the future)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4446
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4447
    ^ $/
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4448
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4449
    "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
  4450
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4451
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4452
getDriveList
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4453
    "return a list of volumes in the system. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4454
     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
  4455
     - 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
  4456
     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
  4457
     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
  4458
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4459
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4460
    "/ default: retrurn array filled with
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4461
    "/ root, home and current directories.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4462
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4463
    ^ Array 
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4464
	with:'/'
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4465
	with:(self getHomeDirectory)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4466
	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
  4467
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4468
    "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
  4469
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4470
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4471
infoOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4472
    "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
  4473
     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
  4474
     the returned object) is:
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4475
	 type            - a symbol giving the files type
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4476
	 mode            - numeric access mode 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4477
	 uid             - owners user id
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4478
	 gid             - owners group id
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4479
	 size            - files size
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4480
	 id              - files number (i.e. inode number)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4481
	 accessed        - last access time (as Timestamp)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4482
	 modified        - last modification time (as Timestamp)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4483
	 statusChanged   - last status change time (as Timestamp)
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  4484
	 alternativeName     - (windows only:) the MSDOS name of the file
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  4485
	 recordFormatNumeric - (VMS only:) numeric value of the recordFormat
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  4486
	 recordFormat        - (VMS only:) symbolic value of the recordFormat
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  4487
	 recordAttributes    - (VMS only:) recordAttributes
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  4488
	 fixedHeaderSize     - (VMS only:) fixed header size in a variable record format
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  4489
	 recordSize          - (VMS only:) record size.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4490
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4491
     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
  4492
     all of the information.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4493
     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
  4494
     For symbolic links (if supported by the OS), 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4495
     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
  4496
     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
  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
    |info type mode uid gid size id 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4500
     atime mtime ctime 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4501
     aOStime mOStime cOStime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4502
     aYr aMon aDay aHr aMin aSec aMS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4503
     mYr mMon mDay mHr mMin mSec mMS
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  4504
     cYr cMon cDay cHr cMin cSec cMS|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4505
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4506
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4507
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4508
    char nameBuffer[15];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4509
    unsigned INT ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4510
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4511
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4512
# ifdef TRACE_STAT_CALLS
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4513
	printf("stat on '%s' for info\n", __stringVal(aPathName));
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4514
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4515
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4516
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4517
	    ret = stat((char *) __stringVal(aPathName), &buf);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4518
	} while ((ret < 0) && (errno == EINTR));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4519
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4520
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4521
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4522
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4523
	    RETURN ( nil );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4524
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4525
	switch (buf.st_mode & S_IFMT) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4526
	    case S_IFDIR:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4527
		type = @symbol(directory);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4528
		break;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4529
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4530
	    case S_IFREG:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4531
		type = @symbol(regular);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4532
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4533
# ifdef S_IFCHR
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4534
	    case S_IFCHR:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4535
		type = @symbol(characterSpecial);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4536
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4537
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4538
# ifdef S_IFBLK
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4539
	    case S_IFBLK:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4540
		type = @symbol(blockSpecial);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4541
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4542
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4543
# ifdef S_IFMPC
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4544
	    case S_IFMPC:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4545
		type = @symbol(multiplexedCharacterSpecial);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4546
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4547
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4548
# ifdef S_IFMPB
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4549
	    case S_IFMPB:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4550
		type = @symbol(multiplexedBlockSpecial);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4551
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4552
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4553
# ifdef S_IFLNK
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4554
	    case S_IFLNK:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4555
		type = @symbol(symbolicLink);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4556
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4557
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4558
# ifdef S_IFSOCK
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4559
	    case S_IFSOCK:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4560
		type = @symbol(socket);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4561
		break;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4562
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4563
# ifdef S_IFIFO
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4564
	    case S_IFIFO:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4565
		type = @symbol(fifo);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4566
		break;
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4567
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4568
	    default:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4569
		type = @symbol(unknown);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4570
		break;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4571
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4572
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4573
	ino = buf.st_ino;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4574
	id = __MKUINT(ino);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4575
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4576
	mode = __MKSMALLINT(buf.st_mode & 0777);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4577
	uid = __MKSMALLINT(buf.st_uid);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4578
	gid = __MKSMALLINT(buf.st_gid);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4579
	size = __MKUINT(buf.st_size);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4580
	aOStime = __MKUINT(buf.st_atime);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4581
	mOStime = __MKUINT(buf.st_mtime);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4582
	cOStime = __MKUINT(buf.st_ctime);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4583
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4584
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4585
    mode notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4586
	aOStime notNil ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4587
	    atime := AbsoluteTime fromOSTime:(aOStime * 1000).
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4588
	    mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4589
	    ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4590
	] ifFalse:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4591
	    atime := AbsoluteTime day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4592
	    mtime := AbsoluteTime day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4593
	    ctime := AbsoluteTime day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4594
	].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4595
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4596
	info := FileStatusInfo
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4597
		    type:type 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4598
		    mode:mode 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4599
		    uid:uid 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4600
		    gid:gid 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4601
		    size:size 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4602
		    id:id 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4603
		    accessed:atime 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4604
		    modified:mtime 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4605
		    statusChanged:ctime
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  4606
		    path:nil.
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4607
	^ info
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4608
   ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4609
   ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4610
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4611
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4612
    UnixOperatingSystem infoOf:'/'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4613
    (UnixOperatingSystem infoOf:'/') uid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4614
    (UnixOperatingSystem infoOf:'/') accessed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4615
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4616
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4617
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4618
isDirectory:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4619
    "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
  4620
     (i.e. exists and is a directory).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4621
     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
  4622
     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
  4623
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4624
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4625
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4626
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4627
    if (__isString(aPathName)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4628
	struct stat buf;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4629
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4630
# ifdef TRACE_STAT_CALLS
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4631
	printf("stat on '%s' for isDirectory\n", __stringVal(aPathName));
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4632
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4633
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4634
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4635
	    ret = stat((char *) __stringVal(aPathName), &buf);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4636
	} while ((ret < 0) && (errno == EINTR));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4637
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4638
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4639
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4640
	    RETURN ( false );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4641
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4642
	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
  4643
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4644
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4645
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4646
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4647
    "an alternative implementation would be:
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4648
	^ (self infoOf:aPathName) type == #directory
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4649
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4650
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4651
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4652
isExecutable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4653
    "return true, if the given file is executable.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4654
     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
  4655
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4656
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4657
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4658
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4659
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4660
# ifdef TRACE_ACCESS_CALLS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4661
	printf("access on '%s' for executable\n", __stringVal(aPathName));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4662
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4663
	__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4664
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4665
	    ret = access(__stringVal(aPathName), X_OK);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4666
	} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4667
	__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4668
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4669
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4670
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4671
	RETURN ( ((ret == 0) ? true : false) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4672
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4673
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4674
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4675
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4676
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4677
isReadable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4678
    "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
  4679
     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
  4680
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4681
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4682
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4683
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4684
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4685
# ifdef TRACE_ACCESS_CALLS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4686
	printf("access on '%s' for readable\n", __stringVal(aPathName));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4687
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4688
	__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4689
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4690
	    ret = access(__stringVal(aPathName), R_OK);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4691
	} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4692
	__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4693
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4694
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4695
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4696
	RETURN ( ((ret == 0) ? true : false) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4697
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4698
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4699
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4700
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4701
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4702
isSymbolicLink:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4703
    "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
  4704
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4705
    ^ (self linkInfoOf:aPathName) notNil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4706
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4707
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4708
     UnixOperatingSystem isSymbolicLink:'Make.proto'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4709
     UnixOperatingSystem isSymbolicLink:'Makefile' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4710
    "
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4713
isValidPath:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4714
    "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
  4715
     (i.e. the file or directory exists)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4716
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4717
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4718
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4719
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4720
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4721
    if (__isString(aPathName) || __isSymbol(aPathName) ) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4722
# ifdef TRACE_STAT_CALLS
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4723
	printf("stat on '%s' for isValidPath\n", __stringVal(aPathName));
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4724
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4725
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4726
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4727
	    ret = stat((char *) __stringVal(aPathName), &buf);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4728
	} while ((ret < 0) && (errno == EINTR));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4729
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4730
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4731
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4732
	    RETURN (false);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4733
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4734
	RETURN ( ret ? false : true );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4735
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4736
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4737
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4738
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4739
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4740
isWritable:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4741
    "return true, if the given file is writable.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4742
     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
  4743
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
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4746
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4747
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4748
# ifdef TRACE_ACCESS_CALLS
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4749
	printf("access on '%s' for writable\n", __stringVal(aPathName));
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4750
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4751
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4752
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4753
	    ret = access(__stringVal(aPathName), W_OK);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4754
	} while ((ret < 0) && (errno == EINTR));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4755
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4756
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4757
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4758
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4759
	RETURN ( ((ret == 0) ? true : false) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4760
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4761
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4762
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4763
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4764
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4765
linkInfoOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4766
    "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
  4767
     IFF aPathName is a symbolic link. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4768
     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
  4769
     (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
  4770
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4771
     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
  4772
     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
  4773
     in case of a symbolic link."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4774
     
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4775
    |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
  4776
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4777
%{  /* STACK: 1200 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4778
#if defined(S_IFLNK) && !defined(__openVMS__) && !defined(MSDOS_LIKE)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4779
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4780
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4781
    char pathBuffer[1024];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4782
    unsigned INT ino;
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
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4785
	__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4786
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4787
	    ret = lstat((char *) __stringVal(aPathName), &buf);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4788
	} while ((ret < 0) && (errno == EINTR));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4789
	__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4790
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4791
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4792
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4793
	    RETURN ( nil );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4794
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4795
	switch (buf.st_mode & S_IFMT) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4796
	    default:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4797
		RETURN ( nil ); /* not a symbolic link */
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
	    case S_IFLNK:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4800
		type = @symbol(symbolicLink);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4801
		break;
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4804
	ino = buf.st_ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4805
	id = __MKUINT(ino);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4806
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4807
	mode = __MKSMALLINT(buf.st_mode & 0777);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4808
	uid = __MKSMALLINT(buf.st_uid);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4809
	gid = __MKSMALLINT(buf.st_gid);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4810
	size = __MKUINT(buf.st_size);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4811
	atime = __MKUINT(buf.st_atime);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4812
	mtime = __MKUINT(buf.st_mtime);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4813
	ctime = __MKUINT(buf.st_ctime);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4814
	if ((ret = readlink((char *) __stringVal(aPathName), pathBuffer, sizeof(pathBuffer))) < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4815
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4816
	    RETURN ( nil );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4817
	} 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4818
	pathBuffer[ret] = '\0';  /* readlink does not 0-terminate */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4819
	path = __MKSTRING(pathBuffer);
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
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4822
    RETURN ( nil );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4823
#endif
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
    mode notNil ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4826
	info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4827
	^ FileStatusInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4828
	    type:type 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4829
	    mode:mode 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4830
	    uid:uid 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4831
	    gid:gid 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4832
	    size:size 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4833
	    id:id 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4834
	    accessed:(AbsoluteTime fromOSTime:(atime * 1000)) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4835
	    modified:(AbsoluteTime fromOSTime:(mtime * 1000)) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4836
	    statusChanged:(AbsoluteTime fromOSTime:(ctime * 1000))
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4837
	    path:path
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4838
   ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4839
   ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4840
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
    UnixOperatingSystem infoOf:'Make.proto'  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4843
    UnixOperatingSystem linkInfoOf:'Make.proto' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4844
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4845
    UnixOperatingSystem infoOf:'resources/motif.style'   
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4846
    UnixOperatingSystem linkInfoOf:'resources/motif.style' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4847
   "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4848
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4849
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4850
parentDirectoryName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4851
    "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
  4852
     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
  4853
     for other systems.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4854
     (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
  4855
      preparation for the future)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4856
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4857
    ^ '..'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4858
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4859
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4860
pathNameOf:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4861
    "return the pathName of the argument, aPathString,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4862
     - 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
  4863
     This method needs the path to be valid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4864
     (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
  4865
     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
  4866
     from what you expect."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4867
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4868
    |p path command|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4869
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4870
    "some systems have a convenient function for this ..."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4871
    path := self primPathNameOf:pathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4872
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4873
    path isNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4874
	(self isValidPath:pathName) ifFalse:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4875
	    p := pathName.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4876
	    [(p size > 1)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4877
	     and:[p endsWith:(self fileSeparator)]
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4878
	    ] whileTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4879
		p := p copyWithoutLast:1.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4880
	    ].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4881
	    ^ p
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4882
	].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4883
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4884
	(SlowFork==true or:[PipeFailed==true]) ifFalse:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4885
	    PipeStream openErrorSignal handle:[:ex |
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4886
		PipeFailed := true.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4887
		'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4888
		ex return.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4889
	    ] do:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4890
		"have to fall back ..."
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4891
		command := 'cd ' , pathName , '; pwd'.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4892
		p := PipeStream readingFrom:command.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4893
	    ].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4894
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4895
	    (p isNil or:[p atEnd]) ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4896
		('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4897
	    ] ifFalse:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4898
		path := p nextLine.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4899
		p close.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4900
	    ]
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4901
	].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4902
	path isNil ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4903
	    "/
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4904
	    "/ return the original - there is nothing else can we do
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4905
	    "/
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4906
	    path := pathName
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4907
	].
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4908
	(SlowFork==true or:[ForkFailed==true]) ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4909
	    path := self compressPath:path
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4910
	]
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
    ^ path.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4913
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
     UnixOperatingSystem pathNameOf:'.'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4916
     UnixOperatingSystem pathNameOf:'../smalltalk/../smalltalk'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4917
     UnixOperatingSystem pathNameOf:'../../..'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4918
     UnixOperatingSystem pathNameOf:'..'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4919
     UnixOperatingSystem pathNameOf:'/tmp////' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4920
     UnixOperatingSystem pathNameOf:'/foo/bar' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4921
     UnixOperatingSystem pathNameOf:'/foo/bar/'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4922
     UnixOperatingSystem pathNameOf:'/foo/bar//'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4923
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4924
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4925
    "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
  4926
    "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
  4927
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4928
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4929
primIdOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4930
    "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
  4931
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  4932
%{
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4933
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4934
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4935
    unsigned INT ino;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4936
    OBJ retVal;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4937
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4938
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4939
# ifdef TRACE_STAT_CALLS
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4940
	printf("stat on '%s' for id\n", __stringVal(aPathName));
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  4941
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4942
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4943
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4944
	    ret = stat((char *) __stringVal(aPathName), &buf);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4945
	} while (ret < 0 && errno == EINTR);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4946
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4947
	if (ret >= 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4948
	    ino = buf.st_ino;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4949
	    retVal = __MKUINT(ino);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4950
	    RETURN (retVal);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4951
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4952
	@global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4953
	RETURN (nil);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4954
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4955
    RETURN (nil);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4956
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4957
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4958
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4959
primPathNameOf:pathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4960
    "return the pathName of the argument, aPathString,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4961
     - 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
  4962
     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
  4963
     realPath library function.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4964
     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
  4965
     from what you expect."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4966
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4967
    |path|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4968
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4969
%{  /* STACK: 16000 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4970
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4971
    if (__isString(pathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4972
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4973
#ifdef HAS_GETCWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4974
# if defined(UNIX_LIKE) ||defined(__VMS__) || defined(MSDOS_LIKE)
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4975
	if (strcmp(__stringVal(pathName), ".") == 0) 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4976
	{
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4977
	    char nameBuffer[MAXPATHLEN + 1];
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4978
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4979
	    if (@global(CurrentDirectory) == nil) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4980
		if (getcwd(nameBuffer, MAXPATHLEN)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4981
		    OBJ d;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4982
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4983
		    @global(CurrentDirectory) = d = __MKSTRING(nameBuffer);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4984
		    __GSTORE(d);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4985
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4986
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4987
	    RETURN (@global(CurrentDirectory));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4988
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4989
# endif /* UNIX_LIKE */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4990
#endif /* HAS_GETCWD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4991
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  4992
#ifdef HAS_REALPATH
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4993
	{
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4994
	    char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4995
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4996
	    if (realpath(__stringVal(pathName), nameBuffer)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4997
		RETURN ( __MKSTRING(nameBuffer) );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4998
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  4999
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5000
#endif /* ! HAS_REALPATH */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5001
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5002
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5003
    ^ nil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5004
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5005
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5006
timeOfLastAccess:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5007
    "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
  5008
     For nonexistent files, nil is returned."
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
    "could be implemented as:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5011
	(self infoOf:aPathName) accessed 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5012
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5013
    |osSeconds i|
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
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5016
    time_t mtime;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5017
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5018
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5019
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5020
# ifdef TRACE_STAT_CALLS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5021
	printf("stat on '%s' for timeOfLastAccess\n", __stringVal(aPathName));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5022
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5023
	__BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5024
	do {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5025
	    ret = stat((char *) __stringVal(aPathName), &buf);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5026
	} while (ret < 0 && errno == EINTR);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5027
	__END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5028
	if (ret < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5029
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5030
	    RETURN (nil);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5031
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5032
	osSeconds = __MKUINT(buf.st_atime);
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5035
    osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5036
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5037
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5038
    i notNil ifTrue:[^ i accessed].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5039
    ^ nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5040
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5041
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5042
     UnixOperatingSystem timeOfLastAccess:'/'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5043
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5044
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5045
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5046
timeOfLastChange:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5047
    "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
  5048
     For nonexistent files, nil is returned."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5049
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5050
    "could be implemented as:
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5051
	(self infoOf:aPathName) modified
3496
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
    |osSeconds i|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5055
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5056
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5057
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5058
    time_t mtime;
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
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5061
# ifdef TRACE_STAT_CALLS
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5062
	printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName));
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5063
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5064
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5065
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5066
	    ret = stat((char *) __stringVal(aPathName), &buf);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5067
	} while (ret < 0 && errno == EINTR);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5068
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5069
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5070
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5071
	    RETURN ( nil );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5072
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5073
	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
  5074
    }
3496
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
    osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5077
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5078
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5079
    i notNil ifTrue:[^ i modified].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5080
    ^ nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5081
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5082
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5083
     UnixOperatingSystem timeOfLastChange:'/'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5084
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5085
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5086
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5087
typeOf:aPathName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5088
    "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
  5089
     nil is returned.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5090
     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
  5091
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5092
    |i|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5093
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5094
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5095
     this could have been implemented as:
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5096
	(self infoOf:aPathName) type 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5097
     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
  5098
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5099
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5100
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5101
    struct stat buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5102
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5103
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5104
    if (__isString(aPathName)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5105
# ifdef TRACE_STAT_CALLS
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5106
	printf("stat on '%s' for type\n", __stringVal(aPathName));
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5107
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5108
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5109
	do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5110
	    ret = stat((char *) __stringVal(aPathName), &buf);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5111
	} while (ret < 0 && errno == EINTR);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5112
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5113
	if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5114
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5115
	    RETURN ( nil );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5116
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5117
	switch (buf.st_mode & S_IFMT) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5118
	    case S_IFDIR:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5119
		RETURN ( @symbol(directory) );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5120
	    case S_IFREG:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5121
		RETURN ( @symbol(regular) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5122
# ifdef S_IFCHR
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5123
	    case S_IFCHR:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5124
		RETURN ( @symbol(characterSpecial) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5125
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5126
# ifdef S_IFBLK
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5127
	    case S_IFBLK:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5128
		RETURN ( @symbol(blockSpecial) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5129
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5130
# ifdef S_IFLNK
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5131
	    case S_IFLNK:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5132
		RETURN ( @symbol(symbolicLink) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5133
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5134
# ifdef S_IFSOCK
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5135
	    case S_IFSOCK:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5136
		RETURN ( @symbol(socket) );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5137
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5138
# ifdef S_IFIFO
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5139
	    case S_IFIFO:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5140
		RETURN ( @symbol(fifo) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5141
# endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5142
	    default:
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5143
		RETURN ( @symbol(unknown) );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5144
	}
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5145
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5146
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5147
    i := self infoOf:aPathName.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5148
    i notNil ifTrue:[^ i type].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5149
    ^ nil.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5150
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5151
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5152
     UnixOperatingSystem typeOf:'/'   
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5153
     UnixOperatingSystem typeOf:'.'   
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5154
     UnixOperatingSystem typeOf:'Make.proto' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5155
     UnixOperatingSystem typeOf:'resources/motif.style' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5156
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5157
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5158
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5159
volumeNameOf:aPathString
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5160
    "return the volumeName of the argument, aPath
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5161
     - thats the name of the volume where aPath is.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5162
     Not all UnixOperatingSystems support/use volumes; on unix,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5163
     this always returns an empty string."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5164
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5165
    ^ ''
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5166
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  5167
    "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
  5168
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5169
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5170
!UnixOperatingSystem class methodsFor:'interrupts & signals'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5171
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5172
defaultSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5173
    "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
  5174
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5175
     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
  5176
     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
  5177
     default for SIGQUIT (^ \) is to dump core.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5178
     Also, NOTICE that signal numbers are not portable between unix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5179
     systems - use UnixOperatingSystem sigXXX to get the numeric value for
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5180
     a signal."
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5183
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5184
    if (__isSmallInteger(signalNumber)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5185
#ifdef SIG_DFL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5186
	signal(__intVal(signalNumber), SIG_DFL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5187
	RETURN (self);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5188
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5189
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5190
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5191
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5192
     this error is triggered on non-integer argument
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5195
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5196
    "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
  5197
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5198
     'if you hit ^C now, Smalltalk will exit immediately' printNewline.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5199
     UnixOperatingSystem defaultSignal:(UnixOperatingSystem sigINT).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5200
     1 to:1000000 do:[:i| ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5201
     UnixOperatingSystem enableSignal:(UnixOperatingSystem sigINT).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5202
     'normal ^C handling again.' printNewline
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5203
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5204
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5205
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5206
disableIOInterruptsOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5207
    "turn off IO interrupts for a filedescriptor"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5208
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5209
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5210
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5211
    int ret, flags, f;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5212
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5213
#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
  5214
    if (__isSmallInteger(fd)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5215
	f = __intVal(fd);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5216
# if defined(SYSV4)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5217
	ret = ioctl(f, I_SETSIG, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5218
# else /*! SYSV4*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5219
	flags = fcntl(f, F_GETFL, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5220
	/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5221
	 * if already clear, there is no need for this syscall ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5222
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5223
	if (flags & FASYNC) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5224
	    ret = fcntl(f, F_SETFL, flags & ~FASYNC);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5225
	    if (ret >= 0) ret = flags;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5226
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5227
	    ret = flags;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5228
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5229
# endif /* !SYSV4 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5230
	RETURN ( __MKSMALLINT(ret) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5231
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5232
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5233
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5234
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5235
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5236
     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
  5237
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5238
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5239
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5240
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5241
disableSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5242
    "disable (Unix-) signal processing for signalNumber.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5243
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5244
     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
  5245
     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
  5246
     handling.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5247
     Also, NOTICE that signal numbers are not portable between unix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5248
     systems - use UnixOperatingSystem sigXXX to get the numeric value for
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5249
     a signal.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5250
     Use only for fully debugged stand alone applications."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5251
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5252
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5253
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5254
    if (__isSmallInteger(signalNumber)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5255
	int sigNo = __intVal(signalNumber);
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 (sigNo == 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5258
	    RETURN (self);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5259
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5260
#ifdef SIG_IGN
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5261
	signal(sigNo, SIG_IGN);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5262
	RETURN (self);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5263
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5264
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5265
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5266
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5267
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5268
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5269
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5270
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5271
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5272
     'now, ^C is totally ignored ...' printNewline.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5273
     UnixOperatingSystem disableSignal:(UnixOperatingSystem sigINT).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5274
     1 to:1000000 do:[:i| ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5275
     UnixOperatingSystem enableSignal:(UnixOperatingSystem sigINT).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5276
     '^C handled again.' printNewline
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5277
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5278
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5279
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5280
disableTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5281
    "disable timer interrupts.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5282
     WARNING: 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5283
	the system will not operate correctly with timer interrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5284
	disabled, because no scheduling or timeouts are possible."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5285
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5286
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5287
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5288
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5289
    struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5290
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5291
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5292
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5293
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5294
    dt.it_value.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5295
    setitimer(ITIMER_REAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5296
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5297
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5298
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5299
# if defined(USE_SLOW_ALARM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5300
#  if defined(SIGALRM)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5301
    alarm(0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5302
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5303
#  endif /* SIGALRM */
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5306
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5307
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5308
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5309
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5310
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5311
enableChildSignalInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5312
    "enable childSignal interrupts 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5313
     (SIGCHLD, if the architecture supports it).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5314
     After enabling, these signals will send the message 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5315
     'childSignalInterrupt' to the ChildSignalInterruptHandler object."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5316
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5317
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5318
#ifdef __VMS__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5319
    extern void __vmsEnableChildInterrupts();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5320
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5321
    __vmsEnableChildInterrupts();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5322
    RETURN(self);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5323
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5324
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5325
    self enableSignal:(self sigCHLD)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5326
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5327
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5328
enableIOInterruptsOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5329
    "turn on IO interrupts for a filedescriptor"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5330
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5331
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5332
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5333
    int ret, flags, f;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5334
#ifndef __signalIoInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5335
    extern void __signalIoInterrupt();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5336
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5337
    static int firstCall = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5338
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5339
#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
  5340
/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5341
 * SIGIO/SIGPOLL - data available for I/O
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5342
 * (used to wake up waiting processes)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5343
 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5344
#ifdef SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5345
# define THESIGNAL SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5346
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5347
# ifdef SIGPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5348
#  define THESIGNAL SIGPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5349
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5350
#  ifdef SIGURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5351
#   define THESIGNAL SIGURG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5352
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5353
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5354
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5355
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5356
    if (__isSmallInteger(fd)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5357
	if (firstCall) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5358
#ifdef HAS_SIGACTION
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5359
	    struct sigaction act;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5360
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5361
	    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5362
	     * Do not add SA_RESTART here. A signal can cause a
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5363
	     * thread switch, another thread can do a garbage collect
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5364
	     * and restarted system calls may write into old
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5365
	     * (collected) addresses.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5366
	     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5367
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5368
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5369
	    sigemptyset(&act.sa_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5370
	    act.sa_handler = __signalIoInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5371
	    sigaction(THESIGNAL, &act, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5372
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5373
# ifdef HAS_SIGVEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5374
	    struct sigvec vec;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5375
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5376
	    vec.sv_flags = SV_INTERRUPT;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5377
	    sigemptyset(&vec.sv_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5378
	    vec.sv_handler = __signalIoInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5379
	    sigvec(THESIGNAL, &vec, NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5380
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5381
	    signal(THESIGNAL, __signalIoInterrupt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5382
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5383
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5384
	    firstCall = 0;
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
#undef THESIGNAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5387
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5388
	f = __intVal(fd);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5389
# if defined(SYSV4)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5390
	ret = ioctl(f, I_SETSIG, S_INPUT | S_HIPRI | S_ERROR | S_RDNORM | S_RDBAND | S_MSG | S_HANGUP);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5391
# else /*! SYSV4*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5392
	flags = fcntl(f, F_GETFL, 0);
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
	 * if already set, there is no need for this syscall ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5395
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5396
	if (flags & FASYNC) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5397
	    ret = flags;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5398
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5399
	    ret = fcntl(f, F_SETFL, flags | FASYNC);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5400
	    if (ret >= 0) ret = flags;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5401
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5402
# endif /*!SYSV4*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5403
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5404
#if defined(F_SETOWN) || defined(FIOSETOWN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5405
	{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5406
	    int pid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5407
	    int ok;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5408
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5409
	    pid = getpid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5410
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5411
# if defined(F_SETOWN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5412
	    ok = fcntl(f, F_SETOWN, pid);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5413
	    /* printf("F_SETOWN returns %d (%d)\n", ret, errno); */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5414
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5415
	    ok = ioctl(f, FIOSETOWN, &pid);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5416
	    /* printf("FIOSETOWN returns %d (%d)\n", ret, errno); */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5417
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5418
	    if (ok < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5419
		ret = ok;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5420
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5421
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5422
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5423
	RETURN ( __MKUINT(ret) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5424
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5425
#endif
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5428
     this error is triggered on non-integer argument
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5429
     or if the system does not support SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5430
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5431
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5432
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5433
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5434
enableSignal:signalNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5435
    "enable (Unix-)signal processing for signalNumber.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5436
     Dont confuse Unix signals with smalltalk signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5437
     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
  5438
     (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
  5439
     sends #signalInterrupt:.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5440
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5441
     NOTICE that signal numbers are not portable between unix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5442
     systems - use UnixOperatingSystem sigXXX to get the numeric value for
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5443
     a signal."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5444
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5445
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5446
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5447
#ifdef NSIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5448
# define SIG_LIMIT NSIG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5449
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5450
# ifdef SIGUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5451
#  define SIG_LIMIT SIGUSR2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5452
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5453
#  ifdef SIGUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5454
#   define SIG_LIMIT SIGUSR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5455
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5456
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5457
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5458
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5459
#if defined(SIGPOLL) && !defined(SIGIO)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5460
# define SIGIO SIGPOLL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5461
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5462
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5463
#ifdef SIGCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5464
# define CHILD_SIGNAL   SIGCHLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5465
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5466
# ifdef SIGCLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5467
#  define CHILD_SIGNAL  SIGCLD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5468
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5469
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5470
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5471
    int sigNr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5472
#if defined(SIGINT) || defined(SIGQUIT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5473
# ifndef __signalUserInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5474
    extern void __signalUserInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5475
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5476
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5477
#ifdef SIGFPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5478
# ifndef __signalFpExceptionInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5479
    extern void __signalFpExceptionInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5480
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5481
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5482
#ifdef SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5483
# ifndef __signalIoInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5484
    extern void __signalIoInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5485
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5486
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5487
#ifdef CHILD_SIGNAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5488
# ifndef __signalChildInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5489
    extern void __signalChildInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5490
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5491
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5492
#ifdef SIGPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5493
# ifndef __signalPIPEInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5494
    extern void __signalPIPEInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5495
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5496
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5497
#ifdef SIGBUS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5498
# ifndef __signalBUSInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5499
    extern void __signalBUSInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5500
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5501
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5502
#ifdef SIGSEGV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5503
# ifndef __signalSEGVInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5504
    extern void __signalSEGVInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5505
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5506
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5507
#if defined(SIGILL) || defined(SIGEMT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5508
# ifndef __signalTrapInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5509
    extern void __signalTrapInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5510
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5511
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5512
#ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5513
# ifndef WIN32
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5514
#  ifndef __signalTimerInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5515
    extern void __signalTimerInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5516
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5517
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5518
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5519
#ifndef __signalInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5520
    extern void __signalInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5521
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5522
    void (*handler)(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5523
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5524
    if (__isSmallInteger(signalNumber)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5525
     && ((sigNr = __intVal(signalNumber)) >= 0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5526
#ifdef SIG_LIMIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5527
     &&  (sigNr <= SIG_LIMIT)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5528
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5529
    ) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5530
	/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5531
	 * standard signals are forced into standard handlers
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5532
	 * - all others go into general signalInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5533
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5534
#if defined(SIGPOLL) && defined(SIGIO)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5535
	if (sigNr == SIGPOLL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5536
	    sigNr = SIGIO;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5537
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5538
	switch (sigNr) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5539
	    case 0:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5540
		/* enabling a non-supported signal */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5541
		RETURN (self);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5542
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5543
#ifdef SIGBREAK
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5544
	    case SIGBREAK:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5545
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5546
#ifdef SIGINT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5547
	    case SIGINT:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5548
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5549
#ifdef SIGQUIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5550
	    case SIGQUIT:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5551
#endif
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  5552
#if defined(SIGINT) || defined(SIGQUIT) || defined(SIGBREAK)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5553
		handler = __signalUserInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5554
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5555
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5556
#ifdef SIGFPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5557
	    case SIGFPE:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5558
		handler = __signalFpExceptionInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5559
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5560
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5561
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5562
#ifdef SIGPIPE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5563
	    case SIGPIPE:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5564
		handler = __signalPIPEInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5565
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5566
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5567
#ifdef SIGBUS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5568
	    case SIGBUS:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5569
		handler = __signalBUSInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5570
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5571
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5572
#ifdef SIGSEGV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5573
	    case SIGSEGV:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5574
		handler = __signalSEGVInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5575
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5576
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5577
#ifdef SIGILL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5578
	    case SIGILL:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5579
		handler = __signalTrapInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5580
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5581
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5582
#ifdef SIGEMT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5583
	    case SIGEMT:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5584
		handler = __signalTrapInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5585
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5586
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5587
#ifdef SIGIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5588
	    case SIGIO:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5589
		handler = __signalIoInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5590
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5591
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5592
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5593
#ifdef CHILD_SIGNAL
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5594
	    case CHILD_SIGNAL:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5595
		handler = __signalChildInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5596
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5597
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5598
#ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5599
	    case SIGALRM:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5600
		handler = __signalTimerInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5601
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5602
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5603
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5604
	    default:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5605
		handler = __signalInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5606
		break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5607
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5608
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5609
	{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5610
#ifdef HAS_SIGACTION
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5611
	    struct sigaction act;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5612
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5613
	    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5614
	     * Do not add SA_RESTART here. A signal can cause a
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5615
	     * thread switch, another thread can do a garbage collect
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5616
	     * and restarted system calls may write into old
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5617
	     * (collected) addresses.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5618
	     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5619
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5620
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5621
	    sigemptyset(&act.sa_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5622
	    act.sa_handler = handler;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5623
	    sigaction(sigNr, &act, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5624
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5625
# ifdef HAS_SIGVEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5626
	    struct sigvec vec;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5627
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5628
	    vec.sv_flags = SV_INTERRUPT;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5629
	    sigemptyset(&vec.sv_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5630
	    vec.sv_handler = handler;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5631
	    sigvec(sigNr, &vec, NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5632
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5633
	    (void) signal(sigNr, handler);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5634
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5635
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5636
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5637
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5638
	/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5639
	 * maybe, we should return the old enable-status
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5640
	 * as boolean here ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5641
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5642
	RETURN (self);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5643
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5644
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5645
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5646
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5647
     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
  5648
     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
  5649
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5650
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5651
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5652
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5653
enableTimer:milliSeconds
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5654
    "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
  5655
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5656
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5657
    int millis;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5658
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5659
    millis = __intVal(milliSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5660
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5661
#ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5662
    {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5663
	static int firstCall = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5664
# ifndef __signalTimerInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5665
	extern void __signalTimerInterrupt(SIGHANDLER_ARG);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5666
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5667
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5668
	if (firstCall) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5669
# ifdef HAS_SIGACTION
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5670
	    struct sigaction act;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5671
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5672
	    act.sa_flags = SA_SIGINFO; /* <- if you add more, remember dummys at the top */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5673
	    sigemptyset(&act.sa_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5674
	    act.sa_handler = __signalTimerInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5675
	    sigaction(SIGALRM, &act, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5676
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5677
#  ifdef HAS_SIGVEC
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5678
	    struct sigvec vec;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5679
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5680
	    vec.sv_flags = SV_INTERRUPT;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5681
	    sigemptyset(&vec.sv_mask);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5682
	    vec.sv_handler = __signalTimerInterrupt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5683
	    sigvec(SIGALRM, &vec, NULL);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5684
#  else /* neither SIGACTION nor SIGVEC */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5685
	    signal(SIGALRM, __signalTimerInterrupt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5686
#  endif /* stupid system  */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5687
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5688
	    firstCall = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5689
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5690
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5691
#endif /* SIGALRM */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5692
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5693
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5694
#if defined(ITIMER_REAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5695
    {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5696
	struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5697
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5698
	dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5699
	dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5700
	dt.it_value.tv_sec = millis / 1000;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5701
	dt.it_value.tv_usec = (millis % 1000) * 1000;  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5702
	setitimer(ITIMER_REAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5703
	RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5704
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5705
#else /* no ITIMER_REAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5706
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5707
# ifdef USE_SLOW_ALARM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5708
    {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5709
	/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5710
	 * last fallback - use alarm (which only gives 1 second resolution).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5711
	 * If the system does not support any of the above, you have to life
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5712
	 * with this. The consequence is that pressing CTRL-C processing and
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5713
	 * thread switching will take place much delayed.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5714
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5715
	alarm(1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5716
	RETURN(true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5717
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5718
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5719
#endif /* ITIMER_REAL */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5720
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5721
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5722
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5723
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5724
killProcess:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5725
    "kill a unix process.
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5726
     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
  5727
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5728
     WARNING: in order to avoid zombie processes (on unix),
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  5729
	      you may have to fetch the processes exitstatus with
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  5730
	      UnixOperatingSystem>>getStatusOfProcess:aProcessId."
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5731
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5732
    self sendSignal:(self sigKILL) to:processId.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5733
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5734
    "Modified: / 10.6.1998 / 11:59:12 / cg"
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5735
!
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5736
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5737
killProcessGroup:processGroupId
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5738
    "kill a unix process group.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5739
     The process has a no chance to do some cleanup.
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5740
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5741
     WARNING: in order to avoid zombie processes (on unix),
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  5742
	      you may have to fetch the processes exitstatus with
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  5743
	      UnixOperatingSystem>>getStatusOfProcess:aProcessId."
3541
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5744
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5745
    self sendSignal:(self sigKILL) to:(processGroupId negated).
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5746
7391c94f47b3 added killProcess / killProcessGroup
Claus Gittinger <cg@exept.de>
parents: 3540
diff changeset
  5747
    "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
  5748
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5749
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5750
sendSignal:signalNumber to:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5751
    "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
  5752
     Returns false if any error occurred, true otherwise.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5753
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5754
     Do not confuse UNIX signals with Smalltalk-Signals.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5755
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5756
     WARNING: in order to avoid zombie processes (on unix),
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5757
	      you may have to fetch the processes exitstatus with
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5758
	      UnixOperatingSystem>>getStatusOfProcess:aProcessId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5759
	      if the signal terminates that process."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5760
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5761
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5762
#ifndef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5763
    if (__bothSmallInteger(signalNumber, processId)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5764
	if (kill(__intVal(processId), __intVal(signalNumber)) < 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5765
	    @global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5766
	    RETURN ( false );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5767
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5768
	RETURN ( true );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5769
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5770
#endif
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
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5773
    "/ either invalid argument (non-integers)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5774
    "/ or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5775
    "/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5776
    ^ self primitiveFailed
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
startSpyTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5780
    "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
  5781
     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
  5782
     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
  5783
     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
  5784
     (which is of course less correct).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5785
     OBSOLETE: the new messageTally runs as a high prio process, not using 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5786
	       spy interrupts."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5787
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5788
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5789
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5790
#ifndef __spyInterrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5791
    extern void __spyInterrupt();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5792
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5793
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5794
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5795
    struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5796
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5797
# ifdef SIGVTALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5798
    signal(SIGVTALRM, __spyInterrupt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5799
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5800
#  ifdef SIGALRM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5801
    signal(SIGALRM, __spyInterrupt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5802
#  else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5803
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5804
     * mhmh - system has neither SIGBTALRM nor SIGALRM ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5805
     * what should we do here ?
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
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5808
# endif
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
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5811
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5812
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5813
    dt.it_value.tv_usec = 1000;   /* 1000 Hz */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5814
    setitimer(ITIMER_VIRTUAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5815
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5816
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5817
#endif /* ITIMER_VIRTUAL */
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
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5820
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5821
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5822
stopSpyTimer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5823
    "stop spy timing - disable spy timer.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5824
     OBSOLETE: the new messageTally runs as a high prio process, not using 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5825
	       spy interrupts."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5826
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5827
%{  /* NOCONTEXT */
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
#if defined(ITIMER_VIRTUAL) && !defined(NO_SETITIMER)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5830
    struct itimerval dt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5831
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5832
    dt.it_interval.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5833
    dt.it_interval.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5834
    dt.it_value.tv_sec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5835
    dt.it_value.tv_usec = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5836
    setitimer(ITIMER_VIRTUAL, &dt, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5837
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5838
#endif /* ITIMER_VIRTUAL */
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
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5841
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5842
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5843
terminateProcess:processId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5844
    "terminate a unix process.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5845
     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
  5846
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5847
     WARNING: in order to avoid zombie processes (on unix),
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5848
	      you may have to fetch the processes exitstatus with
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5849
	      UnixOperatingSystem>>getStatusOfProcess:aProcessId."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5850
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5851
    self sendSignal:(self sigTERM) to:processId.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5852
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5853
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5854
    "Modified: / 27.1.1998 / 20:05:47 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5855
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5856
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5857
terminateProcessGroup:processGroupId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5858
    "terminate a unix process group.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5859
     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
  5860
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5861
     WARNING: in order to avoid zombie processes (on unix),
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5862
	      you may have to fetch the processes exitstatus with
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5863
	      UnixOperatingSystem>>getStatusOfProcess:aProcessId."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5864
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5865
    self sendSignal:(self sigTERM) to:(processGroupId negated).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5866
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5867
    "Modified: / 28.12.1995 / 15:05:37 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5868
    "Created: / 23.4.1996 / 16:40:34 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5869
    "Modified: / 27.1.1998 / 20:05:59 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5870
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5871
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5872
!UnixOperatingSystem class methodsFor:'ipc support - UNIX'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  5873
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5874
makePTYPair
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5875
    "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
  5876
     nil on failure.
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5877
     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
  5878
     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
  5879
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5880
    |fdS fdM|    
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5881
                
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5882
%{       
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5883
    /*
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5884
     * Find a pseudo tty to use and open both sides.
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5885
     *  _fdM receives the master file descriptor while _fdS
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5886
     *  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
  5887
     *  needed in daemons such as rlogind and telnetd.
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5888
     */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5889
3536
adad0d12c9a8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3534
diff changeset
  5890
#ifdef IRIX5
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5891
    int _fdM, _fdS;
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5892
    char *line;
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5893
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5894
    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
  5895
    if ((line != 0) && (_fdM >= 0)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5896
	_fdS = open(line, O_RDWR);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5897
	if (_fdS < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5898
	    (void)close(_fdM);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5899
	    _fdS = _fdM = -1;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5900
	}
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5901
    } else {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5902
	_fdM -1;
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5903
    }
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5904
    if ((_fdM >= 0) && (_fdS >= 0)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5905
	 fdM = __MKSMALLINT(_fdM);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5906
	 fdS = __MKSMALLINT(_fdS);
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  5907
    }
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5908
#   define NO_PTY_TEMPL
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5909
#endif /* IRIX5 */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5910
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5911
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5912
#ifdef LINUX
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5913
#   define PTY_TEMPL    "/dev/ptyXX"
3550
6c3824d07eac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3549
diff changeset
  5914
#   define PTY_1_CHARS  "pqrstuabcdevwxyz"
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5915
#   define PTY_2_CHARS  "0123456789abcdef"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5916
#endif /* LINUX */
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5917
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5918
#ifdef solaris
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5919
#   define PTY_TEMPL    "/dev/ptyXX"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5920
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5921
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5922
#endif /* solaris */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5923
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5924
#ifdef aix
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5925
#   define PTY_TEMPL    "/dev/ptyXX"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5926
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5927
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5928
#endif /* aix */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5929
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5930
#ifdef next3
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5931
#   define PTY_TEMPL    "/dev/ptyXX"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5932
#   define PTY_1_CHARS  "pqr"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5933
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5934
#endif /* next3 */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5935
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5936
#ifdef hpux
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5937
#   define PTY_TEMPL    "/dev/ptyXX"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5938
#   define PTY_1_CHARS  "pqrs"
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5939
#   define PTY_2_CHARS  "0123456789abcdef"
3539
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5940
#endif /* hpux */
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5941
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5942
#if defined(BSD)
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5943
#   define PTY_TEMPL    "/dev/ptyXX"
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5944
#   define PTY_1_CHARS  "p"
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5945
#   define PTY_2_CHARS  "0123456789abcdefghijklmnopqrstuv"
1655aae9d622 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3538
diff changeset
  5946
#endif /* BSD */
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5947
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5948
#ifdef NO_PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5949
# undef PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5950
#endif
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5951
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5952
#ifdef PTY_TEMPL
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5953
#   include <grp.h>
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5954
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5955
    static char line[] = PTY_TEMPL;
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5956
3575
39723f691a0e hp-cc does not recognize const keyword
Claus Gittinger <cg@exept.de>
parents: 3571
diff changeset
  5957
    register CONST char *cp1, *cp2;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5958
    int _fdM = -1, _fdS = -1, ttygid;
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5959
    struct group *gr;
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5960
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5961
    if ((gr = getgrnam("tty")) != NULL)
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5962
	ttygid = gr->gr_gid;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5963
    else
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5964
	ttygid = -1;
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5965
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5966
    for (cp1 = PTY_1_CHARS; *cp1; cp1++) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5967
	line[sizeof(line)-1-2] = * cp1;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5968
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5969
	for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5970
	    line[5] = 'p';
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5971
	    line[sizeof(line)-1-1] = *cp2;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5972
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5973
	    if ((_fdM = open(line, O_RDWR, 0)) == -1) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5974
		if (errno == ENOENT) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5975
		    _fdM = _fdS = -1;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5976
		    goto getOutOfHere; /* out of ptys */
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5977
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5978
	    } else {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5979
		line[5] = 't';
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5980
		(void) chown( line, getuid(), ttygid );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5981
		(void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5982
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5983
		if( (_fdS = open(line, O_RDWR, 0)) != -1 ) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5984
		    goto getOutOfHere;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5985
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5986
		(void) close( _fdM );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5987
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5988
	}
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5989
    }
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5990
  getOutOfHere: ;
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5991
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5992
    if ((_fdM >= 0) && (_fdS >= 0)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5993
	 fdM = __MKSMALLINT(_fdM);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  5994
	 fdS = __MKSMALLINT(_fdS);
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5995
    }
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5996
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  5997
#endif /* PTY_TEMPL */
3542
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5998
#undef NO_PTY_TEMPL
b6e8232516c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3541
diff changeset
  5999
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  6000
%}.
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  6001
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  6002
    fdM notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6003
	^ Array with:fdM with:fdS.
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  6004
    ].
3538
fcedde036bc3 added makePTYPair for others
Claus Gittinger <cg@exept.de>
parents: 3536
diff changeset
  6005
3534
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  6006
    ^ nil
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  6007
!
126b23939933 added makePTYPair (IRIX only - for now)
Claus Gittinger <cg@exept.de>
parents: 3518
diff changeset
  6008
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6009
makePipe
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6010
    "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
  6011
     nil on failure.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6012
     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
  6013
     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
  6014
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6015
    |fd1 fd2|    
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6016
                
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6017
%{       
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6018
     int fds[2];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6019
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6020
     if (pipe(fds) < 0) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6021
	@global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6022
	RETURN ( nil );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6023
     }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6024
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6025
     fd1 = __MKSMALLINT(fds[0]);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6026
     fd2 = __MKSMALLINT(fds[1]);
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
    fd1 notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6029
	^ Array with:fd1 with:fd2.
3496
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
    ^ nil
3556
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6032
!
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6033
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6034
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
  6035
    "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
  6036
%{
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6037
#ifdef TIOCSWINSZ
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6038
    struct winsize wsize;
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6039
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6040
    if (__isSmallInteger(fd)
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6041
     && __isSmallInteger(w)
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6042
     && __isSmallInteger(h)) {
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6043
	wsize.ws_row = (unsigned short)__intVal(h);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6044
	wsize.ws_col = (unsigned short)__intVal(w);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6045
	if (ioctl(__intVal(fd), TIOCSWINSZ, (char *)&wsize) >= 0) {
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6046
	    RETURN (true);
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  6047
	}
3556
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6048
    }
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6049
#endif
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6050
%}.
03e4132de6da added ioctl to change a pseudo-terminals window size
Claus Gittinger <cg@exept.de>
parents: 3555
diff changeset
  6051
    ^ false
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6052
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6053
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6054
!UnixOperatingSystem class methodsFor:'misc'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6055
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6056
closePid:pid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6057
    "free pid resource"
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  6058
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6059
    ^ true.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6060
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  6061
    "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
  6062
    "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
  6063
    "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
  6064
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6065
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6066
slowFork:aBoolean
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6067
    "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
  6068
     Only used internally on SYSV3 systems"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6069
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6070
    SlowFork := aBoolean
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
    "Modified: 22.4.1996 / 13:13:09 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6073
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6074
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6075
!UnixOperatingSystem class methodsFor:'os queries'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6076
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6077
executableFileExtensions
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6078
    "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
  6079
     Only req'd for msdos like systems ..."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6080
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6081
    ^ #('')
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6082
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  6083
    "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
  6084
    "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
  6085
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6086
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6087
getDomainName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6088
    "return the domain this host is in.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6089
     Notice:
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6090
	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
  6091
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6092
    |name idx hostName|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6093
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6094
    DomainName notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6095
	^ DomainName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6096
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6097
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6098
%{  /* STACK: 2048 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6099
#if defined(HAS_GETDOMAINNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6100
    char buffer[128];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6101
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6102
    if (getdomainname(buffer, sizeof(buffer)) == 0) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6103
	name = __MKSTRING(buffer);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6104
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6105
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6106
# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6107
    struct utsname ubuff;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6108
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6109
    if (uname(&ubuff) >= 0) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6110
	name = __MKSTRING(ubuff.domainname);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6111
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6112
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6113
#  if defined(HAS_SYSINFO) && defined(SI_SRPC_DOMAIN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6114
    char buffer[256];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6115
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6116
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6117
    if ((ret = sysinfo(SI_SRPC_DOMAIN, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6118
	name = __MKSTRING(buffer);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6119
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6120
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6121
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6122
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6123
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6124
    name isNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6125
	name := self getEnvironment:'DOMAIN'.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6126
	name isNil ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6127
	    UnixOperatingSystem isUNIXlike ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6128
		name := self getCommandOutputFrom:'domainname'
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6129
	    ]
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6130
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6131
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6132
    name isNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6133
	"/ sometimes, we can extract the domainName from the hostName ...
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6134
	hostName := self getHostName.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6135
	hostName notNil ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6136
	    idx := hostName indexOf:$..
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6137
	    idx ~~ 0 ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6138
		name := hostName copyFrom:idx+1.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6139
	    ]
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6140
	]. 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6141
	name isNil ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6142
	    'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6143
	    name := 'unknown'.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6144
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6145
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6146
    DomainName := name.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6147
    ^ name
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6148
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6149
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6150
     UnixOperatingSystem getDomainName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6151
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6152
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6153
    "Modified: 26.4.1996 / 10:04:54 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6154
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6155
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6156
getEnvironment:aStringOrSymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6157
    "get an environment string"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6158
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6159
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6160
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6161
    char *env;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6162
    extern char *getenv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6163
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6164
    if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6165
	env =  getenv(__stringVal(aStringOrSymbol));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6166
	if (env) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6167
	    RETURN ( __MKSTRING(env) );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6168
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6169
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6170
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6171
.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6172
    ^ nil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6173
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6174
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6175
     UnixOperatingSystem getEnvironment:'LANG'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6176
     UnixOperatingSystem getEnvironment:'LOGIN'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6177
     UnixOperatingSystem getEnvironment:'HOME'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6178
     UnixOperatingSystem getEnvironment:'NNTPSERVER'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6179
     UnixOperatingSystem getEnvironment:'MAIL'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6180
     UnixOperatingSystem getEnvironment:'PATH'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6181
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6182
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6183
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6184
getHostName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6185
    "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
  6186
     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
  6187
     Notice:
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6188
	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
  6189
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6190
    |name idx|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6191
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6192
    HostName notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6193
	^ HostName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6194
    ].
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
%{  /* STACK: 2048 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6197
#if defined(HAS_GETHOSTNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6198
    char buffer[256];
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
    if (gethostname(buffer, sizeof(buffer)) == 0) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6201
	name = __MKSTRING(buffer);
3496
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
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6204
# if defined(HAS_UNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6205
    struct utsname ubuff;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6206
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6207
    if (uname(&ubuff) >= 0) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6208
	name = __MKSTRING(ubuff.nodename);
3496
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
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6211
#  if defined(HAS_SYSINFO) && defined(SI_HOSTNAME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6212
    char buffer[256];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6213
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6214
 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6215
    if ((ret = sysinfo(SI_HOSTNAME, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6216
	name = __MKSTRING(buffer);
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  6217
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6218
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6219
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6220
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6221
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6222
    name isNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6223
	name := self getEnvironment:'HOST'.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6224
	name isNil ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6225
	    UnixOperatingSystem isUNIXlike ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6226
		name := self getCommandOutputFrom:'hostname'
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6227
	    ]
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6228
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6229
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6230
    name isNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6231
	'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6232
	name := 'unknown'.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6233
    ] ifFalse:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6234
	"/ on some systems, the hostname already contains the domain.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6235
	"/ decompose it here.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6236
	idx := name indexOf:$..
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6237
	idx ~~ 0 ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6238
	    DomainName := name copyFrom:(idx+1).
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6239
	    name := name copyTo:(idx-1).
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6240
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6241
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6242
    HostName := name.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6243
    ^ name
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6244
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6245
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6246
     UnixOperatingSystem getHostName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6247
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6248
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6249
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6250
getLocaleInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6251
    "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
  6252
     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
  6253
     Possible fields are:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6254
	decimalPoint                    <String>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6255
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6256
	thousandsSep                    <String>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6257
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6258
	internationalCurrencySymbol     <String>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6259
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6260
	currencySymbol                  <String>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6261
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6262
	monetaryDecimalPoint            <String>
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
	monetaryThousandsSeparator      <String>
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
	positiveSign                    <String>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6267
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6268
	negativeSign                    <String>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6269
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6270
	internationalFractionalDigits   <Integer>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6271
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6272
	fractionalDigits                <Integer>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6273
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6274
	positiveSignPrecedesCurrencySymbol      <Boolean>
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
	negativeSignPrecedesCurrencySymbol      <Boolean>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6277
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6278
	positiveSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6279
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6280
	negativeSignSeparatedBySpaceFromCurrencySymbol  <Boolean>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6281
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6282
	positiveSignPosition                            <Symbol>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6283
							one of: #parenthesesAround, 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6284
								#signPrecedes, 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6285
								#signSuceeds, 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6286
								#signPrecedesCurrencySymbol,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6287
								#signSuceedsCurrencySymbol
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6288
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6289
	negativeSignPosition                            <like above>
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6290
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6291
     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
  6292
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6293
     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
  6294
     it should be used by applications as required.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6295
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6296
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6297
    |info val|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6298
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6299
    LocaleInfo notNil ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6300
	"/ return the internal info; useful on systems which do not
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6301
	"/ support this.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6302
	^ LocaleInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6303
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6304
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6305
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6306
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6307
    char *decimalPoint;         /* something like "." (US) or "," (german) */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6308
    char *thousandsSep;         /* something like "," (US) or "." (german) */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6309
    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
  6310
    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
  6311
    char *monDecimalPoint;      /* money: decimal point */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6312
    char *monThousandsSep;      /* money: thousands sep */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6313
    char *positiveSign;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6314
    char *negativeSign;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6315
    int   intFractDigits;       /* money: international digits after decPoint */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6316
    int   fractDigits;          /* money: local digits after decPoint */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6317
    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
  6318
    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
  6319
    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
  6320
    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
  6321
    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
  6322
    int   csNegSignPosition;    /*        1: sign precedes the value & currency symbol */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6323
				/*        2: sign succeeds the value & currency symbol */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6324
				/*        3: sign immediately precedes the currency symbol */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6325
				/*        4: sign immediately suceeds the currency symbol */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6326
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6327
#if defined(HAS_LOCALECONV)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6328
    struct lconv *conf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6329
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6330
    conf = localeconv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6331
    if (conf) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6332
	decimalPoint = conf->decimal_point;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6333
	thousandsSep = conf->thousands_sep;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6334
	intCurrencySymbol = conf->int_curr_symbol;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6335
	currencySymbol = conf->currency_symbol;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6336
	monDecimalPoint = conf->mon_decimal_point;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6337
	monThousandsSep = conf->mon_thousands_sep;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6338
	positiveSign = conf->positive_sign;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6339
	negativeSign = conf->negative_sign;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6340
	intFractDigits = conf->int_frac_digits;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6341
	fractDigits = conf->frac_digits;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6342
	csPosPrecedes = conf->p_cs_precedes; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6343
	csNegPrecedes = conf->n_cs_precedes; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6344
	csPosSepBySpace = conf->p_sep_by_space; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6345
	csNegSepBySpace = conf->n_sep_by_space; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6346
	csPosSignPosition = conf->p_sign_posn;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6347
	csNegSignPosition = conf->n_sign_posn;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6348
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6349
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6350
    decimalPoint = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6351
    thousandsSep = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6352
    intCurrencySymbol = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6353
    currencySymbol = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6354
    monDecimalPoint = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6355
    monThousandsSep = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6356
    positiveSign =  (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6357
    negativeSign =(char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6358
    intFractDigits = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6359
    fractDigits = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6360
    csPosPrecedes = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6361
    csNegPrecedes = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6362
    csPosSepBySpace = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6363
    csNegSepBySpace = -1; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6364
    csPosSignPosition = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6365
    csNegSignPosition = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6366
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6367
    if (decimalPoint) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6368
	val = __MKSTRING(decimalPoint);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6369
	__AT_PUT_(info, @symbol(decimalPoint), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6370
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6371
    if (thousandsSep) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6372
	val = __MKSTRING(thousandsSep);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6373
	__AT_PUT_(info, @symbol(thousandsSeparator), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6374
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6375
    if (intCurrencySymbol) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6376
	val = __MKSTRING(intCurrencySymbol);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6377
	__AT_PUT_(info, @symbol(internationCurrencySymbol), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6378
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6379
    if (currencySymbol) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6380
	val = __MKSTRING(currencySymbol);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6381
	__AT_PUT_(info, @symbol(currencySymbol), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6382
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6383
    if (monDecimalPoint) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6384
	val = __MKSTRING(monDecimalPoint);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6385
	__AT_PUT_(info, @symbol(monetaryDecimalPoint), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6386
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6387
    if (monThousandsSep) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6388
	val = __MKSTRING(monThousandsSep);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6389
	__AT_PUT_(info, @symbol(monetaryThousandsSeparator), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6390
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6391
    if (positiveSign) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6392
	val = __MKSTRING(positiveSign);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6393
	__AT_PUT_(info, @symbol(positiveSign), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6394
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6395
    if (negativeSign) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6396
	val = __MKSTRING(negativeSign);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6397
	__AT_PUT_(info, @symbol(negativeSign), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6398
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6399
    if (intFractDigits >= 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6400
	__AT_PUT_(info, @symbol(internationalFractionalDigits),  __MKSMALLINT(intFractDigits));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6401
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6402
    if (fractDigits >= 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6403
	__AT_PUT_(info, @symbol(fractionalDigits),  __MKSMALLINT(fractDigits));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6404
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6405
    if (csPosPrecedes >= 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6406
	if (csPosPrecedes == 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6407
	    val = false;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6408
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6409
	    val = true;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6410
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6411
	__AT_PUT_(info, @symbol(positiveSignPrecedesCurrencySymbol), val );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6412
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6413
    if (csNegPrecedes >= 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6414
	if (csNegPrecedes == 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6415
	    val = false;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6416
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6417
	    val = true;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6418
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6419
	__AT_PUT_(info, @symbol(negativeSignPrecedesCurrencySymbol), val );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6420
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6421
    if (csPosSepBySpace >= 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6422
	if (csPosSepBySpace == 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6423
	    val = false;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6424
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6425
	    val = true;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6426
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6427
	__AT_PUT_(info, @symbol(positiveSignSeparatedBySpaceFromCurrencySymbol), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6428
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6429
    if (csNegSepBySpace >= 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6430
	if (csNegSepBySpace == 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6431
	    val = false;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6432
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6433
	    val = true;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6434
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6435
	__AT_PUT_(info, @symbol(negativeSignSeparatedBySpaceFromCurrencySymbol), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6436
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6437
    switch (csPosSignPosition) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6438
	case 0:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6439
	    val = @symbol(parenthesesAround);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6440
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6441
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6442
	case 1:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6443
	    val = @symbol(signPrecedes);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6444
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6445
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6446
	case 2:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6447
	    val = @symbol(signSuceeds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6448
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6449
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6450
	case 3:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6451
	    val = @symbol(signPrecedesCurrencySymbol);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6452
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6453
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6454
	case 4:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6455
	    val = @symbol(signSuceedsCurrencySymbol);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6456
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6457
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6458
	default:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6459
	    val = nil;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6460
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6461
    if (val != nil) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6462
	__AT_PUT_(info, @symbol(positiveSignPosition), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6463
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6464
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6465
    switch (csNegSignPosition) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6466
	case 0:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6467
	    val = @symbol(parenthesesAround);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6468
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6469
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6470
	case 1:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6471
	    val = @symbol(signPrecedes);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6472
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6473
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6474
	case 2:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6475
	    val = @symbol(signSuceeds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6476
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6477
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6478
	case 3:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6479
	    val = @symbol(signPrecedesCurrencySymbol);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6480
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6481
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6482
	case 4:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6483
	    val = @symbol(signSuceedsCurrencySymbol);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6484
	    break;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6485
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6486
	default:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6487
	    val = nil;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6488
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6489
    if (val != nil) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6490
	__AT_PUT_(info, @symbol(negativeSignPosition), val);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6491
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6492
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6493
    ^ info
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6494
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6495
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6496
     UnixOperatingSystem getLocaleInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6497
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6498
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6499
    "Created: 23.12.1995 / 14:19:20 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6500
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6501
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6502
getProcessId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6503
    "return the (unix-)processId"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6504
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6505
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6506
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6507
    int pid = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6508
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6509
    pid = getpid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6510
    RETURN ( __MKSMALLINT(pid) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6511
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6512
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6513
     UnixOperatingSystem getProcessId
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6514
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6515
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6516
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6517
getSystemID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6518
    "if supported by the OS, return the systemID;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6519
     a unique per machine identification.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6520
     WARNING:
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6521
	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
  6522
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6523
%{  /* NO_CONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6524
#if defined(IRIX5) && !defined(HAS_GETHOSTID)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6525
    char idBuffer[MAXSYSIDSIZE];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6526
    int retVal;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6527
    OBJ arr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6528
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6529
    if ((retVal = syssgi(SGI_SYSID, idBuffer)) == 0) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6530
	arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6531
	bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6532
	RETURN (arr);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6533
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6534
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6535
#if defined(HAS_GETHOSTID)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6536
    int runningId;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6537
    OBJ arr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6538
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6539
    runningId = gethostid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6540
    arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(4);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6541
    *(int *)(__ByteArrayInstPtr(arr)->ba_element) = runningId;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6542
    RETURN (arr);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6543
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6544
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6545
    {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6546
	char buffer[128];
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6547
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6548
	buffer[0] = 0;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6549
	if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6550
	    buffer[127] = 0;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6551
	    if (strlen(buffer) > 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6552
		RETURN(__MKSTRING(buffer));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6553
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  6554
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6555
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6556
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6557
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6558
    ^ 'unknown'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6559
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6560
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6561
     UnixOperatingSystem getSystemID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6562
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6563
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6564
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6565
getSystemInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6566
    "return info on the system weare running on.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6567
     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
  6568
     otherwise, some simulated info is returned.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6569
 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6570
     WARNING:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6571
       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
  6572
       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
  6573
       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
  6574
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6575
       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
  6576
       information. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6577
       (in case of system/version specific OS errors, conditional workarounds and patches
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6578
        may be based upon this info).
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6579
       Your application should NOT depend upon this in any way.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6580
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6581
     The returned info may (or may not) contain:
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6582
        #system -> some operating system identification (irix, Linux, nt, win32s ...) 
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6583
        #version -> OS version (some os version identification)
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6584
        #release -> OS release (3.5, 1.2.1 ...)
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6585
        #node   -> some host identification (hostname)
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6586
        #domain  -> domain name (hosts domain)
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6587
        #machine -> type of CPU (i586, mips ...)
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6588
     
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6589
     those are currently returned on some machines (no warranty)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6590
     linux:
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6591
        #totalRam -> total amount of memory available
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6592
        #sharedRam -> amount of memory which is shared among processes
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6593
                      (i.e. shared code)
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6594
        #bufferRam -> amount used for buffers
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6595
        #swapSize -> total size of swap space
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6596
        #freeSwap -> free amount in swapSpace
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6597
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6598
     osf:
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6599
        #physicalRam -> total amount of physical memory
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6600
        #cpuType -> type of cpu (more detailed than machine)
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6601
        #numberOfCPUs -> number of cpus in box
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6602
        
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6603
     solaris:
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6604
        #physicalRam -> total amount of physical memory
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6605
        #numberOfCPUs -> number of cpus in box
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6606
	#dCacheSize -> bytes in data cache
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6607
	#iCacheSize -> bytes in data cache
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6608
    "
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6609
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6610
    |sys node rel ver mach dom mtyp brel info arch cpuType
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6611
     physicalRam totalRam sharedRam bufferRam swapSize freeSwap
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6612
     numberOfCPUs pageSize physicalPages dCacheSize iCacheSize|
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6613
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6614
%{  /* STACK: 4096 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6615
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6616
#ifdef LINUX
3696
a0c77f9bdbc7 oops - a.out linux has no sysinfo
Claus Gittinger <cg@exept.de>
parents: 3692
diff changeset
  6617
# 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
  6618
    /* 
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6619
     * additional info available ...
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6620
     */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6621
    struct sysinfo infoBuffer;
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6622
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6623
    if (sysinfo(&infoBuffer) >= 0) {
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6624
        totalRam   = __MKUINT(infoBuffer.totalram);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6625
        sharedRam = __MKUINT(infoBuffer.sharedram);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6626
        bufferRam = __MKUINT(infoBuffer.bufferram);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6627
        swapSize  = __MKUINT(infoBuffer.totalswap);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6628
        freeSwap  = __MKUINT(infoBuffer.freeswap);
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6629
    }
3696
a0c77f9bdbc7 oops - a.out linux has no sysinfo
Claus Gittinger <cg@exept.de>
parents: 3692
diff changeset
  6630
# endif
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6631
#endif /* LINUX */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6632
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6633
#if defined(HAS_UNAME)
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6634
    {
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6635
        struct utsname ubuff;
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6636
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6637
        if (uname(&ubuff) >= 0) {
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6638
            sys  = __MKSTRING(ubuff.sysname);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6639
            node = __MKSTRING(ubuff.nodename);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6640
            rel  = __MKSTRING(ubuff.release);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6641
            ver  = __MKSTRING(ubuff.version);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6642
            mach = __MKSTRING(ubuff.machine);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6643
# ifdef HAS_UTS_DOMAINNAME
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6644
            dom  = __MKSTRING(ubuff.domainname);
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6645
# endif /* no HAS_UTS_DOMAINNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6646
        }
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6647
    }
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6648
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6649
#else /* no UNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6650
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6651
    /*
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6652
     * use fallBack code below
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6653
     */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6654
#endif /* no UNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6655
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6656
#if defined(HAS_SYSINFO) && defined(SI_ARCHITECTURE)
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6657
    if (arch == nil) {
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6658
        char buffer[128];
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6659
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6660
        if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6661
            arch = __MKSTRING(buffer);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6662
        }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  6663
    }
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6664
#endif /* HAS_SYSINFO & SI_ARCHITECTURE */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6665
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6666
#if defined(HAS_GETDOMAINNAME)
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6667
    if (dom == nil) {
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6668
        char buffer[128];
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6669
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6670
        if (getdomainname(buffer, sizeof(buffer)) == 0) {
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6671
            dom = __MKSTRING(buffer);
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  6672
        }
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6673
    }
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6674
#endif /* HAS_GETDOMAINNAME */
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  6675
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6676
#if defined(HAS_SYSCONF)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6677
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6678
# ifdef _SC_NPROCESSORS_ONLN
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6679
    {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6680
	long val;
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6681
 
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6682
        val = sysconf(_SC_NPROCESSORS_ONLN);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6683
	if (val > 0) {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6684
	    numberOfCPUs = __MKINT(val);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6685
	}
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6686
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6687
# endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6688
# if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6689
    {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6690
	long val;
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6691
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6692
	val = sysconf(_SC_PHYS_PAGES);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6693
	if (val != -1) {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6694
	    physicalPages = __MKUINT(val);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6695
	    val = sysconf(_SC_PAGESIZE);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6696
	    if (val != -1) {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6697
	        pageSize = __MKUINT(val);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6698
	    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6699
	}
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6700
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6701
# endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6702
# if defined(_SC_ICACHE_SZ)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6703
    {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6704
	long val;
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6705
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6706
	val = sysconf(_SC_ICACHE_SZ);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6707
	if (val != -1) {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6708
	    iCacheSize = __MKUINT(val);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6709
	}
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6710
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6711
# endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6712
# if defined(_SC_DCACHE_SZ)
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6713
    {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6714
        long val;
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6715
 
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6716
        val = sysconf(_SC_DCACHE_SZ);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6717
        if (val != -1) {
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6718
            dCacheSize = __MKUINT(val);
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6719
        }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6720
    }
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6721
# endif
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6722
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6723
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6724
#endif /* HAS_SYSCONF */
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  6725
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6726
#if defined(HAS_GETSYSTEMINFO)
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6727
    {
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6728
        INT index;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6729
        int retInt32 = 0;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6730
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6731
# if defined(GSI_CPU)
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6732
        index = 0;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6733
        if (getsysinfo(GSI_CPU, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6734
            switch (retInt32) {
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6735
#  ifdef VAX_780
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6736
                case VAX_780:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6737
                    cpuType = __MKSTRING("VAX_780");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6738
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6739
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6740
#  ifdef VAX_750
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6741
                case VAX_750:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6742
                    cpuType = __MKSTRING("VAX_750");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6743
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6744
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6745
#  ifdef VAX_730
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6746
                case VAX_730:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6747
                    cpuType = __MKSTRING("VAX_730");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6748
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6749
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6750
#  ifdef VAX_8600
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6751
                case VAX_8600:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6752
                    cpuType = __MKSTRING("VAX_8600");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6753
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6754
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6755
#  ifdef VAX_8200
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6756
                case VAX_8200:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6757
                    cpuType = __MKSTRING("VAX_8200");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6758
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6759
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6760
#  ifdef VAX_8800
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6761
                case VAX_8800:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6762
                    cpuType = __MKSTRING("VAX_8800");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6763
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6764
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6765
#  ifdef MVAX_I
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6766
                case MVAX_I:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6767
                    cpuType = __MKSTRING("MVAX_I");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6768
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6769
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6770
#  ifdef MVAX_II
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6771
                case MVAX_II:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6772
                    cpuType = __MKSTRING("MVAX_II");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6773
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6774
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6775
#  ifdef V_VAX
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6776
                case V_VAX:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6777
                    cpuType = __MKSTRING("V_VAX");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6778
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6779
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6780
#  ifdef VAX_3600
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6781
                case VAX_3600:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6782
                    cpuType = __MKSTRING("VAX_3600");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6783
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6784
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6785
#  ifdef VAX_6200
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6786
                case VAX_6200:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6787
                    cpuType = __MKSTRING("VAX_6200");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6788
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6789
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6790
#  ifdef VAX_3400
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6791
                case VAX_3400:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6792
                    cpuType = __MKSTRING("VAX_3400");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6793
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6794
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6795
#  ifdef C_VAXSTAR
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6796
                case C_VAXSTAR:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6797
                    cpuType = __MKSTRING("C_VAXSTAR");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6798
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6799
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6800
#  ifdef VAX_60
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6801
                case VAX_60:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6802
                    cpuType = __MKSTRING("VAX_60");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6803
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6804
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6805
#  ifdef VAX_3900
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6806
                case VAX_3900:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6807
                    cpuType = __MKSTRING("VAX_3900");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6808
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6809
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6810
#  ifdef DS_3100
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6811
                case DS_3100:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6812
                    cpuType = __MKSTRING("DS_3100");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6813
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6814
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6815
#  ifdef VAX_8820
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6816
                case VAX_8820:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6817
                    cpuType = __MKSTRING("VAX_8820");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6818
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6819
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6820
#  ifdef DS_5400
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6821
                case DS_5400:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6822
                    cpuType = __MKSTRING("DS_5400");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6823
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6824
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6825
#  ifdef DS_5800
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6826
                case DS_5800:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6827
                    cpuType = __MKSTRING("DS_5800");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6828
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6829
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6830
#  ifdef DS_5000
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6831
                case DS_5000:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6832
                    cpuType = __MKSTRING("DS_5000");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6833
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6834
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6835
#  ifdef DS_CMAX
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6836
                case DS_CMAX:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6837
                    cpuType = __MKSTRING("DS_CMAX");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6838
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6839
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6840
#  ifdef VAX_6400
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6841
                case VAX_6400:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6842
                    cpuType = __MKSTRING("VAX_6400");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6843
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6844
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6845
#  ifdef VAXSTAR
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6846
                case VAXSTAR:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6847
                    cpuType = __MKSTRING("VAXSTAR");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6848
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6849
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6850
#  ifdef DS_5500
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6851
                case DS_5500:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6852
                    cpuType = __MKSTRING("DS_5500");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6853
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6854
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6855
#  ifdef DS_5100
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6856
                case DS_5100:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6857
                    cpuType = __MKSTRING("DS_5100");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6858
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6859
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6860
#  ifdef VAX_9000
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6861
                case VAX_9000:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6862
                    cpuType = __MKSTRING("VAX_9000");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6863
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6864
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6865
#  ifdef DS_500_100
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6866
                case DS_500_100:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6867
                    cpuType = __MKSTRING("DS_500_100");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6868
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6869
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6870
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6871
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6872
#  ifdef ALPHA_ADU
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6873
                case ALPHA_ADU:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6874
                    cpuType = __MKSTRING("ALPHA_ADU");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6875
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6876
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6877
#  ifdef DEC_4000
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6878
                case DEC_4000:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6879
                    cpuType = __MKSTRING("DEC_4000");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6880
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6881
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6882
#  ifdef DEC_3000_500
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6883
                case DEC_3000_500:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6884
                    cpuType = __MKSTRING("DEC_3000_500");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6885
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6886
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6887
#  ifdef DEC_7000
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6888
                case DEC_7000:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6889
                    cpuType = __MKSTRING("DEC_7000");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6890
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6891
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6892
#  ifdef DS_5000_300
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6893
                case DS_5000_300:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6894
                    cpuType = __MKSTRING("DS_5000_300");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6895
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6896
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6897
#  ifdef DEC_3000_300
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6898
                case DEC_3000_300:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6899
                    cpuType = __MKSTRING("DEC_3000_300");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6900
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6901
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6902
#  ifdef DEC_2000_300
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6903
                case DEC_2000_300:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6904
                    cpuType = __MKSTRING("DEC_2000_300");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6905
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6906
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6907
#  ifdef DEC_2100_A500
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6908
                case DEC_2100_A500:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6909
                    cpuType = __MKSTRING("DEC_2100_A500");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6910
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6911
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6912
#  ifdef DEC_2100_A50
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6913
                case DEC_2100_A50:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6914
                    cpuType = __MKSTRING("DEC_2100_A50");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6915
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6916
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6917
#  ifdef ALPHA_KN20AA
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6918
                case ALPHA_KN20AA:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6919
                    cpuType = __MKSTRING("ALPHA_KN20AA");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6920
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6921
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6922
#  ifdef DEC_21000
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6923
                case DEC_21000:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6924
                    cpuType = __MKSTRING("DEC_21000");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6925
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6926
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6927
#  ifdef DEC_AXPVME_64
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6928
                case DEC_AXPVME_64:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6929
                    cpuType = __MKSTRING("DEC_AXPVME_64");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6930
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6931
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6932
#  ifdef DEC_2100_C500
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6933
                case DEC_2100_C500:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6934
                    cpuType = __MKSTRING("DEC_2100_C500");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6935
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6936
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6937
#  ifdef DEC_AXPPCI_33
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6938
                case DEC_AXPPCI_33:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6939
                    cpuType = __MKSTRING("DEC_AXPPCI_33");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6940
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6941
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6942
#  ifdef DEC_1000
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6943
                case DEC_1000:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6944
                    cpuType = __MKSTRING("DEC_1000");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6945
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6946
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6947
#  ifdef EB64_PLUS
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6948
                case EB64_PLUS:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6949
                    cpuType = __MKSTRING("EB64_PLUS");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6950
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6951
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6952
#  ifdef LCA_EB66
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6953
                case LCA_EB66:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6954
                    cpuType = __MKSTRING("LCA_EB66");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6955
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6956
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6957
#  ifdef ALPHA_EB164
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6958
                case ALPHA_EB164:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6959
                    cpuType = __MKSTRING("ALPHA_EB164");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6960
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6961
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6962
#  ifdef DEC_EV45_PBP
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6963
                case DEC_EV45_PBP:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6964
                    cpuType = __MKSTRING("DEC_EV45_PBP");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6965
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6966
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6967
#  ifdef DEC_1000A
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6968
                case DEC_1000A:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6969
                    cpuType = __MKSTRING("DEC_1000A");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6970
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6971
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6972
#  ifdef DEC_4100
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6973
                case DEC_4100:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6974
                    cpuType = __MKSTRING("DEC_4100");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6975
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6976
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6977
#  ifdef DEC_ALPHAVME_224
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6978
                case DEC_ALPHAVME_224:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6979
                    cpuType = __MKSTRING("DEC_ALPHAVME_224");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6980
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6981
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6982
#  ifdef DEC_1000_5
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6983
                case DEC_1000_5:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6984
                    cpuType = __MKSTRING("DEC_1000_5");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6985
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6986
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6987
#  ifdef DEC_1000A_5
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6988
                case DEC_1000A_5:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6989
                    cpuType = __MKSTRING("DEC_1000A_5");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6990
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6991
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6992
#  ifdef UNKN_SYSTEM
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6993
                case UNKN_SYSTEM:
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6994
                    cpuType = __MKSTRING("UNKN_SYSTEM");
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6995
                    break;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6996
#  endif
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6997
            }
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6998
        }
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  6999
# endif /* GSI_CPU */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7000
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7001
# if defined(GSI_CPUS_IN_BOX)
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7002
        index = 0;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7003
        if (getsysinfo(GSI_CPUS_IN_BOX, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7004
            numberOfCPUs   = __MKUINT(retInt32);
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7005
        }
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7006
# endif /* GSI_CPUS_IN_BOX */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7007
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7008
# if defined(GSI_PHYSMEM)
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7009
        index = 0;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7010
        if (getsysinfo(GSI_PHYSMEM, &retInt32, sizeof(retInt32), &index, NULL) > 0) {
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7011
            INT bytes = retInt32 * 1024;
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7012
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7013
            physicalRam   = __MKUINT(bytes);
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7014
        }
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7015
# endif /* GSI_PHYSMEM */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7016
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7017
    }
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7018
#endif /* HAS_GETSYSTEMINFO */
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7019
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7020
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7021
    sys isNil ifTrue:[
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  7022
        sys := self getSystemType.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7023
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7024
    node isNil ifTrue:[
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  7025
        node := self getHostName.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7026
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7027
    dom isNil ifTrue:[
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  7028
        dom := self getDomainName.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7029
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7030
    mach isNil ifTrue:[
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  7031
        mach := self getCPUType.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7032
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7033
    arch isNil ifTrue:[
3691
985cebf62d06 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3690
diff changeset
  7034
        arch := sys.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7035
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7036
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7037
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7038
    info at:#system put:sys.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7039
    info at:#node put:node.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7040
    rel notNil ifTrue:[info at:#release put:rel].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7041
    ver notNil ifTrue:[info at:#version put:ver].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7042
    mach notNil ifTrue:[info at:#machine put:mach].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7043
    arch notNil ifTrue:[info at:#architecture put:arch].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7044
    dom notNil ifTrue:[info at:#domain put:dom].
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  7045
    (pageSize notNil and:[physicalPages notNil]) ifTrue:[
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  7046
	physicalRam := pageSize * physicalPages. "/ done here - could be largeInt.
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  7047
    ].
3735
3560084b4f83 more sysInfo for alpha systems (cpuType & physicalRam)
Claus Gittinger <cg@exept.de>
parents: 3696
diff changeset
  7048
    physicalRam notNil ifTrue:[info at:#physicalRam put:physicalRam].
3690
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  7049
    totalRam notNil ifTrue:[info at:#totalRam put:totalRam].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  7050
    sharedRam notNil ifTrue:[info at:#sharedRam put:sharedRam].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  7051
    bufferRam notNil ifTrue:[info at:#bufferRam put:bufferRam].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  7052
    swapSize notNil ifTrue:[info at:#swapSize put:swapSize].
7b7c5ff84986 more info in getSystemInfo (linux only)
Claus Gittinger <cg@exept.de>
parents: 3663
diff changeset
  7053
    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
  7054
    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
  7055
    cpuType notNil ifTrue:[info at:#cpuType put:cpuType].
3737
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  7056
    dCacheSize notNil ifTrue:[info at:#dCacheSize put:dCacheSize].
7560b716b2d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3735
diff changeset
  7057
    iCacheSize notNil ifTrue:[info at:#iCacheSize put:iCacheSize].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7058
    info at:#osType put:(self getOSType).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7059
    ^ info
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7060
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7061
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7062
     UnixOperatingSystem getSystemInfo
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7063
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7064
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7065
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7066
getSystemType
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7067
    "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
  7068
     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
  7069
     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
  7070
     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
  7071
     here ... 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7072
     (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
  7073
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7074
    |sys|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7075
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7076
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7077
#   ifdef NEXT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7078
#    define SYS_STRING "next"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7079
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7080
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7081
#   ifdef IRIS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7082
#    define SYS_STRING "iris"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7083
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7084
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7085
#   ifdef SYS_STRING
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7086
     sys = __MKSTRING(SYS_STRING);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7087
#    undef SYS_STRING
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7088
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7089
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7090
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7091
    sys isNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7092
	^ self getOSType
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7093
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7094
    ^ sys
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7095
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7096
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7097
     UnixOperatingSystem getSystemType
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7098
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7099
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7101
isBSDlike
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7102
    "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
  7103
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7104
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7105
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7106
#if defined(BSD) || defined(MACH) || defined(SYSV4)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7107
    RETURN ( true );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7108
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7109
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7110
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7111
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7112
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7113
isUNIXlike
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7114
    "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
  7115
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7116
    ^ true
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7117
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7118
    "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
  7119
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7120
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7121
maxFileNameLength
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7122
    "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
  7123
     CAVEAT:
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7124
	 Actually, the following is somewhat wrong - some systems
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7125
	 support different sizes, depending on the volume.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7126
	 We return a somewhat conservative number here.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7127
	 Another entry, to query for volume specific max
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7128
	 will be added in the future."
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7129
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7130
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7131
 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7132
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7133
     * TODO: newer systems provide a query function for this ... use it
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7134
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7135
#   if defined(BSD) || defined(SYSV4) || defined(LONGFILENAMES)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7136
     RETURN ( __MKSMALLINT(255) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7137
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7138
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7139
#   ifdef realIX
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7140
      RETURN ( __MKSMALLINT(127) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7141
#   endif
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
#   ifdef SYSV
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7144
      RETURN ( __MKSMALLINT(14) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7145
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7146
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7147
    "unix default"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7148
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7149
    ^ 14
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7150
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7151
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7152
maxPathLength
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7153
    "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
  7154
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7155
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7156
    RETURN ( __MKSMALLINT(MAXPATHLEN) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7157
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7158
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7159
     UnixOperatingSystem maxPathLength   
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7162
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7163
pathSeparator
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7164
    "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
  7165
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7166
    ^ $:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7167
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7168
    "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
  7169
    "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
  7170
!
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
platformName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7173
    "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
  7174
     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
  7175
     #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
  7176
     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
  7177
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7178
    ^ #unix
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7179
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7180
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7181
     UnixOperatingSystem platformName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7182
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7183
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7184
    "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
  7185
!
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
setLocaleInfo:anInfoDictionary
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7188
    "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
  7189
     (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
  7190
     See description of fields in #getLocaleInfo.
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
     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
  7193
     it should be used by applications as required."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7194
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7195
    LocaleInfo := anInfoDictionary
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7196
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
     |d|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7199
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7200
     d := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7201
     d at:#decimalPoint                 put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7202
     d at:#thousandsSeparator           put:','         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7203
     d at:#currencySymbol               put:'USD'       .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7204
     d at:#monetaryDecimalPoint         put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7205
     d at:#monetaryThousandsSeparator   put:'.'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7206
     d at:#fractionalDigits             put:2           .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7207
     d at:#positiveSign                 put:'+'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7208
     d at:#negativeSign                 put:'-'         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7209
     d at:#positiveSignPrecedesCurrencySymbol put:true          .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7210
     d at:#negativeSignPrecedesCurrencySymbol put:false         .
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7211
     UnixOperatingSystem setLocaleInfo:d
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7212
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7213
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7214
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7215
supportsChildInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7216
    "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
  7217
     through interrupts (i.e. SIGCHILD)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7218
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7219
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7220
#if defined(SIGCHLD) || defined(SIGCLD) || defined(__VMS__)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7221
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7222
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7223
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7224
    ^ false
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
     UnixOperatingSystem supportsChildInterrupts 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7228
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7229
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7230
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7231
supportsIOInterrupts
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7232
    "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
  7233
     (i.e. SIGPOLL/SIGIO).
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
     Currently, this mechanism does not work on all
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7236
     systems ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7237
    "
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
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7240
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7241
  /* positive defines here
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7242
   *  - irix5.2 does not work
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
#if defined(LINUX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7245
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7246
# if defined(SIGIO) || defined(SIGPOLL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7247
#  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
  7248
#   if defined(F_SETOWN) || defined(FIOSETOWN)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7249
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7250
    RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7251
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7252
#   endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7253
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7254
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7255
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7256
#endif /* machines where it works */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7257
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7258
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7259
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7260
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7261
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7262
     UnixOperatingSystem supportsIOInterrupts 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7263
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7264
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7265
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7266
supportsNonBlockingIO
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7267
    "return true, if the OS supports nonblocking IO."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7268
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7269
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7270
#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
  7271
       RETURN (true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7272
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7273
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7274
    ^ false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7275
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7276
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7277
     UnixOperatingSystem supportsNonBlockingIO  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7278
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7279
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7280
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7281
supportsSelect
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7282
    "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
  7283
     filedescriptors via select.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7284
     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
  7285
     intervals for I/O becoming ready."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7286
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7287
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7288
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7289
#if defined(sco)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7290
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7291
     * 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
  7292
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7293
    RETURN(false);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7294
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7295
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7296
    ^ true
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7297
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7298
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7299
     UnixOperatingSystem supportsSelect 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7300
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7301
3759
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7302
!
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7303
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7304
supportsSymbolicLinks
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7305
    "return true, if the OS supports symbolic (soft) links;
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7306
     most UNIX'es do; many other OS's do not."
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7307
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7308
%{  /* NOCONTEXT */
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7309
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7310
#ifdef S_IFLNK
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7311
    /*
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7312
     * assume yes - if that is defined.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7313
     */
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7314
    RETURN(true);
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7315
#endif
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7316
%}.
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7317
    ^ false
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7318
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7319
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7320
     OperatingSystem supportsSymbolicLinks 
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7321
    "
1601d99a36b5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3737
diff changeset
  7322
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7323
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7324
3558
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7325
!UnixOperatingSystem class methodsFor:'private'!
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7326
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7327
osProcessStatusClass
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7328
    ^ OSProcessStatus
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7329
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7330
    "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
  7331
! !
5a6c4b491b95 oops - OSProcessStatus is only known in a concrete class
Claus Gittinger <cg@exept.de>
parents: 3556
diff changeset
  7332
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7333
!UnixOperatingSystem class methodsFor:'shared memory access'!
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
shmAttach:id address:addr flags:flags
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7336
    "low level entry to shmat()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7337
     Not supported on all operatingSystems"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7338
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7339
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7340
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7341
    void *address, *shmaddr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7342
    int shmflg, shmid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7343
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7344
    if (__isSmallInteger(addr)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7345
     && __bothSmallInteger(flags, id)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7346
	shmaddr = (void *) __intVal(addr);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7347
	shmflg = __intVal(flags);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7348
	shmid = __intVal(id);
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
	address = shmat(shmid, shmaddr, shmflg);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7351
	if (address != (void *)-1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7352
	    RETURN (__MKEXTERNALBYTES(addr));
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
	@global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7355
	RETURN (nil);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7356
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7357
#endif
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
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7360
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7361
    "Modified: 22.4.1996 / 13:15:12 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7362
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7363
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7364
shmDetach:addr
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7365
    "low level entry to shmdt()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7366
     Not supported on all operatingSystems"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7367
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7368
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7369
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7370
    void *shmaddr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7371
    int rslt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7372
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7373
    if (__isSmallInteger(addr)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7374
	shmaddr = (void *) __intVal(addr);
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
	rslt = shmdt(shmaddr);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7377
	if (rslt != -1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7378
	    RETURN (true);
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
	@global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7381
	RETURN (false);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7382
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7383
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7384
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7385
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7386
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7387
    "Modified: 22.4.1996 / 13:15:03 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7388
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7389
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7390
shmGet:key size:size flags:flags
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7391
    "low level entry to shmget()-system call.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7392
     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
  7393
     - use the provided wrapper class SharedExternalBytes instead."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7394
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7395
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7396
#ifdef WANT_SHM
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7397
    if (__bothSmallInteger(key, size)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7398
     && __isSmallInteger(flags)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7399
	int rslt;
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
	rslt = shmget(__intVal(key), __intVal(size), __intVal(flags));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7402
	if (rslt != -1) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7403
	    RETURN (__MKSMALLINT(rslt));
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
	@global(LastErrorNumber) = __MKSMALLINT(errno);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7406
	RETURN (nil);
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
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7409
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7410
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7411
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7412
    "Modified: 22.4.1996 / 13:14:46 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7413
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7414
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7415
!UnixOperatingSystem class methodsFor:'time and date'!
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
computeDatePartsOf:osTime for:aBlock
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7418
    "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
  7419
     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
  7420
     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
  7421
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7422
    |year month day osSeconds|
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
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7425
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7426
    struct tm* tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7427
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7428
    TIME_T tt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7429
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7430
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7431
    tt = (TIME_T)t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7432
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7433
    tmPtr = localtime(&tt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7434
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7435
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7436
    day = __MKSMALLINT(tmPtr->tm_mday);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7437
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7438
    aBlock value:year value:month value:day
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7439
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
     UnixOperatingSystem computeDatePartsOf:0 for:[:y :m :d |
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7442
	y printCR. m printCR. d printCR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7443
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7444
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7445
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7446
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7447
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
  7448
    "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
  7449
     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
  7450
     any daylight saving adjustings."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7451
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7452
    |osSeconds|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7453
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7454
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7455
    struct tm tm;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7456
    TIME_T t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7457
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7458
    if (__bothSmallInteger(y, m) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7459
     && __bothSmallInteger(d, h)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7460
     && __bothSmallInteger(min, s)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7461
	tm.tm_hour = __intVal(h);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7462
	tm.tm_min = __intVal(min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7463
	tm.tm_sec = __intVal(s);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7464
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7465
	tm.tm_year = __intVal(y) - 1900;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7466
	tm.tm_mon = __intVal(m) - 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7467
	tm.tm_mday = __intVal(d);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7468
	tm.tm_isdst = -1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7469
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7470
	t = mktime(&tm);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7471
	osSeconds = __MKUINT((INT)t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7472
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7473
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7474
    osSeconds notNil ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7475
	^ osSeconds * 1000 + millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7476
    ].    
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7477
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7478
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7479
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7480
     UnixOperatingSystem computeOSTimeFromYear:1970 month:1 day:1 hour:0 minute:0 seconds:0 millis:0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7481
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7482
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7483
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7484
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7485
computeTimeAndDateFrom:osTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7486
    "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
  7487
     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
  7488
     offset to UTC, daylight savings time flag, milliseconds,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7489
     dayInYear (1..) and dayInWeek (1..).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7490
     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
  7491
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7492
    |low hi year month day hours minutes seconds millis utcOffset 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7493
     dst yDay wDay osSeconds ret|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7494
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7495
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7496
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7497
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7498
    struct tm *tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7499
    struct tm *gmTmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7500
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7501
    TIME_T tt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7502
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7503
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7504
    tt = (TIME_T)t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7505
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7506
    tmPtr = localtime(&tt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7507
    hours = __MKSMALLINT(tmPtr->tm_hour);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7508
    minutes = __MKSMALLINT(tmPtr->tm_min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7509
    seconds = __MKSMALLINT(tmPtr->tm_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7510
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7511
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7512
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7513
    day = __MKSMALLINT(tmPtr->tm_mday);
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
    yDay = __MKSMALLINT(tmPtr->tm_yday+1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7516
    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7517
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7518
    if (tmPtr->tm_isdst == 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7519
	dst = false;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7520
	utcOffset = __MKINT(TIMEZONE(tmPtr));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7521
    } else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7522
	dst = true;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7523
#ifdef HAS_ALTZONE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7524
	utcOffset = __MKINT(altzone);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7525
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7526
	utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7527
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7528
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7529
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7530
    "I would love to have SELF-like inline objects ..."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7531
    ret := Array new:11.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7532
    ret at:1 put:year.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7533
    ret at:2 put:month.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7534
    ret at:3 put:day.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7535
    ret at:4 put:hours.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7536
    ret at:5 put:minutes.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7537
    ret at:6 put:seconds.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7538
    ret at:7 put:utcOffset.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7539
    ret at:8 put:dst.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7540
    ret at:9 put:millis.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7541
    ret at:10 put:yDay.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7542
    ret at:11 put:wDay.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7543
    ^ ret
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7544
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7545
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7546
     UnixOperatingSystem computeTimeAndDateFrom:0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7547
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7548
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7549
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7550
computeTimePartsOf:osTime for:aBlock
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7551
    "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
  7552
     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
  7553
     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
  7554
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7555
    |hours minutes seconds millis osSeconds|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7556
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7557
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7558
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7559
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7560
    struct tm *tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7561
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7562
    TIME_T tt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7563
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7564
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7565
    tt = (TIME_T)t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7566
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7567
    tmPtr = localtime(&tt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7568
    hours = __MKSMALLINT(tmPtr->tm_hour);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7569
    minutes = __MKSMALLINT(tmPtr->tm_min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7570
    seconds = __MKSMALLINT(tmPtr->tm_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7571
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7572
    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
  7573
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7574
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7575
     UnixOperatingSystem computeTimePartsOf:100 for:[:h :m :s :milli |
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7576
	h printCR. m printCR. s printCR. millis printCR
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7581
computeUTCTimeAndDateFrom:osTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7582
    "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
  7583
     containing year, month, day, hour, minute and seconds,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7584
     offset to UTC, daylight savings time flag, milliseconds,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7585
     dayInYear (1..) and dayInWeek (1..).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7586
     Conversion is to UTC."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7587
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7588
    |low hi year month day hours minutes seconds millis utcOffset 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7589
     dst yDay wDay osSeconds ret|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7590
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7591
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7592
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7593
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7594
    struct tm *tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7595
    struct tm *gmTmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7596
    long t;
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
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7599
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7600
    tmPtr = gmtime(&t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7601
    hours = __MKSMALLINT(tmPtr->tm_hour);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7602
    minutes = __MKSMALLINT(tmPtr->tm_min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7603
    seconds = __MKSMALLINT(tmPtr->tm_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7604
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7605
    year = __MKSMALLINT(tmPtr->tm_year + 1900);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7606
    month = __MKSMALLINT(tmPtr->tm_mon + 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7607
    day = __MKSMALLINT(tmPtr->tm_mday);
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
    yDay = __MKSMALLINT(tmPtr->tm_yday + 1);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7610
    wDay = __MKSMALLINT(tmPtr->tm_wday == 0 ? 7 : tmPtr->tm_wday);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7611
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7612
    if (tmPtr->tm_isdst == 0) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7613
	dst = false;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7614
	utcOffset = __MKINT(TIMEZONE(tmPtr));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7615
    } else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7616
	dst = true;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7617
#ifdef HAS_ALTZONE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7618
	utcOffset = __MKINT(altzone);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7619
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7620
	utcOffset = __MKINT(TIMEZONE(tmPtr) + 3600);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7621
#endif
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
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7624
    "I would love to have SELF-like inline objects ..."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7625
    ret := Array new:11.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7626
    ret at:1 put:year.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7627
    ret at:2 put:month.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7628
    ret at:3 put:day.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7629
    ret at:4 put:hours.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7630
    ret at:5 put:minutes.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7631
    ret at:6 put:seconds.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7632
    ret at:7 put:utcOffset.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7633
    ret at:8 put:dst.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7634
    ret at:9 put:millis.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7635
    ret at:10 put:yDay.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7636
    ret at:11 put:wDay.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7637
    ^ ret
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7638
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7639
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7640
     UnixOperatingSystem computeUTCTimeAndDateFrom:0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7641
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7642
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7643
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7644
computeUTCTimePartsOf:osTime for:aBlock
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7645
    "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
  7646
     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
  7647
     Conversion is to UTC."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7648
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7649
    |hours minutes seconds millis osSeconds|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7650
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7651
    osSeconds := osTime // 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7652
    millis := osTime \\ 1000.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7653
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7654
    struct tm *tmPtr;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7655
    long t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7656
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7657
    t = __longIntVal(osSeconds);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7658
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7659
    tmPtr = gmtime(&t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7660
    hours = __MKSMALLINT(tmPtr->tm_hour);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7661
    minutes = __MKSMALLINT(tmPtr->tm_min);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7662
    seconds = __MKSMALLINT(tmPtr->tm_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7663
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7664
    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
  7665
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7666
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7667
     UnixOperatingSystem computeUTCTimePartsOf:100 for:[:h :m :s :milli |
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7668
	h printCR. m printCR. s printCR. milli printCR
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7669
     ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7670
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7671
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7672
3692
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7673
getMicrosecondTime
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7674
    "This returns the microsecond timers value - if available. 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7675
     On some machines, times with this precision may not be available,
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7676
     on those, the returned value may be rounded towards some internal
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7677
     clock resolution value."
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7678
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7679
    |seconds millis micros|
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7680
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7681
%{
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7682
    long _seconds = 0;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7683
    long _millis = 0;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7684
    long _micros = 0;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7685
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7686
#if !defined(HAS_GETTIMEOFDAY)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7687
# if defined(HAS_FTIME)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7688
    struct timeb timebuffer;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7689
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7690
    ftime(&timebuffer);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7691
    _seconds = timebuffer.time.
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7692
    _millis = timebuffer.millitm;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7693
#   define HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7694
# endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7695
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7696
# ifndef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7697
#  if defined(SYSV) && defined(HZ)
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7698
    /* 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7699
     * sys5 time - in ticks
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7700
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7701
    long ticks;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7702
    struct tms tb;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7703
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7704
    ticks = times(&tb);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7705
    _seconds = ticks / HZ;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7706
    ticks -= (_seconds * HZ);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7707
    _millis = ticks * 1000 / HZ;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7708
#   define HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7709
#  endif /* old SYSV stuff */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7710
# endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7711
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7712
# ifndef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7713
#  ifdef MSDOS_LIKE
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7714
    struct _timeb timebuffer;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7715
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7716
    _ftime(&timebuffer);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7717
    _seconds = timebuffer.time;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7718
    _millis = timebuffer.millitm;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7719
#   define HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7720
#  endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7721
# endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7722
#endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7723
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7724
#ifndef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7725
    /* assume HAS_GETTIMEOFDAY 
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7726
     * - will result in a linkage error
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7727
     * if not fixed.
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7728
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7729
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7730
    /*
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7731
     * bsd time
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7732
     */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7733
    struct timeval tb;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7734
    /* struct timezone tzb; */
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7735
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7736
    gettimeofday(&tb, NULL /* &tzb */);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7737
    _seconds = tb.tv_sec;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7738
    _micros = tb.tv_usec;
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7739
    if (_micros >= (1000*1000)) {
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7740
        printf("oops\n");
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7741
    }
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7742
#endif
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7743
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7744
#undef HAVE_TIME
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7745
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7746
    seconds = __MKINT(_seconds);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7747
    millis = __MKINT(_millis);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7748
    micros = __MKINT(_micros);
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7749
%}.
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7750
    ^ (((seconds * 1000) + millis) * 1000) + micros
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7751
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7752
    "
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7753
     Transcript showCR:(OperatingSystem getMicrosecondTime).
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7754
     Transcript showCR:(OperatingSystem getMicrosecondTime).
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
!
0f0377cca3d6 added microSecondclock access.
Claus Gittinger <cg@exept.de>
parents: 3691
diff changeset
  7757
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7758
getMillisecondTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7759
    "This returns the millisecond timers value. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7760
     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
  7761
     LargeInteger arithmetic when doing timeouts and delays.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7762
     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
  7763
     short relative time deltas.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7764
     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
  7765
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7766
     BAD DESIGN:
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7767
	This should be changed to return some instance of RelativeTime,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7768
	and these computations moved there.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7769
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7770
     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
  7771
     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
  7772
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7773
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7774
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7775
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7776
    long t = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7777
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7778
#if !defined(HAS_GETTIMEOFDAY)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7779
# if defined(HAS_FTIME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7780
    struct timeb timebuffer;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7781
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7782
    ftime(&timebuffer);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7783
    t = (timebuffer.time * 1000) + timebuffer.millitm;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7784
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7785
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7786
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7787
# ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7788
#  if defined(SYSV) && defined(HZ)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7789
    /* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7790
     * sys5 time
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7791
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7792
    long ticks;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7793
    struct tms tb;
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
    ticks = times(&tb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7796
    t = (ticks * 1000) / HZ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7797
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7798
#  endif /* old SYSV stuff */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7799
# endif
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
# ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7802
#  ifdef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7803
    struct _timeb timebuffer;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7804
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7805
    _ftime(&timebuffer);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7806
    t = (timebuffer.time * 1000) + timebuffer.millitm;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7807
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7808
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7809
# endif
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
    /* assume HAS_GETTIMEOFDAY 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7814
     * - will result in a linkage error
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7815
     * if not fixed.
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7818
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7819
     * bsd time
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7820
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7821
    struct timeval tb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7822
    struct timezone tzb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7823
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7824
    gettimeofday(&tb, &tzb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7825
    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
  7826
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7827
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7828
#undef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7829
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7830
    RETURN ( __MKSMALLINT(t & 0x1FFFFFFF) );
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
getOSTime
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7835
    "This returns the OS time.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7836
     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
  7837
     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
  7838
     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
  7839
     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
  7840
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7841
     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
  7842
     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
  7843
     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
  7844
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7845
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7846
    |seconds millis|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7847
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7848
%{
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
    long t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7851
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7852
#if !defined(HAS_GETTIMEOFDAY) 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7853
# if defined(HAS_FTIME)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7854
    struct timeb timebuffer;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7855
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7856
    ftime(&timebuffer);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7857
    seconds = __MKUINT(timebuffer.time);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7858
    millis = __MKUINT(timebuffer.millitm);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7859
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7860
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7861
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7862
# ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7863
#  if defined(SYSV) && defined(HZ)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7864
    /* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7865
     * sys5 time; we have to fake the information
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7866
     * the returned value is inexact.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7867
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7868
    int now;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7869
    long ticks;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7870
    struct tms tb;
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
    now = time(0);   /* seconds since 1970 ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7873
    seconds = __MKUINT(now);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7874
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7875
    ticks = times(&tb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7876
    t = (ticks * 1000) / HZ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7877
    t = t % 1000;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7878
    millis = __MKSMALLINT(t);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7879
#  endif /* OLD SYSV stuff */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7880
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7881
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7882
# ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7883
#  ifdef MSDOS_LIKE
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7884
    struct _timeb timebuffer;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7885
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7886
    _ftime(&timebuffer);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7887
    seconds = __MKUINT(timebuffer.time);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7888
    millis = __MKUINT(timebuffer.millitm);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7889
#   define HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7890
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7891
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7892
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7893
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7894
#ifndef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7895
    /* assume HAS_GETTIMEOFDAY 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7896
     * - will result in a linkage error
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7897
     * if not fixed.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7898
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7899
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7900
     * bsd time
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7901
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7902
    struct timeval tb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7903
    struct timezone tzb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7904
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7905
    gettimeofday(&tb, &tzb);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7906
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7907
    /* 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7908
     * mhmh long-long stuff seems not to work correctly 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7909
     * on all machines (sparc)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7910
     * being conservative here ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7911
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7912
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7913
# if defined(__GNUC__) && (__GNUC__ >= 2) && defined(i386) && defined(LINUX)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7914
#   define HAS_LONGLONG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7915
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7916
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7917
# ifdef HAS_LONGLONG
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7918
    {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7919
	unsigned long long _secs, _millis, rslt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7920
	unsigned low, hi;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7921
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7922
	_secs = tb.tv_sec;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7923
	_millis = tb.tv_usec / 1000;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7924
	rslt = _secs * 1000 + _millis;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7925
	low = rslt & 0xFFFFFFFF;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7926
	hi = rslt >> 32;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7927
	RETURN (__MKLARGEINT64(1, low, hi));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7928
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7929
# endif /* long long */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7930
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7931
# ifdef alpha64
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7932
    {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7933
	unsigned INT _secs, _millis, rslt;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7934
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7935
	_secs = (INT) tb.tv_sec;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7936
	_millis = (INT) tb.tv_usec / 1000;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7937
	rslt = _secs * 1000 + _millis;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7938
	RETURN (__MKUINT(rslt));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7939
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7940
# endif /* alpha */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7941
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7942
    seconds = __MKUINT(tb.tv_sec);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7943
    millis = __MKUINT(tb.tv_usec / 1000);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7944
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7945
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7946
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7947
#undef HAVE_TIME
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7948
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7949
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7950
    ^ (seconds * 1000) + millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7951
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7952
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7953
     UnixOperatingSystem getOSTime printCR.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7954
     Delay waitForSeconds:0.2.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7955
     UnixOperatingSystem getOSTime printCR.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7956
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7957
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7958
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7959
millisecondDelay:millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7960
    "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
  7961
     arrives.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7962
     All lower priority threads will also sleep for the duration, 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7963
     interrupts (and therefore, higher prio processes) are
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7964
     still handled. 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7965
     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
  7966
     (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
  7967
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7968
    |now then delta|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7969
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7970
    now := UnixOperatingSystem getMillisecondTime.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7971
    then := UnixOperatingSystem millisecondTimeAdd:now and:millis.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7972
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7973
    [UnixOperatingSystem millisecondTime:then isAfter:now] whileTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7974
	delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7975
	self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  7976
	now := UnixOperatingSystem getMillisecondTime.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7977
    ]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7978
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7979
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7980
     UnixOperatingSystem millisecondDelay:2000
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7981
    "
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7982
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  7983
    "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
  7984
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7985
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7986
sleep:numberOfSeconds
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7987
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7988
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7989
    "cease ANY action for some time. This suspends the whole smalltalk
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7990
     (unix-) process for some time.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7991
     Not really useful since not even low-prio processes and interrupt
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7992
     handling will run during the sleep.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7993
     Use either UnixOperatingSystem>>millisecondDelay: (which makes all
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7994
     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
  7995
     only the calling thread sleep)."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7996
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7997
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7998
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  7999
    if (__isSmallInteger(numberOfSeconds)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8000
	sleep(__intVal(numberOfSeconds));
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8001
	RETURN ( self );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8002
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8003
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8004
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8005
     argument not integer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8006
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8007
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8008
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8009
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8010
     UnixOperatingSystem sleep:2
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8011
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8012
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8013
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8014
!UnixOperatingSystem class methodsFor:'users & groups'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8015
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8016
getEffectiveGroupID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8017
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8018
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8019
    "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
  8020
     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
  8021
     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
  8022
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8023
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8024
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8025
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8026
    uid = getegid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8027
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8028
%}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8029
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8030
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8031
     UnixOperatingSystem getEffectiveGroupID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8032
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8033
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8034
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8035
getEffectiveUserID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8036
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8037
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8038
    "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
  8039
     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
  8040
     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
  8041
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8042
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8043
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8044
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8045
    uid = geteuid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8046
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8047
%}
3496
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8050
     UnixOperatingSystem getEffectiveUserID
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
getFullUserNameFromID:userID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8055
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8056
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8057
    "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
  8058
     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
  8059
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8060
    |info gecos|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8061
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8062
    info := self userInfoOf:userID.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8063
    (info notNil
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8064
    and:[info includesKey:#gecos]) ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8065
	gecos := info at:#gecos.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8066
	(gecos includes:$,) ifTrue:[
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8067
	    ^ gecos copyTo:(gecos indexOf:$,) - 1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8068
	].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8069
	^ gecos
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8070
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8071
    ^ self getUserNameFromID:userID
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
     UnixOperatingSystem getFullUserNameFromID:0 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8075
     UnixOperatingSystem getFullUserNameFromID:(UnixOperatingSystem getUserID)  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8076
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8077
     UnixOperatingSystem getUserNameFromID:(UnixOperatingSystem getUserID)  
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8078
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8079
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8080
    "Modified: 15.7.1996 / 12:44:21 / cg"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8083
getGroupID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8084
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8085
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8086
    "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
  8087
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8088
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8089
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8090
    int uid;
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
    uid = getgid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8093
    RETURN ( __MKSMALLINT(uid) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8094
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8095
    ^ 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
  8096
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8097
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8098
     UnixOperatingSystem getGroupID
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
!
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
getGroupNameFromID:aNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8103
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8104
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8105
    "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
  8106
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8107
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8108
    struct group *g;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8109
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8110
    if (__isSmallInteger(aNumber)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8111
	g = getgrgid(__intVal(aNumber));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8112
	if (g) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8113
	    RETURN ( __MKSTRING(g->gr_name) );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8114
	}
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8115
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8116
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8117
    ^ '???'
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
     UnixOperatingSystem getGroupNameFromID:0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8121
     UnixOperatingSystem getGroupNameFromID:10
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
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8124
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8125
getHomeDirectory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8126
    "{ Pragma: +optSpace }"
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
    "return the name of the users home directory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8129
     (i.e. yours)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8130
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8131
    ^ UnixOperatingSystem getEnvironment:'HOME'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8132
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8133
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8134
     UnixOperatingSystem getHomeDirectory
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8135
    "
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
    "Modified: 24.1.1997 / 11:32:13 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8138
!
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
getLoginName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8141
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8142
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8143
    "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
  8144
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8145
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8146
    static char cachedName[64];
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8147
    static firstCall = 1;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8148
    extern char *getenv();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8149
    extern char *getlogin();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8150
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8151
    char *name = (char *)0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8152
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8153
    if (firstCall) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8154
	name = getlogin();
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8155
	if (! name || (name[0] == 0)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8156
	    name = getenv("LOGNAME");
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8157
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8158
	if (name && (strlen(name) < sizeof(cachedName))) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8159
	    strcpy(cachedName, name);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8160
	    firstCall = 0;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8161
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8162
    } else {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8163
	name = cachedName;
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8164
    }
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8165
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8166
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8167
     * try a few common environment variables ...
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8168
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8169
    if (! name || (name[0] == 0) ) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8170
	name = getenv("LOGIN");
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8171
	if (! name || (name[0] == 0) ) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8172
	    name = getenv("LOGNAME");
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8173
	    if (! name || (name[0] == 0) ) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8174
		name = getenv("USER");
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8175
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8176
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8177
    }
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
     * nope - I really font know who you are.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8180
     */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8181
    if (! name || (name[0] == 0) ) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8182
	name = "you";
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8183
    }
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
    RETURN ( __MKSTRING(name) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8186
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8187
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8188
     UnixOperatingSystem getLoginName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8189
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8190
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8191
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8192
getUserID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8193
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8194
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8195
    "return the current users (thats you) numeric user id"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8196
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8197
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8198
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8199
    int uid;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8200
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8201
    uid = getuid();
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8202
    RETURN ( __MKSMALLINT(uid) );
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8203
%}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8204
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8205
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8206
     UnixOperatingSystem getUserID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8207
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8208
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8209
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8210
getUserNameFromID:aNumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8211
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8212
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8213
    "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
  8214
     This is the login name, not the fullName."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8215
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8216
%{  /* NOCONTEXT */
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
# ifndef NO_PWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8219
    struct passwd *p;
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 (__isSmallInteger(aNumber)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8222
	p = getpwuid(__intVal(aNumber));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8223
	if (p) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8224
	    RETURN ( __MKSTRING(p->pw_name) );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8225
	}
3512
5d1c5de6b9ca removed most WIN32 and VMS stuff. Now in separate classFiles.
Claus Gittinger <cg@exept.de>
parents: 3501
diff changeset
  8226
    }
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8227
#endif /* unix-like */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8228
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8229
    aNumber == self getUserID ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8230
	^ self getLoginName
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8231
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8232
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8233
    ^ '? (' , aNumber printString , ')'
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
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8236
     UnixOperatingSystem getUserNameFromID:0
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8237
     UnixOperatingSystem getUserNameFromID:100
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8238
     UnixOperatingSystem getUserNameFromID:9991 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8239
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8240
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8241
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8242
userInfoOf:aNameOrID
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8243
    "{ Pragma: +optSpace }"
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
    "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
  8246
     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
  8247
     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
  8248
     DOS systems return nothing; 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8249
     non-SYSV4 systems have no age/comment.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8250
     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
  8251
     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
  8252
     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
  8253
     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
  8254
     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
  8255
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8256
    |info name passw uid gid age comment
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8257
     gecos dir shell|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8258
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8259
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8260
# ifndef NO_PWD
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8261
    struct passwd *buf;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8262
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8263
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8264
    if (__isString(aNameOrID)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8265
	buf = getpwnam(__stringVal(aNameOrID));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8266
    } else if (__isSmallInteger(aNameOrID)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8267
	buf = getpwuid(__intVal(aNameOrID));
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8268
    } else {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8269
	buf = (struct passwd *)0;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8270
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8271
    if (buf) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8272
	name = __MKSTRING(buf->pw_name);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8273
#  ifndef NO_PWD_PASSWD
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8274
	passw = __MKSTRING(buf->pw_passwd);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8275
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8276
#  ifdef SYSV4
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8277
	age = __MKSTRING(buf->pw_age);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8278
	comment = __MKSTRING(buf->pw_comment);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8279
#  endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8280
	dir = __MKSTRING(buf->pw_dir);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8281
#  ifndef NO_PWD_GECOS
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8282
	gecos = __MKSTRING(buf->pw_gecos);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8283
#  endif
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8284
	shell = __MKSTRING(buf->pw_shell);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8285
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8286
	uid = __MKSMALLINT(buf->pw_uid);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8287
	gid = __MKSMALLINT(buf->pw_gid);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8288
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8289
# endif /* has PWD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8290
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8291
    info := IdentityDictionary new.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8292
    name isNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8293
	aNameOrID == self getUserID ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8294
	    name := self getLoginName
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8295
	].
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8296
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8297
    name notNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8298
	info at:#name put:name.
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8299
    ] ifFalse:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8300
	info at:#name put:'unknown'
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8301
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8302
    passw notNil ifTrue:[info at:#passwd put:passw].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8303
    age notNil ifTrue:[info at:#age put:age].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8304
    comment notNil ifTrue:[info at:#comment put:comment].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8305
    gecos notNil ifTrue:[info at:#gecos put:gecos].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8306
    shell notNil ifTrue:[info at:#shell put:shell].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8307
    dir isNil ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8308
	aNameOrID == self getUserID ifTrue:[
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8309
	    dir := self getHomeDirectory
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8310
	]
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8311
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8312
    dir notNil ifTrue:[info at:#dir put:dir].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8313
    uid notNil ifTrue:[info at:#uid put:uid].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8314
    gid  notNil ifTrue:[info at:#gid put:gid].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8315
    ^ info
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8316
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8317
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8318
     UnixOperatingSystem userInfoOf:'root'
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8319
     UnixOperatingSystem userInfoOf:1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8320
     UnixOperatingSystem userInfoOf:'claus' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8321
     UnixOperatingSystem userInfoOf:'fooBar' 
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8322
     UnixOperatingSystem userInfoOf:(UnixOperatingSystem getUserID)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8323
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8324
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8325
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8326
!UnixOperatingSystem class methodsFor:'waiting for events'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8327
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8328
blockingChildProcessWait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8329
     "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
  8330
      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
  8331
      a subprocesses status (to avoid blocking)."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8332
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8333
%{ /*NOCONTEXT*/
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8334
#if defined(HAS_WAITPID) || defined(HAS_WAIT3)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8335
    RETURN(false);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8336
#else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8337
    RETURN(true);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8338
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8339
%}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8340
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8341
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8342
childProcessWait:blocking pid:pidToWait
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8343
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8344
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8345
    "get status changes from child processes.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8346
     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
  8347
     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
  8348
     otherwise we return immediately.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8349
     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
  8350
     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
  8351
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8352
    |pid status code core|
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8353
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8354
#if defined(UNIX_LIKE) && !defined(__VMS__)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8355
    int p;
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
# if defined(HAS_WAITPID)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8358
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8359
    int s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8360
#   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
  8361
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8362
# else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8363
#  if defined(HAS_WAIT3)
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
    union wait s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8366
#   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
  8367
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8368
#  else /* neither waitpid, nor wait3; use wait, which is blocking */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8369
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8370
    int s;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8371
#   define __WAIT      wait(&s)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8372
#   define __BLOCKING_WAIT__ 1
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8373
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8374
    if (blocking != true) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8375
	/*
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8376
	 * We do not support nonBlocking waits, so signal an error
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8377
	 * Sorry about the goto, but with all these ifdefs ...
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8378
	 */
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8379
	goto done;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8380
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8381
#  endif /*!HAS_WAIT3*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8382
# endif  /*!HAS_WAITPID*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8383
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8384
# if !defined(WIFEXITED)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8385
#  define WIFEXITED(stat)      (((int)((stat)&0377))==0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8386
#  define WIFSIGNALED(stat)    (((int)((stat)&0377))>0&&((int)(((stat)>>8)&0377))==0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8387
#  define WIFSTOPPED(stat)     (((int)((stat)&0377))==0177&&((int)(((stat)>>8)&0377))!=0)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8388
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8389
#  define WEXITSTATUS(stat)    ((int)(((stat)>>8)&0377))
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8390
#  define WTERMSIG(stat)       (((int)((stat)&0377))&0177)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8391
#  define WSTOPSIG(stat)       ((int)(((stat)>>8)&0377))
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8392
# endif /*!WIFEXITED*/
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
# if !defined(WCOREDUMP)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8395
   /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8396
    * 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
  8397
    */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8398
#  if defined(HAS_WAIT3)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8399
#   define WCOREDUMP(status)    (((union __wait*)&(status))->__w_coredump)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8400
#  else
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8401
#   define WCOREDUMP(status)    ((int)(((status)>>8)&0200))
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8402
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8403
# endif /*!WCOREDUMP*/
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8404
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8405
# if __BLOCKING_WAIT__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8406
    __BEGIN_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8407
# endif
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
    do {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8410
	p = __WAIT;
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8411
    } while (p == -1 && errno == EINTR);
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_WAIT__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8414
    __END_INTERRUPTABLE__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8415
#   undef __BLOCKING_WAIT__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8416
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8417
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8418
# undef __WAIT
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8419
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8420
    if (p == 0)
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8421
	RETURN(nil)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8422
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8423
    if (p == -1) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8424
	if (errno == ECHILD)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8425
	    RETURN(nil);
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8426
    } else {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8427
	pid = __MKSMALLINT(p);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8428
	if (WIFEXITED(s)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8429
	    status = @symbol(exit);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8430
	    code = __MKSMALLINT(WEXITSTATUS(s));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8431
	    core = WCOREDUMP(s) ? true : false;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8432
	} else if (WIFSIGNALED(s)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8433
	    status = @symbol(signal);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8434
	    code = __MKSMALLINT(WTERMSIG(s));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8435
	} else if (WIFSTOPPED(s)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8436
	    status = @symbol(stop);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8437
	    code = __MKSMALLINT(WSTOPSIG(s));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8438
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8439
# if defined(WIFCONTINUED)
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8440
	else if (WIFCONTINUED(s)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8441
	    status = @symbol(continue);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8442
	} 
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8443
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8444
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8445
done: ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8446
#endif /* UNIX_LIKE */
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8449
    (status isNil or:[pid isNil]) ifTrue:[
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8450
	^ self primitiveFailed
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8451
    ].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8452
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8453
"/ 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
  8454
"/ show:' code: '; show:code; show:' core:'; showCR:core.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8455
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8456
    ^ 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
  8457
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
     UnixOperatingSystem childProcessWait:false
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8460
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8461
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8462
    "Created: 5.1.1996 / 16:39:14 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8463
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8464
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8465
numAvailableForReadOn:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8466
    "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
  8467
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8468
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8469
#ifdef NOTDEF   /* does not work ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8470
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8471
     * 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
  8472
     */
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8473
# if defined(FIONREAD)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8474
    {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8475
	int n;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8476
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8477
	if (__isSmallInteger(fd)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8478
	    if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8479
		RETURN (__MKINT(n));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8480
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8481
	}
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8482
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8483
# endif /* FIONREAD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8484
#endif
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
    ^ (self readCheck:fd) ifTrue:[1] ifFalse:[0]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8487
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8488
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8489
readCheck:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8490
    "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
  8491
     (i.e. read is possible without blocking).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8492
     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
  8493
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8494
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8495
#ifdef NOTDEF   /* does not work ... */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8496
    /*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8497
     * 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
  8498
     */
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  8499
# if defined(FIONREAD)
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8500
    {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8501
	int n;
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
	if (__isSmallInteger(fd)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8504
	    if (n = ioctl(__intVal(fd), FIONREAD)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8505
		printf("FIONREAD returns %d\n", n);
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
	}
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
# endif /* FIONREAD */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8510
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8511
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8512
# ifdef __VMS__
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8513
#  ifdef DOES_NOT_WORK_YET
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8514
    {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8515
	/*
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8516
	 * do a sys$qio ..
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8517
	 * fd here is suposed to be a channel nr.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8518
	 */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8519
	struct IOSB iosb;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8520
	int status;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8521
	int channel;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8522
	struct typahdask sensebuf;
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
	if (__isSmallInteger(fd)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8525
	    channel = __intVal(fd);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8526
	    status = SYS$QIO(0, /* efn */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8527
			     channel,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8528
			     IO$_SENSEMODE | IO$M_TYPEAHDCNT,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8529
			     &iosb,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8530
			     0, /* ast */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8531
			     0, /* ast arg */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8532
			     &sensebuf,         /* data */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8533
			     sizeof(sensebuf),  /* data size */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8534
			     0, 0, 0, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8535
	    if (status != SS$_NORMAL) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8536
		fprintf(stderr, "OS [info]: SYS$QIO failed on %d\n", channel);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8537
	    } else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8538
		fprintf(stderr, "sys$QIO -> %d\n", sensebuf.typcnt);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8539
	    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8540
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8541
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8542
#  endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8543
# endif /* __VMS__ */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8544
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8545
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8546
    ^ super readCheck:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8547
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8548
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8549
selectOnAnyReadable:readFdArray writable:writeFdArray exception:exceptFdArray withTimeOut:millis
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8550
    "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
  8551
     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
  8552
     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
  8553
     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
  8554
     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
  8555
     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
  8556
     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
  8557
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8558
%{
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8559
    fd_set rset, wset, eset;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8560
    struct timeval wt, et;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8561
    int f, maxF, i, lX, bX;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8562
    INT t;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8563
    OBJ fd, retFd;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8564
    int ret;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8565
    int count;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8566
    int numFds = 0;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8567
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8568
    if (__isSmallInteger(millis)) {
3540
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8569
	FD_ZERO(&rset);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8570
	FD_ZERO(&wset);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8571
	FD_ZERO(&eset);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8572
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8573
	maxF = -1;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8574
	if (__isNonNilObject(readFdArray)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8575
	    if (! __isArray(readFdArray)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8576
		goto fail;    
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8577
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8578
	    count = __arraySize(readFdArray);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8579
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8580
	    for (i=0; i<count;i++) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8581
		fd = __ArrayInstPtr(readFdArray)->a_element[i];
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8582
		if (fd != nil) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8583
		    f = __intVal(fd);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8584
		    if ((unsigned)f < FD_SETSIZE) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8585
			FD_SET(f, &rset);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8586
			if (f > maxF) maxF = f;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8587
			numFds++;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8588
		    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8589
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8590
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8591
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8592
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8593
	if (__isNonNilObject(writeFdArray)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8594
	    if (! __isArray(writeFdArray)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8595
		goto fail;    
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8596
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8597
	    count = __arraySize(writeFdArray);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8598
	    for (i=0; i<count;i++) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8599
		fd = __ArrayInstPtr(writeFdArray)->a_element[i];
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8600
		if (fd != nil) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8601
		    f = __intVal(fd);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8602
		    if ((unsigned)f < FD_SETSIZE) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8603
			FD_SET(f, &wset);       
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8604
			if (f > maxF) maxF = f;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8605
			numFds++;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8606
		    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8607
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8608
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8609
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8610
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8611
	if (__isNonNilObject(exceptFdArray)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8612
	    if (! __isArray(exceptFdArray)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8613
		goto fail;    
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8614
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8615
	    count = __arraySize(exceptFdArray);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8616
	    for (i=0; i<count;i++) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8617
		fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8618
		if (fd != nil) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8619
		    f = __intVal(fd);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8620
		    if ((unsigned)f < FD_SETSIZE) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8621
			FD_SET(f, &eset);       
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8622
			if (f > maxF) maxF = f;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8623
			numFds++;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8624
		    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8625
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8626
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8627
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8628
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8629
	t = __intVal(millis);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8630
	if (t) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8631
	    wt.tv_sec = t / 1000;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8632
	    wt.tv_usec = (t % 1000) * 1000;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8633
	} else {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8634
	    wt.tv_sec = wt.tv_usec = 0;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8635
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8636
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8637
	/*
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8638
	 * make certain, that interrupt gets us out of the select
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8639
	 * However, we must then care for moved objects.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8640
	 */
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8641
	__BEGIN_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8642
	errno = 0;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8643
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8644
	if (t == 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8645
	    /* 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8646
	     * if there is no timeout time, we can stay here interruptable.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8647
	     */
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8648
	    do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8649
		ret = select(maxF+1, &rset, &wset, &eset, &wt);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8650
	    } while ((ret < 0) && (errno == EINTR));
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8651
	} else {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8652
	    do {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8653
		ret = select(maxF+1, &rset, &wset, &eset, &wt);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8654
		/* 
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8655
		 * for now: dont loop; if we did, we had to adjust the vt-timeval;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8656
		 * could otherwise stay in this loop forever ...
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8657
		 * Premature return (before the time expired) must be handled by the caller.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8658
		 * A good solution is to update the wt-timeval and redo the select.
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8659
		 */
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8660
	    } while (0 /* (ret < 0) && (errno == EINTR) */ );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8661
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8662
	__END_INTERRUPTABLE__
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8663
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8664
	if (ret > 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8665
	    for (i=0; i <= maxF; i++) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8666
		if (FD_ISSET(i, &rset)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8667
		 || FD_ISSET(i, &wset)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8668
		 || FD_ISSET(i, &eset)) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8669
		    RETURN ( __MKSMALLINT(i) );
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8670
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8671
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8672
	} else {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8673
	    if (ret < 0) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8674
		if (errno == EINTR) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8675
		    errno = 0;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8676
		    @global(LastErrorNumber) = nil;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8677
		} else {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8678
		    if (@global(InfoPrinting) == true) {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8679
			fprintf(stderr, "OS [info]: select errno = %d\n", errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8680
		    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8681
		    @global(LastErrorNumber) = __MKSMALLINT(errno);
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8682
		}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8683
	    } else {
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8684
		@global(LastErrorNumber) = nil;
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8685
	    }
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8686
	}
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8687
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8688
	/*
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8689
	 * return nil (means time expired or interrupted)
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8690
	 */
f0a069e481b8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3539
diff changeset
  8691
	RETURN ( nil );
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8692
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8693
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8694
fail: ;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8695
%}.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8696
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8697
     timeout argument not integer,
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8698
     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
  8699
     or not supported by OS
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8700
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8701
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8702
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8703
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8704
setBlocking:aBoolean on:fd
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8705
    "{ Pragma: +optSpace }"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8706
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8707
    "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
  8708
     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
  8709
     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
  8710
     nil."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8711
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8712
%{  /* NOCONTEXT */
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8713
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8714
    int ret, flags;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8715
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8716
#if defined(F_GETFL) && defined(F_SETFL)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8717
# if defined(FNDELAY)
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8718
    if (__isSmallInteger(fd)) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8719
	int f = __intVal(fd);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8720
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8721
	flags = fcntl(f, F_GETFL, 0);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8722
	if (aBoolean == true) {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8723
	    ret = fcntl(f, F_SETFL, flags & ~FNDELAY);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8724
	} else {
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8725
	    ret = fcntl(f, F_SETFL, flags | FNDELAY);
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8726
	}
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8727
	if (ret >= 0) ret = flags;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8728
	RETURN ( __MKSMALLINT(ret) );
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8729
    }
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8730
# endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8731
#endif
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8732
%}.
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
     fd argument not integer
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8735
    "
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8736
    ^ self primitiveFailed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8737
! !
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
!UnixOperatingSystem::FileStatusInfo class methodsFor:'instance creation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8740
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8741
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8742
    ^ self basicNew
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8743
	type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP 
3496
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8746
!UnixOperatingSystem::FileStatusInfo methodsFor:'accessing'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8747
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8748
accessed
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8749
    "return accessed"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8750
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8751
    ^ accessed!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8752
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8753
alternativeName
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8754
    "return the files other name (DOS name on windows).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8755
     Nil if there is no other name"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8756
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8757
    ^ nil
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8758
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8759
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8760
fixedHeaderSize
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8761
    "return the fixedHeaderSize (VMS only; nil everywhere else)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8762
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8763
    ^ nil
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8764
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8765
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8766
gid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8767
    "return gid"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8768
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8769
    ^ gid!
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
id
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8772
    "return id"
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
    ^ id!
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
mode
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8777
    "return mode"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8778
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8779
    ^ mode!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8780
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8781
modified
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8782
    "return modified"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8783
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8784
    ^ modified!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8785
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8786
path
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8787
    "for symbolic links only: return the path where the symbolic link points to"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8788
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8789
    ^ path
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8790
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8791
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8792
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8793
recordAttributes
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8794
    "return the recordAttributes (VMS only; nil everywhere else)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8795
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8796
    ^ nil
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8797
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8798
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8799
recordFormat
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8800
    "return the recordFormat (VMS only; nil everywhere else)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8801
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8802
    ^ nil
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8803
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8804
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8805
recordFormatNumeric
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8806
    "return the recordFormat as numeric (VMS only; nil everywhere else)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8807
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8808
    ^ nil
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8809
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8810
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8811
recordSize
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8812
    "return the recordSize (VMS only; nil everywhere else)"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8813
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8814
    ^ nil
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8815
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8816
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8817
size
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8818
    "return size"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8819
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8820
    ^ size!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8821
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8822
statusChanged
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8823
    "return statusChanged"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8824
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8825
    ^ statusChanged!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8826
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8827
type
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8828
    "return type"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8829
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8830
    ^ type!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8831
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8832
uid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8833
    "return uid"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8834
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8835
    ^ uid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8836
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8837
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8838
!UnixOperatingSystem::FileStatusInfo methodsFor:'backward compatibility'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8839
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8840
at:key
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8841
    "backward compatibility access: in previous releases, IdentityDictionaries
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8842
     were used to hold my information. Allow access via key messages.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8843
     This method will vanish - use the proper access protocol."
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8844
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8845
    ^ self perform:key
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8846
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8847
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8848
!UnixOperatingSystem::FileStatusInfo methodsFor:'private accessing'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8849
3563
16ccd4cefcbe *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3561
diff changeset
  8850
type:t mode:m uid:u gid:g size:s id:i accessed:aT modified:mT statusChanged:sT path:lP
3496
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8851
    type := t.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8852
    mode := m.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8853
    uid := u.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8854
    gid := g.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8855
    size := s.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8856
    id := i.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8857
    accessed := aT.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8858
    modified := mT.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8859
    statusChanged := sT.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8860
    path := lP.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8861
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8862
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8863
!UnixOperatingSystem::OSProcessStatus class methodsFor:'documentation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8864
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8865
documentation
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8866
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8867
    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
  8868
    operating system processes (these are no smalltalk processes!!).
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8869
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8870
    [Instance variables:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8871
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8872
	pid     <Integer>       OS-Process identifier
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8873
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8874
	status  <Symbol>        either #exit #signal #stop #continue
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8875
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8876
	code    <Integer>       either exitcode or signalnumber
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8877
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8878
	core    <Boolean>       true if core has been dumped
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8879
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8880
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8881
    [author:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8882
	Stefan Vogel
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8883
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8884
    [see also:]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8885
	OperatingSystem
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8886
"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8887
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8888
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8889
!UnixOperatingSystem::OSProcessStatus class methodsFor:'instance creation'!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8890
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8891
pid:pid status:status code:code core:core
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8892
    "private interface for UnixOperatingSystem"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8893
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8894
    ^ 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
  8895
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8896
    "Created: 28.12.1995 / 14:16:14 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8897
    "Modified: 30.4.1996 / 18:25:00 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8898
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8899
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8900
processCreationFailure
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8901
    "private interface for UnixOperatingSystem"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8902
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8903
    ^ 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
  8904
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8905
    "Created: 28.12.1995 / 14:35:29 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8906
    "Modified: 30.4.1996 / 18:25:05 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8907
! !
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8908
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8909
!UnixOperatingSystem::OSProcessStatus methodsFor:'accessing'!
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
code
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8912
    "return the exitcode / signalNumber"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8913
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8914
    ^ code
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
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8917
    "Modified: 30.4.1996 / 18:26:23 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8918
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8919
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8920
core
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8921
    "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
  8922
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8923
    ^ core == true
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8924
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8925
    "Modified: 28.12.1995 / 14:14:38 / stefan"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8928
pid
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8929
    "return the pid"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8930
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8931
    ^ pid
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
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8934
    "Modified: 30.4.1996 / 18:26:30 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8935
!
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
status
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8938
    "return status as a Symbol;
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8939
     one of #exit #signal #stop #continue"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8940
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8941
    ^ status
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8942
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8943
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8944
    "Modified: 30.4.1996 / 18:26:54 / cg"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8947
!UnixOperatingSystem::OSProcessStatus methodsFor:'initialization'!
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
pid:newPid status:newStatus code:newCode core:newCore
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8950
    pid := newPid.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8951
    status := newStatus.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8952
    code := newCode.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8953
    core := newCore.
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
    "Created: 28.12.1995 / 14:18:22 / stefan"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8958
!UnixOperatingSystem::OSProcessStatus methodsFor:'private-OS interface'!
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:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8961
    "set the exitCode"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8962
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8963
    code := something.
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
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8966
    "Modified: 30.4.1996 / 18:25:18 / cg"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8967
!
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:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8970
    "set core"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8971
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8972
    core := something.
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
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8975
!
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:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8978
    "set pid"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8979
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8980
    pid := something.
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
    "Created: 28.12.1995 / 14:05:07 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8983
!
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8984
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8985
status:something
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8986
    "set status"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8987
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8988
    status := something.
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8989
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8990
    "Created: 28.12.1995 / 14:05:07 / stefan"
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:'queries'!
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
couldNotExecute
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8996
    "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
  8997
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8998
    ^ status == #exit and:[code = 127].
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  8999
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9000
    "Created: 28.12.1995 / 15:43:17 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9001
    "Modified: 30.4.1996 / 18:27:03 / cg"
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
stillAlive
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9005
    "true if process is still alive"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9006
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9007
    ^ status == #stop or:[status == #continue]
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
    "Created: 28.12.1995 / 14:27:26 / stefan"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9012
success
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9013
    "true if process terminated successfully"
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
    ^ status == #exit and:[code = 0]
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9016
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9017
    "Created: 28.12.1995 / 14:13:05 / stefan"
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9018
    "Modified: 28.12.1995 / 14:13:41 / stefan"
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
85e19a68bd61 started to separate into OS-specific classes
Claus Gittinger <cg@exept.de>
parents:
diff changeset
  9021
!UnixOperatingSystem class methodsFor:'documentation'!
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
version
3780
7d735472f937 removed some WIN32 stuff
Claus Gittinger <cg@exept.de>
parents: 3773
diff changeset
  9024
    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.38 1998-08-25 13:43:22 cg Exp $'
3496
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
UnixOperatingSystem initialize!